[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1423216711-1829-1-git-send-email-hofrat@osadl.org>
Date: Fri, 6 Feb 2015 04:58:31 -0500
From: Nicholas Mc Guire <hofrat@...dl.org>
To: Juergen Stuber <starblue@...rs.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
legousb-devel@...ts.sourceforge.net, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Nicholas Mc Guire <hofrat@...dl.org>
Subject: [PATCH] USB: legotower: use msecs_to_jiffies for time conversion
This is only an API consolidation and should make things more readable
it replaces var * HZ / 1000 by msecs_to_jiffies(var).
Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
---
Patch was only compile tested with x86_64_defconfig + CONFIG_USB_LEGOTOWER=m
Patch is against 3.19.0-rc7 (localversion-next is -next-20150204)
drivers/usb/misc/legousbtower.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 97cd9e2..7771be3 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -574,7 +574,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count,
}
if (read_timeout) {
- timeout = jiffies + read_timeout * HZ / 1000;
+ timeout = jiffies + msecs_to_jiffies(read_timeout);
}
/* wait for data */
@@ -592,7 +592,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count,
/* reset read timeout during read or write activity */
if (read_timeout
&& (dev->read_buffer_length || dev->interrupt_out_busy)) {
- timeout = jiffies + read_timeout * HZ / 1000;
+ timeout = jiffies + msecs_to_jiffies(read_timeout);
}
/* check for read timeout */
if (read_timeout && time_after (jiffies, timeout)) {
@@ -831,7 +831,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
dev->read_buffer_length = 0;
dev->read_packet_length = 0;
spin_lock_init (&dev->read_buffer_lock);
- dev->packet_timeout_jiffies = packet_timeout * HZ / 1000;
+ dev->packet_timeout_jiffies = msecs_to_jiffies(packet_timeout);
dev->read_last_arrival = jiffies;
init_waitqueue_head (&dev->read_wait);
--
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