leds-tca6507.c (8853c95e997e0a3621bd8718bdaded81ed37bc9a) | leds-tca6507.c (99a013c840a05083fd82d220685af7579238bfa8) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * leds-tca6507 4 * 5 * The TCA6507 is a programmable LED controller that can drive 7 6 * separate lines either by holding them low, or by pulsing them 7 * with modulated width. 8 * The modulation can be varied in a simple pattern to produce a --- 680 unchanged lines hidden (view full) --- 689static struct tca6507_platform_data * 690tca6507_led_dt_init(struct i2c_client *client) 691{ 692 struct device_node *np = dev_of_node(&client->dev), *child; 693 struct tca6507_platform_data *pdata; 694 struct led_info *tca_leds; 695 int count; 696 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * leds-tca6507 4 * 5 * The TCA6507 is a programmable LED controller that can drive 7 6 * separate lines either by holding them low, or by pulsing them 7 * with modulated width. 8 * The modulation can be varied in a simple pattern to produce a --- 680 unchanged lines hidden (view full) --- 689static struct tca6507_platform_data * 690tca6507_led_dt_init(struct i2c_client *client) 691{ 692 struct device_node *np = dev_of_node(&client->dev), *child; 693 struct tca6507_platform_data *pdata; 694 struct led_info *tca_leds; 695 int count; 696 |
697 count = of_get_child_count(np); | 697 count = of_get_available_child_count(np); |
698 if (!count || count > NUM_LEDS) 699 return ERR_PTR(-ENODEV); 700 701 tca_leds = devm_kcalloc(&client->dev, 702 NUM_LEDS, sizeof(struct led_info), GFP_KERNEL); 703 if (!tca_leds) 704 return ERR_PTR(-ENOMEM); 705 | 698 if (!count || count > NUM_LEDS) 699 return ERR_PTR(-ENODEV); 700 701 tca_leds = devm_kcalloc(&client->dev, 702 NUM_LEDS, sizeof(struct led_info), GFP_KERNEL); 703 if (!tca_leds) 704 return ERR_PTR(-ENOMEM); 705 |
706 for_each_child_of_node(np, child) { | 706 for_each_available_child_of_node(np, child) { |
707 struct led_info led; 708 u32 reg; 709 int ret; 710 711 led.name = 712 of_get_property(child, "label", NULL) ? : child->name; 713 led.default_trigger = 714 of_get_property(child, "linux,default-trigger", NULL); --- 134 unchanged lines hidden --- | 707 struct led_info led; 708 u32 reg; 709 int ret; 710 711 led.name = 712 of_get_property(child, "label", NULL) ? : child->name; 713 led.default_trigger = 714 of_get_property(child, "linux,default-trigger", NULL); --- 134 unchanged lines hidden --- |