[PATCH v3 12/13] backlight: as3711_bl: introduce backlight_is_blank()

Sam Ravnborg sam at ravnborg.org
Mon Jun 1 06:52:06 UTC 2020


Replaces the open-coded checks of the state, with the
backlight_is_blank() helper. This increases readability
of the code and aling the functionality across the drivers.

Futhermore drop the debug prints in update_status().
If we need debug printing then we can add it to the backlight core.

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
Cc: Lee Jones <lee.jones at linaro.org>
Cc: Daniel Thompson <daniel.thompson at linaro.org>
Cc: Jingoo Han <jingoohan1 at gmail.com>
Cc: Emil Velikov <emil.l.velikov at gmail.com>
---
 drivers/video/backlight/as3711_bl.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c
index 33f0f0f2e8b3..cc5628beaffd 100644
--- a/drivers/video/backlight/as3711_bl.c
+++ b/drivers/video/backlight/as3711_bl.c
@@ -107,13 +107,7 @@ static int as3711_bl_update_status(struct backlight_device *bl)
 	int brightness = bl->props.brightness;
 	int ret = 0;
 
-	dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, blank %x, state %x\n",
-		__func__, bl->props.brightness, bl->props.power,
-		bl->props.fb_blank, bl->props.state);
-
-	if (bl->props.power != FB_BLANK_UNBLANK ||
-	    bl->props.fb_blank != FB_BLANK_UNBLANK ||
-	    bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+	if (backlight_is_blank(bl))
 		brightness = 0;
 
 	if (data->type == AS3711_BL_SU1) {
-- 
2.25.1



More information about the dri-devel mailing list