On Fri, 14 May 2004, Oliver Neukum wrote:
> /**
> + * usb_uninterruptible_sleep_ms - safe sleeping delay
> + * @msecs: minimum time to sleep given in milliseconds
> + */
> +void usb_uninterruptible_sleep_ms (unsigned int msecs)
> +{
> + wait_ms(msecs);
> +}
> static __inline__ void wait_ms(unsigned int ms)
> {
> if(!in_interrupt()) {
> + long timeout = MSEC_TO_JIFFIES(ms);
> +
> + while(timeout) {
> + set_current_state(TASK_UNINTERRUPTIBLE);
> + timeout = schedule_timeout(timeout);
> + }
> + } else {
> mdelay(ms);
> + }
> }
Do we really need both an inline and a non-inline version of the same
function? Certainly the time penalty for function-call overhead doesn't
matter when you're going to sleep anyway!
More importantly, I don't like this notion of doing things differently
depending on whether or not in_interrupt() is true. It doesn't take into
account other things the programmer should be aware of, like whether
interrupts are enabled or any spinlocks are held. IMO we should have a
single non-inline function that always calls schedule_timeout(). If
someone wants to use mdelay() instead, let them call mdelay() directly.
Alan Stern
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel