Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

backlight: gpio_backlight: Simplify update_status()

Introduce the use of backlight_get_brightness() to simplify the
update_status() operation. With the simpler implementation drop the
gpio_backlight_get_next_brightness() helper as it was now a
one-liner.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Sam Ravnborg and committed by
Lee Jones
de7b490c 24d34617

+2 -15
+2 -15
drivers/video/backlight/gpio_backlight.c
··· 21 21 struct gpio_desc *gpiod; 22 22 }; 23 23 24 - static int gpio_backlight_get_next_brightness(struct backlight_device *bl) 25 - { 26 - int brightness = bl->props.brightness; 27 - 28 - if (bl->props.power != FB_BLANK_UNBLANK || 29 - bl->props.fb_blank != FB_BLANK_UNBLANK || 30 - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 31 - brightness = 0; 32 - 33 - return brightness; 34 - } 35 - 36 24 static int gpio_backlight_update_status(struct backlight_device *bl) 37 25 { 38 26 struct gpio_backlight *gbl = bl_get_data(bl); 39 - int brightness = gpio_backlight_get_next_brightness(bl); 40 27 41 - gpiod_set_value_cansleep(gbl->gpiod, brightness); 28 + gpiod_set_value_cansleep(gbl->gpiod, backlight_get_brightness(bl)); 42 29 43 30 return 0; 44 31 } ··· 95 108 96 109 bl->props.brightness = 1; 97 110 98 - init_brightness = gpio_backlight_get_next_brightness(bl); 111 + init_brightness = backlight_get_brightness(bl); 99 112 ret = gpiod_direction_output(gbl->gpiod, init_brightness); 100 113 if (ret) { 101 114 dev_err(dev, "failed to set initial brightness\n");