Skip to content

Commit 948cea1

Browse files
anshulgarg31dtor
authored andcommitted
Input: ff-core - 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 <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent f23487c commit 948cea1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/input/ff-core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,8 @@ int input_ff_create(struct input_dev *dev, unsigned int max_effects)
343343
__set_bit(EV_FF, dev->evbit);
344344

345345
/* Copy "true" bits into ff device bitmap */
346-
for (i = 0; i <= FF_MAX; i++)
347-
if (test_bit(i, dev->ffbit))
348-
__set_bit(i, ff->ffbit);
346+
for_each_set_bit(i, dev->ffbit, FF_CNT)
347+
__set_bit(i, ff->ffbit);
349348

350349
/* we can emulate RUMBLE with periodic effects */
351350
if (test_bit(FF_PERIODIC, ff->ffbit))

0 commit comments

Comments
 (0)