diff mbox series

[v2,3/5] drm/gma500: Use backlight_get_brightness() to get the brightness

Message ID 20220917140352.526507-4-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series drm/gma500: Backlight handling changes | expand

Commit Message

Hans de Goede Sept. 17, 2022, 2:03 p.m. UTC
Use backlight_get_brightness() instead of directly referencing
bd->props.brightness. This will take backlight_is_blank() into account,
properly setting brightness to 0 when screen-blanking has been requested
through the backlight sysfs interface.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2 of the patch-set:
- New patch in v2 of the patch-set
---
 drivers/gpu/drm/gma500/backlight.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sam Ravnborg Sept. 17, 2022, 8:46 p.m. UTC | #1
On Sat, Sep 17, 2022 at 04:03:50PM +0200, Hans de Goede wrote:
> Use backlight_get_brightness() instead of directly referencing
> bd->props.brightness. This will take backlight_is_blank() into account,
> properly setting brightness to 0 when screen-blanking has been requested
> through the backlight sysfs interface.
> 
> Suggested-by: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
> ---
> Changes in v2 of the patch-set:
> - New patch in v2 of the patch-set
> ---
>  drivers/gpu/drm/gma500/backlight.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/gma500/backlight.c b/drivers/gpu/drm/gma500/backlight.c
> index d113c5810ca5..9be28dc0bdd1 100644
> --- a/drivers/gpu/drm/gma500/backlight.c
> +++ b/drivers/gpu/drm/gma500/backlight.c
> @@ -52,7 +52,7 @@ static int gma_backlight_get_brightness(struct backlight_device *bd)
>  static int gma_backlight_update_status(struct backlight_device *bd)
>  {
>  	struct drm_device *dev = bl_get_data(bd);
> -	int level = bd->props.brightness;
> +	int level = backlight_get_brightness(bd);
>  
>  	/* Percentage 1-100% being valid */
>  	if (level < 1)
> -- 
> 2.37.3
Hans de Goede Sept. 17, 2022, 9 p.m. UTC | #2
Hi,

On 9/17/22 22:46, Sam Ravnborg wrote:
> On Sat, Sep 17, 2022 at 04:03:50PM +0200, Hans de Goede wrote:
>> Use backlight_get_brightness() instead of directly referencing
>> bd->props.brightness. This will take backlight_is_blank() into account,
>> properly setting brightness to 0 when screen-blanking has been requested
>> through the backlight sysfs interface.
>>
>> Suggested-by: Sam Ravnborg <sam@ravnborg.org>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>

Thank you.

I have just send out a v3 with your ack added and fixing the
2 unused variables when CONFIG_BACKLIGHT is not set spotted
by the lkp test robot.

I was sort of hoping that you could review / ack the entire
series ?

Regards,

Hans


>> ---
>> Changes in v2 of the patch-set:
>> - New patch in v2 of the patch-set
>> ---
>>  drivers/gpu/drm/gma500/backlight.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/gma500/backlight.c b/drivers/gpu/drm/gma500/backlight.c
>> index d113c5810ca5..9be28dc0bdd1 100644
>> --- a/drivers/gpu/drm/gma500/backlight.c
>> +++ b/drivers/gpu/drm/gma500/backlight.c
>> @@ -52,7 +52,7 @@ static int gma_backlight_get_brightness(struct backlight_device *bd)
>>  static int gma_backlight_update_status(struct backlight_device *bd)
>>  {
>>  	struct drm_device *dev = bl_get_data(bd);
>> -	int level = bd->props.brightness;
>> +	int level = backlight_get_brightness(bd);
>>  
>>  	/* Percentage 1-100% being valid */
>>  	if (level < 1)
>> -- 
>> 2.37.3
>
Sam Ravnborg Sept. 17, 2022, 9:20 p.m. UTC | #3
Hi Hans,

On Sat, Sep 17, 2022 at 11:00:55PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 9/17/22 22:46, Sam Ravnborg wrote:
> > On Sat, Sep 17, 2022 at 04:03:50PM +0200, Hans de Goede wrote:
> >> Use backlight_get_brightness() instead of directly referencing
> >> bd->props.brightness. This will take backlight_is_blank() into account,
> >> properly setting brightness to 0 when screen-blanking has been requested
> >> through the backlight sysfs interface.
> >>
> >> Suggested-by: Sam Ravnborg <sam@ravnborg.org>
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
> Thank you.
> 
> I have just send out a v3 with your ack added and fixing the
> 2 unused variables when CONFIG_BACKLIGHT is not set spotted
> by the lkp test robot.
> 
> I was sort of hoping that you could review / ack the entire
> series ?
OK, I may take a closer look tomorrow then (as time permits - needs to
prepare for a business trip too).
I have not looked at gma500 code that much so I hope Patrick
takes a look too.

	Sam
diff mbox series

Patch

diff --git a/drivers/gpu/drm/gma500/backlight.c b/drivers/gpu/drm/gma500/backlight.c
index d113c5810ca5..9be28dc0bdd1 100644
--- a/drivers/gpu/drm/gma500/backlight.c
+++ b/drivers/gpu/drm/gma500/backlight.c
@@ -52,7 +52,7 @@  static int gma_backlight_get_brightness(struct backlight_device *bd)
 static int gma_backlight_update_status(struct backlight_device *bd)
 {
 	struct drm_device *dev = bl_get_data(bd);
-	int level = bd->props.brightness;
+	int level = backlight_get_brightness(bd);
 
 	/* Percentage 1-100% being valid */
 	if (level < 1)