Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO
@ 2026-10-12  9:48 phucduc.bui
  2026-10-12  9:48 ` [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors phucduc.bui
  2026-10-13 16:20 ` [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO Thierry Reding
  0 siblings, 2 replies; 4+ messages in thread
From: phucduc.bui @ 2026-10-12  9:48 UTC (permalink / raw)
  To: Lorenzo Pieralisi, kwilczynski, Manivannan Sadhasivam,
	Rob Herring, Bjorn Helgaas, Thierry Reding, Jonathan Hunter,
	Manikanta Maddireddy
  Cc: Vidya Sagar, Niklas Cassel, linux-pci, linux-tegra, linux-kernel,
	bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Use dev_err_probe() when getting the PERST# GPIO to simplify error
handling and properly handle -EPROBE_DEFER.

Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Changes in v2:
 - Follow the subject line capitalization style.
 - Use "PERST#" in the subject, commit log, and dmesg text to match
   spec usage.

 drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 63a0f56cad8e..2f8e828c4d9a 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1200,18 +1200,9 @@ static int tegra_pcie_dw_parse_dt(struct tegra_pcie_dw *pcie)
 
 	/* Endpoint mode specific DT entries */
 	pcie->pex_rst_gpiod = devm_gpiod_get(pcie->dev, "reset", GPIOD_IN);
-	if (IS_ERR(pcie->pex_rst_gpiod)) {
-		int err = PTR_ERR(pcie->pex_rst_gpiod);
-		const char *level = KERN_ERR;
-
-		if (err == -EPROBE_DEFER)
-			level = KERN_DEBUG;
-
-		dev_printk(level, pcie->dev,
-			   dev_fmt("Failed to get PERST GPIO: %d\n"),
-			   err);
-		return err;
-	}
+	if (IS_ERR(pcie->pex_rst_gpiod))
+		return dev_err_probe(pcie->dev, PTR_ERR(pcie->pex_rst_gpiod),
+				     "Failed to get PERST# GPIO\n");
 
 	pcie->pex_refclk_sel_gpiod = devm_gpiod_get_optional(pcie->dev,
 							     "nvidia,refclk-select",
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors
  2026-10-12  9:48 [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO phucduc.bui
@ 2026-10-12  9:48 ` phucduc.bui
  2026-10-13 16:21   ` Thierry Reding
  2026-10-13 16:20 ` [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO Thierry Reding
  1 sibling, 1 reply; 4+ messages in thread
From: phucduc.bui @ 2026-10-12  9:48 UTC (permalink / raw)
  To: Lorenzo Pieralisi, kwilczynski, Manivannan Sadhasivam,
	Rob Herring, Bjorn Helgaas, Thierry Reding, Jonathan Hunter,
	Manikanta Maddireddy
  Cc: Vidya Sagar, Niklas Cassel, linux-pci, linux-tegra, linux-kernel,
	bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

devm_gpiod_get_optional() returns NULL when the optional GPIO is not
present, but may return -EPROBE_DEFER or other errors.

The current code treats GPIO lookup errors as if the GPIO were not
present.

Check the return value and propagate errors from the REFCLK select GPIO
lookup.

Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Changes in v2:
 - Follow the subject line capitalization style.

 drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 2f8e828c4d9a..4c1f22b88288 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1207,18 +1207,9 @@ static int tegra_pcie_dw_parse_dt(struct tegra_pcie_dw *pcie)
 	pcie->pex_refclk_sel_gpiod = devm_gpiod_get_optional(pcie->dev,
 							     "nvidia,refclk-select",
 							     GPIOD_OUT_HIGH);
-	if (IS_ERR(pcie->pex_refclk_sel_gpiod)) {
-		int err = PTR_ERR(pcie->pex_refclk_sel_gpiod);
-		const char *level = KERN_ERR;
-
-		if (err == -EPROBE_DEFER)
-			level = KERN_DEBUG;
-
-		dev_printk(level, pcie->dev,
-			   dev_fmt("Failed to get REFCLK select GPIOs: %d\n"),
-			   err);
-		pcie->pex_refclk_sel_gpiod = NULL;
-	}
+	if (IS_ERR(pcie->pex_refclk_sel_gpiod))
+		return dev_err_probe(pcie->dev, PTR_ERR(pcie->pex_refclk_sel_gpiod),
+				     "Failed to get REFCLK select GPIO\n");
 
 	return 0;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO
  2026-10-12  9:48 [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO phucduc.bui
  2026-10-12  9:48 ` [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors phucduc.bui
@ 2026-10-13 16:20 ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2026-10-13 16:20 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Lorenzo Pieralisi, kwilczynski, Manivannan Sadhasivam,
	Rob Herring, Bjorn Helgaas, Jonathan Hunter, Manikanta Maddireddy,
	Vidya Sagar, Niklas Cassel, linux-pci, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

On Mon, Oct 12, 2026 at 04:48:14PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> Use dev_err_probe() when getting the PERST# GPIO to simplify error
> handling and properly handle -EPROBE_DEFER.
> 
> Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> 
> Changes in v2:
>  - Follow the subject line capitalization style.
>  - Use "PERST#" in the subject, commit log, and dmesg text to match
>    spec usage.
> 
>  drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors
  2026-10-12  9:48 ` [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors phucduc.bui
@ 2026-10-13 16:21   ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2026-10-13 16:21 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Lorenzo Pieralisi, kwilczynski, Manivannan Sadhasivam,
	Rob Herring, Bjorn Helgaas, Jonathan Hunter, Manikanta Maddireddy,
	Vidya Sagar, Niklas Cassel, linux-pci, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

On Mon, Oct 12, 2026 at 04:48:15PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> devm_gpiod_get_optional() returns NULL when the optional GPIO is not
> present, but may return -EPROBE_DEFER or other errors.
> 
> The current code treats GPIO lookup errors as if the GPIO were not
> present.
> 
> Check the return value and propagate errors from the REFCLK select GPIO
> lookup.
> 
> Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> 
> Changes in v2:
>  - Follow the subject line capitalization style.
> 
>  drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-13 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12  9:48 [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO phucduc.bui
2026-10-12  9:48 ` [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors phucduc.bui
2026-10-13 16:21   ` Thierry Reding
2026-10-13 16:20 ` [PATCH v2 1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox