Skip to content

Commit 43e1120

Browse files
Thomas Zimmermannlag-linaro
authored andcommitted
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>
1 parent 05deb1c commit 43e1120

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

drivers/video/backlight/lcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int fb_notifier_callback(struct notifier_block *self,
5454

5555
if (!ld->ops)
5656
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))
5858
return 0;
5959
if (fb_lcd && fb_lcd != ld)
6060
return 0;

drivers/video/backlight/platform_lcd.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <linux/module.h>
1111
#include <linux/platform_device.h>
12-
#include <linux/fb.h>
1312
#include <linux/lcd.h>
1413
#include <linux/slab.h>
1514

@@ -50,17 +49,17 @@ static int platform_lcd_set_power(struct lcd_device *lcd, int power)
5049
return 0;
5150
}
5251

53-
static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info)
52+
static bool platform_lcd_controls_device(struct lcd_device *lcd, struct device *display_device)
5453
{
5554
struct platform_lcd *plcd = to_our_lcd(lcd);
5655

57-
return plcd->us->parent == info->device;
56+
return plcd->us->parent == display_device;
5857
}
5958

6059
static const struct lcd_ops platform_lcd_ops = {
61-
.get_power = platform_lcd_get_power,
62-
.set_power = platform_lcd_set_power,
63-
.check_fb = platform_lcd_match,
60+
.get_power = platform_lcd_get_power,
61+
.set_power = platform_lcd_set_power,
62+
.controls_device = platform_lcd_controls_device,
6463
};
6564

6665
static int platform_lcd_probe(struct platform_device *pdev)

include/linux/lcd.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
*/
3636

3737
struct lcd_device;
38-
struct fb_info;
3938

4039
struct lcd_properties {
4140
/* The maximum value for contrast (read-only) */
@@ -54,9 +53,18 @@ struct lcd_ops {
5453
int (*set_contrast)(struct lcd_device *, int contrast);
5554
/* Set LCD panel mode (resolutions ...) */
5655
int (*set_mode)(struct lcd_device *, struct fb_videomode *);
57-
/* Check if given framebuffer device is the one LCD is bound to;
58-
return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */
59-
int (*check_fb)(struct lcd_device *, struct fb_info *);
56+
57+
/*
58+
* Check if the LCD controls the given display device. This
59+
* operation is optional and if not implemented it is assumed that
60+
* the display is always the one controlled by the LCD.
61+
*
62+
* RETURNS:
63+
*
64+
* If display_dev is NULL or display_dev matches the device controlled by
65+
* the LCD, return true. Otherwise return false.
66+
*/
67+
bool (*controls_device)(struct lcd_device *lcd, struct device *display_device);
6068
};
6169

6270
struct lcd_device {

0 commit comments

Comments
 (0)