2023-06-06 07:23:00

by Prathamesh Shete

[permalink] [raw]
Subject: [PATCH] gpio: tegra186: Check PMC driver status before any request

This patch fixes the issue where even if PMC driver status is
disabled still we are trying to look up for the IRQ domain
that PMC driver would've registered if it had been enabled.

Signed-off-by: Manish Bhardwaj <[email protected]>
Signed-off-by: Prathamesh Shete <[email protected]>
---
drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index 464b0ea3b6f1..80d08ddde40e 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -964,11 +964,15 @@ static int tegra186_gpio_probe(struct platform_device *pdev)

np = of_find_matching_node(NULL, tegra186_pmc_of_match);
if (np) {
- irq->parent_domain = irq_find_host(np);
- of_node_put(np);
-
- if (!irq->parent_domain)
- return -EPROBE_DEFER;
+ if (of_device_is_available(np)) {
+ irq->parent_domain = irq_find_host(np);
+ of_node_put(np);
+
+ if (!irq->parent_domain)
+ return -EPROBE_DEFER;
+ } else {
+ of_node_put(np);
+ }
}

irq->map = devm_kcalloc(&pdev->dev, gpio->gpio.ngpio,
--
2.17.1



2023-06-06 09:02:06

by Jon Hunter

[permalink] [raw]
Subject: Re: [PATCH] gpio: tegra186: Check PMC driver status before any request


On 06/06/2023 08:17, Prathamesh Shete wrote:
> This patch fixes the issue where even if PMC driver status is
> disabled still we are trying to look up for the IRQ domain
> that PMC driver would've registered if it had been enabled.

It might be clearer to say ...

When the PMC device is disabled, probing of the Tegra186 GPIO driver
fails because the IRQ domain that is registered by the PMC driver is not
found. Fix this by checking to see if the PMC device is enabled before
attempting to lookup the IRQ domain registered by the PMC.

Otherwise ...

Reviewed-by: Jon Hunter <[email protected]>

> Signed-off-by: Manish Bhardwaj <[email protected]>
> Signed-off-by: Prathamesh Shete <[email protected]>
> ---
> drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
> index 464b0ea3b6f1..80d08ddde40e 100644
> --- a/drivers/gpio/gpio-tegra186.c
> +++ b/drivers/gpio/gpio-tegra186.c
> @@ -964,11 +964,15 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
>
> np = of_find_matching_node(NULL, tegra186_pmc_of_match);
> if (np) {
> - irq->parent_domain = irq_find_host(np);
> - of_node_put(np);
> -
> - if (!irq->parent_domain)
> - return -EPROBE_DEFER;
> + if (of_device_is_available(np)) {
> + irq->parent_domain = irq_find_host(np);
> + of_node_put(np);
> +
> + if (!irq->parent_domain)
> + return -EPROBE_DEFER;
> + } else {
> + of_node_put(np);
> + }
> }
>
> irq->map = devm_kcalloc(&pdev->dev, gpio->gpio.ngpio,

--
nvpublic

2023-06-06 10:21:48

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] gpio: tegra186: Check PMC driver status before any request

Tue, Jun 06, 2023 at 12:47:17PM +0530, Prathamesh Shete kirjoitti:
> This patch fixes the issue where even if PMC driver status is
> disabled still we are trying to look up for the IRQ domain
> that PMC driver would've registered if it had been enabled.

-ENOPARSE.

Also mind grammar punctuation.

--
With Best Regards,
Andy Shevchenko



2023-06-07 11:17:28

by Jon Hunter

[permalink] [raw]
Subject: Re: [PATCH] gpio: tegra186: Check PMC driver status before any request


On 06/06/2023 09:53, Jon Hunter wrote:
>
> On 06/06/2023 08:17, Prathamesh Shete wrote:
>> This patch fixes the issue where even if PMC driver status is
>> disabled still we are trying to look up for the IRQ domain
>> that PMC driver would've registered if it had been enabled.
>
> It might be clearer to say ...
>
> When the PMC device is disabled, probing of the Tegra186 GPIO driver
> fails because the IRQ domain that is registered by the PMC driver is not
> found. Fix this by checking to see if the PMC device is enabled before
> attempting to lookup the IRQ domain registered by the PMC.

It could also be worth noting that it is OK to skip the PMC IRQ domain
in this case because this only impacts wake-ups and not GPIO
functionality in general.

Jon

--
nvpublic

2023-06-07 11:48:54

by Prathamesh Shete

[permalink] [raw]
Subject: [PATCH v2] gpio: tegra186: Check PMC driver status before any request

When the PMC device is disabled, probing of the Tegra186 GPIO driver
fails because the IRQ domain that is registered by the PMC driver is
not found. The PMC IRQ domain is only used for wake-up and does not
impact GPIO functionality in general. Therefore, if the PMC device is
disabled, skip looking up the PMC IRQ domain to allow the GPIO driver
to be probed.

Signed-off-by: Manish Bhardwaj <[email protected]>
Signed-off-by: Prathamesh Shete <[email protected]>
---
drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index 464b0ea3b6f1..80d08ddde40e 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -964,11 +964,15 @@ static int tegra186_gpio_probe(struct platform_device *pdev)

np = of_find_matching_node(NULL, tegra186_pmc_of_match);
if (np) {
- irq->parent_domain = irq_find_host(np);
- of_node_put(np);
-
- if (!irq->parent_domain)
- return -EPROBE_DEFER;
+ if (of_device_is_available(np)) {
+ irq->parent_domain = irq_find_host(np);
+ of_node_put(np);
+
+ if (!irq->parent_domain)
+ return -EPROBE_DEFER;
+ } else {
+ of_node_put(np);
+ }
}

irq->map = devm_kcalloc(&pdev->dev, gpio->gpio.ngpio,
--
2.17.1


2023-06-07 11:50:51

by Jon Hunter

[permalink] [raw]
Subject: Re: [PATCH v2] gpio: tegra186: Check PMC driver status before any request


On 07/06/2023 12:31, Prathamesh Shete wrote:
> When the PMC device is disabled, probing of the Tegra186 GPIO driver
> fails because the IRQ domain that is registered by the PMC driver is
> not found. The PMC IRQ domain is only used for wake-up and does not
> impact GPIO functionality in general. Therefore, if the PMC device is
> disabled, skip looking up the PMC IRQ domain to allow the GPIO driver
> to be probed.
>
> Signed-off-by: Manish Bhardwaj <[email protected]>
> Signed-off-by: Prathamesh Shete <[email protected]>
> ---
> drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
> index 464b0ea3b6f1..80d08ddde40e 100644
> --- a/drivers/gpio/gpio-tegra186.c
> +++ b/drivers/gpio/gpio-tegra186.c
> @@ -964,11 +964,15 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
>
> np = of_find_matching_node(NULL, tegra186_pmc_of_match);
> if (np) {
> - irq->parent_domain = irq_find_host(np);
> - of_node_put(np);
> -
> - if (!irq->parent_domain)
> - return -EPROBE_DEFER;
> + if (of_device_is_available(np)) {
> + irq->parent_domain = irq_find_host(np);
> + of_node_put(np);
> +
> + if (!irq->parent_domain)
> + return -EPROBE_DEFER;
> + } else {
> + of_node_put(np);
> + }
> }
>
> irq->map = devm_kcalloc(&pdev->dev, gpio->gpio.ngpio,

Thanks!

Reviewed-by: Jon Hunter <[email protected]>

Jon

--
nvpublic

2023-06-08 16:20:01

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v2] gpio: tegra186: Check PMC driver status before any request

On Wed, Jun 07, 2023 at 05:01:04PM +0530, Prathamesh Shete wrote:
> When the PMC device is disabled, probing of the Tegra186 GPIO driver
> fails because the IRQ domain that is registered by the PMC driver is
> not found. The PMC IRQ domain is only used for wake-up and does not
> impact GPIO functionality in general. Therefore, if the PMC device is
> disabled, skip looking up the PMC IRQ domain to allow the GPIO driver
> to be probed.
>
> Signed-off-by: Manish Bhardwaj <[email protected]>
> Signed-off-by: Prathamesh Shete <[email protected]>
> ---
> drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (722.00 B)
signature.asc (849.00 B)
Download all attachments

2023-06-09 07:30:27

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] gpio: tegra186: Check PMC driver status before any request

On Tue, Jun 6, 2023 at 9:17 AM Prathamesh Shete <[email protected]> wrote:

> This patch fixes the issue where even if PMC driver status is
> disabled still we are trying to look up for the IRQ domain
> that PMC driver would've registered if it had been enabled.
>
> Signed-off-by: Manish Bhardwaj <[email protected]>
> Signed-off-by: Prathamesh Shete <[email protected]>

Patch applied!

Yours,
Linus Walleij