.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Generic Syscon LEDs Driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2014, Linaro Limited |
---|
5 | 6 | * 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 |
---|
21 | 7 | */ |
---|
22 | 8 | #include <linux/io.h> |
---|
23 | 9 | #include <linux/init.h> |
---|
.. | .. |
---|
69 | 55 | |
---|
70 | 56 | static int syscon_led_probe(struct platform_device *pdev) |
---|
71 | 57 | { |
---|
| 58 | + struct led_init_data init_data = {}; |
---|
72 | 59 | struct device *dev = &pdev->dev; |
---|
73 | | - struct device_node *np = dev->of_node; |
---|
| 60 | + struct device_node *np = dev_of_node(dev); |
---|
74 | 61 | struct device *parent; |
---|
75 | 62 | struct regmap *map; |
---|
76 | 63 | struct syscon_led *sled; |
---|
.. | .. |
---|
82 | 69 | dev_err(dev, "no parent for syscon LED\n"); |
---|
83 | 70 | return -ENODEV; |
---|
84 | 71 | } |
---|
85 | | - map = syscon_node_to_regmap(parent->of_node); |
---|
| 72 | + map = syscon_node_to_regmap(dev_of_node(parent)); |
---|
86 | 73 | if (IS_ERR(map)) { |
---|
87 | 74 | dev_err(dev, "no regmap for syscon LED parent\n"); |
---|
88 | 75 | return PTR_ERR(map); |
---|
.. | .. |
---|
98 | 85 | return -EINVAL; |
---|
99 | 86 | if (of_property_read_u32(np, "mask", &sled->mask)) |
---|
100 | 87 | 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); |
---|
105 | 88 | |
---|
106 | 89 | state = of_get_property(np, "default-state", NULL); |
---|
107 | 90 | if (state) { |
---|
.. | .. |
---|
129 | 112 | } |
---|
130 | 113 | sled->cdev.brightness_set = syscon_led_set; |
---|
131 | 114 | |
---|
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); |
---|
133 | 118 | if (ret < 0) |
---|
134 | 119 | return ret; |
---|
135 | 120 | |
---|