Commit dcb50b35 authored by Michał Kępień's avatar Michał Kępień Committed by Darren Hart

platform/x86: fujitsu-laptop: rework logolamp_set() to properly handle errors

Potential errors returned by some call_fext_func() calls inside
logolamp_set() are currently ignored.  Rework logolamp_set() to properly
handle them.  This causes one more call_fext_func() call to be made in
the LED_OFF case, though one could argue that this is logically the
right thing to do (even though the extra call is not needed to shut the
LED off).
Signed-off-by: default avatarMichał Kępień <kernel@kempniu.pl>
Acked-by: default avatarJonathan Woithe <jwoithe@just42.net>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 9893ae86
...@@ -271,15 +271,20 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2) ...@@ -271,15 +271,20 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
static int logolamp_set(struct led_classdev *cdev, static int logolamp_set(struct led_classdev *cdev,
enum led_brightness brightness) enum led_brightness brightness)
{ {
if (brightness >= LED_FULL) { int poweron = FUNC_LED_ON, always = FUNC_LED_ON;
call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); int ret;
return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON);
} else if (brightness >= LED_HALF) { if (brightness < LED_HALF)
call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); poweron = FUNC_LED_OFF;
return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF);
} else { if (brightness < LED_FULL)
return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF); always = FUNC_LED_OFF;
}
ret = call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron);
if (ret < 0)
return ret;
return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, always);
} }
static int kblamps_set(struct led_classdev *cdev, static int kblamps_set(struct led_classdev *cdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment