[PATCH 1/1] gpio: tegra186: Set fwnode of the GPIO chip

From: Dipen Patel
Date: Mon Oct 09 2023 - 13:39:18 EST


Any driver that depends on the GPIO match function to locate the GPIO
controller, it has to use the fwnode from the gpio_chip structure. But
with [1], it is GPIO providers job to set any members of the gpio_chip
structure. This patch addresses that.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux.git/patch/drivers/gpio/gpiolib.c?id=daecca4b8433d47f0db4933bcc0f283d530ba22e

Signed-off-by: Dipen Patel <dipenp@xxxxxxxxxx>
---
drivers/gpio/gpio-tegra186.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index d87dd06db40d..86ad34e07841 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -989,6 +989,12 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
offset += port->pins;
}

+ /*
+ * This is needed for driver using gpio device matching where it
+ * has to use gpio_chip fwnode to match the gpio controller.
+ */
+ gpio->gpio.fwnode = of_node_to_fwnode(pdev->dev.of_node);
+
return devm_gpiochip_add_data(&pdev->dev, &gpio->gpio, gpio);
}

--
2.25.1