linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Thompson <danielt@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: lee@kernel.org, pavel@ucw.cz, jingoohan1@gmail.com,
	deller@gmx.de, simona@ffwll.ch, linux-leds@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH v3 06/11] backlight: Replace fb events with a dedicated function call
Date: Tue, 18 Mar 2025 09:23:40 +0000	[thread overview]
Message-ID: <Z9k7nAXNGDaQMnMO@aspen.lan> (raw)
In-Reply-To: <20250306140947.580324-7-tzimmermann@suse.de>

On Thu, Mar 06, 2025 at 03:05:48PM +0100, Thomas Zimmermann wrote:
> Remove support for fb events from backlight subsystem. Provide the
> helper backlight_notify_blank_all() instead. Also export the existing
> helper backlight_notify_blank() to update a single backlight device.
>
> In fbdev, call either helper to inform the backlight subsystem of
> changes to a display's blank state. If the framebuffer device has a
> specific backlight, only update this one; otherwise update all.
>
> v3:
> - declare empty fb_bl_notify_blank() as static inline (kernel test robot)

Looks like there are still configs where we get build failure.


> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Other than the build issues, generally this looks great. Just a couple
of small issues below.


> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index 1c43f579396f..9dc93c5e480b 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -78,11 +77,8 @@ static const char *const backlight_scale_types[] = {
>  	[BACKLIGHT_SCALE_NON_LINEAR]	= "non-linear",
>  };
>
> -#if defined(CONFIG_FB_CORE) || (defined(CONFIG_FB_CORE_MODULE) && \
> -				defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
> -static void backlight_notify_blank(struct backlight_device *bd,
> -				   struct device *display_dev,
> -				   bool fb_on, bool prev_fb_on)
> +void backlight_notify_blank(struct backlight_device *bd, struct device *display_dev,
> +			    bool fb_on, bool prev_fb_on)
>  {
>  	guard(mutex)(&bd->ops_lock);
>
> @@ -103,68 +99,18 @@ static void backlight_notify_blank(struct backlight_device *bd,
>  		}
>  	}
>  }
> +EXPORT_SYMBOL(backlight_notify_blank);

Should this be EXPORT_SYMBOL_GPL()?


>
> -/*
> - * fb_notifier_callback
> - *
> - * This callback gets called when something important happens inside a
> - * framebuffer driver. The backlight core only cares about FB_BLANK_UNBLANK
> - * which is reported to the driver using backlight_update_status()
> - * as a state change.
> - *
> - * There may be several fbdev's connected to the backlight device,
> - * in which case they are kept track of. A state change is only reported
> - * if there is a change in backlight for the specified fbdev.
> - */
> -static int fb_notifier_callback(struct notifier_block *self,
> -				unsigned long event, void *data)
> +void backlight_notify_blank_all(struct device *display_dev, bool fb_on, bool prev_fb_on)
>  {
>  	struct backlight_device *bd;
> -	struct fb_event *evdata = data;
> -	struct fb_info *info = evdata->info;
> -	const int *fb_blank = evdata->data;
> -	struct backlight_device *fb_bd = fb_bl_device(info);
> -	bool fb_on, prev_fb_on;
> -
> -	/* If we aren't interested in this event, skip it immediately ... */
> -	if (event != FB_EVENT_BLANK)
> -		return 0;
> -
> -	bd = container_of(self, struct backlight_device, fb_notif);
> -
> -	if (fb_bd && fb_bd != bd)
> -		return 0;
> -
> -	fb_on = fb_blank[0] == FB_BLANK_UNBLANK;
> -	prev_fb_on = fb_blank[1] == FB_BLANK_UNBLANK;
> -
> -	backlight_notify_blank(bd, info->device, fb_on, prev_fb_on);
> -
> -	return 0;
> -}
> -
> -static int backlight_register_fb(struct backlight_device *bd)
> -{
> -	memset(&bd->fb_notif, 0, sizeof(bd->fb_notif));
> -	bd->fb_notif.notifier_call = fb_notifier_callback;
>
> -	return fb_register_client(&bd->fb_notif);
> -}
> +	guard(mutex)(&backlight_dev_list_mutex);
>
> -static void backlight_unregister_fb(struct backlight_device *bd)
> -{
> -	fb_unregister_client(&bd->fb_notif);
> -}
> -#else
> -static inline int backlight_register_fb(struct backlight_device *bd)
> -{
> -	return 0;
> +	list_for_each_entry(bd, &backlight_dev_list, entry)
> +		backlight_notify_blank(bd, display_dev, fb_on, prev_fb_on);
>  }
> -
> -static inline void backlight_unregister_fb(struct backlight_device *bd)
> -{
> -}
> -#endif /* CONFIG_FB_CORE */
> +EXPORT_SYMBOL(backlight_notify_blank_all);

Same here.


Daniel.

  parent reply	other threads:[~2025-03-18  9:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 14:05 [PATCH v3 00/11] backlight, lcd, led: Remove fbdev dependencies Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 01/11] fbdev: Rework fb_blank() Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 02/11] fbdev: Track display blanking state Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 03/11] fbdev: Send old blank state in FB_EVENT_BLANK Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 04/11] backlight: Implement fbdev tracking with blank state from event Thomas Zimmermann
2025-03-18  9:05   ` Daniel Thompson
2025-03-06 14:05 ` [PATCH v3 05/11] backlight: Move blank-state handling into helper Thomas Zimmermann
2025-03-18  9:07   ` Daniel Thompson
2025-03-06 14:05 ` [PATCH v3 06/11] backlight: Replace fb events with a dedicated function call Thomas Zimmermann
2025-03-08 11:31   ` kernel test robot
2025-03-08 11:31   ` kernel test robot
2025-03-18  9:23   ` Daniel Thompson [this message]
2025-03-21  8:13     ` Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 07/11] backlight: lcd: Move event handling into helpers Thomas Zimmermann
2025-03-18  9:25   ` Daniel Thompson
2025-03-06 14:05 ` [PATCH v3 08/11] backlight: lcd: Replace fb events with a dedicated function call Thomas Zimmermann
2025-03-18  9:40   ` Daniel Thompson
2025-03-21  8:16     ` Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 09/11] leds: backlight trigger: Move blank-state handling into helper Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 10/11] leds: backlight trigger: Replace fb events with a dedicated function call Thomas Zimmermann
2025-03-06 14:05 ` [PATCH v3 11/11] fbdev: Remove constants of unused events Thomas Zimmermann
2025-03-13 16:51 ` [PATCH v3 00/11] backlight, lcd, led: Remove fbdev dependencies Lee Jones
2025-03-14  8:39   ` Simona Vetter
2025-03-17  8:42   ` Thomas Zimmermann
2025-03-17 17:14     ` Daniel Thompson

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=Z9k7nAXNGDaQMnMO@aspen.lan \
    --to=danielt@kernel.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=simona@ffwll.ch \
    --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 NNTP newsgroup(s).