Re: [PATCH] rtlwifi: Change long delays to sleeps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/16/2016 12:17 AM, Souptick Joarder wrote:
On Tue, Feb 16, 2016 at 3:42 AM, Larry Finger <Larry.Finger@xxxxxxxxxxxx> wrote:
--snip--

         else if (addr == 0xf9)
-               udelay(1);
+               usleep_range(1, 2);

          why udelay is replaced by usleep_range?

I'm not sure of your level of sophistication, but here goes.

All delay statements cause a processor to stay in control and make the system wait for that amount of time. A sleep statement allows a context switch, and the processor is able to run some other job. For that reason, sleeps are always preferred over delays as long as the code is not running in atomic context.

There used to be a usleep() function, but as the system cannot promise to return from sleep after a specific delay, it was replaced with usleep_range().

It is true that the difference between delaying and sleeping for 1 usec would not be too destructive to the system, but I decided to convert every branch of that if structure to sleep statements.

Larry

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux