diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2021-09-21 07:39:36 +0300 |
---|---|---|
committer | Joel Stanley <joel@jms.id.au> | 2021-09-24 07:37:17 +0300 |
commit | cf06e1ab1c3ed354da5873e646f2164fea147c88 (patch) | |
tree | dc70626988ed0ff021b987b430607354028b18f4 | |
parent | d50442f77fe4bd042e6641c1aee7b1500b35412d (diff) | |
download | linux-cf06e1ab1c3ed354da5873e646f2164fea147c88.tar.xz |
leds: pca955x: Allow zero LEDs to be specified
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.
OpenBMC-Staging-Count: 1
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210921043936.468001-3-andrew@aj.id.au
Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r-- | drivers/leds/leds-pca955x.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |