Skip to content

Commit

Permalink
backlight: aat2870: Use backlight helper
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Stephen Kitt authored and Lee Jones committed Feb 22, 2023
1 parent e3b2ac4 commit 32fb258
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/video/backlight/aat2870_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd);
struct aat2870_data *aat2870 =
dev_get_drvdata(aat2870_bl->pdev->dev.parent);
int brightness = bd->props.brightness;
int brightness = backlight_get_brightness(bd);
int ret;

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

if ((bd->props.power != FB_BLANK_UNBLANK) ||
(bd->props.state & BL_CORE_FBBLANK) ||
(bd->props.state & BL_CORE_SUSPENDED))
brightness = 0;

ret = aat2870->write(aat2870, AAT2870_BLM,
(u8)aat2870_brightness(aat2870_bl, brightness));
if (ret < 0)
Expand Down

0 comments on commit 32fb258

Please sign in to comment.