提交 81c2a3ba 编写于 作者: D Daniel Mack 提交者: Dmitry Torokhov

Input: use ABS_CNT rather than (ABS_MAX + 1)

Signed-off-by: NDaniel Mack <daniel@caiaq.de>
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
上级 a62f0d27
...@@ -811,7 +811,7 @@ static const char *relatives[REL_MAX + 1] = { ...@@ -811,7 +811,7 @@ static const char *relatives[REL_MAX + 1] = {
[REL_WHEEL] = "Wheel", [REL_MISC] = "Misc", [REL_WHEEL] = "Wheel", [REL_MISC] = "Misc",
}; };
static const char *absolutes[ABS_MAX + 1] = { static const char *absolutes[ABS_CNT] = {
[ABS_X] = "X", [ABS_Y] = "Y", [ABS_X] = "X", [ABS_Y] = "Y",
[ABS_Z] = "Z", [ABS_RX] = "Rx", [ABS_Z] = "Z", [ABS_RX] = "Rx",
[ABS_RY] = "Ry", [ABS_RZ] = "Rz", [ABS_RY] = "Ry", [ABS_RZ] = "Rz",
......
...@@ -47,15 +47,15 @@ struct joydev { ...@@ -47,15 +47,15 @@ struct joydev {
struct mutex mutex; struct mutex mutex;
struct device dev; struct device dev;
struct js_corr corr[ABS_MAX + 1]; struct js_corr corr[ABS_CNT];
struct JS_DATA_SAVE_TYPE glue; struct JS_DATA_SAVE_TYPE glue;
int nabs; int nabs;
int nkey; int nkey;
__u16 keymap[KEY_MAX - BTN_MISC + 1]; __u16 keymap[KEY_MAX - BTN_MISC + 1];
__u16 keypam[KEY_MAX - BTN_MISC + 1]; __u16 keypam[KEY_MAX - BTN_MISC + 1];
__u8 absmap[ABS_MAX + 1]; __u8 absmap[ABS_CNT];
__u8 abspam[ABS_MAX + 1]; __u8 abspam[ABS_CNT];
__s16 abs[ABS_MAX + 1]; __s16 abs[ABS_CNT];
}; };
struct joydev_client { struct joydev_client {
...@@ -826,7 +826,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, ...@@ -826,7 +826,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
joydev->handle.handler = handler; joydev->handle.handler = handler;
joydev->handle.private = joydev; joydev->handle.private = joydev;
for (i = 0; i < ABS_MAX + 1; i++) for (i = 0; i < ABS_CNT; i++)
if (test_bit(i, dev->absbit)) { if (test_bit(i, dev->absbit)) {
joydev->absmap[i] = joydev->nabs; joydev->absmap[i] = joydev->nabs;
joydev->abspam[joydev->nabs] = i; joydev->abspam[joydev->nabs] = i;
......
...@@ -300,7 +300,7 @@ static int uinput_validate_absbits(struct input_dev *dev) ...@@ -300,7 +300,7 @@ static int uinput_validate_absbits(struct input_dev *dev)
unsigned int cnt; unsigned int cnt;
int retval = 0; int retval = 0;
for (cnt = 0; cnt < ABS_MAX + 1; cnt++) { for (cnt = 0; cnt < ABS_CNT; cnt++) {
if (!test_bit(cnt, dev->absbit)) if (!test_bit(cnt, dev->absbit))
continue; continue;
...@@ -387,7 +387,7 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu ...@@ -387,7 +387,7 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu
dev->id.product = user_dev->id.product; dev->id.product = user_dev->id.product;
dev->id.version = user_dev->id.version; dev->id.version = user_dev->id.version;
size = sizeof(int) * (ABS_MAX + 1); size = sizeof(int) * ABS_CNT;
memcpy(dev->absmax, user_dev->absmax, size); memcpy(dev->absmax, user_dev->absmax, size);
memcpy(dev->absmin, user_dev->absmin, size); memcpy(dev->absmin, user_dev->absmin, size);
memcpy(dev->absfuzz, user_dev->absfuzz, size); memcpy(dev->absfuzz, user_dev->absfuzz, size);
......
...@@ -1155,7 +1155,7 @@ struct input_dev { ...@@ -1155,7 +1155,7 @@ struct input_dev {
int sync; int sync;
int abs[ABS_MAX + 1]; int abs[ABS_CNT];
int rep[REP_MAX + 1]; int rep[REP_MAX + 1];
unsigned long key[BITS_TO_LONGS(KEY_CNT)]; unsigned long key[BITS_TO_LONGS(KEY_CNT)];
...@@ -1163,11 +1163,11 @@ struct input_dev { ...@@ -1163,11 +1163,11 @@ struct input_dev {
unsigned long snd[BITS_TO_LONGS(SND_CNT)]; unsigned long snd[BITS_TO_LONGS(SND_CNT)];
unsigned long sw[BITS_TO_LONGS(SW_CNT)]; unsigned long sw[BITS_TO_LONGS(SW_CNT)];
int absmax[ABS_MAX + 1]; int absmax[ABS_CNT];
int absmin[ABS_MAX + 1]; int absmin[ABS_CNT];
int absfuzz[ABS_MAX + 1]; int absfuzz[ABS_CNT];
int absflat[ABS_MAX + 1]; int absflat[ABS_CNT];
int absres[ABS_MAX + 1]; int absres[ABS_CNT];
int (*open)(struct input_dev *dev); int (*open)(struct input_dev *dev);
void (*close)(struct input_dev *dev); void (*close)(struct input_dev *dev);
......
...@@ -64,8 +64,8 @@ struct js_event { ...@@ -64,8 +64,8 @@ struct js_event {
#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_MAX + 1]) /* set axis mapping */ #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_MAX + 1]) /* get axis mapping */ #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
......
...@@ -166,11 +166,11 @@ struct uinput_ff_erase { ...@@ -166,11 +166,11 @@ struct uinput_ff_erase {
struct uinput_user_dev { struct uinput_user_dev {
char name[UINPUT_MAX_NAME_SIZE]; char name[UINPUT_MAX_NAME_SIZE];
struct input_id id; struct input_id id;
int ff_effects_max; int ff_effects_max;
int absmax[ABS_MAX + 1]; int absmax[ABS_CNT];
int absmin[ABS_MAX + 1]; int absmin[ABS_CNT];
int absfuzz[ABS_MAX + 1]; int absfuzz[ABS_CNT];
int absflat[ABS_MAX + 1]; int absflat[ABS_CNT];
}; };
#endif /* __UINPUT_H_ */ #endif /* __UINPUT_H_ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册