From: Thierry Reding <thierry.reding@gmail.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: "Thierry Reding" <thierry.reding@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczy??ski" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Karthikeyan Mitran" <m.karthikeyan@mobiveil.co.in>,
"Hou Zhiqiang" <Zhiqiang.Hou@nxp.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Pali Rohár" <pali@kernel.org>,
"Michal Simek" <michal.simek@amd.com>,
"Kevin Xie" <kevin.xie@starfivetech.com>,
"Aksh Garg" <a-garg7@ti.com>,
linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
"Thierry Reding" <treding@nvidia.com>
Subject: Re: [PATCH v5 2/4] PCI: Use standard wait times for PCIe link monitoring
Date: Wed, 27 May 2026 10:28:51 +0200 [thread overview]
Message-ID: <ahanoZgDwq3v6x8M@orome> (raw)
In-Reply-To: <ahV_r6NJWnmJptT2@wunner.de>
[-- Attachment #1: Type: text/plain, Size: 2143 bytes --]
On Tue, May 26, 2026 at 01:10:39PM +0200, Lukas Wunner wrote:
> On Tue, May 26, 2026 at 10:53:11AM +0200, Thierry Reding wrote:
> > Instead of defining the wait values for each driver, use common values
> > defined in the core pci.h header file. Note that most drivers don't use
> > the millisecond waits, but rather usleep_range(), so add these commonly
> > used values to the header so that all drivers can use them.
>
> Hm, why not just replace usleep_range() with msleep() and use the existing
> macro instead of defining new ones?
I'm trying to somewhat unify the implementations across drivers without
changing behaviour. I don't have a way of testing any of these drivers,
so keeping the existing implementation and just switching out the symbol
seemed like a good compromise.
> > +++ b/drivers/pci/pci.h
> > @@ -63,6 +63,8 @@ struct pcie_tlp_log;
> > /* Parameters for the waiting for link up routine */
> > #define PCIE_LINK_WAIT_MAX_RETRIES 10
> > #define PCIE_LINK_WAIT_SLEEP_MS 90
> > +#define PCIE_LINK_WAIT_US_MIN 90000
> > +#define PCIE_LINK_WAIT_US_MAX 100000
>
> If you absolutely positively want to add a new macro, consider
> 90 * USEC_PER_MSEC instead of 90000.
That seems rather useless to me. We have a _US infix in those symbolic
names, so it's obvious what the unit is, so nobody should be confused as
to the purpose of these. I suppose if you want to make sure it
correlates to the SLEEP_MS variant we could maybe do:
#define PCIE_LINK_WAIT_US_MIN (PCIE_LINK_WAIT_SLEEP_MS * USEC_PER_MSEC)
Then again, I count 2 drivers (in linux-next) that use the existing
PCIE_LINK_WAIT_SLEEP_MS, one of which multiplies by MILLI to get at the
US version (so it could easily be converted to the US_MIN version). Only
pcie-designware.c uses msleep() with PCIE_LINK_WAIT_SLEEP_MS, so it is
clearly the outlier.
Maybe I should just go all the way and drop the SLEEP_MS symbol and
replace usage by the US versions?
> Moreover, consider using fsleep() instead of adding an additional MAX
> macro.
This would then be changing behaviour again for all the drivers.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-05-27 8:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 8:53 [PATCH v5 0/4] PCI: tegra: Add Tegra264 support Thierry Reding
2026-05-26 8:53 ` [PATCH v5 1/4] dt-bindings: pci: Strictly distinguish C0 from C1-C5 Thierry Reding
2026-05-26 8:53 ` [PATCH v5 2/4] PCI: Use standard wait times for PCIe link monitoring Thierry Reding
2026-05-26 11:10 ` Lukas Wunner
2026-05-27 8:28 ` Thierry Reding [this message]
2026-05-27 17:22 ` Lukas Wunner
2026-05-26 8:53 ` [PATCH v5 3/4] PCI: tegra: Add Tegra264 support Thierry Reding
2026-05-27 8:12 ` Thierry Reding
2026-05-26 8:53 ` [PATCH v5 4/4] arm64: tegra: Reorder reg and reg-names to match bindings Thierry Reding
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=ahanoZgDwq3v6x8M@orome \
--to=thierry.reding@gmail.com \
--cc=Zhiqiang.Hou@nxp.com \
--cc=a-garg7@ti.com \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kevin.xie@starfivetech.com \
--cc=krzk+dt@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=lukas@wunner.de \
--cc=m.karthikeyan@mobiveil.co.in \
--cc=mani@kernel.org \
--cc=michal.simek@amd.com \
--cc=pali@kernel.org \
--cc=robh@kernel.org \
--cc=thierry.reding@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=treding@nvidia.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