public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: daire.mcnamara@microchip.com
Cc: conor.dooley@microchip.com, lpieralisi@kernel.org, kw@linux.com,
	robh@kernel.org, bhelgaas@google.com,
	linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 7/7] PCI: microchip: Re-partition code between probe() and init()
Date: Thu, 30 May 2024 11:42:26 -0500	[thread overview]
Message-ID: <20240530164226.GA550240@bhelgaas> (raw)
In-Reply-To: <20230728131401.1615724-8-daire.mcnamara@microchip.com>

On Fri, Jul 28, 2023 at 02:14:01PM +0100, daire.mcnamara@microchip.com wrote:
> From: Daire McNamara <daire.mcnamara@microchip.com>
> 
> Continuing to use pci_host_common_probe() for the PCIe Root Complex on
> PolarFire SoC was leading to an extremely large _init() function and
> some unnatural code flow. Re-partition so some tasks are done in
> a _probe() routine, which calls pci_host_common_probe() and then use a
> much smaller _init() function, mainly to enable interrupts after address
> translation tables are set up.
> ...

> +++ b/drivers/pci/controller/pcie-microchip-host.c
> @@ -384,6 +384,8 @@ static struct {
>  
>  static char poss_clks[][5] = { "fic0", "fic1", "fic2", "fic3" };
>  
> +static struct mc_pcie *port;
> ...

> +static int mc_host_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
>  	void __iomem *bridge_base_addr;
>  	int ret;
>  	u32 val;
> @@ -1112,13 +1141,8 @@ static int mc_platform_init(struct pci_config_window *cfg)
>  	port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);

Saving this per-device pointer in a static singleton is kind of
problematic.  We may know there can only be a single instance right
now, but even if that remains true forever for this driver, we don't
want this pattern to be be copied elsewhere.

I didn't look hard enough to figure out exactly what problem this
singleton solves, but is there any other way to address it?

I suspect it's related to using pci_host_common_probe(), and it's
great to share that code, but it seems like that basically forces some
non-ECAM initialization into the struct pci_ecam_ops.init() method
where it doesn't really fit very well.

Bjorn

  reply	other threads:[~2024-05-30 16:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-28 13:13 [PATCH v3 0/7] PCI: microchip: Fixes and clean-ups daire.mcnamara
2023-07-28 13:13 ` [PATCH v3 1/7] PCI: microchip: Correct the DED and SEC interrupt bit offsets daire.mcnamara
2023-07-28 13:13 ` [PATCH v3 2/7] PCI: microchip: Enable building driver as a module daire.mcnamara
2023-07-28 13:13 ` [PATCH v3 3/7] PCI: microchip: Align register, offset, and mask names with hw docs daire.mcnamara
2023-07-28 13:13 ` [PATCH v3 4/7] PCI: microchip: Enable event handlers to access bridge and ctrl ptrs daire.mcnamara
2023-07-28 13:13 ` [PATCH v3 5/7] PCI: microchip: Clean up initialisation of interrupts daire.mcnamara
2023-07-28 13:14 ` [PATCH v3 6/7] PCI: microchip: Gather MSI information from hardware config registers daire.mcnamara
2023-07-28 13:14 ` [PATCH v3 7/7] PCI: microchip: Re-partition code between probe() and init() daire.mcnamara
2024-05-30 16:42   ` Bjorn Helgaas [this message]
2023-08-08 11:02 ` [PATCH v3 0/7] PCI: microchip: Fixes and clean-ups Lorenzo Pieralisi

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=20240530164226.GA550240@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=kw@linux.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.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