diff mbox series

[11/15] powerpc: via-pmu-backlight: Introduce backlight_get_brightness()

Message ID 20230107-sam-video-backlight-drop-fb_blank-v1-11-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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
 drivers/macintosh/via-pmu-backlight.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Stephen Kitt Jan. 8, 2023, 7:36 p.m. UTC | #1
On Sat, 07 Jan 2023 19:26:25 +0100, Sam Ravnborg via B4 Submission Endpoint
<devnull+sam.ravnborg.org@kernel.org> wrote:

> 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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
>  drivers/macintosh/via-pmu-backlight.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/macintosh/via-pmu-backlight.c
> b/drivers/macintosh/via-pmu-backlight.c index 2194016122d2..c2d87e7fa85b
> 100644 --- a/drivers/macintosh/via-pmu-backlight.c
> +++ b/drivers/macintosh/via-pmu-backlight.c
> @@ -71,12 +71,7 @@ static int pmu_backlight_get_level_brightness(int level)
>  static int __pmu_backlight_update_status(struct backlight_device *bd)
>  {
>  	struct adb_request req;
> -	int level = bd->props.brightness;
> -
> -
> -	if (bd->props.power != FB_BLANK_UNBLANK ||
> -	    bd->props.fb_blank != FB_BLANK_UNBLANK)
> -		level = 0;
> +	int level = backlight_get_brightness(bd);
>  
>  	if (level > 0) {
>  		int pmulevel = pmu_backlight_get_level_brightness(level);
> 
> -- 
> 2.34.1

This one is already in 6.2-rc1, it went in via powerpc/next.

Regards,

Stephen
diff mbox series

Patch

diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
index 2194016122d2..c2d87e7fa85b 100644
--- a/drivers/macintosh/via-pmu-backlight.c
+++ b/drivers/macintosh/via-pmu-backlight.c
@@ -71,12 +71,7 @@  static int pmu_backlight_get_level_brightness(int level)
 static int __pmu_backlight_update_status(struct backlight_device *bd)
 {
 	struct adb_request req;
-	int level = bd->props.brightness;
-
-
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
+	int level = backlight_get_brightness(bd);
 
 	if (level > 0) {
 		int pmulevel = pmu_backlight_get_level_brightness(level);