Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-18 Thread Robin van der Gracht
Hi Thomas,

Thank you for submitting your patch, it looks fine to me.

Reviewed-by: Robin van der Gracht 

On Wed, 13 Mar 2024 16:45:00 +0100
Thomas Zimmermann  wrote:

> Replace the use of struct backlight_properties.fb_blank with a
> call to backlight_get_brightness(). The helper implement the same
> logic as the driver's function.
> 
> Signed-off-by: Thomas Zimmermann 
> Cc: Robin van der Gracht 
> Cc: Miguel Ojeda 
> ---
>  drivers/auxdisplay/ht16k33.c | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c
> b/drivers/auxdisplay/ht16k33.c index a90430b7d07ba..83db829b97a5e
> 100644 --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -314,14 +314,9 @@ static int ht16k33_initialize(struct
> ht16k33_priv *priv) 
>  static int ht16k33_bl_update_status(struct backlight_device *bl)
>  {
> - int brightness = bl->props.brightness;
> + int brightness = backlight_get_brightness(bl);
>   struct ht16k33_priv *priv = bl_get_data(bl);
>  
> - if (bl->props.power != FB_BLANK_UNBLANK ||
> - bl->props.fb_blank != FB_BLANK_UNBLANK ||
> - bl->props.state & BL_CORE_FBBLANK)
> - brightness = 0;
> -
>   return ht16k33_brightness_set(priv, brightness);
>  }
>  


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-14 Thread Miguel Ojeda
On Thu, Mar 14, 2024 at 9:09 AM Thomas Zimmermann  wrote:
>
> As Sam already said, it doesn't seem to make different in practice. I'd
> mention it in the commit message and that's it. Ok?

Yeah, that is what I meant -- thanks a lot!

Reviewed-by: Miguel Ojeda 

Cheers,
Miguel


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-14 Thread Miguel Ojeda
On Wed, Mar 13, 2024 at 6:54 PM Sam Ravnborg  wrote:
>
> The driver does not set BL_CORE_SUSPENDRESUME so that part is a nop.

The driver may not set it now, but it is still not the same logic (and
unless I am missing something it would not generate the same code
either, so not sure I would say it is a "nop" in that sense).

But, yeah, I only meant to say that the commit message could be more
accurate (e.g. mention why the difference does not matter) -- that is
why I quoted the message instead of the code. Apologies if that was
unclear.

Cheers,
Miguel


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-14 Thread Geert Uytterhoeven
On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann  wrote:
> Replace the use of struct backlight_properties.fb_blank with a
> call to backlight_get_brightness(). The helper implement the same
> logic as the driver's function.
>
> Signed-off-by: Thomas Zimmermann 

Reviewed-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-14 Thread Thomas Zimmermann

Hi

Am 13.03.24 um 17:08 schrieb Miguel Ojeda:

Hi Thomas,

Thanks for this!

Cc'ing Andy and Geert -- the new maintainer and reviewer.


Ah, sorry. They are not yet in my MAINTAINERS file.



Also, a couple quick notes below since I am here...

On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann  wrote:

Replace the use of struct backlight_properties.fb_blank with a
call to backlight_get_brightness(). The helper implement the same
logic as the driver's function.

It is not exactly the same logic since `backlight_is_blank` accounts
for `BL_CORE_SUSPENDED`.


As Sam already said, it doesn't seem to make different in practice. I'd 
mention it in the commit message and that's it. Ok?


Best regards
Thomas




-   int brightness = bl->props.brightness;
+   int brightness = backlight_get_brightness(bl);

This can be `const` now (or even removed and have the call embedded below).

Cheers,
Miguel


--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-13 Thread Sam Ravnborg
On Wed, Mar 13, 2024 at 04:45:00PM +0100, Thomas Zimmermann wrote:
> Replace the use of struct backlight_properties.fb_blank with a
> call to backlight_get_brightness(). The helper implement the same
> logic as the driver's function.
> 
> Signed-off-by: Thomas Zimmermann 
> Cc: Robin van der Gracht 
> Cc: Miguel Ojeda 

