[PATCH 1/2] staging: dgnc: use schedule_timeout_interruptible()

Nicholas Mc Guire hofrat at osadl.org
Fri May 29 16:41:27 UTC 2015


API consolidation with coccinelle found:
./drivers/staging/dgnc/dgnc_utils.c:16:1-17:
        consolidation with schedule_timeout_*() recommended

This is a 1:1 conversion with respect to schedule_timeout() to the
schedule_timeout_interruptible() helper only - so only an API
consolidation to improve readability. The timeout was being passed
as (ms * HZ) / 1000 but that is not reliable as it allows the timeout
to become 0 for small values of ms. As this cut-off is HZ dependent
this is most likely not intended, so the timeout is converted with 
msecs_to_jiffies which handles all corener-cases correctly.

Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y,
CONFIG_DGNC=m

Patch is against 4.1-rc5 (localversion-next is -next-20150529)

Signed-off-by: Nicholas Mc Guire <hofrat at osadl.org>
---
 drivers/staging/dgnc/dgnc_utils.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_utils.c b/drivers/staging/dgnc/dgnc_utils.c
index f76de82..0cbb8a1 100644
--- a/drivers/staging/dgnc/dgnc_utils.c
+++ b/drivers/staging/dgnc/dgnc_utils.c
@@ -12,7 +12,6 @@
  */
 int dgnc_ms_sleep(ulong ms)
 {
-	__set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout((ms * HZ) / 1000);
+	schedule_timeout_interruptible(msecs_to_jiffies(ms));
 	return signal_pending(current);
 }
-- 
1.7.10.4



More information about the devel mailing list