diff options
Diffstat (limited to 'drivers/input')
85 files changed, 300 insertions, 234 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 1d62c8b88e1..e5b4e9bfbdc 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -495,7 +495,7 @@ static unsigned int evdev_poll(struct file *file, poll_table *wait) #ifdef CONFIG_COMPAT #define BITS_PER_LONG_COMPAT (sizeof(compat_long_t) * 8) -#define NBITS_COMPAT(x) ((((x) - 1) / BITS_PER_LONG_COMPAT) + 1) +#define BITS_TO_LONGS_COMPAT(x) ((((x) - 1) / BITS_PER_LONG_COMPAT) + 1) #ifdef __BIG_ENDIAN static int bits_to_user(unsigned long *bits, unsigned int maxbit, @@ -504,7 +504,7 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit, int len, i; if (compat) { - len = NBITS_COMPAT(maxbit) * sizeof(compat_long_t); + len = BITS_TO_LONGS_COMPAT(maxbit) * sizeof(compat_long_t); if (len > maxlen) len = maxlen; @@ -515,7 +515,7 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit, sizeof(compat_long_t))) return -EFAULT; } else { - len = NBITS(maxbit) * sizeof(long); + len = BITS_TO_LONGS(maxbit) * sizeof(long); if (len > maxlen) len = maxlen; @@ -530,8 +530,8 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit, unsigned int maxlen, void __user *p, int compat) { int len = compat ? - NBITS_COMPAT(maxbit) * sizeof(compat_long_t) : - NBITS(maxbit) * sizeof(long); + BITS_TO_LONGS_COMPAT(maxbit) * sizeof(compat_long_t) : + BITS_TO_LONGS(maxbit) * sizeof(long); if (len > maxlen) len = maxlen; @@ -545,7 +545,7 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit, static int bits_to_user(unsigned long *bits, unsigned int maxbit, unsigned int maxlen, void __user *p, int compat) { - int len = NBITS(maxbit) * sizeof(long); + int len = BITS_TO_LONGS(maxbit) * sizeof(long); if (len > maxlen) len = maxlen; diff --git a/drivers/input/input.c b/drivers/input/input.c index 2f2b020cd62..307c7b5c2b3 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -584,10 +584,10 @@ static int input_default_setkeycode(struct input_dev *dev, #define MATCH_BIT(bit, max) \ - for (i = 0; i < NBITS(max); i++) \ + for (i = 0; i < BITS_TO_LONGS(max); i++) \ if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \ break; \ - if (i != NBITS(max)) \ + if (i != BITS_TO_LONGS(max)) \ continue; static const struct input_device_id *input_match_device(const struct input_device_id *id, @@ -698,7 +698,7 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name, { int i; - for (i = NBITS(max) - 1; i > 0; i--) + for (i = BITS_TO_LONGS(max) - 1; i > 0; i--) if (bitmap[i]) break; @@ -892,7 +892,7 @@ static int input_print_modalias_bits(char *buf, int size, len += snprintf(buf, max(size, 0), "%c", name); for (i = min_bit; i < max_bit; i++) - if (bm[LONG(i)] & BIT(i)) + if (bm[BIT_WORD(i)] & BIT_MASK(i)) len += snprintf(buf + len, max(size - len, 0), "%X,", i); return len; } @@ -991,7 +991,7 @@ static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap, int i; int len = 0; - for (i = NBITS(max) - 1; i > 0; i--) + for (i = BITS_TO_LONGS(max) - 1; i > 0; i--) if (bitmap[i]) break; diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 2b201f9aa02..22b2789ef58 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -844,8 +844,8 @@ static const struct input_device_id joydev_blacklist[] = { { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT(EV_KEY) }, - .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, + .evbit = { BIT_MASK(EV_KEY) }, + .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) }, }, /* Avoid itouchpads, touchscreens and tablets */ { } /* Terminating entry */ }; @@ -854,20 +854,20 @@ static const struct input_device_id joydev_ids[] = { { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, - .evbit = { BIT(EV_ABS) }, - .absbit = { BIT(ABS_X) }, + .evbit = { BIT_MASK(EV_ABS) }, + .absbit = { BIT_MASK(ABS_X) }, }, { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, - .evbit = { BIT(EV_ABS) }, - .absbit = { BIT(ABS_WHEEL) }, + .evbit = { BIT_MASK(EV_ABS) }, + .absbit = { BIT_MASK(ABS_WHEEL) }, }, { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, - .evbit = { BIT(EV_ABS) }, - .absbit = { BIT(ABS_THROTTLE) }, + .evbit = { BIT_MASK(EV_ABS) }, + .absbit = { BIT_MASK(ABS_THROTTLE) }, }, { } /* Terminating entry */ }; diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c index ff701ab10d7..52ba16f487c 100644 --- a/drivers/input/joystick/a3d.c +++ b/drivers/input/joystick/a3d.c @@ -326,14 +326,19 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) a3d->length = 33; - input_dev->evbit[0] |= BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL); - input_dev->relbit[0] |= BIT(REL_X) | BIT(REL_Y); - input_dev->absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_RUDDER) - | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y) | BIT(ABS_HAT1X) | BIT(ABS_HAT1Y); - input_dev->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE) - | BIT(BTN_SIDE) | BIT(BTN_EXTRA); - input_dev->keybit[LONG(BTN_JOYSTICK)] |= BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) - | BIT(BTN_PINKIE); + input_dev->evbit[0] |= BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY) | + BIT_MASK(EV_REL); + input_dev->relbit[0] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y); + input_dev->absbit[0] |= BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | + BIT_MASK(ABS_THROTTLE) | BIT_MASK(ABS_RUDDER) | + BIT_MASK(ABS_HAT0X) | BIT_MASK(ABS_HAT0Y) | + BIT_MASK(ABS_HAT1X) | BIT_MASK(ABS_HAT1Y); + input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_RIGHT) | + BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | + BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA); + input_dev->keybit[BIT_WORD(BTN_JOYSTICK)] |= + BIT_MASK(BTN_TRIGGER) | BIT_MASK(BTN_THUMB) | + BIT_MASK(BTN_TOP) | BIT_MASK(BTN_PINKIE); a3d_read(a3d, data); @@ -348,9 +353,10 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) } else { a3d->length = 29; - input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_REL); - input_dev->relbit[0] |= BIT(REL_X) | BIT(REL_Y); - input_dev->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE); + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); + input_dev->relbit[0] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y); + input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_RIGHT) | + BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE); a3d_read(a3d, data); diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c index 28140c4a110..d1ca8a14950 100644 --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -431,7 +431,7 @@ static int adi_init_input(struct adi *adi, struct adi_port *port, int half) input_dev->open = adi_open; input_dev->close = adi_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++) set_bit(adi->abs[i], input_dev->absbit); diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c index b0f5541ec3e..5cf9f3610e6 100644 --- a/drivers/input/joystick/amijoy.c +++ b/drivers/input/joystick/amijoy.c @@ -137,9 +137,10 @@ static int __init amijoy_init(void) amijoy_dev[i]->open = amijoy_open; amijoy_dev[i]->close = amijoy_close; - amijoy_dev[i]->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - amijoy_dev[i]->absbit[0] = BIT(ABS_X) | BIT(ABS_Y); - amijoy_dev[i]->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); + amijoy_dev[i]->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); + amijoy_dev[i]->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y); + amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | + BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); for (j = 0; j < 2; j++) { amijoy_dev[i]->absmin[ABS_X + j] = -1; amijoy_dev[i]->absmax[ABS_X + j] = 1; diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index bdd157c1ebf..15739880afc 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c @@ -456,7 +456,7 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i input_dev->open = analog_open; input_dev->close = analog_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (i = j = 0; i < 4; i++) if (analog->mask & (1 << i)) { diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c index d3352a849b8..55646a6d89f 100644 --- a/drivers/input/joystick/cobra.c +++ b/drivers/input/joystick/cobra.c @@ -218,7 +218,7 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv) input_dev->open = cobra_open; input_dev->close = cobra_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); input_set_abs_params(input_dev, ABS_X, -1, 1, 0, 0); input_set_abs_params(input_dev, ABS_Y, -1, 1, 0, 0); for (j = 0; cobra_btn[j]; j++) diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c index b069ee18e35..27fc475bd3a 100644 --- a/drivers/input/joystick/db9.c +++ b/drivers/input/joystick/db9.c @@ -631,7 +631,7 @@ static struct db9 __init *db9_probe(int parport, int mode) input_dev->open = db9_open; input_dev->close = db9_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (j = 0; j < db9_mode->n_buttons; j++) set_bit(db9_mode->buttons[j], input_dev->keybit); for (j = 0; j < db9_mode->n_axis; j++) { diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index 1a452e0e5f2..df2a9d02ca6 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c @@ -653,12 +653,12 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) input_dev->close = gc_close; if (pad_type != GC_SNESMOUSE) { - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (i = 0; i < 2; i++) input_set_abs_params(input_dev, ABS_X + i, -1, 1, 0, 0); } else - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); gc->pads[0] |= gc_status_bit[idx]; gc->pads[pad_type] |= gc_status_bit[idx]; diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c index d514aebf755..1f6302c0eb3 100644 --- a/drivers/input/joystick/gf2k.c +++ b/drivers/input/joystick/gf2k.c @@ -315,7 +315,7 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv) input_dev->open = gf2k_open; input_dev->close = gf2k_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (i = 0; i < gf2k_axes[gf2k->id]; i++) set_bit(gf2k_abs[i], input_dev->absbit); diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c index 73eb5ab6f14..fd3853ab1aa 100644 --- a/drivers/input/joystick/grip.c +++ b/drivers/input/joystick/grip.c @@ -370,7 +370,7 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv) input_dev->open = grip_open; input_dev->close = grip_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (j = 0; (t = grip_abs[grip->mode[i]][j]) >= 0; j++) { diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c index 4ed3a3eadf1..c57e21d68c0 100644 --- a/drivers/input/joystick/grip_mp.c +++ b/drivers/input/joystick/grip_mp.c @@ -606,7 +606,7 @@ static int register_slot(int slot, struct grip_mp *grip) input_dev->open = grip_open; input_dev->close = grip_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (j = 0; (t = grip_abs[port->mode][j]) >= 0; j++) input_set_abs_params(input_dev, t, -1, 1, 0, 0); diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c index d4e8073caf2..aa6bfb3fb8c 100644 --- a/drivers/input/joystick/guillemot.c +++ b/drivers/input/joystick/guillemot.c @@ -238,7 +238,7 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver * input_dev->open = guillemot_open; input_dev->close = guillemot_close; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (i = 0; (t = guillemot->type->abs[i]) >= 0; i++) input_set_abs_params(input_dev, t, 0, 255, 0, 0); diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 682244b1c04..6f826b37d9a 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -389,7 +389,8 @@ int iforce_init_device(struct iforce *iforce) * Set input device bitfields and ranges. */ - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_FF_STATUS); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) | + BIT_MASK(EV_FF_STATUS); for (i = 0; iforce->type->btn[i] >= 0; i++) set_bit(iforce->type->btn[i], input_dev |