Skip to contentSkip to conversation

PCI: tegra194: Use dev_err_probe() for PERST# GPIO

PATCH Applied [email protected] 4 participants 7 messages Oct 12 – Oct 17

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

PATCH v2 1/2 PCI: tegra194: Use dev_err_probe() for PERST# GPIO

From: bui duc phuc <[email protected]>

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

---

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(-)
drivers/pci/controller/dwc/pcie-tegra194.c +3 -12
index 63a0f56cad8e..2f8e828c4d9a 100644
@@ -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",
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 PCI: tegra194: Propagate REFCLK select GPIO errors

From: bui duc phuc <[email protected]>

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.

---

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

 drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +3 -12
index 2f8e828c4d9a..4c1f22b88288 100644
@@ -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;
 }
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

From: bui duc phuc <[email protected]>

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

Quoted 8 lines

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.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#4 lore raw
In reply to [email protected]
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 lines

From: bui duc phuc <[email protected]>

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

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v2 1/2
#5 lore raw
In reply to [email protected]
Quoted 9 lines · On Mon, Oct 12, 2026 at 04:48:14PM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

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

---

Quoted 7 lines

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(-)
maintainer Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] PCI: tegra194: Propagate REFCLK select GPIO errors

In reply to [email protected]
Quoted 11 lines · On Mon, Oct 12, 2026 at 04:48:15PM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

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.

Quoted 8 lines

---

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

 drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------
maintainer Applied
#6 lore raw
In reply to [email protected]
Quoted 1 line · On Mon, 12 Oct 2026 16:48:14 +0700, [email protected] wrote:

PCI: tegra194: Use dev_err_probe() for PERST# GPIO

Applied, thanks!

[1/2] PCI: tegra194: Use dev_err_probe() for PERST# GPIO

      commit: d9b0c9ec352a5c8f037607bb938b6410ecf0dd54
[2/2] PCI: tegra194: Propagate REFCLK select GPIO errors
      commit: a439b860c96071e17d8877d28d0effdd42f60413

Best regards,

Signature · 1 line
மணிவண்ணன் சதாசிவம்