mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: manivannan.sadhasivam@oss.qualcomm.com,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Cc: shawn.lin@rock-chips.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, vincent.guittot@linaro.org,
	zhangsenchuan@eswincomputing.com,
	Richard Zhu <hongxing.zhu@nxp.com>
Subject: Re: [PATCH v4 6/6] PCI: dwc: Skip failure during dw_pcie_resume_noirq() if no device is available
Date: Wed, 7 Jan 2026 16:41:33 +0800	[thread overview]
Message-ID: <3bae58cb-cf60-487b-a056-0c0d7a85d05c@rock-chips.com> (raw)
In-Reply-To: <20260107-pci-dwc-suspend-rework-v4-6-9b5f3c72df0a@oss.qualcomm.com>


在 2026/01/07 星期三 16:11, Manivannan Sadhasivam via B4 Relay 写道:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> 
> If there is no device attached to any of the Root Ports available under the
> Root bus before suspend and during resume, then there is no point in
> returning failure.
> 
> So skip returning failure so that the resume succeeds and allow the device
> to get attached later.
> 
> If there was a device before suspend and not available during resume, then
> propagate the error to indicate that the device got removed during suspend.
> 

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>


> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
>   drivers/pci/controller/dwc/pcie-designware-host.c | 17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index ccde12b85463..c30a2ed324cd 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -20,6 +20,7 @@
>   #include <linux/platform_device.h>
>   
>   #include "../../pci.h"
> +#include "../pci-host-common.h"
>   #include "pcie-designware.h"
>   
>   static struct pci_ops dw_pcie_ops;
> @@ -1227,6 +1228,7 @@ EXPORT_SYMBOL_GPL(dw_pcie_suspend_noirq);
>   
>   int dw_pcie_resume_noirq(struct dw_pcie *pci)
>   {
> +	struct dw_pcie_rp *pp = &pci->pp;
>   	int ret;
>   
>   	if (!pci->suspended)
> @@ -1234,23 +1236,28 @@ int dw_pcie_resume_noirq(struct dw_pcie *pci)
>   
>   	pci->suspended = false;
>   
> -	if (pci->pp.ops->init) {
> -		ret = pci->pp.ops->init(&pci->pp);
> +	if (pp->ops->init) {
> +		ret = pp->ops->init(pp);
>   		if (ret) {
>   			dev_err(pci->dev, "Host init failed: %d\n", ret);
>   			return ret;
>   		}
>   	}
>   
> -	dw_pcie_setup_rc(&pci->pp);
> +	dw_pcie_setup_rc(pp);
>   
>   	ret = dw_pcie_start_link(pci);
>   	if (ret)
>   		return ret;
>   
>   	ret = dw_pcie_wait_for_link(pci);
> -	if (ret)
> -		return ret;
> +	/*
> +	 * Skip failure if there is no device attached to the bus now and before
> +	 * suspend. But the error should be returned if a device was attached
> +	 * before suspend and not available now.
> +	 */
> +	if (ret == -ENODEV && !pci_root_ports_have_device(pp->bridge->bus))
> +		return 0;
>   
>   	return ret;
>   }
> 


  reply	other threads:[~2026-01-07  8:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07  8:11 [PATCH v4 0/6] PCI: dwc: Rework the error handling of dw_pcie_wait_for_link() API Manivannan Sadhasivam via B4 Relay
2026-01-07  8:11 ` [PATCH v4 1/6] PCI: dwc: Return -ENODEV from dw_pcie_wait_for_link() if device is not found Manivannan Sadhasivam via B4 Relay
2026-01-07  8:34   ` Shawn Lin
2026-01-07  8:11 ` [PATCH v4 2/6] PCI: dwc: Rename and move ltssm_status_string() to pcie-designware.c Manivannan Sadhasivam via B4 Relay
2026-01-07  8:35   ` Shawn Lin
2026-01-07  8:11 ` [PATCH v4 3/6] PCI: dwc: Rework the error print of dw_pcie_wait_for_link() Manivannan Sadhasivam via B4 Relay
2026-01-07  8:38   ` Shawn Lin
2026-01-07  9:09     ` Manivannan Sadhasivam
2026-01-07  9:28       ` Shawn Lin
2026-01-07  8:11 ` [PATCH v4 4/6] PCI: dwc: Only skip the dw_pcie_wait_for_link() failure if it returns -ENODEV Manivannan Sadhasivam via B4 Relay
2026-01-07  8:38   ` Shawn Lin
2026-01-07  8:11 ` [PATCH v4 5/6] PCI: host-common: Add an API to check for any device under the Root Ports Manivannan Sadhasivam via B4 Relay
2026-01-07  8:39   ` Shawn Lin
2026-01-07  8:11 ` [PATCH v4 6/6] PCI: dwc: Skip failure during dw_pcie_resume_noirq() if no device is available Manivannan Sadhasivam via B4 Relay
2026-01-07  8:41   ` Shawn Lin [this message]
2026-01-13 17:53 ` [PATCH v4 0/6] PCI: dwc: Rework the error handling of dw_pcie_wait_for_link() API Vincent Guittot
2026-01-16  1:36 ` Hongxing Zhu
2026-10-13  9:15 ` Franz Schnyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3bae58cb-cf60-487b-a056-0c0d7a85d05c@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=bhelgaas@google.com \
    --cc=hongxing.zhu@nxp.com \
    --cc=jingoohan1@gmail.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=zhangsenchuan@eswincomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®