Re: [PATCH v2] PCI: rzg3s-host: Treat link-down as -ENODEV instead of error
From: Manivannan Sadhasivam
Date: Sat Apr 04 2026 - 13:17:38 EST
On Thu, Apr 02, 2026 at 08:23:53PM +0200, John Madieu wrote:
> rzg3s_pcie_host_init() failing to establish a PCIe link does not
> necessarily indicate a hardware or driver error; it may simply mean no
> card is inserted. Demote the message from dev_err_probe() to dev_info()
> and return -ENODEV so the driver defers gracefully rather than printing
> a spurious error.
>
> Signed-off-by: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx>
> ---
>
> Changes in v2:
> - Dropped Rb tag from Geert as patch structure changed
> - Moved link-down handling into rzg3s_pcie_host_init() instead of
> masking all errors in rzg3s_pcie_host_setup() (Claudiu)
> - Kept dev_err_probe() for real init failures, only suppress for
> -ENODEV (link down)
>
> v1:
> - https://lore.kernel.org/all/20260401143347.8463-1-john.madieu.xa@xxxxxxxxxxxxxx/
>
> drivers/pci/controller/pcie-rzg3s-host.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index d86e7516dcc2..0acc21981ee9 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
> @@ -1384,8 +1384,11 @@ static int rzg3s_pcie_host_init(struct rzg3s_pcie_host *host)
> PCIE_LINK_WAIT_SLEEP_MS * MILLI,
> PCIE_LINK_WAIT_SLEEP_MS * MILLI *
> PCIE_LINK_WAIT_MAX_RETRIES);
> - if (ret)
> + if (ret) {
> + dev_info(host->dev, "PCIe link down!\n");
> + ret = -ENODEV;
> goto config_deinit_post;
> + }
>
> val = readl_relaxed(host->axi + RZG3S_PCI_PCSTAT2);
> dev_info(host->dev, "PCIe link status [0x%x]\n", val);
> @@ -1655,7 +1658,9 @@ rzg3s_pcie_host_setup(struct rzg3s_pcie_host *host,
>
> ret = rzg3s_pcie_host_init(host);
> if (ret) {
> - dev_err_probe(dev, ret, "Failed to initialize the HW!\n");
> + if (ret != -ENODEV)
> + dev_err_probe(dev, ret, "Failed to initialize the HW!\n");
Well, probe() should not fail in the case of LDn unless the controller doesn't
support hotplug.
- Mani
--
மணிவண்ணன் சதாசிவம்