diff mbox series

[12/15] auxdisplay: ht16k33: Introduce backlight_get_brightness()

Message ID 20230107-sam-video-backlight-drop-fb_blank-v1-12-1bd9bafb351f@ravnborg.org
State New
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: Robin van der Gracht <robin@protonic.nl>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/auxdisplay/ht16k33.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Miguel Ojeda Jan. 7, 2023, 9:02 p.m. UTC | #1
On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint
<devnull+sam.ravnborg.org@kernel.org> wrote:
>
> Introduce backlight_get_brightness() to simplify logic
> and avoid direct access to backlight properties.

Note: Stephen sent this one too a while ago (with some more details in
the commit message, which is always nice); and then he sent yesterday
v2 [1] (to mention the functional change with `BL_CORE_SUSPENDED`
[2]).

Anyway, if it goes via drm-misc, feel free to have my:

    Acked-by: Miguel Ojeda <ojeda@kernel.org>

Though it would be nice to have Robin test the change.

Thanks!

[1] https://lore.kernel.org/lkml/20230106143002.1434266-1-steve@sk2.org/
[2] https://lore.kernel.org/lkml/CANiq72kRhmT37H1FAGYGny83ONYXeqJuO8ZPbym0ajQOWKY4Kw@mail.gmail.com/

Cheers,
Miguel
Sam Ravnborg Jan. 8, 2023, 9:29 a.m. UTC | #2
Hi Robin.

On Sat, Jan 07, 2023 at 10:02:38PM +0100, Miguel Ojeda wrote:
> On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint
> <devnull+sam.ravnborg.org@kernel.org> wrote:
> >
> > Introduce backlight_get_brightness() to simplify logic
> > and avoid direct access to backlight properties.
> 
> Note: Stephen sent this one too a while ago (with some more details in
> the commit message, which is always nice); and then he sent yesterday
> v2 [1] (to mention the functional change with `BL_CORE_SUSPENDED`
> [2]).
Thanks for the pointers. I will try to move forward with Stephen's
patches.
> 
> Anyway, if it goes via drm-misc, feel free to have my:
> 
>     Acked-by: Miguel Ojeda <ojeda@kernel.org>
> 
> Though it would be nice to have Robin test the change.

Robin - can I get your ack to apply Stephen's original v2 patch to
drm-misc?

	Sam

> 
> Thanks!
> 
> [1] https://lore.kernel.org/lkml/20230106143002.1434266-1-steve@sk2.org/
> [2] https://lore.kernel.org/lkml/CANiq72kRhmT37H1FAGYGny83ONYXeqJuO8ZPbym0ajQOWKY4Kw@mail.gmail.com/
> 
> Cheers,
> Miguel
Robin van der Gracht Jan. 9, 2023, 10:12 a.m. UTC | #3
Hi Sam,

On 2023-01-08 10:29, Sam Ravnborg wrote:
> Hi Robin.
> 
> On Sat, Jan 07, 2023 at 10:02:38PM +0100, Miguel Ojeda wrote:
>> On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint
>> <devnull+sam.ravnborg.org@kernel.org> wrote:
>> >
>> > Introduce backlight_get_brightness() to simplify logic
>> > and avoid direct access to backlight properties.
>> 
>> Note: Stephen sent this one too a while ago (with some more details in
>> the commit message, which is always nice); and then he sent yesterday
>> v2 [1] (to mention the functional change with `BL_CORE_SUSPENDED`
>> [2]).
> Thanks for the pointers. I will try to move forward with Stephen's
> patches.
>> 
>> Anyway, if it goes via drm-misc, feel free to have my:
>> 
>>     Acked-by: Miguel Ojeda <ojeda@kernel.org>
>> 
>> Though it would be nice to have Robin test the change.
> 
> Robin - can I get your ack to apply Stephen's original v2 patch to
> drm-misc?

done! see: 
https://lore.kernel.org/lkml/0b16391f997e6ed005a326e4e48f2033@protonic.nl/

- Robin
Sam Ravnborg March 19, 2023, 6:44 p.m. UTC | #4
On Sun, Mar 19, 2023 at 02:44:08PM +0100, Stephen Kitt wrote:
> Hi,
> 
> On Mon, 09 Jan 2023 11:12:02 +0100, Robin van der Gracht <robin@protonic.nl>
> wrote:
> > On 2023-01-08 10:29, Sam Ravnborg wrote:
> > > On Sat, Jan 07, 2023 at 10:02:38PM +0100, Miguel Ojeda wrote:  
> > >> On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint
> > >> <devnull+sam.ravnborg.org@kernel.org> wrote:  
> > >> >
> > >> > Introduce backlight_get_brightness() to simplify logic
> > >> > and avoid direct access to backlight properties.  
> > >> 
> > >> Note: Stephen sent this one too a while ago (with some more details in
> > >> the commit message, which is always nice); and then he sent yesterday
> > >> v2 [1] (to mention the functional change with `BL_CORE_SUSPENDED`
> > >> [2]).  
> > > Thanks for the pointers. I will try to move forward with Stephen's
> > > patches.  
> > >> 
> > >> Anyway, if it goes via drm-misc, feel free to have my:
> > >> 
> > >>     Acked-by: Miguel Ojeda <ojeda@kernel.org>
> > >> 
> > >> Though it would be nice to have Robin test the change.  
> > > 
> > > Robin - can I get your ack to apply Stephen's original v2 patch to
> > > drm-misc?  
> > 
> > done! see: 
> > https://lore.kernel.org/lkml/0b16391f997e6ed005a326e4e48f2033@protonic.nl/
> 
> As far as I can tell, this never got applied to drm-misc, and I don’t see it
> anywhere else. I guess it slipped through the cracks ;-)

Yes, I have been busy with a lot of other stuff lately, and cannot
promise when I get back to do Linux work.
So if someone else could pick it up that would be nice.

	Sam
diff mbox series

Patch

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 02425991c159..15ab118c80f5 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);
 }