patch "staging: greybus: loopback: fix broken udelay" added to staging-next
Subsystems (4)
This is a note to let you know that I've just added the patch titled
staging: greybus: loopback: fix broken udelay
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-next branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will also be merged in the next major kernel release during the merge window.
If you have any questions about this process, please let me know.
Quoted 1 line
From
33b8807a6fe10d0e675e0704444373a6fad93188Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Thu, 26 Jan 2017 12:37:32 +0100
Subject: staging: greybus: loopback: fix broken udelay
The loopback driver allows the user to set a minimum delay of up to one second to be inserted between test iterations (i.e. request submissions). The delay is currently specified in microseconds and is implemented using udelay.
Busy looping for long periods is not just anti-social; udelay must not be used for delays longer than a few milliseconds due to the risk of integer overflow.
Replace the broken udelay with a usleep_range with a 100 us range for short delays (< 20 ms) and otherwise revert to using msleep.
--- drivers/staging/greybus/loopback.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/staging/greybus/loopback.c +7 -2
@@ -1061,8 +1061,13 @@ static int gb_loopback_fn(void *data)gb_loopback_calculate_stats (gb, !!error); } gb->send_count++; -if (us_wait) -udelay (us_wait); + +if (us_wait) { +if (us_wait <20000 ) +usleep_range (us_wait, us_wait +100 ); +else +msleep (us_wait /1000 ); + } }gb_pm_runtime_put_autosuspend (bundle);
Signature · 1 line
2.11.0