Skip to content

Commit ecb42bb

Browse files
andy-shevBenjamin Tissoires
authored andcommitted
HID: cp2112: Switch to for_each_set_bit() to simplify the code
It's cleaner to use for_each_set_bit() than open coding it. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 3e2977c commit ecb42bb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/hid/hid-cp2112.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf
1717
*/
1818

19+
#include <linux/bitops.h>
1920
#include <linux/gpio/consumer.h>
2021
#include <linux/gpio/machine.h>
2122
#include <linux/gpio/driver.h>
@@ -1100,7 +1101,6 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
11001101
gpio_poll_worker.work);
11011102
struct irq_data *d;
11021103
u8 gpio_mask;
1103-
u8 virqs = (u8)dev->irq_mask;
11041104
u32 irq_type;
11051105
int irq, virq, ret;
11061106

@@ -1111,11 +1111,7 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
11111111
goto exit;
11121112

11131113
gpio_mask = ret;
1114-
1115-
while (virqs) {
1116-
virq = ffs(virqs) - 1;
1117-
virqs &= ~BIT(virq);
1118-
1114+
for_each_set_bit(virq, &dev->irq_mask, 8) {
11191115
if (!dev->gc.to_irq)
11201116
break;
11211117

0 commit comments

Comments
 (0)