From: Radu Rendec <rrendec@redhat.com>
To: Marc Zyngier <maz@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Manivannan Sadhasivam <mani@kernel.org>
Cc: "Will Deacon" <will@kernel.org>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] PCI: host-common: Allow drivers to use the device's drvdata pointer
Date: Tue, 18 Nov 2025 17:12:42 -0500 [thread overview]
Message-ID: <20251118221244.372423-1-rrendec@redhat.com> (raw)
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
next reply other threads:[~2025-11-18 22:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 22:12 Radu Rendec [this message]
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
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=20251118221244.372423-1-rrendec@redhat.com \
--to=rrendec@redhat.com \
--cc=bhelgaas@google.com \
--cc=kwilczynski@kernel.org \
--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=maz@kernel.org \
--cc=robh@kernel.org \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).