From: Bjorn Helgaas <helgaas@kernel.org>
To: JunDong Song <jundongsong1@gmail.com>
Cc: jingoohan1@gmail.com, gustavo.pimentel@synopsys.com,
lpieralisi@kernel.org, robh@kernel.org, kw@linux.com,
bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] PCI: dwc-host: Add a warning to prevent invalid values
Date: Thu, 10 Nov 2022 15:32:39 -0600 [thread overview]
Message-ID: <20221110213239.GA672651@bhelgaas> (raw)
In-Reply-To: <20221107153108.5770-1-jundongsong1@gmail.com>
The subject lines are not quite accurate. The warning does nothing to
*prevent* invalid values; it only warns about them.
And it should say what *kind* of values we're talking about.
Maybe:
PCI: dwc: Warn about invalid 'max-link-speed' from DT
On Mon, Nov 07, 2022 at 11:31:07PM +0800, JunDong Song wrote:
> of_pci_get_max_link_speed() may return a negative value,
> causing the controller to not set the speed correctly.
> Add a warning in case the driver engineer misses it.
Rewrap this to fill 75 columns.
I would probably squash these into a single patch since they're
doing exactly the same thing to the host and endpoint cases.
> Signed-off-by: JunDong Song <jundongsong1@gmail.com>
> ---
>
> When I use the pcie dwc driver, the controller speed is abnormal,
> but it has not been detected because of the @max-link-speed error,
> so I think I need to return an error or warning here.
>
> Thanks.
>
> drivers/pci/controller/dwc/pcie-designware-ep.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
> index 83ddb1902..573342601 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
> @@ -739,8 +739,11 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
> return -ENOMEM;
> ep->outbound_addr = addr;
>
> - if (pci->link_gen < 1)
> + if (pci->link_gen < 1) {
> pci->link_gen = of_pci_get_max_link_speed(np);
> + if (unlikely(pci->link_gen < 0))
Using "unlikely" here is unnecessary since this is not a performance
path, and it's a distraction.
> + dev_warn(dev, "Failed to get max link speed\n");
> + }
>
> epc = devm_pci_epc_create(dev, &epc_ops);
> if (IS_ERR(epc)) {
> --
> 2.25.1
>
prev parent reply other threads:[~2022-11-10 21:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 15:31 [PATCH 1/2] PCI: dwc-host: Add a warning to prevent invalid values JunDong Song
2022-11-07 15:31 ` [PATCH 2/2] " JunDong Song
2022-11-10 21:32 ` Bjorn Helgaas [this message]
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=20221110213239.GA672651@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=gustavo.pimentel@synopsys.com \
--cc=jingoohan1@gmail.com \
--cc=jundongsong1@gmail.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=robh@kernel.org \
/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