From: Marcelo Feitoza Parisi <[EMAIL PROTECTED]>

Use of time_after and time_before macros, defined at linux/jiffies.h, which deal
with wrapping correctly and are nicer to read.

Signed-off-by: Marcelo Feitoza Parisi <[EMAIL PROTECTED]>
Signed-off-by: Domen Puncer <[EMAIL PROTECTED]>

---
 ati_remote.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

Index: quilt/drivers/usb/input/ati_remote.c
===================================================================
--- quilt.orig/drivers/usb/input/ati_remote.c
+++ quilt/drivers/usb/input/ati_remote.c
@@ -95,6 +95,7 @@
 #include <linux/input.h>
 #include <linux/usb.h>
 #include <linux/wait.h>
+#include <linux/jiffies.h>
 
 /*
  * Module and Version Information, Module Parameters
@@ -510,16 +511,22 @@ static void ati_remote_input_report(stru
         * pad down, so we increase acceleration, ramping up over two seconds to
         * a maximum speed.  The acceleration curve is #defined above.
         */
-       if ((jiffies - ati_remote->old_jiffies) > (HZ >> 2)) {
+       if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) {
                acc = 1;
                ati_remote->acc_jiffies = jiffies;
        }
-       else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 3))  acc = 
accel[0];
-       else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 2))  acc = 
accel[1];
-       else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 1))  acc = 
accel[2];
-       else if ((jiffies - ati_remote->acc_jiffies) < HZ )        acc = 
accel[3];
-       else if ((jiffies - ati_remote->acc_jiffies) < HZ+(HZ>>1)) acc = 
accel[4];
-       else if ((jiffies - ati_remote->acc_jiffies) < (HZ << 1))  acc = 
accel[5];
+       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3)))
+               acc = accel[0];
+       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2)))
+               acc = accel[1];
+       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1)))
+               acc = accel[2];
+       else if (time_before(jiffies, ati_remote->acc_jiffies + HZ ))
+               acc = accel[3];
+       else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1)))
+               acc = accel[4];
+       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1)))
+               acc = accel[5];
        else acc = accel[6];
 
        input_regs(dev, regs);

--


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to