diff options
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r-- | drivers/leds/leds-gpio.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index c032b2180340..087d1e66f4f7 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/workqueue.h> | 21 | #include <linux/workqueue.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/pinctrl/consumer.h> | ||
23 | 24 | ||
24 | struct gpio_led_data { | 25 | struct gpio_led_data { |
25 | struct led_classdev cdev; | 26 | struct led_classdev cdev; |
@@ -170,11 +171,10 @@ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_dev | |||
170 | { | 171 | { |
171 | struct device_node *np = pdev->dev.of_node, *child; | 172 | struct device_node *np = pdev->dev.of_node, *child; |
172 | struct gpio_leds_priv *priv; | 173 | struct gpio_leds_priv *priv; |
173 | int count = 0, ret; | 174 | int count, ret; |
174 | 175 | ||
175 | /* count LEDs in this device, so we know how much to allocate */ | 176 | /* count LEDs in this device, so we know how much to allocate */ |
176 | for_each_child_of_node(np, child) | 177 | count = of_get_child_count(np); |
177 | count++; | ||
178 | if (!count) | 178 | if (!count) |
179 | return NULL; | 179 | return NULL; |
180 | 180 | ||
@@ -228,7 +228,6 @@ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_dev | |||
228 | { | 228 | { |
229 | return NULL; | 229 | return NULL; |
230 | } | 230 | } |
231 | #define of_gpio_leds_match NULL | ||
232 | #endif /* CONFIG_OF_GPIO */ | 231 | #endif /* CONFIG_OF_GPIO */ |
233 | 232 | ||
234 | 233 | ||
@@ -236,8 +235,14 @@ static int __devinit gpio_led_probe(struct platform_device *pdev) | |||
236 | { | 235 | { |
237 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | 236 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; |
238 | struct gpio_leds_priv *priv; | 237 | struct gpio_leds_priv *priv; |
238 | struct pinctrl *pinctrl; | ||
239 | int i, ret = 0; | 239 | int i, ret = 0; |
240 | 240 | ||
241 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
242 | if (IS_ERR(pinctrl)) | ||
243 | dev_warn(&pdev->dev, | ||
244 | "pins are not configured from the driver\n"); | ||
245 | |||
241 | if (pdata && pdata->num_leds) { | 246 | if (pdata && pdata->num_leds) { |
242 | priv = devm_kzalloc(&pdev->dev, | 247 | priv = devm_kzalloc(&pdev->dev, |
243 | sizeof_gpio_leds_priv(pdata->num_leds), | 248 | sizeof_gpio_leds_priv(pdata->num_leds), |
@@ -270,13 +275,13 @@ static int __devinit gpio_led_probe(struct platform_device *pdev) | |||
270 | 275 | ||
271 | static int __devexit gpio_led_remove(struct platform_device *pdev) | 276 | static int __devexit gpio_led_remove(struct platform_device *pdev) |
272 | { | 277 | { |
273 | struct gpio_leds_priv *priv = dev_get_drvdata(&pdev->dev); | 278 | struct gpio_leds_priv *priv = platform_get_drvdata(pdev); |
274 | int i; | 279 | int i; |
275 | 280 | ||
276 | for (i = 0; i < priv->num_leds; i++) | 281 | for (i = 0; i < priv->num_leds; i++) |
277 | delete_gpio_led(&priv->leds[i]); | 282 | delete_gpio_led(&priv->leds[i]); |
278 | 283 | ||
279 | dev_set_drvdata(&pdev->dev, NULL); | 284 | platform_set_drvdata(pdev, NULL); |
280 | 285 | ||
281 | return 0; | 286 | return 0; |
282 | } | 287 | } |
@@ -287,7 +292,7 @@ static struct platform_driver gpio_led_driver = { | |||
287 | .driver = { | 292 | .driver = { |
288 | .name = "leds-gpio", | 293 | .name = "leds-gpio", |
289 | .owner = THIS_MODULE, | 294 | .owner = THIS_MODULE, |
290 | .of_match_table = of_gpio_leds_match, | 295 | .of_match_table = of_match_ptr(of_gpio_leds_match), |
291 | }, | 296 | }, |
292 | }; | 297 | }; |
293 | 298 | ||