All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Sekhar Nori <nsekhar@ti.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 1/3 v6] gpio: pcf857x: Name instance after dev_name()
Date: Thu, 15 Jul 2021 21:11:39 +0200	[thread overview]
Message-ID: <20210715191141.430307-1-linus.walleij@linaro.org> (raw)

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 <nsekhar@ti.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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


WARNING: multiple messages have this Message-ID (diff)
From: Linus Walleij <linus.walleij@linaro.org>
To: Sekhar Nori <nsekhar@ti.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 1/3 v6] gpio: pcf857x: Name instance after dev_name()
Date: Thu, 15 Jul 2021 21:11:39 +0200	[thread overview]
Message-ID: <20210715191141.430307-1-linus.walleij@linaro.org> (raw)

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 <nsekhar@ti.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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


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

             reply	other threads:[~2021-07-15 19:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 19:11 Linus Walleij [this message]
2021-07-15 19:11 ` [PATCH 1/3 v6] gpio: pcf857x: Name instance after dev_name() Linus Walleij
2021-07-15 19:11 ` [PATCH 2/3 v6] ARM: davinci: dm644x: Convert LEDs to GPIO descriptor table Linus Walleij
2021-07-15 19:11   ` Linus Walleij
2021-07-15 19:11 ` [PATCH 3/3 v6] ARM: davinci: dm646x: " Linus Walleij
2021-07-15 19:11   ` Linus Walleij
2021-07-16  8:14 ` [PATCH 1/3 v6] gpio: pcf857x: Name instance after dev_name() Bartosz Golaszewski
2021-07-16  8:14   ` Bartosz Golaszewski

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=20210715191141.430307-1-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /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.