diff options
author | Anshul Garg <aksgarg1989@gmail.com> | 2015-07-08 16:41:39 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-07-08 21:50:58 -0700 |
commit | f23487cdbe3bd002e99f41250143014e522c34de (patch) | |
tree | b81d5e202ea6b62e15e6bf94ecb53764e8a8a646 /drivers/input/joydev.c | |
parent | ec0843fabe29ad44bdaaa16c8d6cda4537716de5 (diff) | |
download | linux-f23487cdbe3bd002e99f41250143014e522c34de.tar.gz linux-f23487cdbe3bd002e99f41250143014e522c34de.tar.bz2 linux-f23487cdbe3bd002e99f41250143014e522c34de.zip |
Input: joydev - use for_each_set_bit where appropriate
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>
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r-- | drivers/input/joydev.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index f362883c94e3..46862602a5f7 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -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)) { |