fbdev: riva: Use backlight helper
authorStephen Kitt <steve@sk2.org>
Tue, 7 Jun 2022 19:23:35 +0000 (21:23 +0200)
committerHelge Deller <deller@gmx.de>
Mon, 9 Jan 2023 08:57:51 +0000 (09:57 +0100)
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>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/riva/fbdev.c

index 6442781..41edc6e 100644 (file)
@@ -293,13 +293,7 @@ static int riva_bl_update_status(struct backlight_device *bd)
 {
        struct riva_par *par = bl_get_data(bd);
        U032 tmp_pcrt, tmp_pmc;
-       int level;
-
-       if (bd->props.power != FB_BLANK_UNBLANK ||
-           bd->props.fb_blank != FB_BLANK_UNBLANK)
-               level = 0;
-       else
-               level = bd->props.brightness;
+       int level = backlight_get_brightness(bd);
 
        tmp_pmc = NV_RD32(par->riva.PMC, 0x10F0) & 0x0000FFFF;
        tmp_pcrt = NV_RD32(par->riva.PCRTC0, 0x081C) & 0xFFFFFFFC;