Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

backlight: lcd: Test against struct fb_info.lcd_dev

Add struct fb_info.lcd_dev for fbdev drivers to store a reference to
their lcd device. Update the lcd's fb_notifier_callback() to test for
this field. The lcd module can now detect if an lcd device belongs to
an fbdev device.

This works similar to the bl_dev for backlights and will allow for
the removal of the check_fb callback from several fbdev driver's lcd
devices.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20240906075439.98476-3-tzimmermann@suse.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Thomas Zimmermann and committed by
Lee Jones
26228256 d3687036

+16
+3
drivers/video/backlight/lcd.c
··· 30 30 struct lcd_device *ld = container_of(self, struct lcd_device, fb_notif); 31 31 struct fb_event *evdata = data; 32 32 struct fb_info *info = evdata->info; 33 + struct lcd_device *fb_lcd = fb_lcd_device(info); 33 34 34 35 guard(mutex)(&ld->ops_lock); 35 36 36 37 if (!ld->ops) 37 38 return 0; 38 39 if (ld->ops->check_fb && !ld->ops->check_fb(ld, info)) 40 + return 0; 41 + if (fb_lcd && fb_lcd != ld) 39 42 return 0; 40 43 41 44 if (event == FB_EVENT_BLANK) {
+13
include/linux/fb.h
··· 21 21 struct file; 22 22 struct i2c_adapter; 23 23 struct inode; 24 + struct lcd_device; 24 25 struct module; 25 26 struct notifier_block; 26 27 struct page; ··· 481 480 struct mutex bl_curve_mutex; 482 481 u8 bl_curve[FB_BACKLIGHT_LEVELS]; 483 482 #endif 483 + 484 + /* 485 + * Assigned LCD device; set before framebuffer 486 + * registration, remove after unregister 487 + */ 488 + struct lcd_device *lcd_dev; 489 + 484 490 #ifdef CONFIG_FB_DEFERRED_IO 485 491 struct delayed_work deferred_work; 486 492 unsigned long npagerefs; ··· 761 753 return NULL; 762 754 } 763 755 #endif 756 + 757 + static inline struct lcd_device *fb_lcd_device(struct fb_info *info) 758 + { 759 + return info->lcd_dev; 760 + } 764 761 765 762 /* fbmon.c */ 766 763 #define FB_MAXTIMINGS 0