linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
@ 2023-01-06 16:48 Stephen Kitt
  2023-01-06 17:43 ` Daniel Vetter
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Stephen Kitt @ 2023-01-06 16:48 UTC (permalink / raw)
  To: Lee Jones, Daniel Thompson, Jingoo Han
  Cc: Sam Ravnborg, Stephen Kitt, Helge Deller, dri-devel, linux-fbdev,
	linux-kernel

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>
---
 drivers/video/backlight/aat2870_bl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c
index a7af9adafad6..1cbb303e9c88 100644
--- a/drivers/video/backlight/aat2870_bl.c
+++ b/drivers/video/backlight/aat2870_bl.c
@@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
 	struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd);
 	struct aat2870_data *aat2870 =
 			dev_get_drvdata(aat2870_bl->pdev->dev.parent);
-	int brightness = bd->props.brightness;
+	int brightness = backlight_get_brightness(bd);
 	int ret;
 
 	if ((brightness < 0) || (bd->props.max_brightness < brightness)) {
@@ -70,11 +70,6 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
 	dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n",
 		 bd->props.brightness, bd->props.power, bd->props.state);
 
-	if ((bd->props.power != FB_BLANK_UNBLANK) ||
-			(bd->props.state & BL_CORE_FBBLANK) ||
-			(bd->props.state & BL_CORE_SUSPENDED))
-		brightness = 0;
-
 	ret = aat2870->write(aat2870, AAT2870_BLM,
 			     (u8)aat2870_brightness(aat2870_bl, brightness));
 	if (ret < 0)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
  2023-01-06 16:48 [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper Stephen Kitt
@ 2023-01-06 17:43 ` Daniel Vetter
  2023-01-06 20:26   ` Stephen Kitt
  2023-01-09 10:27   ` Daniel Thompson
  2023-01-06 17:44 ` Sam Ravnborg
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 8+ messages in thread
From: Daniel Vetter @ 2023-01-06 17:43 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Lee Jones, Daniel Thompson, Jingoo Han, linux-fbdev,
	Helge Deller, linux-kernel, dri-devel, Sam Ravnborg

On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote:
> 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>

Lee/Daniel, will you pick these up, or should I smash them all into
drm-misc-next for 6.3?

Stephen, I see to be missing 3/4 here, but maybe it'll show up.
-Daniel

> ---
>  drivers/video/backlight/aat2870_bl.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c
> index a7af9adafad6..1cbb303e9c88 100644
> --- a/drivers/video/backlight/aat2870_bl.c
> +++ b/drivers/video/backlight/aat2870_bl.c
> @@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
>  	struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd);
>  	struct aat2870_data *aat2870 =
>  			dev_get_drvdata(aat2870_bl->pdev->dev.parent);
> -	int brightness = bd->props.brightness;
> +	int brightness = backlight_get_brightness(bd);
>  	int ret;
>  
>  	if ((brightness < 0) || (bd->props.max_brightness < brightness)) {
> @@ -70,11 +70,6 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
>  	dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n",
>  		 bd->props.brightness, bd->props.power, bd->props.state);
>  
> -	if ((bd->props.power != FB_BLANK_UNBLANK) ||
> -			(bd->props.state & BL_CORE_FBBLANK) ||
> -			(bd->props.state & BL_CORE_SUSPENDED))
> -		brightness = 0;
> -
>  	ret = aat2870->write(aat2870, AAT2870_BLM,
>  			     (u8)aat2870_brightness(aat2870_bl, brightness));
>  	if (ret < 0)
> -- 
> 2.30.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
  2023-01-06 16:48 [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper Stephen Kitt
  2023-01-06 17:43 ` Daniel Vetter
@ 2023-01-06 17:44 ` Sam Ravnborg
  2023-01-09 10:16 ` Daniel Thompson
  2023-01-19 21:41 ` Lee Jones
  3 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2023-01-06 17:44 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Lee Jones, Daniel Thompson, Jingoo Han, linux-fbdev,
	Helge Deller, linux-kernel, dri-devel

Hi Stephen,

On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote:
> 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>
Nice cleanup.
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/video/backlight/aat2870_bl.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c
> index a7af9adafad6..1cbb303e9c88 100644
> --- a/drivers/video/backlight/aat2870_bl.c
> +++ b/drivers/video/backlight/aat2870_bl.c
> @@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
>  	struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd);
>  	struct aat2870_data *aat2870 =
>  			dev_get_drvdata(aat2870_bl->pdev->dev.parent);
> -	int brightness = bd->props.brightness;
> +	int brightness = backlight_get_brightness(bd);
>  	int ret;
>  
>  	if ((brightness < 0) || (bd->props.max_brightness < brightness)) {
> @@ -70,11 +70,6 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
>  	dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n",
>  		 bd->props.brightness, bd->props.power, bd->props.state);
>  
> -	if ((bd->props.power != FB_BLANK_UNBLANK) ||
> -			(bd->props.state & BL_CORE_FBBLANK) ||
> -			(bd->props.state & BL_CORE_SUSPENDED))
> -		brightness = 0;
> -
>  	ret = aat2870->write(aat2870, AAT2870_BLM,
>  			     (u8)aat2870_brightness(aat2870_bl, brightness));
>  	if (ret < 0)
> -- 
> 2.30.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
  2023-01-06 17:43 ` Daniel Vetter
@ 2023-01-06 20:26   ` Stephen Kitt
  2023-01-09 10:27   ` Daniel Thompson
  1 sibling, 0 replies; 8+ messages in thread
