Skip to contentSkip to conversation

gpio: tegra186: Check PMC driver status before any request

PATCH In review Prathamesh Shete 5 participants 8 messages Jun 6, 2023 – Jun 9, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpio/gpio-tegra186.c +9 -5
index 464b0ea3b6f1..80d08ddde40e 100644
@@ -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,
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Prathamesh Shete

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 ...

Quoted 31 lines
---
  drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpio/gpio-tegra186.c +9 -5
index 464b0ea3b6f1..80d08ddde40e 100644
@@ -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,
Signature · 1 line
nvpublic
maintainer
#2 lore raw
Quoted 9 lines · Jon Hunter
Quoted 3 lines · Prathamesh Shete

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

Signature · 1 line
nvpublic
#3 lore raw

PATCH v2 1/1 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.

---
 drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpio/gpio-tegra186.c +9 -5
index 464b0ea3b6f1..80d08ddde40e 100644
@@ -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,
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 1/1
#4 lore raw
Quoted 28 lines · Prathamesh Shete

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.

---
  drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpio/gpio-tegra186.c +2 -5
index 464b0ea3b6f1..80d08ddde40e 100644
@@ -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);

drivers/gpio/gpio-tegra186.c static int tegra186_gpio_probe(struct platform_device *pdev) · line 978

Quoted 10 lines
drivers/gpio/gpio-tegra186.c +7 -0
+			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!

Jon

Signature · 1 line
nvpublic
Acked-by on v2 1/1
#5 lore raw
In reply to Prathamesh Shete
Quoted 7 lines · Prathamesh Shete

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.

Quoted 5 lines
---
 drivers/gpio/gpio-tegra186.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
#6 lore raw
In reply to Prathamesh Shete

Tue, Jun 06, 2023 at 12:47:17PM +0530, Prathamesh Shete kirjoitti:

Quoted 3 lines

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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko