diff options
author | Marek BehĂșn <marek.behun@nic.cz> | 2020-09-18 01:33:08 +0300 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 2020-09-26 22:56:40 +0300 |
commit | eed951bbf737bb728006b1d248af6341abf79cd8 (patch) | |
tree | bd3b080b67e0f3f3164f77e323c61b923a283a5a /drivers/leds/leds-pm8058.c | |
parent | b23ca98af6114ee24b3ba085514677db4bfda53c (diff) | |
download | linux-eed951bbf737bb728006b1d248af6341abf79cd8.tar.xz |
leds: pm8058: use struct led_init_data when registering
By using struct led_init_data when registering we do not need to parse
`label` DT property. Moreover `label` is deprecated and if it is not
present but `color` and `function` are, LED core will compose a name
from these properties instead.
Signed-off-by: Marek BehĂșn <marek.behun@nic.cz>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds/leds-pm8058.c')
-rw-r--r-- | drivers/leds/leds-pm8058.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c index 69a7f7e63ea7..f19bd0563ee5 100644 --- a/drivers/leds/leds-pm8058.c +++ b/drivers/leds/leds-pm8058.c @@ -87,6 +87,7 @@ static enum led_brightness pm8058_led_get(struct led_classdev *cled) static int pm8058_led_probe(struct platform_device *pdev) { + struct led_init_data init_data = {}; struct pm8058_led *led; struct device_node *np = dev_of_node(&pdev->dev); int ret; @@ -113,8 +114,6 @@ static int pm8058_led_probe(struct platform_device *pdev) return -EINVAL; } - /* Use label else node name */ - led->cdev.name = of_get_property(np, "label", NULL) ? : np->name; led->cdev.default_trigger = of_get_property(np, "linux,default-trigger", NULL); led->cdev.brightness_set = pm8058_led_set; @@ -142,10 +141,12 @@ static int pm8058_led_probe(struct platform_device *pdev) led->ledtype == PM8058_LED_TYPE_FLASH) led->cdev.flags = LED_CORE_SUSPENDRESUME; - ret = devm_led_classdev_register(&pdev->dev, &led->cdev); + init_data.fwnode = of_fwnode_handle(np); + + ret = devm_led_classdev_register_ext(&pdev->dev, &led->cdev, + &init_data); if (ret) { - dev_err(&pdev->dev, "unable to register led \"%s\"\n", - led->cdev.name); + dev_err(&pdev->dev, "Failed to register LED for %pOF\n", np); return ret; } |