summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Wilczyński <kwilczynski@kernel.org>2026-05-08 04:35:40 +0000
committerBjorn Helgaas <bhelgaas@google.com>2026-06-23 15:19:09 -0500
commit574b5470f8d43c85bf3dcb8c48efc2788a2bfb0c (patch)
treecbf01053f58b8ab025be5a226f7b14e1d11e1c94 /drivers
parent385ec1d40756e3bcb868814e305089b4edd32149 (diff)
PCI/sysfs: Add __weak pci_legacy_has_sparse() helper
Currently, Alpha's sparse/dense legacy attribute handling is done via pci_adjust_legacy_attr(), which updates dynamically allocated attributes at runtime. The upcoming conversion to static attributes needs a way to determine sparse support at visibility check time. Add a __weak pci_legacy_has_sparse() that returns false by default. Alpha overrides it to check has_sparse() on the bus host controller. 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-22-kwilczynski@kernel.org
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci-sysfs.c6
-rw-r--r--drivers/pci/pci.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 1e60f072f746..c1ba706844c9 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -983,6 +983,12 @@ static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io);
}
+bool __weak pci_legacy_has_sparse(struct pci_bus *bus,
+ enum pci_mmap_state type)
+{
+ return false;
+}
+
/**
* pci_adjust_legacy_attr - adjustment of legacy file attributes
* @b: bus to create files under
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 71a1fde1e505..c64c7f5f0bcf 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -392,6 +392,10 @@ static inline int pci_no_d1d2(struct pci_dev *dev)
}
+#ifdef HAVE_PCI_LEGACY
+bool pci_legacy_has_sparse(struct pci_bus *bus, enum pci_mmap_state type);
+#endif
+
#ifdef CONFIG_SYSFS
extern const struct attribute_group *pci_dev_groups[];
extern const struct attribute_group *pci_dev_attr_groups[];