Input: rotary_encoder - use input_set_capability()
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 17 Jan 2016 18:52:54 +0000 (10:52 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 2 Mar 2016 17:32:07 +0000 (09:32 -0800)
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 <dmitry.torokhov@gmail.com>
drivers/input/misc/rotary_encoder.c

index 471175e5306be3d4afacd8fd2e41c176ea8b87db..70fdcce8486602aa9720cfe4a55eaf7f393b2219 100644 (file)
@@ -317,14 +317,10 @@ static int rotary_encoder_probe(struct platform_device *pdev)
        input->id.bustype = BUS_HOST;
        input->dev.parent = dev;
 
-       if (pdata->relative_axis) {
-               input->evbit[0] = BIT_MASK(EV_REL);
-               input->relbit[0] = BIT_MASK(pdata->axis);
-       } else {
-               input->evbit[0] = BIT_MASK(EV_ABS);
-               input_set_abs_params(encoder->input,
-                                    pdata->axis, 0, pdata->steps, 0, 1);
-       }
+       if (pdata->relative_axis)
+               input_set_capability(input, EV_REL, pdata->axis);
+       else
+               input_set_abs_params(input, pdata->axis, 0, pdata->steps, 0, 1);
 
        switch (pdata->steps_per_period) {
        case 4: