Skip to content

Commit 8631580

Browse files
committed
Input: rotary_encoder - use input_set_capability()
Instead of manipulating capability bits directly let's use appropriate helpers. Also there is no need to explicitly set EV_ABS when calling input_set_abs_params(). Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 77a8f0a commit 8631580

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/input/misc/rotary_encoder.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,10 @@ static int rotary_encoder_probe(struct platform_device *pdev)
317317
input->id.bustype = BUS_HOST;
318318
input->dev.parent = dev;
319319

320-
if (pdata->relative_axis) {
321-
input->evbit[0] = BIT_MASK(EV_REL);
322-
input->relbit[0] = BIT_MASK(pdata->axis);
323-
} else {
324-
input->evbit[0] = BIT_MASK(EV_ABS);
325-
input_set_abs_params(encoder->input,
326-
pdata->axis, 0, pdata->steps, 0, 1);
327-
}
320+
if (pdata->relative_axis)
321+
input_set_capability(input, EV_REL, pdata->axis);
322+
else
323+
input_set_abs_params(input, pdata->axis, 0, pdata->steps, 0, 1);
328324

329325
switch (pdata->steps_per_period) {
330326
case 4:

0 commit comments

Comments
 (0)