From: Stephen Kitt @ 2023-01-06 20:26 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Lee Jones, Daniel Thompson, Jingoo Han, linux-fbdev,
	Helge Deller, linux-kernel, dri-devel, Sam Ravnborg

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

Hi Daniel,

On Fri, 6 Jan 2023 18:43:36 +0100, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote:
> > 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>  
> 
> Lee/Daniel, will you pick these up, or should I smash them all into
> drm-misc-next for 6.3?
> 
> Stephen, I see to be missing 3/4 here, but maybe it'll show up.

It seems to have been delayed in transit, it showed up some time after all
the others on the mailing lists. If you haven’t got it yet I can resend it!

Regards,

Stephen

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
  2023-01-06 16:48 [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper Stephen Kitt
  2023-01-06 17:43 ` Daniel Vetter
  2023-01-06 17:44 ` Sam Ravnborg
@ 2023-01-09 10:16 ` Daniel Thompson
  2023-01-19 21:41 ` Lee Jones
  3 siblings, 0 replies; 8+ messages in thread
From: Daniel Thompson @ 2023-01-09 10:16 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Lee Jones, Jingoo Han, Sam Ravnborg, Helge Deller, dri-devel,
	linux-fbdev, linux-kernel

On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote:
> 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>

This RESEND seems to have dropped the Reviewed-By tags provided the
last time is was circulated:
https://lore.kernel.org/all/20220608143233.l5pbopafqc4n6uwq@maple.lan/

There's only four patches so I guess I can add them again so the tools
can pick them up.

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
  2023-01-06 17:43 ` Daniel Vetter
  2023-01-06 20:26   ` Stephen Kitt
@ 2023-01-09 10:27   ` Daniel Thompson
  2023-01-09 16:35     ` Lee Jones
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Thompson @ 2023-01-09 10:27 UTC (permalink / raw)
  To: Stephen Kitt, Lee Jones, Jingoo Han, linux-fbdev, Helge Deller,
	linux-kernel, dri-devel, Sam Ravnborg

On Fri, Jan 06, 2023 at 06:43:36PM +0100, Daniel Vetter wrote:
> On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote:
> > 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>
>
> Lee/Daniel, will you pick these up, or should I smash them all into
> drm-misc-next for 6.3?

Outside of holiday, Lee usually hoovers up the backlight patches (and
negotiates about who merges what).


Daniel.


> > ---
> >  drivers/video/backlight/aat2870_bl.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c
> > index a7af9adafad6..1cbb303e9c88 100644
> > --- a/drivers/video/backlight/aat2870_bl.c
> > +++ b/drivers/video/backlight/aat2870_bl.c
> > @@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
> >  	struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd);
> >  	struct aat2870_data *aat2870 =
> >  			dev_get_drvdata(aat2870_bl->pdev->dev.parent);
> > -	int brightness = bd->props.brightness;
> > +	int brightness = backlight_get_brightness(bd);
> >  	int ret;
> >
> >  	if ((brightness < 0) || (bd->props.max_brightness < brightness)) {
> > @@ -70,11 +70,6 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
> >  	dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n",
> >  		 bd->props.brightness, bd->props.power, bd->props.state);
> >
> > -	if ((bd->props.power != FB_BLANK_UNBLANK) ||
> > -			(bd->props.state & BL_CORE_FBBLANK) ||
> > -			(bd->props.state & BL_CORE_SUSPENDED))
> > -		brightness = 0;
> > -
> >  	ret = aat2870->write(aat2870, AAT2870_BLM,
> >  			     (u8)aat2870_brightness(aat2870_bl, brightness));
> >  	if (ret < 0)
> > --
> > 2.30.2
> >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
  2023-01-09 10:27   ` Daniel Thompson
@ 2023-01-09 16:35     ` Lee Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2023-01-09 16:35 UTC (permalink / raw)
  To: Daniel Thompson
  Cc: Stephen Kitt, Jingoo Han, linux-fbdev, Helge Deller,
	linux-kernel, dri-devel, Sam Ravnborg

On Mon, 09 Jan 2023, Daniel Thompson wrote:

> On Fri, Jan 06, 2023 at 06:43:36PM +0100, Daniel Vetter wrote:
> > On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote:
> > > 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>
> >
> > Lee/Daniel, will you pick these up, or should I smash them all into
> > drm-misc-next for 6.3?
> 
> Outside of holiday, Lee usually hoovers up the backlight patches (and
> negotiates about who merges what).

Right, I'll collect these into the Backlight tree if there aren't any
build deps involved.  If there are, we'll need to devise a strategy
that will likely involve immutable branches.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper
  2023-01-06 16:48 [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper Stephen Kitt
                   ` (2 preceding siblings ...)
  2023-01-09 10:16 ` Daniel Thompson
@ 2023-01-19 21:41 ` Lee Jones
  3 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2023-01-19 21:41 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Daniel Thompson, Jingoo Han, Sam Ravnborg, Helge Deller,
	dri-devel, linux-fbdev, linux-kernel

On Fri, 06 Jan 2023, Stephen Kitt wrote:

> 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>
> ---
>  drivers/video/backlight/aat2870_bl.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

Applied, thanks

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-01-19 22:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 16:48 [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper Stephen Kitt
2023-01-06 17:43 ` Daniel Vetter
2023-01-06 20:26   ` Stephen Kitt
2023-01-09 10:27   ` Daniel Thompson
2023-01-09 16:35     ` Lee Jones
2023-01-06 17:44 ` Sam Ravnborg
2023-01-09 10:16 ` Daniel Thompson
2023-01-19 21:41 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).