From 99a013c840a05083fd82d220685af7579238bfa8 Mon Sep 17 00:00:00 2001 From: Marek BehĂșn Date: Fri, 18 Sep 2020 00:32:56 +0200 Subject: leds: various: use only available OF children MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Various drivers count and iterate over OF children nodes via of_get_child_count and for_each_child_of_node. Instead they should use of_get_available_child_count and for_each_available_child_of_node, so that if a given node has the `status` property set to `disabled`, the child will be ignored. Signed-off-by: Marek BehĂșn Cc: Andrew Lunn Cc: Andrey Utkin Cc: Baolin Wang Cc: Baolin Wang Cc: Benjamin Herrenschmidt Cc: Christian Mauderer Cc: Chunyan Zhang Cc: Dan Murphy Cc: David Rivshin Cc: Haojian Zhuang Cc: H. Nikolaus Schaller Cc: Michael Ellerman Cc: Milo Kim Cc: NeilBrown Cc: Nikita Travkin Cc: Orson Zhai Cc: Paul Mackerras Cc: Philippe Retornaz Cc: Riku Voipio Cc: Simon Guinot Cc: Simon Shields Cc: Vasant Hegde Cc: Xiaotong Lu Signed-off-by: Pavel Machek --- drivers/leds/leds-ns2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/leds/leds-ns2.c') diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 9cbd2d7251af..22d38c83b6dc 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c @@ -251,7 +251,7 @@ ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata) struct ns2_led *led, *leds; int ret, num_leds = 0; - num_leds = of_get_child_count(np); + num_leds = of_get_available_child_count(np); if (!num_leds) return -ENODEV; @@ -261,7 +261,7 @@ ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata) return -ENOMEM; led = leds; - for_each_child_of_node(np, child) { + for_each_available_child_of_node(np, child) { const char *string; int i, num_modes; struct ns2_led_modval *modval; -- cgit v1.2.3