Skip to content

Commit

Permalink
leds: pca955x: Allow zero LEDs to be specified
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
  • Loading branch information
Andrew Jeffery authored and Pavel Machek committed Mar 2, 2022
1 parent ca38625 commit e26557a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/leds/leds-pca955x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e26557a

Please sign in to comment.