linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI: host-common: Allow drivers to use the device's drvdata pointer
@ 2025-11-18 22:12 Radu Rendec
  2025-11-18 22:12 ` [PATCH 1/2] PCI: host-common: Do not set drvdata in pci_host_common_init() Radu Rendec
  2025-11-18 22:12 ` [PATCH 2/2] PCI: apple: Store private pointer in platform device's drvdata Radu Rendec
  0 siblings, 2 replies; 7+ messages in thread
From: Radu Rendec @ 2025-11-18 22:12 UTC (permalink / raw)
  To: Marc Zyngier, Bjorn Helgaas, Manivannan Sadhasivam
  Cc: Will Deacon, Rob Herring, Krzysztof Wilczyński,
	Lorenzo Pieralisi, linux-pci, linux-arm-kernel, linux-kernel

Currently there's only one user of pci_host_common_init(), the
pcie-apple driver, and it goes to great lengths to store its own
per-device private pointer, because the device's drvdata is used by
pci_host_common_init() to store a pointer to struct pci_host_bridge.
See commit 643c0c9d0496 ("PCI: apple: Add tracking of probed root
ports").

However, it looks like this is necessary only for simple drivers that
use pci_host_common_{probe,remove}() directly as their platform
probe/remove functions. More complex drivers that allocate their own
private structure, like pcie-apple, can store a pointer to that instead;
the pointer to struct pci_host_bridge can be encapsulated in the private
structure if it's needed.

The first patch changes the pci-host-common library to free up drvdata
for drivers that do not use pci_host_common_{probe,remove}() directly.

The second patch uses the changes in the first patch to simplify the
pointer storage logic. This patch is *untested* because I don't have
access to the hardware.

Radu Rendec (2):
  PCI: host-common: Do not set drvdata in pci_host_common_init()
  PCI: apple: Store private pointer in platform device's drvdata

 drivers/pci/controller/pci-host-common.c | 36 +++++++++++-----
 drivers/pci/controller/pci-host-common.h |  6 ++-
 drivers/pci/controller/pcie-apple.c      | 53 ++++--------------------
 3 files changed, 36 insertions(+), 59 deletions(-)

-- 
2.51.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-11-20  9:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-18 22:12 [PATCH 0/2] PCI: host-common: Allow drivers to use the device's drvdata pointer Radu Rendec
2025-11-18 22:12 ` [PATCH 1/2] PCI: host-common: Do not set drvdata in pci_host_common_init() Radu Rendec
2025-11-19 12:01   ` Marc Zyngier
2025-11-19 16:19     ` Radu Rendec
2025-11-20  9:23       ` Marc Zyngier
2025-11-18 22:12 ` [PATCH 2/2] PCI: apple: Store private pointer in platform device's drvdata Radu Rendec
2025-11-19 11:30   ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).