aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2024-03-05 17:22:43 +0100
committerLee Jones <lee@kernel.org>2024-03-28 10:09:06 +0000
commit0a4be7263749945a3882f7a0e2e5b1c45c31064e (patch)
tree76787247220793a2de23ab1c7d15fed981533f35
parent7929446702295f7e336c13b39302589070f11560 (diff)
downloadbacklight-ib-backlight-auxdisplay-hid-fb-6.9.tar.gz
backlight: Add controls_device callback to struct backlight_opsib-backlight-auxdisplay-hid-fb-v6.9ib-backlight-auxdisplay-hid-fb-6.9
Replace check_fb with controls_device in struct backlight_ops. The new callback interface takes a Linux device instead of a framebuffer. Resolves one of the dependencies of backlight.h on fb.h. The few drivers that had custom implementations of check_fb can easily use the framebuffer's Linux device instead. Update them accordingly. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-11-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
-rw-r--r--drivers/video/backlight/backlight.c2
-rw-r--r--drivers/video/backlight/bd6107.c12
-rw-r--r--drivers/video/backlight/gpio_backlight.c12
-rw-r--r--drivers/video/backlight/lv5207lp.c12
-rw-r--r--include/linux/backlight.h16
5 files changed, 27 insertions, 27 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 4f7973c6fcc798..2bd4299206aef6 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -112,7 +112,7 @@ static int fb_notifier_callback(struct notifier_block *self,
if (!bd->ops)
goto out;
- if (bd->ops->check_fb && !bd->ops->check_fb(bd, info))
+ if (bd->ops->controls_device && !bd->ops->controls_device(bd, info->device))
goto out;
if (fb_bd && fb_bd != bd)
goto out;
diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c
index b1e7126380ef27..6be2c67ba85c77 100644
--- a/drivers/video/backlight/bd6107.c
+++ b/drivers/video/backlight/bd6107.c
@@ -99,18 +99,18 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight)
return 0;
}
-static int bd6107_backlight_check_fb(struct backlight_device *backlight,
- struct fb_info *info)
+static bool bd6107_backlight_controls_device(struct backlight_device *backlight,
+ struct device *display_dev)
{
struct bd6107 *bd = bl_get_data(backlight);
- return !bd->pdata->dev || bd->pdata->dev == info->device;
+ return !bd->pdata->dev || bd->pdata->dev == display_dev;
}
static const struct backlight_ops bd6107_backlight_ops = {
- .options = BL_CORE_SUSPENDRESUME,
- .update_status = bd6107_backlight_update_status,
- .check_fb = bd6107_backlight_check_fb,
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = bd6107_backlight_update_status,
+ .controls_device = bd6107_backlight_controls_device,
};
static int bd6107_probe(struct i2c_client *client)
diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index e0c8c2a3f5dc2b..4476c317ce293a 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -30,18 +30,18 @@ static int gpio_backlight_update_status(struct backlight_device *bl)
return 0;
}
-static int gpio_backlight_check_fb(struct backlight_device *bl,
- struct fb_info *info)
+static bool gpio_backlight_controls_device(struct backlight_device *bl,
+ struct device *display_dev)
{
struct gpio_backlight *gbl = bl_get_data(bl);
- return !gbl->dev || gbl->dev == info->device;
+ return !gbl->dev || gbl->dev == display_dev;
}
static const struct backlight_ops gpio_backlight_ops = {
- .options = BL_CORE_SUSPENDRESUME,
- .update_status = gpio_backlight_update_status,
- .check_fb = gpio_backlight_check_fb,
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = gpio_backlight_update_status,
+ .controls_device = gpio_backlight_controls_device,
};
static int gpio_backlight_probe(struct platform_device *pdev)
diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c
index 1f1d06b4e119a1..0cf00fee0f6052 100644
--- a/drivers/video/backlight/lv5207lp.c
+++ b/drivers/video/backlight/lv5207lp.c
@@ -62,18 +62,18 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight)
return 0;
}
-static int lv5207lp_backlight_check_fb(struct backlight_device *backlight,
- struct fb_info *info)
+static bool lv5207lp_backlight_controls_device(struct backlight_device *backlight,
+ struct device *display_dev)
{
struct lv5207lp *lv = bl_get_data(backlight);
- return !lv->pdata->dev || lv->pdata->dev == info->device;
+ return !lv->pdata->dev || lv->pdata->dev == display_dev;
}
static const struct backlight_ops lv5207lp_backlight_ops = {
- .options = BL_CORE_SUSPENDRESUME,
- .update_status = lv5207lp_backlight_update_status,
- .check_fb = lv5207lp_backlight_check_fb,
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = lv5207lp_backlight_update_status,
+ .controls_device = lv5207lp_backlight_controls_device,
};
static int lv5207lp_probe(struct i2c_client *client)
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 614653e07e3a86..2db4c70053c46f 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -13,6 +13,7 @@
#include <linux/fb.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
+#include <linux/types.h>
/**
* enum backlight_update_reason - what method was used to update backlight
@@ -110,7 +111,6 @@ enum backlight_scale {
};
struct backlight_device;
-struct fb_info;
/**
* struct backlight_ops - backlight operations
@@ -160,18 +160,18 @@ struct backlight_ops {
int (*get_brightness)(struct backlight_device *);
/**
- * @check_fb: Check the framebuffer device.
+ * @controls_device: Check against the display device
*
- * Check if given framebuffer device is the one bound to this backlight.
- * This operation is optional and if not implemented it is assumed that the
- * fbdev is always the one bound to the backlight.
+ * Check if the backlight 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 backlight.
*
* RETURNS:
*
- * If info is NULL or the info matches the fbdev bound to the backlight return true.
- * If info does not match the fbdev bound to the backlight return false.
+ * If display_dev is NULL or display_dev matches the device controlled by
+ * the backlight, return true. Otherwise return false.
*/
- int (*check_fb)(struct backlight_device *bd, struct fb_info *info);
+ bool (*controls_device)(struct backlight_device *bd, struct device *display_dev);
};
/**