From: Lukas Wunner <lukas@wunner.de>
To: Hans Zhang <18255117159@163.com>
Cc: lpieralisi@kernel.org, kw@linux.com,
manivannan.sadhasivam@linaro.org, robh@kernel.org,
bhelgaas@google.com, jingoohan1@gmail.com,
thomas.richard@bootlin.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [v5 1/4] PCI: Introduce generic capability search functions
Date: Fri, 21 Mar 2025 18:06:09 +0100 [thread overview]
Message-ID: <Z92cgXEGwgYD2gau@wunner.de> (raw)
In-Reply-To: <20250321163803.391056-2-18255117159@163.com>
On Sat, Mar 22, 2025 at 12:38:00AM +0800, Hans Zhang wrote:
> Existing controller drivers (e.g., DWC, custom out-of-tree drivers)
> duplicate logic for scanning PCI capability lists. This creates
> maintenance burdens and risks inconsistencies.
>
> To resolve this:
>
> Add pci_host_bridge_find_*capability() in drivers/pci/pci.c, accepting
> controller-specific read functions and device data as parameters.
[...]
> drivers/pci/pci.c | 86 +++++++++++++++++++++++++++++++++++++++++++++
Please put this in a .c file which is only compiled and linked if
one of the controller drivers using those new helpers is enabled
in .config.
If you put the helpers in drivers/pci/pci.c, they unnecessarily
enlarge the kernel's .text section even if it's known already
at compile time that they're never going to be used (e.g. on x86).
You could put them in drivers/pci/controller/pci-host-common.c
and then select PCI_HOST_COMMON for each driver using them.
Or put them in a separate completely new file.
> include/linux/pci.h | 16 ++++++++-
Helpers that are only used internally in the PCI core should be
declared in drivers/pci/pci.h. I'd assume this also applies to
helpers used by controller drivers.
Thanks,
Lukas
next prev parent reply other threads:[~2025-03-21 17:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 16:37 [v5 0/4] Introduce generic capability search functions Hans Zhang
2025-03-21 16:38 ` [v5 1/4] PCI: " Hans Zhang
2025-03-21 17:06 ` Lukas Wunner [this message]
2025-03-22 15:47 ` Hans Zhang
2025-03-22 16:11 ` Lukas Wunner
2025-03-23 15:36 ` Hans Zhang
2025-03-21 20:05 ` kernel test robot
2025-03-21 20:57 ` kernel test robot
2025-03-21 20:57 ` kernel test robot
2025-03-21 16:38 ` [v5 2/4] PCI: dwc: Use common PCI host bridge APIs for finding the capabilities Hans Zhang
2025-03-21 16:38 ` [v5 3/4] PCI: cadence: " Hans Zhang
2025-03-21 16:38 ` [v5 4/4] PCI: cadence: Use cdns_pcie_find_*capability to avoid hardcode Hans Zhang
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=Z92cgXEGwgYD2gau@wunner.de \
--to=lukas@wunner.de \
--cc=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@kernel.org \
--cc=thomas.richard@bootlin.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