aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-05-21 01:52:58 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-05-21 02:05:28 -0400
commit81c2a3ba497835797332b517ebf2de7b7f2a7c80 (patch)
treea7dee14c14bdf2a1d9a5aa99bf9625943ace70ba
parenta62f0d27b4196bad5e900d766b285feb7069cd16 (diff)
Input: use ABS_CNT rather than (ABS_MAX + 1)
Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/hid/hid-debug.c2
-rw-r--r--drivers/input/joydev.c10
-rw-r--r--drivers/input/misc/uinput.c4
-rw-r--r--include/linux/input.h12
-rw-r--r--include/linux/joystick.h4
-rw-r--r--include/linux/uinput.h10
6 files changed, 21 insertions, 21 deletions
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 56f314fbd4f9..c94026768570 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -811,7 +811,7 @@ static const char *relatives[REL_MAX + 1] = {
811 [REL_WHEEL] = "Wheel", [REL_MISC] = "Misc", 811 [REL_WHEEL] = "Wheel", [REL_MISC] = "Misc",
812}; 812};
813 813
814static const char *absolutes[ABS_MAX + 1] = { 814static const char *absolutes[ABS_CNT] = {
815 [ABS_X] = "X", [ABS_Y] = "Y", 815 [ABS_X] = "X", [ABS_Y] = "Y",
816 [ABS_Z] = "Z", [ABS_RX] = "Rx", 816 [ABS_Z] = "Z", [ABS_RX] = "Rx",
817 [ABS_RY] = "Ry", [ABS_RZ] = "Rz", 817 [ABS_RY] = "Ry", [ABS_RZ] = "Rz",
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 423e0e6031ab..34157bb97ed6 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -47,15 +47,15 @@ struct joydev {
47 struct mutex mutex; 47 struct mutex mutex;
48 struct device dev; 48 struct device dev;
49 49
50 struct js_corr corr[ABS_MAX + 1]; 50 struct js_corr corr[ABS_CNT];
51 struct JS_DATA_SAVE_TYPE glue; 51 struct JS_DATA_SAVE_TYPE glue;
52 int nabs; 52 int nabs;
53 int nkey; 53 int nkey;
54 __u16 keymap[KEY_MAX - BTN_MISC + 1]; 54 __u16 keymap[KEY_MAX - BTN_MISC + 1];
55 __u16 keypam[KEY_MAX - BTN_MISC + 1]; 55 __u16 keypam[KEY_MAX - BTN_MISC + 1];
56 __u8 absmap[ABS_MAX + 1]; 56 __u8 absmap[ABS_CNT];
57 __u8 abspam[ABS_MAX + 1]; 57 __u8 abspam[ABS_CNT];
58 __s16 abs[ABS_MAX + 1]; 58 __s16 abs[ABS_CNT];
59}; 59};
60 60
61struct joydev_client { 61struct joydev_client {
@@ -826,7 +826,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
826 joydev->handle.handler = handler; 826 joydev->handle.handler = handler;
827 joydev->handle.private = joydev; 827 joydev->handle.private = joydev;
828 828
829 for (i = 0; i < ABS_MAX + 1; i++) 829 for (i = 0; i < ABS_CNT; i++)
830 if (test_bit(i, dev->absbit)) { 830 if (test_bit(i, dev->absbit)) {
831 joydev->absmap[i] = joydev->nabs; 831 joydev->absmap[i] = joydev->nabs;
832 joydev->abspam[joydev->nabs] = i; 832 joydev->abspam[joydev->nabs] = i;
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 1477466076ad..b71eb55f2dbc 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -300,7 +300,7 @@ static int uinput_validate_absbits(struct input_dev *dev)
300 unsigned int cnt; 300 unsigned int cnt;
301 int retval = 0; 301 int retval = 0;
302 302
303 for (cnt = 0; cnt < ABS_MAX + 1; cnt++) { 303 for (cnt = 0; cnt < ABS_CNT; cnt++) {
304 if (!test_bit(cnt, dev->absbit)) 304 if (!test_bit(cnt, dev->absbit))
305 continue; 305 continue;
306 306
@@ -387,7 +387,7 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu
387 dev->id.product = user_dev->id.product; 387 dev->id.product = user_dev->id.product;
388 dev->id.version = user_dev->id.version; 388 dev->id.version = user_dev->id.version;
389 389
390 size = sizeof(int) * (ABS_MAX + 1); 390 size = sizeof(int) * ABS_CNT;
391 memcpy(dev->absmax, user_dev->absmax, size); 391 memcpy(dev->absmax, user_dev->absmax, size);
392 memcpy(dev->absmin, user_dev->absmin, size); 392 memcpy(dev->absmin, user_dev->absmin, size);
393 memcpy(dev->absfuzz, user_dev->absfuzz, size); 393 memcpy(dev->absfuzz, user_dev->absfuzz, size);
diff --git a/include/linux/input.h b/include/linux/input.h
index 83524e4f3290..6fcc9101beeb 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1155,7 +1155,7 @@ struct input_dev {
1155 1155
1156 int sync; 1156 int sync;
1157 1157
1158 int abs[ABS_MAX + 1]; 1158 int abs[ABS_CNT];
1159 int rep[REP_MAX + 1]; 1159 int rep[REP_MAX + 1];
1160 1160
1161 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1161 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
@@ -1163,11 +1163,11 @@ struct input_dev {
1163 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1163 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1164 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1164 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1165 1165
1166 int absmax[ABS_MAX + 1]; 1166 int absmax[ABS_CNT];
1167 int absmin[ABS_MAX + 1]; 1167 int absmin[ABS_CNT];
1168 int absfuzz[ABS_MAX + 1]; 1168 int absfuzz[ABS_CNT];
1169 int absflat[ABS_MAX + 1]; 1169 int absflat[ABS_CNT];
1170 int absres[ABS_MAX + 1]; 1170 int absres[ABS_CNT];
1171 1171
1172 int (*open)(struct input_dev *dev); 1172 int (*open)(struct input_dev *dev);
1173 void (*close)(struct input_dev *dev); 1173 void (*close)(struct input_dev *dev);
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index 9e20c29c1e14..47199b13e0eb 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -64,8 +64,8 @@ struct js_event {
64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ 64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ 65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
66 66
67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_MAX + 1]) /* set axis mapping */ 67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_MAX + 1]) /* get axis mapping */ 68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ 69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ 70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
71 71
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 15ddd4483b09..60c81da77f0f 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -166,11 +166,11 @@ struct uinput_ff_erase {
166struct uinput_user_dev { 166struct uinput_user_dev {
167 char name[UINPUT_MAX_NAME_SIZE]; 167 char name[UINPUT_MAX_NAME_SIZE];
168 struct input_id id; 168 struct input_id id;
169 int ff_effects_max; 169 int ff_effects_max;
170 int absmax[ABS_MAX + 1]; 170 int absmax[ABS_CNT];
171 int absmin[ABS_MAX + 1]; 171 int absmin[ABS_CNT];
172 int absfuzz[ABS_MAX + 1]; 172 int absfuzz[ABS_CNT];
173 int absflat[ABS_MAX + 1]; 173 int absflat[ABS_CNT];
174}; 174};
175#endif /* __UINPUT_H_ */ 175#endif /* __UINPUT_H_ */
176 176