Skip to contentSkip to conversation

gpio: ftgpio010: use device name for gpiochip name & label

PATCH Applied Jeremy Kerr 3 participants 5 messages Oct 24, 2022 – Oct 26, 2022 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: ftgpio010: use device name for gpiochip name & label

Currently, we use just the fixed string "FTGPIO010" as the gpiochip name for ftgpio010 drivers. Because it's fixed, this means we cannot distinguish multiple ftgpio010 devices present on a single system.

This change uses the dev_name() instead, which should be unique between multiple instances.

---
 drivers/gpio/gpio-ftgpio010.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-ftgpio010.c +1 -1
index f77a965f5780..2728672ef9f8 100644
@@ -277,7 +277,7 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
 		dev_err(dev, "unable to init generic GPIO\n");
 		goto dis_clk;
 	}
-	g->gc.label = "FTGPIO010";
+	g->gc.label = dev_name(dev);
 	g->gc.base = -1;
 	g->gc.parent = dev;
 	g->gc.owner = THIS_MODULE;
Signature · 1 line
2.35.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jeremy Kerr

Currently, we use just the fixed string "FTGPIO010" as the gpiochip name for ftgpio010 drivers. Because it's fixed, this means we cannot distinguish multiple ftgpio010 devices present on a single system.

This change uses the dev_name() instead, which should be unique between multiple instances.

Fine by me:

Out of curiosity: what device/SoC are you using this driver with?

Yours,
Linus Walleij

#2 lore raw

Hi Linus,

Quoted 4 lines

Fine by me:

Out of curiosity: what device/SoC are you using this driver with?

Thanks for the review.

We're using the ftgpio driver for GPIO peripherals on the microwatt CPU implementation; the driver uses a simple & sensible register layout, so we've based the gateware on that:

https://github.com/CodeConstruct/microwatt/commit/03293903

That's a fairly arbitrary choice, but it works well as-is.

Cheers,

Jeremy

#3 lore raw
Quoted 11 lines · Jeremy Kerr
Quoted 1 line

Out of curiosity: what device/SoC are you using this driver with?

Thanks for the review.

We're using the ftgpio driver for GPIO peripherals on the microwatt CPU implementation; the driver uses a simple & sensible register layout, so we've based the gateware on that:

https://github.com/CodeConstruct/microwatt/commit/03293903

That's a fairly arbitrary choice, but it works well as-is.

Haha that was a clever choice, adjust the reality after the map :D

I could have done it myself!

Yours,
Linus Walleij

#4 lore raw
In reply to Jeremy Kerr
Quoted 27 lines · Jeremy Kerr

Currently, we use just the fixed string "FTGPIO010" as the gpiochip name for ftgpio010 drivers. Because it's fixed, this means we cannot distinguish multiple ftgpio010 devices present on a single system.

This change uses the dev_name() instead, which should be unique between multiple instances.

---
 drivers/gpio/gpio-ftgpio010.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-ftgpio010.c +1 -2
index f77a965f5780..2728672ef9f8 100644
@@ -277,7 +277,7 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
                dev_err(dev, "unable to init generic GPIO\n");
                goto dis_clk;
        }
-       g->gc.label = "FTGPIO010";
+       g->gc.label = dev_name(dev);
        g->gc.base = -1;
        g->gc.parent = dev;
        g->gc.owner = THIS_MODULE;
--
Quoted 2 lines

2.35.1

Applied, thanks!

Bart