public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] gpio: tegra186: Simplify GPIO line name prefix handling
@ 2026-02-17  8:14 Prathamesh Shete
  2026-02-17  8:14 ` [PATCH v2 2/2] gpio: tegra186: Support multi-socket devices Prathamesh Shete
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Prathamesh Shete @ 2026-02-17  8:14 UTC (permalink / raw)
  To: linusw, brgl, thierry.reding, jonathanh, linux-gpio, linux-tegra,
	linux-kernel
  Cc: pshete

Introduce TEGRA_GPIO_PREFIX() to define the Tegra SoC GPIO name
prefix in one place. Use it for the Tegra410 COMPUTE and SYSTEM
controllers so the prefix is "COMPUTE-" and "SYSTEM-" respectively.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
---
Changes in v2:
  * Split the v1 patch into two; this one to simplify prefix handling.
---
 drivers/gpio/gpio-tegra186.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index 9c874f07be75..f04cc240b5ec 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -942,12 +942,8 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
 		char *name;
 
 		for (j = 0; j < port->pins; j++) {
-			if (gpio->soc->prefix)
-				name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "%s-P%s.%02x",
-						      gpio->soc->prefix, port->name, j);
-			else
-				name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "P%s.%02x",
-						      port->name, j);
+			name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "%sP%s.%02x",
+					      gpio->soc->prefix ?: "", port->name, j);
 			if (!name)
 				return -ENOMEM;
 
@@ -1373,6 +1369,9 @@ static const struct tegra_gpio_soc tegra256_main_soc = {
 	.has_vm_support = true,
 };
 
+/* Macro to define GPIO name prefix with separator */
+#define TEGRA_GPIO_PREFIX(_x)	_x "-"
+
 #define TEGRA410_COMPUTE_GPIO_PORT(_name, _bank, _port, _pins)	\
 	TEGRA_GPIO_PORT(TEGRA410_COMPUTE, _name, _bank, _port, _pins)
 
@@ -1388,7 +1387,7 @@ static const struct tegra_gpio_soc tegra410_compute_soc = {
 	.num_ports = ARRAY_SIZE(tegra410_compute_ports),
 	.ports = tegra410_compute_ports,
 	.name = "tegra410-gpio-compute",
-	.prefix = "COMPUTE",
+	.prefix = TEGRA_GPIO_PREFIX("COMPUTE"),
 	.num_irqs_per_bank = 8,
 	.instance = 0,
 };
@@ -1418,7 +1417,7 @@ static const struct tegra_gpio_soc tegra410_system_soc = {
 	.num_ports = ARRAY_SIZE(tegra410_system_ports),
 	.ports = tegra410_system_ports,
 	.name = "tegra410-gpio-system",
-	.prefix = "SYSTEM",
+	.prefix = TEGRA_GPIO_PREFIX("SYSTEM"),
 	.num_irqs_per_bank = 8,
 	.instance = 0,
 };
-- 
2.43.0


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

end of thread, other threads:[~2026-02-23  9:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17  8:14 [PATCH v2 1/2] gpio: tegra186: Simplify GPIO line name prefix handling Prathamesh Shete
2026-02-17  8:14 ` [PATCH v2 2/2] gpio: tegra186: Support multi-socket devices Prathamesh Shete
2026-02-17  9:34   ` Jon Hunter
2026-02-17 10:06   ` Thierry Reding
2026-02-17  9:34 ` [PATCH v2 1/2] gpio: tegra186: Simplify GPIO line name prefix handling Jon Hunter
2026-02-17 10:04 ` Thierry Reding
2026-02-17 12:17 ` Bartosz Golaszewski
2026-02-17 13:29   ` Jon Hunter
2026-02-17 14:06     ` Bartosz Golaszewski
2026-02-23  9:57 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox