platform/x86: dell-laptop: Use brightness_set_blocking for kbd_led_level_set

kbd_led_level_set uses dell_smbios call which blocks, so the kbd_led
classdev should use the brightness_set_blocking callback.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
This commit is contained in:
Hans de Goede 2016-10-26 17:17:44 +02:00 committed by Darren Hart
parent bb55a2ee76
commit 1d161d4cd7

View File

@ -1904,38 +1904,40 @@ static enum led_brightness kbd_led_level_get(struct led_classdev *led_cdev)
return 0; return 0;
} }
static void kbd_led_level_set(struct led_classdev *led_cdev, static int kbd_led_level_set(struct led_classdev *led_cdev,
enum led_brightness value) enum led_brightness value)
{ {
struct kbd_state state; struct kbd_state state;
struct kbd_state new_state; struct kbd_state new_state;
u16 num; u16 num;
int ret;
if (kbd_get_max_level()) { if (kbd_get_max_level()) {
if (kbd_get_state(&state)) ret = kbd_get_state(&state);
return; if (ret)
return ret;
new_state = state; new_state = state;
if (kbd_set_level(&new_state, value)) ret = kbd_set_level(&new_state, value);
return; if (ret)
kbd_set_state_safe(&new_state, &state); return ret;
return; return kbd_set_state_safe(&new_state, &state);
} }
if (kbd_get_valid_token_counts()) { if (kbd_get_valid_token_counts()) {
for (num = kbd_token_bits; num != 0 && value > 0; --value) for (num = kbd_token_bits; num != 0 && value > 0; --value)
num &= num - 1; /* clear the first bit set */ num &= num - 1; /* clear the first bit set */
if (num == 0) if (num == 0)
return; return 0;
kbd_set_token_bit(ffs(num) - 1); return kbd_set_token_bit(ffs(num) - 1);
return;
} }
pr_warn("Keyboard brightness level control not supported\n"); pr_warn("Keyboard brightness level control not supported\n");
return -ENXIO;
} }
static struct led_classdev kbd_led = { static struct led_classdev kbd_led = {
.name = "dell::kbd_backlight", .name = "dell::kbd_backlight",
.brightness_set = kbd_led_level_set, .brightness_set_blocking = kbd_led_level_set,
.brightness_get = kbd_led_level_get, .brightness_get = kbd_led_level_get,
.groups = kbd_led_groups, .groups = kbd_led_groups,
}; };