From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Cc: Mayur Kumar <kmayur809@gmail.com>,
rafael@kernel.org, daniel.lezcano@kernel.org,
rui.zhang@intel.com, lukasz.luba@arm.com,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thermal: armada: replace msleep with usleep_range for short durations
Date: Tue, 19 May 2026 09:43:45 +0200 [thread overview]
Message-ID: <87se7nsv2m.fsf@bootlin.com> (raw)
In-Reply-To: <9ae2a769-4b2a-4990-90d4-0a1c0f05ba82@oss.qualcomm.com> (Daniel Lezcano's message of "Mon, 18 May 2026 19:57:46 +0200")
Hello Mayur, Daniel,
Actually I have a couple of comments :-)
On 18/05/2026 at 19:57:46 +02, Daniel Lezcano <daniel.lezcano@oss.qualcomm.com> wrote:
> On 5/11/26 17:37, Mayur Kumar wrote:
>> The checkpatch tool warns that msleep(10) can sleep for up to 20ms.
This is a tool that gives you raw advices. Is sleeping 20ms a problem in
an init function, clearly outside of any hotpath? Honestly that does not
look like a big issue to me.
>> According to Documentation/timers/timers-howto.rst, usleep_range()
This file has been dropped in favour of a more up-to-date
Documentation/timers/delay_sleep_functions.rst in:
1f455f601e20 ("timers/Documentation: Cleanup delay/sleep documentation")
>> should be used for delays between 1ms and 20ms to provide better
>> timing accuracy.
Again, I don't see the point here, we do not need accuracy, do we?
>> Replace the 10ms msleep with a 10ms-11ms usleep_range.
10 to 11ms feels very arbitrary and has been selected just for getting
the tool happy. The above file states:
#. Use `fsleep()` whenever unsure (as it combines all the advantages of the
others)
#. Use `*sleep()` whenever possible
#. Use `usleep_range*()` whenever accuracy of `*sleep()` is not sufficient
#. Use `*delay()` for very, very short delays
Accuracy not being a concern here, fsleep() could be the way to go, and
the actual implementation would end up being usleep_range(10000, 20000),
which is exactly what the tool complains about.
In general I would be in favour of avoiding this kind of change that is
not motivated by hardware concerns, but if you really want to fix this
checkpatch.pl warning I believe in such case you should go for an
fsleep().
Thanks,
Miquèl
prev parent reply other threads:[~2026-05-19 7:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 15:37 [PATCH] thermal: armada: replace msleep with usleep_range for short durations Mayur Kumar
2026-05-18 17:57 ` Daniel Lezcano
2026-05-19 7:43 ` Miquel Raynal [this message]
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=87se7nsv2m.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=daniel.lezcano@kernel.org \
--cc=daniel.lezcano@oss.qualcomm.com \
--cc=kmayur809@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/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.