Commit 99a013c8 authored by Marek Behún's avatar Marek Behún Committed by Pavel Machek
Browse files

leds: various: use only available OF children



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: default avatarMarek Behún <marek.behun@nic.cz>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Andrey Utkin <andrey_utkin@fastmail.com>
Cc: Baolin Wang <baolin.wang7@gmail.com>
Cc: Baolin Wang <baolin.wang@linaro.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christian Mauderer <oss@c-mauderer.de>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: David Rivshin <drivshin@allworx.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Milo Kim <milo.kim@ti.com>
Cc: NeilBrown <neilb@suse.de>
Cc: Nikita Travkin <nikitos.tr@gmail.com>
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Philippe Retornaz <philippe.retornaz@epfl.ch>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Simon Guinot <sguinot@lacie.com>
Cc: Simon Shields <simon@lineageos.org>
Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Cc: Xiaotong Lu <xiaotong.lu@spreadtrum.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent 05dec742
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ static int pm860x_led_dt_init(struct platform_device *pdev,
		dev_err(&pdev->dev, "failed to find leds node\n");
		return -ENODEV;
	}
	for_each_child_of_node(nproot, np) {
	for_each_available_child_of_node(nproot, np) {
		if (of_node_name_eq(np, data->name)) {
			of_property_read_u32(np, "marvell,88pm860x-iset",
					     &iset);
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ static int an30259a_dt_init(struct i2c_client *client,
	const char *str;
	struct an30259a_led *led;

	count = of_get_child_count(np);
	count = of_get_available_child_count(np);
	if (!count || count > AN30259A_MAX_LEDS)
		return -EINVAL;

+1 −1
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static int aw2013_probe_dt(struct aw2013 *chip)
	int count, ret = 0, i = 0;
	struct aw2013_led *led;

	count = of_get_child_count(np);
	count = of_get_available_child_count(np);
	if (!count || count > AW2013_MAX_LEDS)
		return -EINVAL;

+2 −2
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ static int is31fl319x_parse_dt(struct device *dev,

	is31->cdef = device_get_match_data(dev);

	count = of_get_child_count(np);
	count = of_get_available_child_count(np);

	dev_dbg(dev, "probing with %d leds defined in DT\n", count);

@@ -230,7 +230,7 @@ static int is31fl319x_parse_dt(struct device *dev,
		return -ENODEV;
	}

	for_each_child_of_node(np, child) {
	for_each_available_child_of_node(np, child) {
		struct is31fl319x_led *led;
		u32 reg;

+2 −2
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ static int is31fl32xx_parse_dt(struct device *dev,
	struct device_node *child;
	int ret = 0;

	for_each_child_of_node(dev_of_node(dev), child) {
	for_each_available_child_of_node(dev_of_node(dev), child) {
		struct is31fl32xx_led_data *led_data =
			&priv->leds[priv->num_leds];
		const struct is31fl32xx_led_data *other_led_data;
@@ -435,7 +435,7 @@ static int is31fl32xx_probe(struct i2c_client *client,

	cdef = device_get_match_data(dev);

	count = of_get_child_count(dev_of_node(dev));
	count = of_get_available_child_count(dev_of_node(dev));
	if (!count)
		return -EINVAL;

Loading