diff mbox series

[v2] gpio: tegra186: Check PMC driver status before any request

Message ID 20230607113104.11761-1-pshete@nvidia.com
State Handled Elsewhere
Headers show
Series [v2] gpio: tegra186: Check PMC driver status before any request | expand

Commit Message

Prathamesh Shete June 7, 2023, 11:31 a.m. UTC
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 <mbhardwaj@nvidia.com>
Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
---
 drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Jon Hunter June 7, 2023, 11:46 a.m. UTC | #1
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 <mbhardwaj@nvidia.com>
> Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
> ---
>   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 <jonathanh@nvidia.com>

Jon
Thierry Reding June 8, 2023, 4:02 p.m. UTC | #2
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 <mbhardwaj@nvidia.com>
> Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
> ---
>  drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>
diff mbox series

Patch

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,