]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
alpha/PCI: Convert resource files to static attributes
authorKrzysztof Wilczyński <kwilczynski@kernel.org>
Fri, 8 May 2026 04:35:36 +0000 (04:35 +0000)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 23 Jun 2026 20:19:09 +0000 (15:19 -0500)
commitb7a57ffd4d9f4db3e95001db427c63053b78cf1f
tree15c507374912ebe02ddb8b63d54082a28119a37c
parent5980dcbc4b25e0164cfebc90c32bca7cff33d1c2
alpha/PCI: Convert resource files to static attributes

Previously, Alpha's PCI resource files (resourceN, resourceN_sparse,
resourceN_dense) were dynamically created by pci_create_resource_files(),
which overrides the generic __weak implementation.  The previous code
allocated bin_attributes at runtime and managed them via the res_attr[] and
res_attr_wc[] fields in struct pci_dev.

Convert to static const attributes with three attribute groups (plain,
sparse, dense), each with an .is_bin_visible() callback that checks
resource length, has_sparse(), and sparse_mem_mmap_fits().  A .bin_size()
callback provides the resource size to the kernfs node, with the sparse
variant shifting by 5 bits for byte-level addressing.

Register the groups via ARCH_PCI_DEV_GROUPS so the driver model handles
creation and removal automatically.

Use the new pci_resource_is_mem() helper for the type check, replacing the
open-coded bitwise flag test.

Finally, remove pci_create_resource_files(), pci_remove_resource_files(),
pci_create_attr(), and pci_create_one_attr() which are no longer needed.

Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Magnus Lindholm <linmag7@gmail.com>
Tested-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Acked-by: Magnus Lindholm <linmag7@gmail.com>
Link: https://patch.msgid.link/20260508043543.217179-18-kwilczynski@kernel.org
arch/alpha/include/asm/pci.h
arch/alpha/kernel/pci-sysfs.c