Reviewed-by: Sam Ravnborg 
> ---
>  drivers/auxdisplay/ht16k33.c | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index a90430b7d07ba..83db829b97a5e 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -314,14 +314,9 @@ static int ht16k33_initialize(struct ht16k33_priv *priv)
>  
>  static int ht16k33_bl_update_status(struct backlight_device *bl)
>  {
> - int brightness = bl->props.brightness;
> + int brightness = backlight_get_brightness(bl);
>   struct ht16k33_priv *priv = bl_get_data(bl);
>  
> - if (bl->props.power != FB_BLANK_UNBLANK ||
> - bl->props.fb_blank != FB_BLANK_UNBLANK ||
> - bl->props.state & BL_CORE_FBBLANK)
> - brightness = 0;
> -
>   return ht16k33_brightness_set(priv, brightness);
>  }
>  
> -- 
> 2.44.0


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-13 Thread Sam Ravnborg
Hi Miguel.

On Wed, Mar 13, 2024 at 05:08:08PM +0100, Miguel Ojeda wrote:
> Hi Thomas,
> 
> Thanks for this!
> 
> Cc'ing Andy and Geert -- the new maintainer and reviewer.
> 
> Also, a couple quick notes below since I am here...
> 
> On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann  wrote:
> >
> > Replace the use of struct backlight_properties.fb_blank with a
> > call to backlight_get_brightness(). The helper implement the same
> > logic as the driver's function.
> 
> It is not exactly the same logic since `backlight_is_blank` accounts
> for `BL_CORE_SUSPENDED`.

The driver does not set BL_CORE_SUSPENDRESUME so that part is a nop.

Sam


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-13 Thread Miguel Ojeda
On Wed, Mar 13, 2024 at 6:11 PM Dan Carpenter  wrote:
>
> Is there an advantage to making this const?

Not much in this case -- it is more about trying to be const-correct
where possible.

Cheers,
Miguel


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-13 Thread Dan Carpenter
On Wed, Mar 13, 2024 at 04:45:00PM +0100, Thomas Zimmermann wrote:
> Replace the use of struct backlight_properties.fb_blank with a
> call to backlight_get_brightness(). The helper implement the same
> logic as the driver's function.

If you end up resending there is a typo s/implement/implements/.

regards,
dan carpenter


Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-13 Thread Dan Carpenter
On Wed, Mar 13, 2024 at 05:08:08PM +0100, Miguel Ojeda wrote:
> > -   int brightness = bl->props.brightness;
> > +   int brightness = backlight_get_brightness(bl);
> 
> This can be `const` now (or even removed and have the call embedded below).
> 

Is there an advantage to making this const?

regards,
dan carpenter



Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-13 Thread Miguel Ojeda
Hi Thomas,

Thanks for this!

Cc'ing Andy and Geert -- the new maintainer and reviewer.

Also, a couple quick notes below since I am here...

On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann  wrote:
>
> Replace the use of struct backlight_properties.fb_blank with a
> call to backlight_get_brightness(). The helper implement the same
> logic as the driver's function.

It is not exactly the same logic since `backlight_is_blank` accounts
for `BL_CORE_SUSPENDED`.

> -   int brightness = bl->props.brightness;
> +   int brightness = backlight_get_brightness(bl);

This can be `const` now (or even removed and have the call embedded below).

Cheers,
Miguel


[PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper

2024-03-13 Thread Thomas Zimmermann
Replace the use of struct backlight_properties.fb_blank with a
call to backlight_get_brightness(). The helper implement the same
logic as the driver's function.

Signed-off-by: Thomas Zimmermann 
Cc: Robin van der Gracht 
Cc: Miguel Ojeda 
---
 drivers/auxdisplay/ht16k33.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index a90430b7d07ba..83db829b97a5e 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -314,14 +314,9 @@ static int ht16k33_initialize(struct ht16k33_priv *priv)
 
 static int ht16k33_bl_update_status(struct backlight_device *bl)
 {
-   int brightness = bl->props.brightness;
+   int brightness = backlight_get_brightness(bl);
struct ht16k33_priv *priv = bl_get_data(bl);
 
-   if (bl->props.power != FB_BLANK_UNBLANK ||
-   bl->props.fb_blank != FB_BLANK_UNBLANK ||
-   bl->props.state & BL_CORE_FBBLANK)
-   brightness = 0;
-
return ht16k33_brightness_set(priv, brightness);
 }
 
-- 
2.44.0