]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
platform/x86: fujitsu-laptop: simplify logolamp_get()
authorMichał Kępień <kernel@kempniu.pl>
Mon, 9 Jan 2017 13:14:17 +0000 (14:14 +0100)
committerDarren Hart <dvhart@linux.intel.com>
Sat, 4 Feb 2017 01:47:07 +0000 (02:47 +0100)
Now that call_fext_func() is invoked by logolamp_set() for both
LOGOLAMP_POWERON and LOGOLAMP_ALWAYS for every brightness value,
logolamp_get() can be simplified to decrease indentation and number of
local variables.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/fujitsu-laptop.c

index 34b8481fb0ed00aecef1c01edf6bb147a2497061..7fa082558a42c66da396eb41ef80c5a555bd982c 100644 (file)
@@ -319,17 +319,17 @@ static int eco_led_set(struct led_classdev *cdev,
 
 static enum led_brightness logolamp_get(struct led_classdev *cdev)
 {
-       enum led_brightness brightness = LED_OFF;
-       int poweron, always;
-
-       poweron = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
-       if (poweron == FUNC_LED_ON) {
-               brightness = LED_HALF;
-               always = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
-               if (always == FUNC_LED_ON)
-                       brightness = LED_FULL;
-       }
-       return brightness;
+       int ret;
+
+       ret = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
+       if (ret == FUNC_LED_ON)
+               return LED_FULL;
+
+       ret = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
+       if (ret == FUNC_LED_ON)
+               return LED_HALF;
+
+       return LED_OFF;
 }
 
 static enum led_brightness kblamps_get(struct led_classdev *cdev)