From: Niklas Cassel <cassel@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: "Sumit Kumar" <sumit.kumar@oss.qualcomm.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Richard Zhu" <hongxing.zhu@nxp.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Yue Wang" <yue.wang@amlogic.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Greentime Hu" <greentime.hu@sifive.com>,
"Samuel Holland" <samuel.holland@sifive.com>,
"Chuanhua Lei" <lchuanhua@maxlinear.com>,
"Marek Vasut" <marek.vasut+renesas@gmail.com>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Pratyush Anand" <pratyush.anand@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev,
linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH 2/2] PCI: dwc: Add multi-port controller support
Date: Tue, 6 Jan 2026 22:16:56 +0100 [thread overview]
Message-ID: <aV17yIhuOFLGYi8r@fedora> (raw)
In-Reply-To: <5gne3bureusi45sy4zqr2zrfvt4ba4uxgnsfdnjeh2eno5zspe@ldvhq2nilsan>
On Tue, Jan 06, 2026 at 06:41:09PM +0530, Manivannan Sadhasivam wrote:
> > One advantage I can see, instead of doing:
> >
> > + struct dw_pcie_port *port = list_first_entry(&pci->pp.ports,
> > + struct dw_pcie_port, list);
> > + return dw_pcie_wait_for_link(pci, port);
> >
> > for drivers with only one port (most drivers), we could just instead do:
> >
> > + return dw_pcie_wait_for_link(pci, pci->pp.port);
> >
> > To simply get the first element in the array. No need to sprinkle
> > list_first_entry() everywhere in all the drivers if they just have one port.
> >
> >
> > For iterating, to avoid manually traversing the array, we could do like
> > libata and create a simple macro, e.g. ata_qc_for_each():
> > https://github.com/torvalds/linux/blob/v6.19-rc4/drivers/ata/libata-eh.c#L851-L854
> > https://github.com/torvalds/linux/blob/v6.19-rc4/include/linux/libata.h#L1657-L1659
> >
>
> I specifically do not want to introduce custom helpers. That's one of my primary
> motivation for using lists :)
You are the maintainer.
IMO it would still be nice if we could avoid sprinkling:
+struct dw_pcie_port *port = list_first_entry(&pci->pp.ports,
+ struct dw_pcie_port, list);
all over the glue drivers somehow, especially those that will only have a
single port. Perhaps by introducing a macro?
In case you don't like the idea of introducing a macro to get the first
port...
Since most glue drivers only seem to use the port when calling
dw_pcie_wait_for_link(), perhaps we could introduce an alternate version
of dw_pcie_wait_for_link(), that can be called by glue drivers that only
have a single port.
Kind regards,
Niklas
WARNING: multiple messages have this Message-ID (diff)
From: Niklas Cassel <cassel@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: "Sumit Kumar" <sumit.kumar@oss.qualcomm.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Richard Zhu" <hongxing.zhu@nxp.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Yue Wang" <yue.wang@amlogic.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Greentime Hu" <greentime.hu@sifive.com>,
"Samuel Holland" <samuel.holland@sifive.com>,
"Chuanhua Lei" <lchuanhua@maxlinear.com>,
"Marek Vasut" <marek.vasut+renesas@gmail.com>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Pratyush Anand" <pratyush.anand@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev,
linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH 2/2] PCI: dwc: Add multi-port controller support
Date: Tue, 6 Jan 2026 22:16:56 +0100 [thread overview]
Message-ID: <aV17yIhuOFLGYi8r@fedora> (raw)
In-Reply-To: <5gne3bureusi45sy4zqr2zrfvt4ba4uxgnsfdnjeh2eno5zspe@ldvhq2nilsan>
On Tue, Jan 06, 2026 at 06:41:09PM +0530, Manivannan Sadhasivam wrote:
> > One advantage I can see, instead of doing:
> >
> > + struct dw_pcie_port *port = list_first_entry(&pci->pp.ports,
> > + struct dw_pcie_port, list);
> > + return dw_pcie_wait_for_link(pci, port);
> >
> > for drivers with only one port (most drivers), we could just instead do:
> >
> > + return dw_pcie_wait_for_link(pci, pci->pp.port);
> >
> > To simply get the first element in the array. No need to sprinkle
> > list_first_entry() everywhere in all the drivers if they just have one port.
> >
> >
> > For iterating, to avoid manually traversing the array, we could do like
> > libata and create a simple macro, e.g. ata_qc_for_each():
> > https://github.com/torvalds/linux/blob/v6.19-rc4/drivers/ata/libata-eh.c#L851-L854
> > https://github.com/torvalds/linux/blob/v6.19-rc4/include/linux/libata.h#L1657-L1659
> >
>
> I specifically do not want to introduce custom helpers. That's one of my primary
> motivation for using lists :)
You are the maintainer.
IMO it would still be nice if we could avoid sprinkling:
+struct dw_pcie_port *port = list_first_entry(&pci->pp.ports,
+ struct dw_pcie_port, list);
all over the glue drivers somehow, especially those that will only have a
single port. Perhaps by introducing a macro?
In case you don't like the idea of introducing a macro to get the first
port...
Since most glue drivers only seem to use the port when calling
dw_pcie_wait_for_link(), perhaps we could introduce an alternate version
of dw_pcie_wait_for_link(), that can be called by glue drivers that only
have a single port.
Kind regards,
Niklas
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
WARNING: multiple messages have this Message-ID (diff)
From: Niklas Cassel <cassel@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: "Sumit Kumar" <sumit.kumar@oss.qualcomm.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Richard Zhu" <hongxing.zhu@nxp.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Yue Wang" <yue.wang@amlogic.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Greentime Hu" <greentime.hu@sifive.com>,
"Samuel Holland" <samuel.holland@sifive.com>,
"Chuanhua Lei" <lchuanhua@maxlinear.com>,
"Marek Vasut" <marek.vasut+renesas@gmail.com>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Pratyush Anand" <pratyush.anand@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev,
linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH 2/2] PCI: dwc: Add multi-port controller support
Date: Tue, 6 Jan 2026 22:16:56 +0100 [thread overview]
Message-ID: <aV17yIhuOFLGYi8r@fedora> (raw)
In-Reply-To: <5gne3bureusi45sy4zqr2zrfvt4ba4uxgnsfdnjeh2eno5zspe@ldvhq2nilsan>
On Tue, Jan 06, 2026 at 06:41:09PM +0530, Manivannan Sadhasivam wrote:
> > One advantage I can see, instead of doing:
> >
> > + struct dw_pcie_port *port = list_first_entry(&pci->pp.ports,
> > + struct dw_pcie_port, list);
> > + return dw_pcie_wait_for_link(pci, port);
> >
> > for drivers with only one port (most drivers), we could just instead do:
> >
> > + return dw_pcie_wait_for_link(pci, pci->pp.port);
> >
> > To simply get the first element in the array. No need to sprinkle
> > list_first_entry() everywhere in all the drivers if they just have one port.
> >
> >
> > For iterating, to avoid manually traversing the array, we could do like
> > libata and create a simple macro, e.g. ata_qc_for_each():
> > https://github.com/torvalds/linux/blob/v6.19-rc4/drivers/ata/libata-eh.c#L851-L854
> > https://github.com/torvalds/linux/blob/v6.19-rc4/include/linux/libata.h#L1657-L1659
> >
>
> I specifically do not want to introduce custom helpers. That's one of my primary
> motivation for using lists :)
You are the maintainer.
IMO it would still be nice if we could avoid sprinkling:
+struct dw_pcie_port *port = list_first_entry(&pci->pp.ports,
+ struct dw_pcie_port, list);
all over the glue drivers somehow, especially those that will only have a
single port. Perhaps by introducing a macro?
In case you don't like the idea of introducing a macro to get the first
port...
Since most glue drivers only seem to use the port when calling
dw_pcie_wait_for_link(), perhaps we could introduce an alternate version
of dw_pcie_wait_for_link(), that can be called by glue drivers that only
have a single port.
Kind regards,
Niklas
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-01-06 21:17 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 12:27 [PATCH 0/2] PCI: dwc: Add multi-port controller support Sumit Kumar
2026-01-05 12:27 ` Sumit Kumar
2026-01-05 12:27 ` Sumit Kumar
2026-01-05 12:27 ` [PATCH 1/2] PCI: API changes for " Sumit Kumar
2026-01-05 12:27 ` Sumit Kumar
2026-01-05 12:27 ` Sumit Kumar
2026-02-16 15:21 ` Manivannan Sadhasivam
2026-02-16 15:21 ` Manivannan Sadhasivam
2026-02-16 15:21 ` Manivannan Sadhasivam
2026-01-05 12:27 ` [PATCH 2/2] PCI: dwc: Add " Sumit Kumar
2026-01-05 12:27 ` Sumit Kumar
2026-01-05 12:27 ` Sumit Kumar
2026-01-05 16:19 ` Niklas Cassel
2026-01-05 16:19 ` Niklas Cassel
2026-01-05 16:19 ` Niklas Cassel
2026-01-06 5:19 ` Manivannan Sadhasivam
2026-01-06 5:19 ` Manivannan Sadhasivam
2026-01-06 5:19 ` Manivannan Sadhasivam
2026-01-06 10:55 ` Niklas Cassel
2026-01-06 10:55 ` Niklas Cassel
2026-01-06 10:55 ` Niklas Cassel
2026-01-06 11:16 ` Niklas Cassel
2026-01-06 11:16 ` Niklas Cassel
2026-01-06 11:16 ` Niklas Cassel
2026-01-06 13:11 ` Manivannan Sadhasivam
2026-01-06 13:11 ` Manivannan Sadhasivam
2026-01-06 13:11 ` Manivannan Sadhasivam
2026-01-06 21:16 ` Niklas Cassel [this message]
2026-01-06 21:16 ` Niklas Cassel
2026-01-06 21:16 ` Niklas Cassel
2026-02-16 15:35 ` Manivannan Sadhasivam
2026-02-16 15:35 ` Manivannan Sadhasivam
2026-02-16 15:35 ` Manivannan Sadhasivam
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=aV17yIhuOFLGYi8r@fedora \
--to=cassel@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=bhelgaas@google.com \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=greentime.hu@sifive.com \
--cc=hongxing.zhu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=jbrunet@baylibre.com \
--cc=jingoohan1@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=krzk@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=l.stach@pengutronix.de \
--cc=lchuanhua@maxlinear.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mani@kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=paul.walmsley@sifive.com \
--cc=pratyush.anand@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=samuel.holland@sifive.com \
--cc=shawnguo@kernel.org \
--cc=sumit.kumar@oss.qualcomm.com \
--cc=thierry.reding@gmail.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
--cc=yue.wang@amlogic.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.