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

backlight: aat2870: Use backlight helper

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230106164856.1453819-2-steve@sk2.org

authored by

Stephen Kitt and committed by
Lee Jones
32fb2588 e3b2ac40

+1 -6
+1 -6
drivers/video/backlight/aat2870_bl.c
··· 59 59 struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd); 60 60 struct aat2870_data *aat2870 = 61 61 dev_get_drvdata(aat2870_bl->pdev->dev.parent); 62 - int brightness = bd->props.brightness; 62 + int brightness = backlight_get_brightness(bd); 63 63 int ret; 64 64 65 65 if ((brightness < 0) || (bd->props.max_brightness < brightness)) { ··· 69 69 70 70 dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n", 71 71 bd->props.brightness, bd->props.power, bd->props.state); 72 - 73 - if ((bd->props.power != FB_BLANK_UNBLANK) || 74 - (bd->props.state & BL_CORE_FBBLANK) || 75 - (bd->props.state & BL_CORE_SUSPENDED)) 76 - brightness = 0; 77 72 78 73 ret = aat2870->write(aat2870, AAT2870_BLM, 79 74 (u8)aat2870_brightness(aat2870_bl, brightness));