fbdev: mx3fb: Use backlight helper
authorStephen Kitt <steve@sk2.org>
Tue, 7 Jun 2022 19:23:32 +0000 (21:23 +0200)
committerHelge Deller <deller@gmx.de>
Mon, 9 Jan 2023 08:57:50 +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: 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/mx3fb.c

index b945b68984b9732f93679e84651b5a72f4b973f3..76771e126d0af805238ebfc069ea288f5476c3be 100644 (file)
@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl)
 static int mx3fb_bl_update_status(struct backlight_device *bl)
 {
        struct mx3fb_data *fbd = bl_get_data(bl);
-       int brightness = bl->props.brightness;
-
-       if (bl->props.power != FB_BLANK_UNBLANK)
-               brightness = 0;
-       if (bl->props.fb_blank != FB_BLANK_UNBLANK)
-               brightness = 0;
+       int brightness = backlight_get_brightness(bl);
 
        fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness;