Linux-PWM Archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: daniel.thompson@linaro.org, jingoohan1@gmail.com, deller@gmx.de,
	andy@kernel.org, robin@protonic.nl, javierm@redhat.com,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-input@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v2 01/10] backlight: Match backlight device against struct fb_info.bl_dev
Date: Fri, 23 Feb 2024 10:53:45 +0000	[thread overview]
Message-ID: <20240223105345.GS10170@google.com> (raw)
In-Reply-To: <20240221094324.27436-2-tzimmermann@suse.de>

On Wed, 21 Feb 2024, Thomas Zimmermann wrote:

> Framebuffer drivers for devices with dedicated backlight are supposed
> to set struct fb_info.bl_dev to the backlight's respective device. Use
> the value to match backlight and framebuffer in the backlight core code.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>  drivers/video/backlight/backlight.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index 86e1cdc8e3697..48844a4f28ad3 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -98,7 +98,8 @@ static int fb_notifier_callback(struct notifier_block *self,
>  {
>  	struct backlight_device *bd;
>  	struct fb_event *evdata = data;
> -	int node = evdata->info->node;
> +	struct fb_info *info = evdata->info;
> +	int node = info->node;
>  	int fb_blank = 0;
>  
>  	/* If we aren't interested in this event, skip it immediately ... */
> @@ -110,8 +111,12 @@ static int fb_notifier_callback(struct notifier_block *self,
>  
>  	if (!bd->ops)
>  		goto out;
> -	if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info))
> +	else if (bd->ops->check_fb && !bd->ops->check_fb(bd, info))
>  		goto out;
> +#if IS_ENABLED(CONFIG_FB_BACKLIGHT)

I don't want #ifery in C files.

Please find another way.

> +	else if (info->bl_dev && info->bl_dev != bd)
> +		goto out;
> +#endif
>  
>  	fb_blank = *(int *)evdata->data;
>  	if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) {
> -- 
> 2.43.0
> 

-- 
Lee Jones [李琼斯]

  parent reply	other threads:[~2024-02-23 10:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  9:41 [PATCH v2 00/10] backlight: Replace struct fb_info in interfaces Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 01/10] backlight: Match backlight device against struct fb_info.bl_dev Thomas Zimmermann
2024-02-21 14:34   ` Andy Shevchenko
2024-02-21 15:44     ` Thomas Zimmermann
2024-02-21 16:46       ` Andy Shevchenko
2024-02-23 10:53   ` Lee Jones [this message]
2024-02-21  9:41 ` [PATCH v2 02/10] auxdisplay/ht16k33: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-21 14:35   ` Andy Shevchenko
2024-02-21  9:41 ` [PATCH v2 03/10] hid/hid-picolcd: Fix initialization order Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 04/10] hid/hid-picolcd: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 05/10] backlight/aat2870-backlight: Remove struct backlight.check_fb Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 06/10] backlight/pwm-backlight: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 07/10] fbdev/sh_mobile_lcdc_fb: " Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 08/10] fbdev/ssd1307fb: Init backlight before registering framebuffer Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 09/10] fbdev/ssd1307fb: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-21  9:41 ` [PATCH v2 10/10] backlight: Add controls_device callback to struct backlight_ops Thomas Zimmermann

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=20240223105345.GS10170@google.com \
    --to=lee@kernel.org \
    --cc=andy@kernel.org \
    --cc=daniel.thompson@linaro.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=jingoohan1@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=robin@protonic.nl \
    --cc=tzimmermann@suse.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).