public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: host: max3421-hcd: use time_after()
@ 2014-12-15  7:22 Asaf Vertz
  2014-12-15  7:50 ` David Mosberger
  0 siblings, 1 reply; 2+ messages in thread
From: Asaf Vertz @ 2014-12-15  7:22 UTC (permalink / raw)
  To: gregkh
  Cc: davidm, khoroshilov, asaf.vertz, sachin.kamat, linux-usb,
	linux-kernel

To be future-proof and for better readability the time comparisons are
modified to use time_after() instead of plain, error-prone math.

Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
---
 drivers/usb/host/max3421-hcd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index 6234c75..aaaff94 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -55,6 +55,7 @@
  * single thread (max3421_spi_thread).
  */
 
+#include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/spi/spi.h>
 #include <linux/usb.h>
@@ -1291,7 +1292,7 @@ max3421_handle_irqs(struct usb_hcd *hcd)
 		char sbuf[16 * 16], *dp, *end;
 		int i;
 
-		if (jiffies - last_time > 5*HZ) {
+		if (time_after(jiffies, last_time + 5*HZ)) {
 			dp = sbuf;
 			end = sbuf + sizeof(sbuf);
 			*dp = '\0';
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: host: max3421-hcd: use time_after()
  2014-12-15  7:22 [PATCH] usb: host: max3421-hcd: use time_after() Asaf Vertz
@ 2014-12-15  7:50 ` David Mosberger
  0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger @ 2014-12-15  7:50 UTC (permalink / raw)
  To: Asaf Vertz
  Cc: Greg Kroah-Hartman, Alexey Khoroshilov, Sachin Kamat,
	linux-usb@vger.kernel.org, linux-kernel

Acked-by: David Mosberger <davidm@egauge.net>

On Mon, Dec 15, 2014 at 8:22 AM, Asaf Vertz <asaf.vertz@tandemg.com> wrote:
> To be future-proof and for better readability the time comparisons are
> modified to use time_after() instead of plain, error-prone math.
>
> Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
> ---
>  drivers/usb/host/max3421-hcd.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
> index 6234c75..aaaff94 100644
> --- a/drivers/usb/host/max3421-hcd.c
> +++ b/drivers/usb/host/max3421-hcd.c
> @@ -55,6 +55,7 @@
>   * single thread (max3421_spi_thread).
>   */
>
> +#include <linux/jiffies.h>
>  #include <linux/module.h>
>  #include <linux/spi/spi.h>
>  #include <linux/usb.h>
> @@ -1291,7 +1292,7 @@ max3421_handle_irqs(struct usb_hcd *hcd)
>                 char sbuf[16 * 16], *dp, *end;
>                 int i;
>
> -               if (jiffies - last_time > 5*HZ) {
> +               if (time_after(jiffies, last_time + 5*HZ)) {
>                         dp = sbuf;
>                         end = sbuf + sizeof(sbuf);
>                         *dp = '\0';
> --
> 1.7.0.4
>



-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-15  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-15  7:22 [PATCH] usb: host: max3421-hcd: use time_after() Asaf Vertz
2014-12-15  7:50 ` David Mosberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox