ChangeSet 1.1734, 2004/05/17 15:34:21-07:00, oliver@neukum.org [PATCH] USB: new delay helper safe wrt waitqueues this is a new waiting helper safe even if we are left on a waitqueue. This version addresses Alan's concerns about ifdefs. Please apply. - add delay helper that is safe even if we are still on another waitqueue drivers/usb/core/usb.c | 11 +++++++++++ include/linux/usb.h | 2 ++ 2 files changed, 13 insertions(+) diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c --- a/drivers/usb/core/usb.c Mon May 17 16:37:22 2004 +++ b/drivers/usb/core/usb.c Mon May 17 16:37:22 2004 @@ -1483,6 +1483,16 @@ return 0; } +void usb_uninterruptible_sleep_ms(int msecs) +{ + long timeout = msecs_to_jiffies(msecs); + + while(timeout) { + set_current_state(TASK_UNINTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } +} + struct bus_type usb_bus_type = { .name = "usb", .match = usb_device_match, @@ -1600,6 +1610,7 @@ EXPORT_SYMBOL(usb_disconnect); EXPORT_SYMBOL(__usb_get_extra_descriptor); +EXPORT_SYMBOL(usb_uninterruptible_sleep_ms); EXPORT_SYMBOL(usb_find_device); EXPORT_SYMBOL(usb_get_current_frame_number); diff -Nru a/include/linux/usb.h b/include/linux/usb.h --- a/include/linux/usb.h Mon May 17 16:37:22 2004 +++ b/include/linux/usb.h Mon May 17 16:37:22 2004 @@ -31,6 +31,8 @@ mdelay(ms); } +void usb_uninterruptible_sleep_ms(int msecs); + struct usb_device; struct usb_driver;