diff mbox series

[02/15] video: fbdev: atyfb: Introduce backlight_get_brightness()

Message ID 20230107-sam-video-backlight-drop-fb_blank-v1-2-1bd9bafb351f@ravnborg.org (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series backlight: Drop use of deprecated fb_blank property | expand

Commit Message

Sam Ravnborg via B4 Relay Jan. 7, 2023, 6:26 p.m. UTC
From: Sam Ravnborg <sam@ravnborg.org>

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

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Jason Yan <yanaijie@huawei.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 drivers/video/fbdev/aty/atyfb_base.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Christophe Leroy Jan. 9, 2023, 5:44 p.m. UTC | #1
Le 07/01/2023 à 19:26, Sam Ravnborg via B4 Submission Endpoint a écrit :
> From: Sam Ravnborg <sam@ravnborg.org>
> 
> Introduce backlight_get_brightness() to simplify logic
> and avoid direct access to backlight properties.

When I read 'introduce' I understand that you are adding a new function.

In fact backlight_get_brightness() already exists, so maybe replace 
'introduce' by 'use'


> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Souptick Joarder <jrdr.linux@gmail.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Jason Yan <yanaijie@huawei.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/video/fbdev/aty/atyfb_base.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
> index 0ccf5d401ecb..ca361e215904 100644
> --- a/drivers/video/fbdev/aty/atyfb_base.c
> +++ b/drivers/video/fbdev/aty/atyfb_base.c
> @@ -2219,13 +2219,7 @@ static int aty_bl_update_status(struct backlight_device *bd)
>   {
>          struct atyfb_par *par = bl_get_data(bd);
>          unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
> -       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);
> 
>          reg |= (BLMOD_EN | BIASMOD_EN);
>          if (level > 0) {
> 
> --
> 2.34.1
Sam Ravnborg Jan. 9, 2023, 6:21 p.m. UTC | #2
Hi Christophe,
On Mon, Jan 09, 2023 at 05:44:46PM +0000, Christophe Leroy wrote:
> 
> 
> Le 07/01/2023 à 19:26, Sam Ravnborg via B4 Submission Endpoint a écrit :
> > From: Sam Ravnborg <sam@ravnborg.org>
> > 
> > Introduce backlight_get_brightness() to simplify logic
> > and avoid direct access to backlight properties.
> 
> When I read 'introduce' I understand that you are adding a new function.
> 
> In fact backlight_get_brightness() already exists, so maybe replace 
> 'introduce' by 'use'

Thanks for your feedback. A similar patch is already applied to the
fbdev tree, so this patch can be ignored.

	Sam
diff mbox series

Patch

diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index 0ccf5d401ecb..ca361e215904 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -2219,13 +2219,7 @@  static int aty_bl_update_status(struct backlight_device *bd)
 {
 	struct atyfb_par *par = bl_get_data(bd);
 	unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
-	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);
 
 	reg |= (BLMOD_EN | BIASMOD_EN);
 	if (level > 0) {