Skip to contentSkip to conversation

Input: automatically set EV_ABS bit in input_set_abs_params

PATCH In review Dmitry Torokhov 3 participants 3 messages Oct 8, 2014 – Oct 10, 2014

Subsystems (2)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/1 Input: automatically set EV_ABS bit in input_set_abs_params

Let's automatically set EV_ABS bit in device's event type list when calling input_set_abs_params() so that drivers do not have to do it explicitly.

These calls are never in a hot paths so we won't lose much time by setting the same bit several times.

---
 drivers/input/input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/input.c +2 -1
index 29ca0bb..d2e06cc 100644
@@ -498,7 +498,8 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
 	absinfo->fuzz = fuzz;
 	absinfo->flat = flat;
 
-	dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
+	__set_bit(EV_ABS, dev->evbit);
+	__set_bit(axis, dev->absbit);
 }
 EXPORT_SYMBOL(input_set_abs_params);
 
Signature · 1 line
Dmitry
Reviewed-by on v1 1/1
#1 lore raw

Hi

Quoted 5 lines · Dmitry Torokhov

Let's automatically set EV_ABS bit in device's event type list when calling input_set_abs_params() so that drivers do not have to do it explicitly.

These calls are never in a hot paths so we won't lose much time by setting the same bit several times.

Looks good to me. I mean we already do the absbit-allocation here, so this looks sane to do.

Thanks
David

Quoted 22 lines
---
 drivers/input/input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/input.c +2 -2
index 29ca0bb..d2e06cc 100644
@@ -498,7 +498,8 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
        absinfo->fuzz = fuzz;
        absinfo->flat = flat;
 
-       dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
+       __set_bit(EV_ABS, dev->evbit);
+       __set_bit(axis, dev->absbit);
 }
 EXPORT_SYMBOL(input_set_abs_params);
 
 
--

Dmitry

Acked-by on v1 1/1
#2 lore raw
In reply to Dmitry Torokhov
Quoted 7 lines · Dmitry Torokhov

Let's automatically set EV_ABS bit in device's event type list when calling input_set_abs_params() so that drivers do not have to do it explicitly.

These calls are never in a hot paths so we won't lose much time by setting the same bit several times.

Makes sense.

Thanks.

Quoted 17 lines
---
 drivers/input/input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/input.c +2 -1
index 29ca0bb..d2e06cc 100644
@@ -498,7 +498,8 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
 	absinfo->fuzz = fuzz;
 	absinfo->flat = flat;
 
-	dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
+	__set_bit(EV_ABS, dev->evbit);
+	__set_bit(axis, dev->absbit);
 }
 EXPORT_SYMBOL(input_set_abs_params);
Signature · 2 lines
Jiri Kosina
SUSE Labs