Search Linux Wireless

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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux