]> git.ipfire.org Git - thirdparty/linux.git/commit
PCI/sysfs: Limit pci_sysfs_init() late_initcall compile scope
authorKrzysztof Wilczyński <kwilczynski@kernel.org>
Fri, 8 May 2026 04:35:29 +0000 (04:35 +0000)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 23 Jun 2026 20:19:08 +0000 (15:19 -0500)
commit4eee7eef239c61d11a2fdd03691d60c5cd91940d
tree5cdbd3065e4127373dbffd2104e1f9f475e69e0d
parent2c31a9675f50a61c9ceed6dab2545be7aa896d1a
PCI/sysfs: Limit pci_sysfs_init() late_initcall compile scope

Currently, pci_sysfs_init() and sysfs_initialized compile unconditionally,
even on platforms where static attribute groups handle all resource file
creation.

Place them behind a new HAVE_PCI_SYSFS_INIT macro, especially as the
late_initcall is only needed when:

  - HAVE_PCI_LEGACY is set, to iterate buses and create legacy I/O and
    memory files.

  - Neither HAVE_PCI_MMAP nor ARCH_GENERIC_PCI_MMAP_RESOURCE is set, to
    iterate devices and create resource files via the __weak
    pci_create_resource_files() stub override (this is how the Alpha
    architecture handles this currently).

On most systems both conditions are false and the entire late_initcall
compiles away.

Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Link: https://patch.msgid.link/20260508043543.217179-11-kwilczynski@kernel.org
drivers/pci/pci-sysfs.c