lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1432918952-27948-1-git-send-email-hofrat@osadl.org>
Date:	Fri, 29 May 2015 19:02:32 +0200
From:	Nicholas Mc Guire <hofrat@...dl.org>
To:	Willy Tarreau <willy@...a-x.org>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Mariusz Gorski <marius.gorski@...il.com>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
	Nicholas Mc Guire <hofrat@...dl.org>
Subject: [PATCH] staging: panel: use schedule_timeout_interruptible()

API consolidation with coccinelle found:
./drivers/staging/panel/panel.c:782:2-18:
        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 + 999) / 1000 but that simply looks wrong - rather than
"manual" converting to jiffies, msecs_to_jiffies which handles all 
corner-cases correctly, was used.

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

Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
---
Patch is against 4.1-rc5 (localversion-next is -next-20150529)

not really clear what the intent of (ms * HZ + 999) / 1000 was - this 
is HZ dependent and does not really make sense - the comment states
"sleeps that many milliseconds" so it probably simply should be
msecs_to_jiffies(ms) - but someone that knows the intention of this code
needs to check this.

 drivers/staging/panel/panel.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 0046ee0..d670494 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -775,12 +775,10 @@ static void pin_to_bits(int pin, unsigned char *d_val, unsigned char *c_val)
 /* sleeps that many milliseconds with a reschedule */
 static void long_sleep(int ms)
 {
-	if (in_interrupt()) {
+	if (in_interrupt())
 		mdelay(ms);
-	} else {
-		__set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout((ms * HZ + 999) / 1000);
-	}
+	else
+		schedule_timeout_interruptible(msecs_to_jiffies(ms));
 }
 
 /* send a serial byte to the LCD panel. The caller is responsible for locking
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