Linux PCI subsystem development
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Feng Tang" <feng.tang@linux.alibaba.com>,
	"Jonathan Cameron" <Jonthan.Cameron@huawei.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH 4/6] PCI/portdrv: Move pcie_port_bus_type to pcie source file
Date: Thu, 11 Dec 2025 19:28:45 +0200 (EET)	[thread overview]
Message-ID: <df1810e3-6c16-0534-9042-f04dbf123e33@linux.intel.com> (raw)
In-Reply-To: <420d771f0091dea7cf18f445b94301576dcee4c8.1764688034.git.u.kleine-koenig@baylibre.com>

[-- Attachment #1: Type: text/plain, Size: 2829 bytes --]

On Tue, 2 Dec 2025, Uwe Kleine-König wrote:

> Conceptually the pci_express bus doesn't belong in generic pci code.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
>  drivers/pci/pci-driver.c   | 22 ----------------------
>  drivers/pci/pcie/portdrv.c | 20 ++++++++++++++++++++
>  2 files changed, 20 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 2b6a628fc7d0..addb1d226a25 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1699,28 +1699,6 @@ const struct bus_type pci_bus_type = {
>  };
>  EXPORT_SYMBOL(pci_bus_type);
>  
> -#ifdef CONFIG_PCIEPORTBUS
> -static int pcie_port_bus_match(struct device *dev, const struct device_driver *drv)
> -{
> -	struct pcie_device *pciedev = to_pcie_device(dev);
> -	const struct pcie_port_service_driver *driver = to_service_driver(drv);
> -
> -	if (driver->service != pciedev->service)
> -		return 0;
> -
> -	if (driver->port_type != PCIE_ANY_PORT &&
> -	    driver->port_type != pci_pcie_type(pciedev->port))
> -		return 0;
> -
> -	return 1;
> -}
> -
> -const struct bus_type pcie_port_bus_type = {
> -	.name		= "pci_express",
> -	.match		= pcie_port_bus_match,
> -};
> -#endif
> -
>  static int __init pci_driver_init(void)
>  {
>  	int ret;
> diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
> index 63492c3d3565..5cb0daf6781b 100644
> --- a/drivers/pci/pcie/portdrv.c
> +++ b/drivers/pci/pcie/portdrv.c
> @@ -508,6 +508,21 @@ static void pcie_port_device_remove(struct pci_dev *dev)
>  	pci_free_irq_vectors(dev);
>  }
>  
> +static int pcie_port_bus_match(struct device *dev, const struct device_driver *drv)
> +{
> +	struct pcie_device *pciedev = to_pcie_device(dev);
> +	const struct pcie_port_service_driver *driver = to_service_driver(drv);
> +
> +	if (driver->service != pciedev->service)
> +		return 0;
> +
> +	if (driver->port_type != PCIE_ANY_PORT &&
> +	    driver->port_type != pci_pcie_type(pciedev->port))
> +		return 0;
> +
> +	return 1;
> +}
> +
>  /**
>   * pcie_port_probe_service - probe driver for given PCI Express port service
>   * @dev: PCI Express port service device to probe against
> @@ -564,6 +579,11 @@ static int pcie_port_remove_service(struct device *dev)
>  	return 0;
>  }
>  
> +const struct bus_type pcie_port_bus_type = {
> +	.name = "pci_express",
> +	.match = pcie_port_bus_match,
> +};
> +
>  /**
>   * pcie_port_service_register - register PCI Express port service driver
>   * @new: PCI Express port service driver to register

I wonder if you should also relocate that #ifdef region 
bus_register(&pcie_port_bus_type); is in and make pcie_port_bus_type 
static? As is, this move feels somewhat incomplete.

-- 
 i.

  reply	other threads:[~2025-12-11 17:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 15:13 [PATCH 0/6] PCI/portdrv: Use bus-type functions Uwe Kleine-König
2025-12-02 15:13 ` [PATCH 1/6] PCI/portdrv: Fix potential resource leak Uwe Kleine-König
2025-12-11 17:19   ` Ilpo Järvinen
2025-12-19 12:07   ` Jonathan Cameron
2025-12-02 15:13 ` [PATCH 2/6] PCI/portdrv: Drop empty shutdown callback Uwe Kleine-König
2025-12-02 16:10   ` Uwe Kleine-König
2025-12-11 17:20   ` Ilpo Järvinen
2025-12-19 12:08   ` Jonathan Cameron
2025-12-02 15:13 ` [PATCH 3/6] PCI/portdrv: Don't check for the driver's and device's bus Uwe Kleine-König
2025-12-19 12:11   ` Jonathan Cameron
2025-12-02 15:13 ` [PATCH 4/6] PCI/portdrv: Move pcie_port_bus_type to pcie source file Uwe Kleine-König
2025-12-11 17:28   ` Ilpo Järvinen [this message]
2025-12-12 22:35     ` Uwe Kleine-König
2026-01-12 10:43       ` Uwe Kleine-König
2025-12-02 15:13 ` [PATCH 5/6] PCI/portdrv: Don't check for valid device and driver in bus callbacks Uwe Kleine-König
2025-12-19 12:12   ` Jonathan Cameron
2025-12-02 15:13 ` [PATCH 6/6] PCI/portdrv: Use bus-type functions Uwe Kleine-König
2025-12-19 12:13   ` Jonathan Cameron
2026-01-13 21:50 ` [PATCH 0/6] " Bjorn Helgaas

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=df1810e3-6c16-0534-9042-f04dbf123e33@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Jonthan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=feng.tang@linux.alibaba.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=u.kleine-koenig@baylibre.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