From b6d30968d86c45a7bb599eaca13ff048d3fa576c Mon Sep 17 00:00:00 2001 From: Anshul Garg Date: Thu, 9 Jul 2015 10:18:22 -0700 Subject: [PATCH] Input: uinput - switch to using for_each_set_bit() Use for_each_set_bit to check for set bits in bitmap as it is more efficient and compact. Signed-off-by: Anshul Garg Signed-off-by: Dmitry Torokhov --- drivers/input/misc/uinput.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 421e29e4cd81..345df9b03aed 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -320,10 +320,8 @@ static int uinput_validate_absbits(struct input_dev *dev) * Check if absmin/absmax/absfuzz/absflat are sane. */ - for (cnt = 0; cnt < ABS_CNT; cnt++) { + for_each_set_bit(cnt, dev->absbit, ABS_CNT) { int min, max; - if (!test_bit(cnt, dev->absbit)) - continue; min = input_abs_get_min(dev, cnt); max = input_abs_get_max(dev, cnt); @@ -416,7 +414,7 @@ static int uinput_setup_device(struct uinput_device *udev, dev->id.product = user_dev->id.product; dev->id.version = user_dev->id.version; - for (i = 0; i < ABS_CNT; i++) { + for_each_set_bit(i, dev->absbit, ABS_CNT) { input_abs_set_max(dev, i, user_dev->absmax[i]); input_abs_set_min(dev, i, user_dev->absmin[i]); input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]); -- 2.20.1