Skip to contentSkip to conversation

iio: accel: adxl355: replace usleep_range() with fsleep()

PATCH In review Stepan Ionichev 3 participants 5 messages May 10 – May 12

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 iio: accel: adxl355: replace usleep_range() with fsleep()

The "at least 5ms" wait after software reset has no specific upper bound. Use fsleep() with 5 * USEC_PER_MSEC to make the unit explicit at the call site.

No functional change.

---
v3:
- Add this changelog (was missing in v2)

v2:
- Use 5 * USEC_PER_MSEC instead of raw 5000

 drivers/iio/accel/adxl355_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/adxl355_core.c +1 -1
index 8f90c58f4..9d4421653 100644
@@ -351,7 +351,7 @@ static int adxl355_setup(struct adxl355_data *data)
 			return ret;
 
 		/* Wait at least 5ms after software reset */
-		usleep_range(5000, 10000);
+		fsleep(5 * USEC_PER_MSEC);
 
 		/* Read shadow registers for comparison */
 		ret = regmap_bulk_read(data->regmap,
Signature · 1 line
2.43.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 5 lines · Stepan Ionichev

The "at least 5ms" wait after software reset has no specific upper bound. Use fsleep() with 5 * USEC_PER_MSEC to make the unit explicit at the call site.

No functional change.

Strictly speaking the upper limit is not set as 10 milliseconds now, but defined by the internals of fsleep(), usually +25%.

Perhaps Jonathan can just drop this sentence from the commit message whilst applying.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
Quoted 9 lines · On Mon, 11 May 2026 10:27:40 +0300 Andy Shevchenko…
Quoted 5 lines · Stepan Ionichev

The "at least 5ms" wait after software reset has no specific upper bound. Use fsleep() with 5 * USEC_PER_MSEC to make the unit explicit at the call site.

No functional change.

Strictly speaking the upper limit is not set as 10 milliseconds now, but defined by the internals of fsleep(), usually +25%.

I'm not following. There doesn't seem to be a statement of anything about the upper limit that is used - just one on it not being specified for the part.

Quoted 6 lines

Perhaps Jonathan can just drop this sentence from the commit message whilst applying.

Given I didn't really get the comment - applied as is.

J

#3 lore raw
Quoted 3 lines · Jonathan Cameron
Quoted 1 line · On Mon, 11 May 2026 10:27:40 +0300 Andy Shevchenko…

On Sun, May 10, 2026 at 04:38:52PM +0500, Stepan Ionichev wrote:

...

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

No functional change.

Strictly speaking the upper limit is not set as 10 milliseconds now, but defined by the internals of fsleep(), usually +25%.

I'm not following. There doesn't seem to be a statement of anything about the upper limit that is used - just one on it not being specified for the part.

I meant that switching from usleep_range() with explicit high limit is different to implicit fsleep(). And that's a (subtle) functional change. Hence "No functional change" is not fully true. Hope now it's clearer.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw
Quoted 12 lines · On Tue, 12 May 2026 10:32:23 +0300 Andy Shevchenko…
Quoted 3 lines · Jonathan Cameron
Quoted 1 line · On Mon, 11 May 2026 10:27:40 +0300 Andy Shevchenko…

On Sun, May 10, 2026 at 04:38:52PM +0500, Stepan Ionichev wrote:

...

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

No functional change.

Strictly speaking the upper limit is not set as 10 milliseconds now, but defined by the internals of fsleep(), usually +25%.

Quoted 7 lines
Quoted 3 lines

I'm not following. There doesn't seem to be a statement of anything about the upper limit that is used - just one on it not being specified for the part.

I meant that switching from usleep_range() with explicit high limit is different to implicit fsleep(). And that's a (subtle) functional change. Hence "No functional change" is not fully true. Hope now it's clearer.

Ah. Got you. Thanks for talking me through it!

Jonathan

Quoted 1 line