Skip to contentSkip to conversation

Should udelay() be replaced by usleep_range() here?

DISCUSSION Soumya Negi 2 participants 2 messages Oct 13, 2023

lore
Share & tools
lore
#0 lore raw

Hi,

I'm looking at this checkpatch warning in driver staging/rts5208:

CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #3240: FILE: drivers/staging/rts5208/ms.c:3240:
+ udelay(30);

As per the .rst file, we should use usleep_range(min,max) to introduce delays of 10us - 20ms. Which applies here as we want 30us. How do we decide on what range to feed to usleep_range()? The documentation mentions tradeoffs between setting a large or small range.

Thanks,
Soumya

#1 lore raw
Quoted 9 lines · Soumya Negi

Hi,

I'm looking at this checkpatch warning in driver staging/rts5208:

CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #3240: FILE: drivers/staging/rts5208/ms.c:3240:

(quoted diff) +1 -0
+		udelay(30);
Quoted 4 lines

As per the .rst file, we should use usleep_range(min,max) to introduce delays of 10us - 20ms. Which applies here as we want 30us. How do we decide on what range to feed to usleep_range()? The documentation mentions tradeoffs between setting a large or small range.

It is difficult to decide how to do this correctly without access to the hardware. It's probably better to do something else.

julia