[PATCH] USB: ati_remote: use time_before() and friends

They deal with wrapping correctly and are nicer to read.

Signed-off-by: Marcelo Feitoza Parisi <[EMAIL PROTECTED]>
Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
commit f0b80fbf294bc4f6ec179b09fd5b63df25188259
tree a3eb4af3ce641bc99dd89bc01aca2917aaba060a
parent 95f209f93663103db2a8fb989e226ac68a98b036
author Marcelo Feitoza Parisi <[EMAIL PROTECTED]> Thu, 01 Dec 2005 00:50:39 
+0300
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Wed, 04 Jan 2006 13:51:41 -0800

 drivers/usb/input/ati_remote.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index b78a4d8..f7bdc50 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -96,6 +96,7 @@
 #include <linux/usb.h>
 #include <linux/usb_input.h>
 #include <linux/wait.h>
+#include <linux/jiffies.h>
 
 /*
  * Module and Version Information, Module Parameters
@@ -471,7 +472,7 @@ static void ati_remote_input_report(stru
                /* Filter duplicate events which happen "too close" together. */
                if ((ati_remote->old_data[0] == data[1]) &&
                        (ati_remote->old_data[1] == data[2]) &&
-                       ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) {
+                       time_before(jiffies, ati_remote->old_jiffies + 
FILTER_TIME)) {
                        ati_remote->repeat_count++;
                } else {
                        ati_remote->repeat_count = 0;
@@ -506,16 +507,16 @@ 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);



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to