staging: unisys: visorinput: handle_locking_key() simplifications
authorTim Sell <Timothy.Sell@unisys.com>
Fri, 6 May 2016 17:11:21 +0000 (13:11 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2016 12:15:18 +0000 (14:15 +0200)
By directly returning for the error-case, a test was eliminated.  Also,
the old_state variable was removed as it was not necessary, and some
redundant parens were removed.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorinput/visorinput.c

index dc94261b31f9aaefe8b9cb0f853caa7cf1604bce..12a3570780fca79d523fc5bd15ff0b8b4e4a64b1 100644 (file)
@@ -467,18 +467,14 @@ handle_locking_key(struct input_dev *visorinput_dev,
                break;
        default:
                led = -1;
-               break;
+               return;
        }
-       if (led >= 0) {
-               int old_state = (test_bit(led, visorinput_dev->led));
-
-               if (old_state != desired_state) {
-                       input_report_key(visorinput_dev, keycode, 1);
-                       input_sync(visorinput_dev);
-                       input_report_key(visorinput_dev, keycode, 0);
-                       input_sync(visorinput_dev);
-                       __change_bit(led, visorinput_dev->led);
-               }
+       if (test_bit(led, visorinput_dev->led) != desired_state) {
+               input_report_key(visorinput_dev, keycode, 1);
+               input_sync(visorinput_dev);
+               input_report_key(visorinput_dev, keycode, 0);
+               input_sync(visorinput_dev);
+               __change_bit(led, visorinput_dev->led);
        }
 }