All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jeffery <andrew@aj.id.au>
To: linux-leds@vger.kernel.org, linux-gpio@vger.kernel.org
Cc: clg@kaod.org, robh+dt@kernel.org, joel@jms.id.au, pavel@ucw.cz,
	linus.walleij@linaro.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	andy.shevchenko@gmail.com
Subject: [PATCH 2/2] leds: pca955x: Allow zero LEDs to be specified
Date: Tue, 21 Sep 2021 14:09:36 +0930	[thread overview]
Message-ID: <20210921043936.468001-3-andrew@aj.id.au> (raw)
In-Reply-To: <20210921043936.468001-1-andrew@aj.id.au>

It's valid to use the PCA955x devices just for GPIOs and not for LEDs.
In this case, as PCA955X_TYPE_GPIO is now equivalent to
PCA955X_TYPE_NONE, remove the test for whether we have any child nodes
specified in the devicetree.

A consequence of this is it's now possible to bind the driver to a
PCA955x device when dynamically instantiated through the I2C subsystem's
`new_device` interface.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 drivers/leds/leds-pca955x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index 77c0f461ab95..81aaf21212d7 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -429,7 +429,7 @@ pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip)
 	int count;
 
 	count = device_get_child_node_count(&client->dev);
-	if (!count || count > chip->bits)
+	if (count > chip->bits)
 		return ERR_PTR(-ENODEV);
 
 	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: Andrew Jeffery <andrew@aj.id.au>
To: linux-leds@vger.kernel.org, linux-gpio@vger.kernel.org
Cc: clg@kaod.org, robh+dt@kernel.org, joel@jms.id.au, pavel@ucw.cz,
	linus.walleij@linaro.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	andy.shevchenko@gmail.com
Subject: [PATCH 2/2] leds: pca955x: Allow zero LEDs to be specified
Date: Tue, 21 Sep 2021 14:09:36 +0930	[thread overview]
Message-ID: <20210921043936.468001-3-andrew@aj.id.au> (raw)
In-Reply-To: <20210921043936.468001-1-andrew@aj.id.au>

It's valid to use the PCA955x devices just for GPIOs and not for LEDs.
In this case, as PCA955X_TYPE_GPIO is now equivalent to
PCA955X_TYPE_NONE, remove the test for whether we have any child nodes
specified in the devicetree.

A consequence of this is it's now possible to bind the driver to a
PCA955x device when dynamically instantiated through the I2C subsystem's
`new_device` interface.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 drivers/leds/leds-pca955x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index 77c0f461ab95..81aaf21212d7 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -429,7 +429,7 @@ pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip)
 	int count;
 
 	count = device_get_child_node_count(&client->dev);
-	if (!count || count > chip->bits)
+	if (count > chip->bits)
 		return ERR_PTR(-ENODEV);
 
 	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-09-21  4:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21  4:39 [PATCH 0/2] leds: pca955x: Expose GPIOs for all pins Andrew Jeffery
2021-09-21  4:39 ` Andrew Jeffery
2021-09-21  4:39 ` [PATCH 1/2] leds: pca955x: Make the gpiochip always expose " Andrew Jeffery
2021-09-21  4:39   ` Andrew Jeffery
2021-11-01  2:07   ` Andrew Jeffery
2021-11-01  2:07     ` Andrew Jeffery
2021-11-09 11:03   ` Linus Walleij
2021-11-09 11:03     ` Linus Walleij
2021-11-16  2:44     ` Joel Stanley
2021-11-16  2:44       ` Joel Stanley
2021-09-21  4:39 ` Andrew Jeffery [this message]
2021-09-21  4:39   ` [PATCH 2/2] leds: pca955x: Allow zero LEDs to be specified Andrew Jeffery
2021-09-21 12:10 ` [PATCH 0/2] leds: pca955x: Expose GPIOs for all pins Andy Shevchenko
2021-09-21 12:10   ` Andy Shevchenko
2021-09-23 21:48 ` Linus Walleij
2021-09-23 21:48   ` Linus Walleij
2021-09-24  3:49 ` Joel Stanley
2021-09-24  3:49   ` Joel Stanley
2021-09-24  6:41 ` Cédric Le Goater
2022-02-21  7:33   ` Joel Stanley
2022-02-21  7:33     ` Joel Stanley
2022-03-02  8:54     ` Pavel Machek
2022-03-02  8:54       ` Pavel Machek
2022-03-03  0:30       ` Andrew Jeffery
2022-03-03  0:30         ` Andrew Jeffery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210921043936.468001-3-andrew@aj.id.au \
    --to=andrew@aj.id.au \
    --cc=andy.shevchenko@gmail.com \
    --cc=clg@kaod.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.