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

backlight: lcd: Replace check_fb with controls_device

Rename check_fb in struct lcd_ops to controls_device. The callback
is now independent from fbdev's struct fb_info and tests if an lcd
device controls a hardware display device. The new naming and semantics
follow similar functionality for backlight devices.

v2:
- fix typos in commit description (Daniel)

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

authored by

Thomas Zimmermann and committed by
Lee Jones
43e1120d 05deb1ce

+18 -11
+1 -1
drivers/video/backlight/lcd.c
··· 54 54 55 55 if (!ld->ops) 56 56 return 0; 57 - if (ld->ops->check_fb && !ld->ops->check_fb(ld, info)) 57 + if (ld->ops->controls_device && !ld->ops->controls_device(ld, info->device)) 58 58 return 0; 59 59 if (fb_lcd && fb_lcd != ld) 60 60 return 0;
+5 -6
drivers/video/backlight/platform_lcd.c
··· 9 9 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 - #include <linux/fb.h> 13 12 #include <linux/lcd.h> 14 13 #include <linux/slab.h> 15 14 ··· 49 50 return 0; 50 51 } 51 52 52 - static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info) 53 + static bool platform_lcd_controls_device(struct lcd_device *lcd, struct device *display_device) 53 54 { 54 55 struct platform_lcd *plcd = to_our_lcd(lcd); 55 56 56 - return plcd->us->parent == info->device; 57 + return plcd->us->parent == display_device; 57 58 } 58 59 59 60 static const struct lcd_ops platform_lcd_ops = { 60 - .get_power = platform_lcd_get_power, 61 - .set_power = platform_lcd_set_power, 62 - .check_fb = platform_lcd_match, 61 + .get_power = platform_lcd_get_power, 62 + .set_power = platform_lcd_set_power, 63 + .controls_device = platform_lcd_controls_device, 63 64 }; 64 65 65 66 static int platform_lcd_probe(struct platform_device *pdev)
+12 -4
include/linux/lcd.h
··· 35 35 */ 36 36 37 37 struct lcd_device; 38 - struct fb_info; 39 38 40 39 struct lcd_properties { 41 40 /* The maximum value for contrast (read-only) */ ··· 53 54 int (*set_contrast)(struct lcd_device *, int contrast); 54 55 /* Set LCD panel mode (resolutions ...) */ 55 56 int (*set_mode)(struct lcd_device *, struct fb_videomode *); 56 - /* Check if given framebuffer device is the one LCD is bound to; 57 - return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ 58 - int (*check_fb)(struct lcd_device *, struct fb_info *); 57 + 58 + /* 59 + * Check if the LCD controls the given display device. This 60 + * operation is optional and if not implemented it is assumed that 61 + * the display is always the one controlled by the LCD. 62 + * 63 + * RETURNS: 64 + * 65 + * If display_dev is NULL or display_dev matches the device controlled by 66 + * the LCD, return true. Otherwise return false. 67 + */ 68 + bool (*controls_device)(struct lcd_device *lcd, struct device *display_device); 59 69 }; 60 70 61 71 struct lcd_device {