Thread (4 messages) flat view 4 messages, 2 authors, 2021-07-16

Re: [PATCH 1/3 v6] gpio: pcf857x: Name instance after dev_name()

From: Bartosz Golaszewski <hidden>
Date: 2021-07-16 08:14:30
Also in: linux-gpio

On Thu, Jul 15, 2021 at 9:13 PM Linus Walleij [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Put the label on this gpio_chip from the dev_name() instead of
the client name.

The client name will be pcf8574 etc for all instances even if
there are several chips on a system.

This manifests on the DaVinci DM6467 (non-devicetree) which
will contain 3 different pcf8574 devices that as a result cannot
be told apart because they are all named "pcf8574", affecting
the GPIO descriptor tables which need a unique label per chip.

By passing in .dev_name in the struct i2c_board_info we can
explicitly name each instance and use that to discern the chips
when using board files.

Cc: Sekhar Nori <redacted>
Cc: Bartosz Golaszewski <redacted>
Signed-off-by: Linus Walleij <redacted>
---
ChangeLog v5->v6:
- Rebase on v5.14-rc1
ChangeLog ->v5:
- New patch to deal with the chip label
---
 drivers/gpio/gpio-pcf857x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index b7568ee33696..2271ec86e414 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -311,7 +311,7 @@ static int pcf857x_probe(struct i2c_client *client,
        if (status < 0)
                goto fail;

-       gpio->chip.label = client->name;
+       gpio->chip.label = dev_name(&client->dev);

        gpio->client = client;
        i2c_set_clientdata(client, gpio);
--
2.31.1
Reviewed-by: Bartosz Golaszewski <redacted>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help