[Cbe-oss-dev] [patch 6/6] mtd/ps3vram: Use msleep in waits

Arnd Bergmann arnd at arndb.de
Thu Jan 8 06:25:23 EST 2009


On Tuesday 06 January 2009, Geoff Levand wrote:
>         do {
> -               if (notify[3] == 0)
> +               if (!notify[3])
>                         return 0;
> -
> -               if (timeout_ms)
> -                       udelay(1);
> +               msleep(1);
>         } while (timeout_ms--);
>  

I guess it's not really important, but this function might wait substantially
longer than requested. If you have CONFIG_HZ=100, msleep(1) will sleep for
at least 10 miliseconds. The correct way to sleep for up to a given amount
of time is to calculate the end time in jiffies, and use time_before() in
the loop condition.

	Arnd <><


More information about the cbe-oss-dev mailing list