linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] auxdisplay: ht16k33: Use backlight helper
@ 2022-06-07 18:04 Stephen Kitt
  2022-06-07 19:08 ` Miguel Ojeda
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Kitt @ 2022-06-07 18:04 UTC (permalink / raw)
  To: Robin van der Gracht, Miguel Ojeda; +Cc: linux-kernel, Stephen Kitt

backlight_properties.fb_blank is deprecated. The states it represents
are handled by other properties; but instead of accessing those
properties directly, drivers should use the helpers provided by
backlight.h.

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>
Cc: Robin van der Gracht <robin@protonic.nl>
Cc: Miguel Ojeda <ojeda@kernel.org>
---
 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 4fab3b2c7023..dbadff38999a 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);
 }
 

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
2.30.2


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

* Re: [PATCH] auxdisplay: ht16k33: Use backlight helper
  2022-06-07 18:04 [PATCH] auxdisplay: ht16k33: Use backlight helper Stephen Kitt
@ 2022-06-07 19:08 ` Miguel Ojeda
  2022-06-07 21:02   ` Stephen Kitt
  0 siblings, 1 reply; 3+ messages in thread
From: Miguel Ojeda @ 2022-06-07 19:08 UTC (permalink / raw)
  To: Stephen Kitt; +Cc: Robin van der Gracht, Miguel Ojeda, linux-kernel

Hi Stephen,

On Tue, Jun 7, 2022 at 8:04 PM Stephen Kitt <steve@sk2.org> wrote:
>
> backlight_properties.fb_blank is deprecated. The states it represents
> are handled by other properties; but instead of accessing those
> properties directly, drivers should use the helpers provided by
> backlight.h.
>
> 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.

Thanks for the patch! Looks good to me.

There is a functional change in that `BL_CORE_SUSPENDED` is taken into
account with this change, but I assume that is expected. In that case,
it could be good to mention it in the commit message.

Cheers,
Miguel

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

* Re: [PATCH] auxdisplay: ht16k33: Use backlight helper
  2022-06-07 19:08 ` Miguel Ojeda
@ 2022-06-07 21:02   ` Stephen Kitt
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Kitt @ 2022-06-07 21:02 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: Robin van der Gracht, linux-kernel

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

Hi Miguel,

On Tue, 7 Jun 2022 21:08:34 +0200, Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
> On Tue, Jun 7, 2022 at 8:04 PM Stephen Kitt <steve@sk2.org> wrote:
> > backlight_properties.fb_blank is deprecated. The states it represents
> > are handled by other properties; but instead of accessing those
> > properties directly, drivers should use the helpers provided by
> > backlight.h.
> >
> > 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.  
> 
> Thanks for the patch! Looks good to me.
> 
> There is a functional change in that `BL_CORE_SUSPENDED` is taken into
> account with this change, but I assume that is expected. In that case,
> it could be good to mention it in the commit message.

That’s a good point, and it is indeed expected; I’ll add it to the commit
message.

Regards,

Stephen

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

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

end of thread, other threads:[~2022-06-08  2:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 18:04 [PATCH] auxdisplay: ht16k33: Use backlight helper Stephen Kitt
2022-06-07 19:08 ` Miguel Ojeda
2022-06-07 21:02   ` Stephen Kitt

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).