2021-11-13 21:11:26

by Sander Vanheule

[permalink] [raw]
Subject: [PATCH] leds: led-core: Update fwnode with device_set_node

Update a newly created device's fwnode and of_node pointers using the
recently added device_set_node helper. This keeps some firmware node
specifics out of led-class and should help tracking future changes
regarding device firmware node updates.

Signed-off-by: Sander Vanheule <[email protected]>
---
drivers/leds/led-class.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index f4bb02f6e042..6a8ea94834fa 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -375,10 +375,8 @@ int led_classdev_register_ext(struct device *parent,
mutex_unlock(&led_cdev->led_access);
return PTR_ERR(led_cdev->dev);
}
- if (init_data && init_data->fwnode) {
- led_cdev->dev->fwnode = init_data->fwnode;
- led_cdev->dev->of_node = to_of_node(init_data->fwnode);
- }
+ if (init_data && init_data->fwnode)
+ device_set_node(led_cdev->dev, init_data->fwnode);

if (ret)
dev_warn(parent, "Led %s renamed to %s due to name collision",
--
2.33.1



2021-11-15 14:12:30

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] leds: led-core: Update fwnode with device_set_node

On Sat 2021-11-13 22:11:13, Sander Vanheule wrote:
> Update a newly created device's fwnode and of_node pointers using the
> recently added device_set_node helper. This keeps some firmware node
> specifics out of led-class and should help tracking future changes
> regarding device firmware node updates.
>
> Signed-off-by: Sander Vanheule <[email protected]>

Thanks, applied.
Pavel

> ---
> drivers/leds/led-class.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index f4bb02f6e042..6a8ea94834fa 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -375,10 +375,8 @@ int led_classdev_register_ext(struct device *parent,
> mutex_unlock(&led_cdev->led_access);
> return PTR_ERR(led_cdev->dev);
> }
> - if (init_data && init_data->fwnode) {
> - led_cdev->dev->fwnode = init_data->fwnode;
> - led_cdev->dev->of_node = to_of_node(init_data->fwnode);
> - }
> + if (init_data && init_data->fwnode)
> + device_set_node(led_cdev->dev, init_data->fwnode);
>
> if (ret)
> dev_warn(parent, "Led %s renamed to %s due to name collision",
> --
> 2.33.1

--
http://www.livejournal.com/~pavelmachek


Attachments:
(No filename) (1.21 kB)
signature.asc (195.00 B)
Download all attachments