PCI: tegra194: use dev_err_probe() for PERST GPIO
PATCH 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.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +3 -12
@@ -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
PATCH 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.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +3 -12
@@ -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 GPIOs\n" );return 0 ; }
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 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 7 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.
Signed-off-by bui duc phuc <[email protected]>
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
Re: [PATCH 2/2] PCI: tegra194: propagate REFCLK select GPIO errors
In reply to [email protected]Quoted 11 lines · On 07/10/26 4:18 pm, [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.
I published similar patch https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
I am OK if this patch is merged, I will drop from my series.
With the subject line capitalization style fix,
Quoted 31 lines
Signed-off-by bui duc phuc <[email protected]>--- drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)drivers/pci/controller/dwc/pcie-tegra194.c +3
-12@@ -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 GPIOs\n" );return 0 ; }
Signature · 1 line
nvpublic
Re: [PATCH 2/2] PCI: tegra194: propagate REFCLK select GPIO errors
Hi Manikanta,
Thanks for pointing this out. I wasn't aware that you had already posted a similar patch.
Quoted 8 lines
I published similar patch
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/I am OK if this patch is merged, I will drop from my series.
With the subject line capitalization style fix,
Reviewed-by Manikanta Maddireddy <[email protected]>
I'll update the subject line capitalization and send v2 shortly. Thanks for the review.
Best regards,
Phuc
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 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.Signed-off-by bui duc phuc <[email protected]>
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
Quoted 6 lines · On Wed, Oct 07, 2026 at 05:48:46PM +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.Signed-off-by bui duc phuc <[email protected]>
For future posts, please match the subject line capitalization style:
PCI: tegra194: Use ...
And style as "PERST#" in the subject, commit log, and dmesg text to match spec usage.
No need to repost just for this; we can tweak these when applying.
Quoted 33 lines
--- drivers/pci/controller/dwc/pcie-tegra194.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)drivers/pci/controller/dwc/pcie-tegra194.c +3
-12@@ -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
Hi Bjorn,
Quoted 10 lines
For future posts, please match the subject line capitalization style:
PCI: tegra194: Use ...
And style as "PERST#" in the subject, commit log, and dmesg text to match spec usage.
No need to repost just for this; we can tweak these when applying.
Thanks for the review and for pointing this out. I'll keep these style details in mind for future posts.
Best regards,
Phuc
Manikanta Maddireddy
Reviewed-byQuoted 10 lines · Bui Duc Phuc
Hi Bjorn,
Quoted 8 lines
For future posts, please match the subject line capitalization style:
PCI: tegra194: Use ...And style as "PERST#" in the subject, commit log, and dmesg text to match spec usage.
Quoted 8 lines
Quoted 2 lines
No need to repost just for this; we can tweak these when applying.
Thanks for the review and for pointing this out. I'll keep these style details in mind for future posts.
Best regards,
Phuc
With the subject line capitalization and "PERST#" style fixes,
Signature · 1 line
nvpublic
Hi Manikanta,
Quoted 3 lines
With the subject line capitalization and "PERST#" style fixes,
Reviewed-by Manikanta Maddireddy <[email protected]>
Thanks for the review. I'll send v2 shortly.
Best regards,
Phuc