From: Thomas Zimmermann <tzimmermann@suse.de>
To: pavel@ucw.cz, lee@kernel.org, danielt@kernel.org,
jingoohan1@gmail.com, deller@gmx.de, simona@ffwll.ch
Cc: linux-leds@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-fbdev@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 07/13] backlight: lcd: Maintain global list of lcd devices
Date: Thu, 6 Feb 2025 16:30:26 +0100 [thread overview]
Message-ID: <20250206154033.697495-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20250206154033.697495-1-tzimmermann@suse.de>
Maintain a list of lcd devices. This will replace the fbdev notifiers
that all lcd devices currently subscribe to.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/video/backlight/lcd.c | 11 +++++++++++
include/linux/lcd.h | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 3267acf8dc5b..95a371b3e8a4 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -18,6 +18,9 @@
#include <linux/fb.h>
#include <linux/slab.h>
+static struct list_head lcd_dev_list;
+static struct mutex lcd_dev_list_mutex;
+
#if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \
defined(CONFIG_LCD_CLASS_DEVICE_MODULE))
static int to_lcd_power(int fb_blank)
@@ -251,6 +254,10 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
return ERR_PTR(rc);
}
+ mutex_lock(&lcd_dev_list_mutex);
+ list_add(&new_ld->entry, &lcd_dev_list);
+ mutex_unlock(&lcd_dev_list_mutex);
+
return new_ld;
}
EXPORT_SYMBOL(lcd_device_register);
@@ -266,6 +273,10 @@ void lcd_device_unregister(struct lcd_device *ld)
if (!ld)
return;
+ mutex_lock(&lcd_dev_list_mutex);
+ list_del(&ld->entry);
+ mutex_unlock(&lcd_dev_list_mutex);
+
mutex_lock(&ld->ops_lock);
ld->ops = NULL;
mutex_unlock(&ld->ops_lock);
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index c3ccdff4519a..195b95edb13f 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -82,6 +82,11 @@ struct lcd_device {
/* The framebuffer notifier block */
struct notifier_block fb_notif;
+ /**
+ * @entry: List entry of all registered lcd devices
+ */
+ struct list_head entry;
+
struct device dev;
};
--
2.48.1
next prev parent reply other threads:[~2025-02-06 15:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 15:30 [RFC PATCH 00/13] backlight, lcd, led: Remove fbdev dependencies Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 01/13] fbdev: Rework fb_blank() Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 02/13] fbdev: Track display blanking state Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 03/13] fbdev: Send old blank state in FB_EVENT_BLANK Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 04/13] backlight: Implement fbdev tracking with blank state from event Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 05/13] backlight: Move blank-state handling into helper Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 06/13] backlight: Replace fb events with a dedicated function call Thomas Zimmermann
2025-02-06 15:30 ` Thomas Zimmermann [this message]
2025-02-06 15:30 ` [PATCH 08/13] backlight: lcd: Move event handling into helpers Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 09/13] backlight: lcd: Replace fb events with a dedicated function call Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 10/13] leds: backlight trigger: Maintain global list of led backlight triggers Thomas Zimmermann
2025-02-11 14:00 ` Lee Jones
2025-02-13 14:23 ` Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 11/13] leds: backlight trigger: Move blank-state handling into helper Thomas Zimmermann
2025-02-06 15:30 ` [PATCH 12/13] leds: backlight trigger: Replace fb events with a dedicated function call Thomas Zimmermann
2025-02-11 13:57 ` Lee Jones
2025-02-13 14:34 ` Thomas Zimmermann
2025-02-20 15:00 ` Lee Jones
2025-02-06 15:30 ` [PATCH 13/13] fbdev: Remove constants of unused events 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=20250206154033.697495-8-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=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 \
/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).