Skip to content

Commit

Permalink
Input: joydev - use for_each_set_bit where appropriate
Browse files Browse the repository at this point in the history
Use for_each_set_bit to check for set bits in bitmap as it is more
efficient than checking individual bits.

Signed-off-by: Anshul Garg <aksgarg1989@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Anshul Garg authored and Dmitry Torokhov committed Jul 9, 2015
1 parent ec0843f commit f23487c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/input/joydev.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,12 +798,11 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
joydev->handle.handler = handler;
joydev->handle.private = joydev;

for (i = 0; i < ABS_CNT; i++)
if (test_bit(i, dev->absbit)) {
joydev->absmap[i] = joydev->nabs;
joydev->abspam[joydev->nabs] = i;
joydev->nabs++;
}
for_each_set_bit(i, dev->absbit, ABS_CNT) {
joydev->absmap[i] = joydev->nabs;
joydev->abspam[joydev->nabs] = i;
joydev->nabs++;
}

for (i = BTN_JOYSTICK - BTN_MISC; i < KEY_MAX - BTN_MISC + 1; i++)
if (test_bit(i + BTN_MISC, dev->keybit)) {
Expand Down

0 comments on commit f23487c

Please sign in to comment.