Skip to content

Commit 32fb258

Browse files
skittlag-linaro
authored andcommitted
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 <[email protected]> Reviewed-by: Daniel Thompson <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e3b2ac4 commit 32fb258

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/video/backlight/aat2870_bl.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
5959
struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd);
6060
struct aat2870_data *aat2870 =
6161
dev_get_drvdata(aat2870_bl->pdev->dev.parent);
62-
int brightness = bd->props.brightness;
62+
int brightness = backlight_get_brightness(bd);
6363
int ret;
6464

6565
if ((brightness < 0) || (bd->props.max_brightness < brightness)) {
@@ -70,11 +70,6 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
7070
dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n",
7171
bd->props.brightness, bd->props.power, bd->props.state);
7272

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-
7873
ret = aat2870->write(aat2870, AAT2870_BLM,
7974
(u8)aat2870_brightness(aat2870_bl, brightness));
8075
if (ret < 0)

0 commit comments

Comments
 (0)