@@ -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);
@@ -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;
};
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(+)