summaryrefslogtreecommitdiffstats
path: root/drivers/led/led-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/led/led-gpio.c')
-rw-r--r--drivers/led/led-gpio.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c
index 5055b82381..c0d14256d3 100644
--- a/drivers/led/led-gpio.c
+++ b/drivers/led/led-gpio.c
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* gpio LED support for barebox
*
* (C) Copyright 2010 Sascha Hauer, Pengutronix
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <common.h>
#include <init.h>
@@ -202,20 +192,20 @@ void led_gpio_rgb_unregister(struct gpio_rgb_led *led)
#endif /* CONFIG_LED_GPIO_RGB */
#ifdef CONFIG_LED_GPIO_OF
-static int led_gpio_of_probe(struct device_d *dev)
+static int led_gpio_of_probe(struct device *dev)
{
struct device_node *child;
struct gpio_led *leds;
int num_leds;
int ret = 0, n = 0;
- num_leds = of_get_child_count(dev->device_node);
+ num_leds = of_get_child_count(dev->of_node);
if (num_leds <= 0)
return num_leds;
leds = xzalloc(num_leds * sizeof(struct gpio_led));
- for_each_child_of_node(dev->device_node, child) {
+ for_each_child_of_node(dev->of_node, child) {
struct gpio_led *gled = &leds[n];
const char *default_state;
enum of_gpio_flags flags;
@@ -224,10 +214,7 @@ static int led_gpio_of_probe(struct device_d *dev)
gpio = of_get_named_gpio_flags(child, "gpios", 0, &flags);
if (gpio < 0) {
- if (gpio != -EPROBE_DEFER)
- dev_err(dev, "failed to get gpio for %s: %d\n",
- child->full_name, gpio);
- ret = gpio;
+ ret = dev_err_probe(dev, gpio, "getting gpio for %pOF\n", child);
goto err;
}
@@ -267,8 +254,9 @@ static struct of_device_id led_gpio_of_ids[] = {
{ .compatible = "gpio-leds", },
{ }
};
+MODULE_DEVICE_TABLE(of, led_gpio_of_ids);
-static struct driver_d led_gpio_of_driver = {
+static struct driver led_gpio_of_driver = {
.name = "gpio-leds",
.probe = led_gpio_of_probe,
.of_compatible = DRV_OF_COMPAT(led_gpio_of_ids),