Skip to contentSkip to conversation

net/ixgb_osdep: replace schedule_timeout() with msleep()

PATCH Applied [email protected] 2 participants 3 messages Mar 6, 2005 – Mar 9, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/26 net/ixgb_osdep: replace schedule_timeout() with msleep()

Use msleep() instead of schedule_timeout()
to guarantee the task delays as expected. I was told earlier that the in_interrupt() check is not necessary. It would be nice to get some verification of this (i.e. the driver functions the same without it).

---

 kj-domen/drivers/net/ixgb/ixgb_osdep.h |    8 +-------
 1 files changed, 1 insertion(+), 7 deletions(-)
drivers/net/ixgb/ixgb_osdep.h renamed from drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep +1 -7
diff -puN drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep drivers/net/ixgb/ixgb_osdep.h
@@ -41,13 +41,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

_

#1 lore raw

No. This would not work. You cannot replace msec_delay with msleep. You probably could replace the set_current_task/schedule_timeout with msleep. msleep does not check for the correct context, and if one were to call msec_delay from interrupt context, the kernel would panic.

ganesh.

Quoted 36 lines · On Sun, 06 Mar 2005 11:32:48 +0100, [email protected] <[email protected]>…

Use msleep() instead of schedule_timeout()
to guarantee the task delays as expected. I was told earlier that the in_interrupt() check is not necessary. It would be nice to get some verification of this (i.e. the driver functions the same without it).

---

kj-domen/drivers/net/ixgb/ixgb_osdep.h | 8 +-------

1 files changed, 1 insertion(+), 7 deletions(-)

diff -puN drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep drivers/net/ixgb/ixgb_osdep.h

drivers/net/ixgb/ixgb_osdep.h 2005-03-05 16:09:27.000000000 +0100 renamed from drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep 2005-03-05 16:09:27.000000000 +0100 +1 -7
@@ -41,13 +41,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

_

#2 lore raw
Quoted 4 lines · Ganesh Venkatesan

No. This would not work. You cannot replace msec_delay with msleep. You probably could replace the set_current_task/schedule_timeout with msleep. msleep does not check for the correct context, and if one were to call msec_delay from interrupt context, the kernel would panic.

And that would be wrong? Guess what BUG() does.

Quoted 42 lines

ganesh.

Quoted 36 lines · On Sun, 06 Mar 2005 11:32:48 +0100, [email protected] <[email protected]>…

Use msleep() instead of schedule_timeout()
to guarantee the task delays as expected. I was told earlier that the in_interrupt() check is not necessary. It would be nice to get some verification of this (i.e. the driver functions the same without it).

---

kj-domen/drivers/net/ixgb/ixgb_osdep.h | 8 +-------

1 files changed, 1 insertion(+), 7 deletions(-)

diff -puN drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep drivers/net/ixgb/ixgb_osdep.h

drivers/net/ixgb/ixgb_osdep.h 2005-03-05 16:09:27.000000000 +0100 renamed from drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep 2005-03-05 16:09:27.000000000 +0100 +1 -7
@@ -41,13 +41,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

_