[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z92cgXEGwgYD2gau@wunner.de>
Date: Fri, 21 Mar 2025 18:06:09 +0100
From: Lukas Wunner <lukas@...ner.de>
To: Hans Zhang <18255117159@....com>
Cc: lpieralisi@...nel.org, kw@...ux.com, manivannan.sadhasivam@...aro.org,
robh@...nel.org, bhelgaas@...gle.com, jingoohan1@...il.com,
thomas.richard@...tlin.com, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [v5 1/4] PCI: Introduce generic capability search functions
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
Powered by blists - more mailing lists