Re: [PATCH v2] staging: greybus: loopback: Use fsleep() for delay

From: Alex Elder

Date: Fri Oct 23 2026 - 09:18:17 EST


On 10/23/26 8:04 AM, Greg KH wrote:
On Fri, Oct 23, 2026 at 07:48:54AM -0500, Alex Elder wrote:
On 10/22/26 3:24 PM, pavankumaryalagada@xxxxxxxxx wrote:
From: Yalagada Pavan Kumar <pavankumaryalagada@xxxxxxxxx>

In the loopback function, usleep_range() is used for short delays
and msleep() for longer delays. This requires choosing the delay
function based on the requested time and converting microseconds
to milliseconds when using msleep().

Replace both functions with fsleep(), which chooses a delay
delay method based on the requested time. For short delays,

s/delay delay/delay/

I think "checkpatch.pl" would have caught this.

Maybe Greg can fix this up.

Nope, not for staging patches, this is for "learning" :)

Sounds good.

Please provide version 3. And given that, I'll add one more
suggestion.

You don't provide the *reason* for making this change in your
description. You say that fsleep() does roughly the same thing
as the existing code. But... why make the change?

The answer is roughly that fsleep() is a common or "standard"
function, and it's better to use those where available. I can
think of at least three reasons:
- It's better to use a well-known common function where available,
because reviewers will already be familiar with what it does
- A common function might get optimizations and improvements that
your code would otherwise not benefit from
- It might (slightly) reduce code size

I am not suggesting you include all that, but you should
understand it. My point is that you should be clear on
the reason for the suggested change in your patch header.

Even something like:
Replace this block of code with a simple call to fsleep(),
which does the same thing.
is enough to explain *why*.

Also, before sending *any* patch for review, please *always*
re-run checkpatch.pl so it can find trivial problems for you.

-Alex


thanks.

greg k-h