linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] gpio: omap: Give unique labels to each GPIO bank/chip
@ 2018-01-02 10:32 Linus Walleij
  2018-01-12 20:43 ` Grygorii Strashko
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2018-01-02 10:32 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
	linux-omap

As we need to add GPIO lookup tables to the OMAP platforms, we
need to reference each GPIO chip with a unique label. Use the GPIO
base to name each chip, "gpio-0-31", "gpio-32-63" etc.

Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Kevin Hilman <khilman@kernel.org>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Break out errorpath fix to a separate patch.
---
 drivers/gpio/gpio-omap.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index d83e8624964a..ed07bbcede01 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1059,6 +1059,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
 static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
 {
 	static int gpio;
+	const char *label;
 	int irq_base = 0;
 	int ret;
 
@@ -1080,7 +1081,11 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
 			bank->chip.parent = &omap_mpuio_device.dev;
 		bank->chip.base = OMAP_MPUIO(0);
 	} else {
-		bank->chip.label = "gpio";
+		label = devm_kasprintf(bank->chip.parent, GFP_KERNEL, "gpio-%d-%d",
+				       gpio, gpio + bank->width - 1);
+		if (!label)
+			return -ENOMEM;
+		bank->chip.label = label;
 		bank->chip.base = gpio;
 	}
 	bank->chip.ngpio = bank->width;
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] gpio: omap: Give unique labels to each GPIO bank/chip
  2018-01-02 10:32 [PATCH v2] gpio: omap: Give unique labels to each GPIO bank/chip Linus Walleij
@ 2018-01-12 20:43 ` Grygorii Strashko
  0 siblings, 0 replies; 2+ messages in thread
From: Grygorii Strashko @ 2018-01-12 20:43 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio; +Cc: Santosh Shilimkar, Kevin Hilman, linux-omap



On 01/02/2018 04:32 AM, Linus Walleij wrote:
> As we need to add GPIO lookup tables to the OMAP platforms, we
> need to reference each GPIO chip with a unique label. Use the GPIO
> base to name each chip, "gpio-0-31", "gpio-32-63" etc.
> 
> Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Cc: Kevin Hilman <khilman@kernel.org>
> Cc: linux-omap@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Break out errorpath fix to a separate patch.
> ---
>   drivers/gpio/gpio-omap.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 

Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>

-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-12 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02 10:32 [PATCH v2] gpio: omap: Give unique labels to each GPIO bank/chip Linus Walleij
2018-01-12 20:43 ` Grygorii Strashko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).