Input: ff-core - use for_each_set_bit where appropriate
authorAnshul Garg <aksgarg1989@gmail.com>
Wed, 8 Jul 2015 23:43:20 +0000 (16:43 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 9 Jul 2015 04:50:59 +0000 (21:50 -0700)
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>
drivers/input/ff-core.c

index 8f4a30fccbb67494d748cc327cca5e5177764152..c642082671987f98963ff7b07758a678aaffc480 100644 (file)
@@ -343,9 +343,8 @@ int input_ff_create(struct input_dev *dev, unsigned int max_effects)
        __set_bit(EV_FF, dev->evbit);
 
        /* Copy "true" bits into ff device bitmap */
-       for (i = 0; i <= FF_MAX; i++)
-               if (test_bit(i, dev->ffbit))
-                       __set_bit(i, ff->ffbit);
+       for_each_set_bit(i, dev->ffbit, FF_CNT)
+               __set_bit(i, ff->ffbit);
 
        /* we can emulate RUMBLE with periodic effects */
        if (test_bit(FF_PERIODIC, ff->ffbit))