summaryrefslogtreecommitdiff
path: root/drivers/video/backlight/lcd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-05-22 20:45:12 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2024-05-22 20:45:12 +0300
commit7eae27cd12a2d305ffad41a8e10cff3bb8c0dcb0 (patch)
tree0f973c127f4ed014dbafa8755db6d0e87d1791c7 /drivers/video/backlight/lcd.c
parenta85629f435a4e724c414a6ae3e2f327272ab11af (diff)
parent1fd949f653ee1a3c1776ef8a5295ae072c9b67f2 (diff)
downloadlinux-7eae27cd12a2d305ffad41a8e10cff3bb8c0dcb0.tar.xz
Merge tag 'backlight-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "Fix-ups: - FB Backlight interaction overhaul - Remove superfluous code and simplify overall - Constify various structs and struct attributes Bug Fixes: - Repair LED flickering - Fix signedness bugs" * tag 'backlight-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (42 commits) backlight: sky81452-backlight: Remove unnecessary call to of_node_get() backlight: mp3309c: Fix LEDs flickering in PWM mode backlight: otm3225a: Drop driver owner assignment backlight: lp8788: Drop support for platform data backlight: lcd: Make lcd_class constant backlight: Make backlight_class constant backlight: mp3309c: Fix signedness bug in mp3309c_parse_fwnode() const_structs.checkpatch: add lcd_ops fbdev: omap: lcd_ams_delta: Constify lcd_ops fbdev: imx: Constify lcd_ops fbdev: clps711x: Constify lcd_ops HID: picoLCD: Constify lcd_ops backlight: tdo24m: Constify lcd_ops backlight: platform_lcd: Constify lcd_ops backlight: otm3225a: Constify lcd_ops backlight: ltv350qv: Constify lcd_ops backlight: lms501kf03: Constify lcd_ops backlight: lms283gf05: Constify lcd_ops backlight: l4f00242t03: Constify lcd_ops backlight: jornada720_lcd: Constify lcd_ops ...
Diffstat (limited to 'drivers/video/backlight/lcd.c')
-rw-r--r--drivers/video/backlight/lcd.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 77c5cb2a44e2..ceec90ca758b 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -159,8 +159,6 @@ static ssize_t max_contrast_show(struct device *dev,
}
static DEVICE_ATTR_RO(max_contrast);
-static struct class *lcd_class;
-
static void lcd_device_release(struct device *dev)
{
struct lcd_device *ld = to_lcd_device(dev);
@@ -175,6 +173,11 @@ static struct attribute *lcd_device_attrs[] = {
};
ATTRIBUTE_GROUPS(lcd_device);
+static const struct class lcd_class = {
+ .name = "lcd",
+ .dev_groups = lcd_device_groups,
+};
+
/**
* lcd_device_register - register a new object of lcd_device class.
* @name: the name of the new object(must be the same as the name of the
@@ -188,7 +191,7 @@ ATTRIBUTE_GROUPS(lcd_device);
* or a pointer to the newly allocated device.
*/
struct lcd_device *lcd_device_register(const char *name, struct device *parent,
- void *devdata, struct lcd_ops *ops)
+ void *devdata, const struct lcd_ops *ops)
{
struct lcd_device *new_ld;
int rc;
@@ -202,7 +205,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
mutex_init(&new_ld->ops_lock);
mutex_init(&new_ld->update_lock);
- new_ld->dev.class = lcd_class;
+ new_ld->dev.class = &lcd_class;
new_ld->dev.parent = parent;
new_ld->dev.release = lcd_device_release;
dev_set_name(&new_ld->dev, "%s", name);
@@ -276,7 +279,7 @@ static int devm_lcd_device_match(struct device *dev, void *res, void *data)
*/
struct lcd_device *devm_lcd_device_register(struct device *dev,
const char *name, struct device *parent,
- void *devdata, struct lcd_ops *ops)
+ void *devdata, const struct lcd_ops *ops)
{
struct lcd_device **ptr, *lcd;
@@ -318,19 +321,19 @@ EXPORT_SYMBOL(devm_lcd_device_unregister);
static void __exit lcd_class_exit(void)
{
- class_destroy(lcd_class);
+ class_unregister(&lcd_class);
}
static int __init lcd_class_init(void)
{
- lcd_class = class_create("lcd");
- if (IS_ERR(lcd_class)) {
- pr_warn("Unable to create backlight class; errno = %ld\n",
- PTR_ERR(lcd_class));
- return PTR_ERR(lcd_class);
+ int ret;
+
+ ret = class_register(&lcd_class);
+ if (ret) {
+ pr_warn("Unable to create backlight class; errno = %d\n", ret);
+ return ret;
}
- lcd_class->dev_groups = lcd_device_groups;
return 0;
}