[PATCH 26/28] backlight: lcd: Replace check_fb with controls_device
Thomas Zimmermann
tzimmermann at suse.de
Tue Aug 20 09:23:04 UTC 2024
Rename check_fb in struct lcd_ops with controls_device. The callback
is not independent from fbdev's struct fb_info and tests is an lcd
device controls a hardware display device. The new naming and semantics
follow similar funcionality for backlight devices.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
drivers/video/backlight/lcd.c | 2 +-
drivers/video/backlight/platform_lcd.c | 11 +++++------
include/linux/lcd.h | 16 ++++++++++++----
3 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index edd5ccb7a43a..269ca9061df4 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -55,7 +55,7 @@ static int fb_notifier_callback(struct notifier_block *self,
if (!ld->ops)
goto out;
- if (ld->ops->check_fb && !ld->ops->check_fb(ld, evdata->info))
+ if (ld->ops->controls_device && !ld->ops->controls_device(ld, info->device))
goto out;
if (fb_lcd && fb_lcd != ld)
goto out;
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c
index 69a22d1a8a35..c9fe50f4d8ed 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -9,7 +9,6 @@
#include <linux/module.h>
#include <linux/platform_device.h>
-#include <linux/fb.h>
#include <linux/lcd.h>
#include <linux/slab.h>
@@ -50,17 +49,17 @@ static int platform_lcd_set_power(struct lcd_device *lcd, int power)
return 0;
}
-static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info)
+static bool platform_lcd_controls_device(struct lcd_device *lcd, struct device *display_device)
{
struct platform_lcd *plcd = to_our_lcd(lcd);
- return plcd->us->parent == info->device;
+ return plcd->us->parent == display_device;
}
static const struct lcd_ops platform_lcd_ops = {
- .get_power = platform_lcd_get_power,
- .set_power = platform_lcd_set_power,
- .check_fb = platform_lcd_match,
+ .get_power = platform_lcd_get_power,
+ .set_power = platform_lcd_set_power,
+ .controls_device = platform_lcd_controls_device,
};
static int platform_lcd_probe(struct platform_device *pdev)
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index dfcc54d327f5..8399b5ed48f2 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -35,7 +35,6 @@
*/
struct lcd_device;
-struct fb_info;
struct lcd_properties {
/* The maximum value for contrast (read-only) */
@@ -54,9 +53,18 @@ struct lcd_ops {
int (*set_contrast)(struct lcd_device *, int contrast);
/* Set LCD panel mode (resolutions ...) */
int (*set_mode)(struct lcd_device *, struct fb_videomode *);
- /* Check if given framebuffer device is the one LCD is bound to;
- return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */
- int (*check_fb)(struct lcd_device *, struct fb_info *);
+
+ /*
+ * Check if the LCD controls the given display device. This
+ * operation is optional and if not implemented it is assumed that
+ * the display is always the one controlled by the LCD.
+ *
+ * RETURNS:
+ *
+ * If display_dev is NULL or display_dev matches the device controlled by
+ * the LCD, return true. Otherwise return false.
+ */
+ bool (*controls_device)(struct lcd_device *lcd, struct device *display_device);
};
struct lcd_device {
--
2.46.0
More information about the dri-devel
mailing list