From: Larry Finger <Larry.Finger@lwfinger.net>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>,
devel@driverdev.osuosl.org,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] rtlwifi: Change long delays to sleeps
Date: Tue, 16 Feb 2016 10:02:19 -0600 [thread overview]
Message-ID: <56C3480B.3020807@lwfinger.net> (raw)
In-Reply-To: <CAFqt6zbRK610rbWEUvsw=Ci5hXVJ6YQL3io_Rh5hF38maRWdvQ@mail.gmail.com>
On 02/16/2016 12:17 AM, Souptick Joarder wrote:
> On Tue, Feb 16, 2016 at 3:42 AM, Larry Finger <Larry.Finger@lwfinger.net> 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
next prev parent reply other threads:[~2016-02-16 16:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 22:12 [PATCH] rtlwifi: Change long delays to sleeps Larry Finger
2016-02-16 6:17 ` Souptick Joarder
2016-02-16 16:02 ` Larry Finger [this message]
2016-02-20 5:48 ` ByeoungWook Kim
2016-02-20 14:06 ` Larry Finger
2016-02-20 14:29 ` ByeoungWook Kim
2016-03-07 12:13 ` Kalle Valo
2016-06-04 16:40 ` [PATCH] " Jan Kiszka
2016-06-04 16:52 ` Kalle Valo
2016-06-04 20:02 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C3480B.3020807@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=jrdr.linux@gmail.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.