Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: hongxing.zhu@nxp.com, l.stach@pengutronix.de,
	bhelgaas@google.com, lpieralisi@kernel.org,
	kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, s.hauer@pengutronix.de,
	festevam@gmail.com, imx@lists.linux.dev, kernel@pengutronix.de,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V5 03/12] PCI: dwc: Allow external allocation of pci_host_bridge
Date: Fri, 13 Feb 2026 10:29:12 -0500	[thread overview]
Message-ID: <aY9DSPaTCMhcR8GC@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260213040852.3340547-4-sherry.sun@nxp.com>

On Fri, Feb 13, 2026 at 12:08:43PM +0800, Sherry Sun wrote:
> Currently, dw_pcie_host_init() always allocates a new pci_host_bridge
> structure internally using devm_pci_alloc_host_bridge(). This prevents
> drivers from pre-allocating the bridge structure when needed.
>
> Modify dw_pcie_host_init() to check if pp->bridge is already set. If
> set, use the pre-allocated bridge instead of allocating a new one. This
> maintains backward compatibility with existing drivers that don't set
> pp->bridge, while allowing new drivers to pre-allocate when needed.
>
> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
>  drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 6ae6189e9b8a..c2de9830e1e9 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -575,11 +575,15 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
>
>  	raw_spin_lock_init(&pp->lock);
>
> -	bridge = devm_pci_alloc_host_bridge(dev, 0);
> -	if (!bridge)
> -		return -ENOMEM;
> +	if (!pp->bridge) {
> +		bridge = devm_pci_alloc_host_bridge(dev, 0);

It'd better call parse port here, or in devm_pci_alloc_host_bridge().

If that, needn't check pp->bridge.

Frank
> +		if (!bridge)
> +			return -ENOMEM;
>
> -	pp->bridge = bridge;
> +		pp->bridge = bridge;
> +	} else {
> +		bridge = pp->bridge;
> +	}
>
>  	ret = dw_pcie_host_get_resources(pp);
>  	if (ret)
> --
> 2.37.1
>

  reply	other threads:[~2026-02-13 15:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13  4:08 [PATCH V5 00/12] pci-imx6: Add support for parsing the reset property in new Root Port binding Sherry Sun
2026-02-13  4:08 ` [PATCH V5 01/12] dt-bindings: PCI: fsl,imx6q-pcie: Add reset GPIO in Root Port node Sherry Sun
2026-02-13  4:08 ` [PATCH V5 02/12] PCI: host-generic: Add common helpers for parsing Root Port properties Sherry Sun
2026-02-16 16:21   ` Manivannan Sadhasivam
2026-02-24 10:24     ` Sherry Sun
2026-02-25 13:15       ` Manivannan Sadhasivam
2026-02-26  3:40         ` Sherry Sun
2026-02-28  1:58           ` Hongxing Zhu
2026-02-28 15:05             ` Manivannan Sadhasivam
2026-02-13  4:08 ` [PATCH V5 03/12] PCI: dwc: Allow external allocation of pci_host_bridge Sherry Sun
2026-02-13 15:29   ` Frank Li [this message]
2026-02-16 16:25     ` Manivannan Sadhasivam
2026-02-24 10:34       ` Sherry Sun
2026-02-13  4:08 ` [PATCH V5 04/12] PCI: imx6: Add support for parsing the reset property in new Root Port binding Sherry Sun
2026-02-13 15:32   ` Frank Li
2026-02-13  4:08 ` [PATCH V5 05/12] arm: dts: imx6qdl: Add Root Port node and PERST property Sherry Sun
2026-02-13  4:08 ` [PATCH V5 06/12] arm: dts: imx6sx: " Sherry Sun
2026-02-13  4:08 ` [PATCH V5 07/12] arm: dts: imx7d: " Sherry Sun
2026-02-13  4:08 ` [PATCH V5 08/12] arm64: dts: imx8mm: " Sherry Sun
2026-02-13  4:08 ` [PATCH V5 09/12] arm64: dts: imx8mp: " Sherry Sun
2026-02-13  4:08 ` [PATCH V5 10/12] arm64: dts: imx8mq: " Sherry Sun
2026-02-13  4:08 ` [PATCH V5 11/12] arm64: dts: imx8dxl/qm/qxp: " Sherry Sun
2026-02-13  4:08 ` [PATCH V5 12/12] arm64: dts: imx95: " Sherry Sun

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=aY9DSPaTCMhcR8GC@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=hongxing.zhu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sherry.sun@nxp.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