leds-ns2.c (8853c95e997e0a3621bd8718bdaded81ed37bc9a) | leds-ns2.c (99a013c840a05083fd82d220685af7579238bfa8) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * leds-ns2.c - Driver for the Network Space v2 (and parents) dual-GPIO LED 4 * 5 * Copyright (C) 2010 LaCie 6 * 7 * Author: Simon Guinot <sguinot@lacie.com> 8 * --- 237 unchanged lines hidden (view full) --- 246static int 247ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata) 248{ 249 struct device_node *np = dev_of_node(dev); 250 struct device_node *child; 251 struct ns2_led *led, *leds; 252 int ret, num_leds = 0; 253 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * leds-ns2.c - Driver for the Network Space v2 (and parents) dual-GPIO LED 4 * 5 * Copyright (C) 2010 LaCie 6 * 7 * Author: Simon Guinot <sguinot@lacie.com> 8 * --- 237 unchanged lines hidden (view full) --- 246static int 247ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata) 248{ 249 struct device_node *np = dev_of_node(dev); 250 struct device_node *child; 251 struct ns2_led *led, *leds; 252 int ret, num_leds = 0; 253 |
254 num_leds = of_get_child_count(np); | 254 num_leds = of_get_available_child_count(np); |
255 if (!num_leds) 256 return -ENODEV; 257 258 leds = devm_kcalloc(dev, num_leds, sizeof(struct ns2_led), 259 GFP_KERNEL); 260 if (!leds) 261 return -ENOMEM; 262 263 led = leds; | 255 if (!num_leds) 256 return -ENODEV; 257 258 leds = devm_kcalloc(dev, num_leds, sizeof(struct ns2_led), 259 GFP_KERNEL); 260 if (!leds) 261 return -ENOMEM; 262 263 led = leds; |
264 for_each_child_of_node(np, child) { | 264 for_each_available_child_of_node(np, child) { |
265 const char *string; 266 int i, num_modes; 267 struct ns2_led_modval *modval; 268 struct gpio_desc *gd; 269 270 ret = of_property_read_string(child, "label", &string); 271 led->name = (ret == 0) ? string : child->name; 272 --- 150 unchanged lines hidden --- | 265 const char *string; 266 int i, num_modes; 267 struct ns2_led_modval *modval; 268 struct gpio_desc *gd; 269 270 ret = of_property_read_string(child, "label", &string); 271 led->name = (ret == 0) ? string : child->name; 272 --- 150 unchanged lines hidden --- |