net/pcnet32: replace
Subsystems (2)
PATCH 28/38 net/pcnet32: replace
Any comments would be appreciated.
Description: Use ssleep() instead of schedule_timeout() to guarantee the task delays as expected.
drivers/net/pcnet32.c +1 -1
@@ -847,7 +847,7 @@ static int pcnet32_phys_id(struct net_deif ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT /HZ ))) data = (u32)(MAX_SCHEDULE_TIMEOUT /HZ ); -schedule_timeout (data *HZ ); +msleep_interruptible (data *1000 );del_timer_sync (&lp->blink_timer);/* Restore the original value of the bcrs */
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
drivers/net/pcnet32.c static int pcnet32_phys_id(struct net_de · line 851
Quoted 9 lines · Nishanth Aravamudan
Any comments would be appreciated.
+++2.6.9-rc1-mm4/drivers/net/pcnet32.c2004-09-13 14:38:47.000000000 -0700drivers/net/pcnet32.c +1
-1@@ -847,7 +847,7 @@ static int pcnet32_phys_id(struct net_deif ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT /HZ ))) data = (u32)(MAX_SCHEDULE_TIMEOUT /HZ ); -schedule_timeout (data *HZ ); +msleep_interruptible (data *1000 );del_timer_sync (&lp->blink_timer);
Surely that needs to be:
if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / 1000)) data = (u32)(MAX_SCHEDULE_TIMEOUT / 1000) msleep_interruptible(data * 1000);
(and actually, this should be pulled into net/core/ethtool.c out of each driver).
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 8 lines · Matthew Wilcox
Surely that needs to be:
if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / 1000)) data = (u32)(MAX_SCHEDULE_TIMEOUT / 1000) msleep_interruptible(data * 1000);(and actually, this should be pulled into
net/core/ethtool.cout of each driver).
A little further thought ...
unsigned long msleep_interruptible(unsigned int msecs)
{
unsigned long timeout = msecs_to_jiffies(msecs);
while (timeout && !signal_pending(current)) {
set_current_state(TASK_INTERRUPTIBLE);
timeout = schedule_timeout(timeout);
}
return jiffies_to_msecs(timeout);
}There's no guarantee that there is a value in ms that converts to MAX_SCHEDULE_TIMEOUT. Do we need an MSEC_SCHEDULE_TIMEOUT so we can do something like:
unsigned long msleep_interruptible(unsigned int msecs)
{
unsigned long timeout = (msecs == MSEC_SCHEDULE_TIMEOUT) ?
MAX_SCHEDULE_TIMEOUT : msecs_to_jiffies(msecs);
...
}I'd be loathe to put this in the msec_to_jiffies macro itself since it isn't always used in an appropriate way...
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 13 lines · Matthew Wilcox
drivers/net/pcnet32.c static int pcnet32_phys_id(struct net_de · line 851
Quoted 9 lines · Nishanth Aravamudan
Any comments would be appreciated.
+++2.6.9-rc1-mm4/drivers/net/pcnet32.c2004-09-13 14:38:47.000000000 -0700drivers/net/pcnet32.c +1
-1@@ -847,7 +847,7 @@ static int pcnet32_phys_id(struct net_deif ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT /HZ ))) data = (u32)(MAX_SCHEDULE_TIMEOUT /HZ ); -schedule_timeout (data *HZ ); +msleep_interruptible (data *1000 );del_timer_sync (&lp->blink_timer);Surely that needs to be:
Quoted 6 lines
if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / 1000)) data = (u32)(MAX_SCHEDULE_TIMEOUT / 1000) msleep_interruptible(data * 1000);(and actually, this should be pulled into
net/core/ethtool.cout of each driver).
I agree - the tabbing in that whole driver is non-standard (looks to be 4 spaces). And some places simply aren't tabbed like this one.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 6 lines · Nishanth Aravamudan
Quoted 4 lines
Quoted 2 lines
if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))) data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / 1000)) data = (u32)(MAX_SCHEDULE_TIMEOUT / 1000)I agree - the tabbing in that whole driver is non-standard (looks to be 4 spaces). And some places simply aren't tabbed like this one.
It wasn't the tabbing, but the divisor that I was complaining about.
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 13 lines · Matthew Wilcox
drivers/net/pcnet32.c static int pcnet32_phys_id(struct net_de · line 851
Quoted 9 lines · Nishanth Aravamudan
Any comments would be appreciated.
+++2.6.9-rc1-mm4/drivers/net/pcnet32.c2004-09-13 14:38:47.000000000 -0700drivers/net/pcnet32.c +1
-1@@ -847,7 +847,7 @@ static int pcnet32_phys_id(struct net_deif ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT /HZ ))) data = (u32)(MAX_SCHEDULE_TIMEOUT /HZ ); -schedule_timeout (data *HZ ); +msleep_interruptible (data *1000 );del_timer_sync (&lp->blink_timer);Surely that needs to be:
Quoted 3 lines
if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / 1000)) data = (u32)(MAX_SCHEDULE_TIMEOUT / 1000) msleep_interruptible(data * 1000);
Beyond the tabbing issue I already replied to (which I now realize wasn't really what you were referring to :) ), there is this problem:
I seems data is in terms of seconds. MAX_SCHEDULE_TIMEOUT is in terms of jiffies, so dividing it by 1000 to determine if the requested timeout is longer than the longest possible timeout would not work, I don't think.
The code should work as is, because the if checks to see if either data is 0 or greater than the maximum allowed number of seconds to sleep. In either case, data gets set to the maximum number of seconds to sleep. Then msleep_interruptible will sleep for the corresponding number of msecs :)
I think it all works itself out...
-Nish
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors