[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231101063041.GG2897@thinkpad>
Date: Wed, 1 Nov 2023 12:00:41 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Krishna chaitanya chundru <quic_krichai@...cinc.com>
Cc: agross@...nel.org, andersson@...nel.org, konrad.dybcio@...aro.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
vireshk@...nel.org, nm@...com, sboyd@...nel.org, mani@...nel.org,
lpieralisi@...nel.org, kw@...ux.com, robh@...nel.org,
bhelgaas@...gle.com, rafael@...nel.org,
linux-arm-msm@...r.kernel.org, linux-pci@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org, quic_vbadigan@...cinc.com,
quic_nitegupt@...cinc.com, quic_skananth@...cinc.com,
quic_ramkri@...cinc.com, quic_parass@...cinc.com
Subject: Re: [PATCH v5 4/5] PCI: qcom: Return error from
'qcom_pcie_icc_update'
On Thu, Sep 07, 2023 at 11:30:32AM +0530, Krishna chaitanya chundru wrote:
> Return error from the function if the icc path is specified in the
> dt and icc_set_bw failed or link is not up.
>
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@...cinc.com>
> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index e2f2940..ca6350b 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1357,22 +1357,21 @@ static int qcom_pcie_icc_init(struct qcom_pcie *pcie)
> return 0;
> }
>
> -static void qcom_pcie_icc_update(struct qcom_pcie *pcie)
> +static int qcom_pcie_icc_update(struct qcom_pcie *pcie)
> {
> struct dw_pcie *pci = pcie->pci;
> u32 offset, status, bw;
> int speed, width;
> - int ret;
>
> if (!pcie->icc_mem)
> - return;
> + return 0;
>
> offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
> status = readw(pci->dbi_base + offset + PCI_EXP_LNKSTA);
>
> /* Only update constraints if link is up. */
> if (!(status & PCI_EXP_LNKSTA_DLLLA))
> - return;
> + return -ENODEV;
Why would you want to fail if the link is not up? This will break the driver if
device shows up later.
- Mani
>
> speed = FIELD_GET(PCI_EXP_LNKSTA_CLS, status);
> width = FIELD_GET(PCI_EXP_LNKSTA_NLW, status);
> @@ -1392,11 +1391,7 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie)
> break;
> }
>
> - ret = icc_set_bw(pcie->icc_mem, 0, width * bw);
> - if (ret) {
> - dev_err(pci->dev, "failed to set interconnect bandwidth: %d\n",
> - ret);
> - }
> + return icc_set_bw(pcie->icc_mem, 0, width * bw);
> }
>
> static int qcom_pcie_link_transition_count(struct seq_file *s, void *data)
> @@ -1529,7 +1524,10 @@ static int qcom_pcie_probe(struct platform_device *pdev)
> goto err_phy_exit;
> }
>
> - qcom_pcie_icc_update(pcie);
> + ret = qcom_pcie_icc_update(pcie);
> + if (ret)
> + dev_err(dev, "failed to update interconnect bandwidth: %d\n",
> + ret);
>
> if (pcie->mhi)
> qcom_pcie_init_debugfs(pcie);
> @@ -1596,7 +1594,10 @@ static int qcom_pcie_resume_noirq(struct device *dev)
> pcie->suspended = false;
> }
>
> - qcom_pcie_icc_update(pcie);
> + ret = qcom_pcie_icc_update(pcie);
> + if (ret)
> + dev_err(dev, "failed to update interconnect bandwidth: %d\n",
> + ret);
>
> return 0;
> }
> --
> 2.7.4
>
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists