aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/ati_remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/input/ati_remote.c')
-rw-r--r--drivers/usb/input/ati_remote.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 9a2a47db9494..f7bdc506e613 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -96,6 +96,7 @@
96#include <linux/usb.h> 96#include <linux/usb.h>
97#include <linux/usb_input.h> 97#include <linux/usb_input.h>
98#include <linux/wait.h> 98#include <linux/wait.h>
99#include <linux/jiffies.h>
99 100
100/* 101/*
101 * Module and Version Information, Module Parameters 102 * Module and Version Information, Module Parameters
@@ -146,7 +147,7 @@ static char init1[] = { 0x01, 0x00, 0x20, 0x14 };
146static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; 147static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
147 148
148/* Acceleration curve for directional control pad */ 149/* Acceleration curve for directional control pad */
149static char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; 150static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
150 151
151/* Duplicate event filtering time. 152/* Duplicate event filtering time.
152 * Sequential, identical KIND_FILTERED inputs with less than 153 * Sequential, identical KIND_FILTERED inputs with less than
@@ -197,7 +198,7 @@ struct ati_remote {
197#define KIND_ACCEL 7 /* Directional keypad - left, right, up, down.*/ 198#define KIND_ACCEL 7 /* Directional keypad - left, right, up, down.*/
198 199
199/* Translation table from hardware messages to input events. */ 200/* Translation table from hardware messages to input events. */
200static struct { 201static const struct {
201 short kind; 202 short kind;
202 unsigned char data1, data2; 203 unsigned char data1, data2;
203 int type; 204 int type;
@@ -295,7 +296,6 @@ static void ati_remote_disconnect (struct usb_interface *interface);
295 296
296/* usb specific object to register with the usb subsystem */ 297/* usb specific object to register with the usb subsystem */
297static struct usb_driver ati_remote_driver = { 298static struct usb_driver ati_remote_driver = {
298 .owner = THIS_MODULE,
299 .name = "ati_remote", 299 .name = "ati_remote",
300 .probe = ati_remote_probe, 300 .probe = ati_remote_probe,
301 .disconnect = ati_remote_disconnect, 301 .disconnect = ati_remote_disconnect,
@@ -472,7 +472,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
472 /* Filter duplicate events which happen "too close" together. */ 472 /* Filter duplicate events which happen "too close" together. */
473 if ((ati_remote->old_data[0] == data[1]) && 473 if ((ati_remote->old_data[0] == data[1]) &&
474 (ati_remote->old_data[1] == data[2]) && 474 (ati_remote->old_data[1] == data[2]) &&
475 ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) { 475 time_before(jiffies, ati_remote->old_jiffies + FILTER_TIME)) {
476 ati_remote->repeat_count++; 476 ati_remote->repeat_count++;
477 } else { 477 } else {
478 ati_remote->repeat_count = 0; 478 ati_remote->repeat_count = 0;
@@ -507,16 +507,16 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
507 * pad down, so we increase acceleration, ramping up over two seconds to 507 * pad down, so we increase acceleration, ramping up over two seconds to
508 * a maximum speed. The acceleration curve is #defined above. 508 * a maximum speed. The acceleration curve is #defined above.
509 */ 509 */
510 if ((jiffies - ati_remote->old_jiffies) > (HZ >> 2)) { 510 if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) {
511 acc = 1; 511 acc = 1;
512 ati_remote->acc_jiffies = jiffies; 512 ati_remote->acc_jiffies = jiffies;
513 } 513 }
514 else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 3)) acc = accel[0]; 514 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3))) acc = accel[0];
515 else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 2)) acc = accel[1]; 515 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2))) acc = accel[1];
516 else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 1)) acc = accel[2]; 516 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1))) acc = accel[2];
517 else if ((jiffies - ati_remote->acc_jiffies) < HZ ) acc = accel[3]; 517 else if (time_before(jiffies, ati_remote->acc_jiffies + HZ)) acc = accel[3];
518 else if ((jiffies - ati_remote->acc_jiffies) < HZ+(HZ>>1)) acc = accel[4]; 518 else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1))) acc = accel[4];
519 else if ((jiffies - ati_remote->acc_jiffies) < (HZ << 1)) acc = accel[5]; 519 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1))) acc = accel[5];
520 else acc = accel[6]; 520 else acc = accel[6];
521 521
522 input_regs(dev, regs); 522 input_regs(dev, regs);