hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/leds/leds-syscon.c
....@@ -1,23 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Generic Syscon LEDs Driver
34 *
45 * Copyright (c) 2014, Linaro Limited
56 * Author: Linus Walleij <linus.walleij@linaro.org>
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License as
9
- * published by the Free Software Foundation; either version 2 of
10
- * the License, or (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20
- * MA 02111-1307 USA
217 */
228 #include <linux/io.h>
239 #include <linux/init.h>
....@@ -69,8 +55,9 @@
6955
7056 static int syscon_led_probe(struct platform_device *pdev)
7157 {
58
+ struct led_init_data init_data = {};
7259 struct device *dev = &pdev->dev;
73
- struct device_node *np = dev->of_node;
60
+ struct device_node *np = dev_of_node(dev);
7461 struct device *parent;
7562 struct regmap *map;
7663 struct syscon_led *sled;
....@@ -82,7 +69,7 @@
8269 dev_err(dev, "no parent for syscon LED\n");
8370 return -ENODEV;
8471 }
85
- map = syscon_node_to_regmap(parent->of_node);
72
+ map = syscon_node_to_regmap(dev_of_node(parent));
8673 if (IS_ERR(map)) {
8774 dev_err(dev, "no regmap for syscon LED parent\n");
8875 return PTR_ERR(map);
....@@ -98,10 +85,6 @@
9885 return -EINVAL;
9986 if (of_property_read_u32(np, "mask", &sled->mask))
10087 return -EINVAL;
101
- sled->cdev.name =
102
- of_get_property(np, "label", NULL) ? : np->name;
103
- sled->cdev.default_trigger =
104
- of_get_property(np, "linux,default-trigger", NULL);
10588
10689 state = of_get_property(np, "default-state", NULL);
10790 if (state) {
....@@ -129,7 +112,9 @@
129112 }
130113 sled->cdev.brightness_set = syscon_led_set;
131114
132
- ret = led_classdev_register(dev, &sled->cdev);
115
+ init_data.fwnode = of_fwnode_handle(np);
116
+
117
+ ret = devm_led_classdev_register_ext(dev, &sled->cdev, &init_data);
133118 if (ret < 0)
134119 return ret;
135120