* [PATCH v3] gpio: tegra186: fix resource handling in ACPI probe path
@ 2025-03-27 3:23 Guixin Liu
2025-04-03 12:09 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Guixin Liu @ 2025-03-27 3:23 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Thierry Reding,
Jonathan Hunter
Cc: linux-gpio, linux-tegra, stable
When the Tegra186 GPIO controller is probed through ACPI matching,
the driver emits two error messages during probing:
"tegra186-gpio NVDA0508:00: invalid resource (null)"
"tegra186-gpio NVDA0508:00: invalid resource (null)"
Fix this by getting resource first and then do the ioremap.
Fixes: 2606e7c9f5fc ("gpio: tegra186: Add ACPI support")
Cc: stable@vger.kernel.org
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
Changes from v2 to v3:
- Add "CC: stable" to commit body.
Changes from v1 to v2:
- Add "Fixes" to commit body.
drivers/gpio/gpio-tegra186.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index 6895b65c86af..d27bfac6c9f5 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -823,6 +823,7 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
struct gpio_irq_chip *irq;
struct tegra_gpio *gpio;
struct device_node *np;
+ struct resource *res;
char **names;
int err;
@@ -842,19 +843,19 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
gpio->num_banks++;
/* get register apertures */
- gpio->secure = devm_platform_ioremap_resource_byname(pdev, "security");
- if (IS_ERR(gpio->secure)) {
- gpio->secure = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(gpio->secure))
- return PTR_ERR(gpio->secure);
- }
-
- gpio->base = devm_platform_ioremap_resource_byname(pdev, "gpio");
- if (IS_ERR(gpio->base)) {
- gpio->base = devm_platform_ioremap_resource(pdev, 1);
- if (IS_ERR(gpio->base))
- return PTR_ERR(gpio->base);
- }
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "security");
+ if (!res)
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ gpio->secure = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(gpio->secure))
+ return PTR_ERR(gpio->secure);
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpio");
+ if (!res)
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ gpio->base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(gpio->base))
+ return PTR_ERR(gpio->base);
err = platform_irq_count(pdev);
if (err < 0)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] gpio: tegra186: fix resource handling in ACPI probe path
2025-03-27 3:23 [PATCH v3] gpio: tegra186: fix resource handling in ACPI probe path Guixin Liu
@ 2025-04-03 12:09 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2025-04-03 12:09 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Thierry Reding,
Jonathan Hunter, Guixin Liu
Cc: Bartosz Golaszewski, linux-gpio, linux-tegra, stable
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Thu, 27 Mar 2025 11:23:49 +0800, Guixin Liu wrote:
> When the Tegra186 GPIO controller is probed through ACPI matching,
> the driver emits two error messages during probing:
> "tegra186-gpio NVDA0508:00: invalid resource (null)"
> "tegra186-gpio NVDA0508:00: invalid resource (null)"
>
> Fix this by getting resource first and then do the ioremap.
>
> [...]
Applied, thanks!
[1/1] gpio: tegra186: fix resource handling in ACPI probe path
commit: 380c913737edb4ec03974f653feee6cbfbb7e013
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-03 12:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27 3:23 [PATCH v3] gpio: tegra186: fix resource handling in ACPI probe path Guixin Liu
2025-04-03 12:09 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox