[PATCH 06/15] video: fbdev: aty128fb: Introduce backlight_get_brightness()

From: Sam Ravnborg via B4 Submission Endpoint
Date: Sat Jan 07 2023 - 13:27:53 EST


From: Sam Ravnborg <sam@xxxxxxxxxxxx>

Introduce backlight_get_brightness() to simplify logic
and avoid direct access to backlight properties.

Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: linux-fbdev@xxxxxxxxxxxxxxx
---
drivers/video/fbdev/aty/aty128fb.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index dd31b9d7d337..736126cc5049 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -1764,17 +1764,10 @@ static int aty128_bl_update_status(struct backlight_device *bd)
{
struct aty128fb_par *par = bl_get_data(bd);
unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
- int level;
-
- if (bd->props.power != FB_BLANK_UNBLANK ||
- bd->props.fb_blank != FB_BLANK_UNBLANK ||
- !par->lcd_on)
- level = 0;
- else
- level = bd->props.brightness;
+ int level = backlight_get_brightness(bd);

reg |= LVDS_BL_MOD_EN | LVDS_BLON;
- if (level > 0) {
+ if (level > 0 || par->lcd_on) {
reg |= LVDS_DIGION;
if (!(reg & LVDS_ON)) {
reg &= ~LVDS_BLON;

--
2.34.1