linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin van der Gracht <robin@protonic.nl>
To: Stephen Kitt <steve@sk2.org>
Cc: Miguel Ojeda <ojeda@kernel.org>,
	linux-kernel@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
Date: Mon, 09 Jan 2023 10:51:06 +0100	[thread overview]
Message-ID: <0b16391f997e6ed005a326e4e48f2033@protonic.nl> (raw)
In-Reply-To: <20230106143002.1434266-1-steve@sk2.org>

On 2023-01-06 15:30, Stephen Kitt 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.
> 
> This means that BL_CORE_SUSPENDED is now taken into account, as it
> should be.
> 
> Signed-off-by: Stephen Kitt <steve@sk2.org>
> ---
> 
> Notes:
>     Changes since v1: mention BL_CORE_SUSPENDED.
> 
>  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 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);
>  }

Thank you Stephen (and Sam), looks good!

Reviewed-by: Robin van der Gracht <robin@protonic.nl>

      parent reply	other threads:[~2023-01-09 10:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 14:30 [PATCH v2] auxdisplay: ht16k33: Use backlight helper Stephen Kitt
2023-01-07  0:56 ` Miguel Ojeda
2023-01-08 10:03 ` Geert Uytterhoeven
2023-01-08 14:56   ` Miguel Ojeda
2023-01-08 18:32     ` Geert Uytterhoeven
2023-01-08 19:11       ` Miguel Ojeda
2023-01-08 20:17         ` Sam Ravnborg
2023-01-09  7:11           ` Stephen Kitt
2023-01-09  9:51 ` Robin van der Gracht [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b16391f997e6ed005a326e4e48f2033@protonic.nl \
    --to=robin@protonic.nl \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=steve@sk2.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).