Skip to content

PCI: host-common: Allow drivers to use the device's drvdata pointer

Radu Rendec linux-arm-kernel linux-pci lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2PCI: host-common: Do not set drvdata in pci_host_common_init()drivers/pci/controller/pci-host-common.c drivers/pci/controller/pci-host-common.h+29 -133 replies
2/2PCI: apple: Store private pointer in platform device's drvdatadrivers/pci/controller/pcie-apple.c+7 -461 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] PCI: host-common: Allow drivers to use the device's drvdata pointer

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(-)
Signature · 1 line
2.51.1