Commit 559093ce authored by Marcus Folkesson's avatar Marcus Folkesson Committed by Kleber Sacilotto de Souza

Input: xpad - avoid using __set_bit() for capabilities

BugLink: https://bugs.launchpad.net/bugs/1810967

[ Upstream commit a0130803 ]

input_set_capability() and input_set_abs_param() will do it for you.
Signed-off-by: default avatarMarcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 4225f86d
...@@ -1579,8 +1579,6 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) ...@@ -1579,8 +1579,6 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
{ {
struct usb_xpad *xpad = input_get_drvdata(input_dev); struct usb_xpad *xpad = input_get_drvdata(input_dev);
set_bit(abs, input_dev->absbit);
switch (abs) { switch (abs) {
case ABS_X: case ABS_X:
case ABS_Y: case ABS_Y:
...@@ -1599,6 +1597,9 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) ...@@ -1599,6 +1597,9 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */ case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */
input_set_abs_params(input_dev, abs, -1, 1, 0, 0); input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
break; break;
default:
input_set_abs_params(input_dev, abs, 0, 0, 0, 0);
break;
} }
} }
...@@ -1639,10 +1640,7 @@ static int xpad_init_input(struct usb_xpad *xpad) ...@@ -1639,10 +1640,7 @@ static int xpad_init_input(struct usb_xpad *xpad)
input_dev->close = xpad_close; input_dev->close = xpad_close;
} }
__set_bit(EV_KEY, input_dev->evbit);
if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { if (!(xpad->mapping & MAP_STICKS_TO_NULL)) {
__set_bit(EV_ABS, input_dev->evbit);
/* set up axes */ /* set up axes */
for (i = 0; xpad_abs[i] >= 0; i++) for (i = 0; xpad_abs[i] >= 0; i++)
xpad_set_up_abs(input_dev, xpad_abs[i]); xpad_set_up_abs(input_dev, xpad_abs[i]);
...@@ -1650,21 +1648,22 @@ static int xpad_init_input(struct usb_xpad *xpad) ...@@ -1650,21 +1648,22 @@ static int xpad_init_input(struct usb_xpad *xpad)
/* set up standard buttons */ /* set up standard buttons */
for (i = 0; xpad_common_btn[i] >= 0; i++) for (i = 0; xpad_common_btn[i] >= 0; i++)
__set_bit(xpad_common_btn[i], input_dev->keybit); input_set_capability(input_dev, EV_KEY, xpad_common_btn[i]);
/* set up model-specific ones */ /* set up model-specific ones */
if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W || if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W ||
xpad->xtype == XTYPE_XBOXONE) { xpad->xtype == XTYPE_XBOXONE) {
for (i = 0; xpad360_btn[i] >= 0; i++) for (i = 0; xpad360_btn[i] >= 0; i++)
__set_bit(xpad360_btn[i], input_dev->keybit); input_set_capability(input_dev, EV_KEY, xpad360_btn[i]);
} else { } else {
for (i = 0; xpad_btn[i] >= 0; i++) for (i = 0; xpad_btn[i] >= 0; i++)
__set_bit(xpad_btn[i], input_dev->keybit); input_set_capability(input_dev, EV_KEY, xpad_btn[i]);
} }
if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
for (i = 0; xpad_btn_pad[i] >= 0; i++) for (i = 0; xpad_btn_pad[i] >= 0; i++)
__set_bit(xpad_btn_pad[i], input_dev->keybit); input_set_capability(input_dev, EV_KEY,
xpad_btn_pad[i]);
} }
/* /*
...@@ -1681,7 +1680,8 @@ static int xpad_init_input(struct usb_xpad *xpad) ...@@ -1681,7 +1680,8 @@ static int xpad_init_input(struct usb_xpad *xpad)
if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
for (i = 0; xpad_btn_triggers[i] >= 0; i++) for (i = 0; xpad_btn_triggers[i] >= 0; i++)
__set_bit(xpad_btn_triggers[i], input_dev->keybit); input_set_capability(input_dev, EV_KEY,
xpad_btn_triggers[i]);
} else { } else {
for (i = 0; xpad_abs_triggers[i] >= 0; i++) for (i = 0; xpad_abs_triggers[i] >= 0; i++)
xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); xpad_set_up_abs(input_dev, xpad_abs_triggers[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment