net/e1000_osdep: replace
Subsystems (2)
PATCH 1/1 net/e1000_osdep: replace
I would appreciate any comments from the janitors list.
Applys-to: 2.6.7
Description: Replace schedule_timeout() with msleep() to guarantee the task delays for the desired time.
drivers/net/e1000/e1000_osdep.h +1 -2
@@ -46,8 +46,7 @@/* Don't mdelay in interrupt context! */ \ BUG(); \ }else { \ -set_current_state (TASK_UNINTERRUPTIBLE ); \ -schedule_timeout ((x *HZ )/1000 +2 ); \ +msleep (x); \ } }while (0 ) #endif
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
drivers/net/e1000/e1000_osdep.h line 50
Quoted 11 lines · Nishanth Aravamudan
I would appreciate any comments from the janitors list.
Applys-to: 2.6.7
Description: Replace
schedule_timeout()withmsleep()to guarantee the task delays for the desired time.drivers/net/e1000/e1000_osdep.h +1
-2}else { \ -set_current_state (TASK_UNINTERRUPTIBLE ); \ -schedule_timeout ((x *HZ )/1000 +2 ); \ +msleep (x); \ } }while (0 )
Looks much better than the previous code. It's actually possible to do better, though. Simply change to:
#define msec_delay(x) msleep(x)
If msleep() ends up scheduling, the bad attempt to sleep will be caught by schedule(). There's no need to do the check in the 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 16 lines · Matthew Wilcox
Review
Quoted 11 lines · Nishanth Aravamudan
I would appreciate any comments from the janitors list.
Applys-to: 2.6.7
Description: Replace
schedule_timeout()withmsleep()to guarantee the task delays for the desired time.(quoted diff) +1
-2} else { \ - set_current_state(TASK_UNINTERRUPTIBLE); \ - schedule_timeout((x * HZ)/1000 + 2); \ + msleep(x); \ } } while(0)Looks much better than the previous code. It's actually possible to do better, though. Simply change to:
Quoted 4 lines
#define
msec_delay(x)msleep(x)If
msleep()ends up scheduling, the bad attempt to sleep will be caught byschedule(). There's no need to do the check in the driver.
Thanks for the tip and here is this change:
drivers/net/e1000/e1000_osdep.h +1 -7
@@ -42,13 +42,7 @@#include <linux/sched.h> #ifndef msec_delay -#define msec_delay (x) do { if(in_interrupt()) { \ -/* Don't mdelay in interrupt context! */ \ -BUG (); \ - } else { \ -set_current_state (TASK_UNINTERRUPTIBLE ); \ - schedule_timeout((x * HZ)/1000 + 2); \ - } } while(0) +#define msec_delay (x) msleep(x)#endif #define PCI_COMMAND_REGISTER PCI_COMMAND
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors