History

PCI/sysfs: Remove pci_create_legacy_files() and pci_sysfs_init()

Currently, pci_create_legacy_files() and pci_remove_legacy_files() are no-op stubs. With legacy attributes now handled by static groups registered via pcibus_groups[], no call site needs them. Remove both functions, their declarations, and the call sites in pci_register_host_bridge(), pci_alloc_child_bus(), and pci_remove_bus(). Remove the pci_sysfs_init() late_initcall and sysfs_initialized. The late_initcall originally existed to create all the dynamic PCI sysfs files, but with both resource and legacy attributes now handled by static groups, it is no longer needed. Remove the legacy_io and legacy_mem fields from struct pci_bus which were used to track the dynamically allocated legacy attributes.

Krzysztof Wilczyński committed 6 months ago

Commit 2800a911 parent 4e14b965 files · +0 −39Browse files

Unified · Split

5 files
  1. drivers/pci/pci-sysfs.c +0 −21
  2. drivers/pci/pci.h +0 −8
  3. drivers/pci/probe.c +0 −6
  4. drivers/pci/remove.c +0 −2
  5. include/linux/pci.h +0 −2
drivers/pci/pci-sysfs.c+0−21
@@ -37,10 +37,6 @@ · 36 unmodified lines
3737 #define ARCH_PCI_DEV_GROUPS
3838 #endif
3939
40−#ifdef HAVE_PCI_LEGACY
41−static int sysfs_initialized; /* = 0 */
42−#endif
43−
4440 /* show configuration fields */
4541 #define pci_config_attr(field, format_string) \
4642 static ssize_t \
@@ -1094,8 +1090,6 @@ static const struct attribute_group pci_legacy_mem_sparse_group = { · 1047 unmodified lines
10941090 .is_bin_visible = pci_legacy_mem_sparse_is_visible,
10951091 };
10961092
1097−void pci_create_legacy_files(struct pci_bus *b) { }
1098−void pci_remove_legacy_files(struct pci_bus *b) { }
10991093 #endif /* HAVE_PCI_LEGACY */
11001094
11011095 const struct attribute_group *pcibus_groups[] = {
@@ -1782,21 +1776,6 @@ static const struct attribute_group pci_dev_resource_resize_attr_group = { · 680 unmodified lines
17821776 .is_visible = resource_resize_attr_is_visible,
17831777 };
17841778
1785−#ifdef HAVE_PCI_LEGACY
1786−static int __init pci_sysfs_init(void)
1787−{
1788− struct pci_bus *pbus = NULL;
1789−
1790− sysfs_initialized = 1;
1791−
1792− while ((pbus = pci_find_next_bus(pbus)))
1793− pci_create_legacy_files(pbus);
1794−
1795− return 0;
1796−}
1797−late_initcall(pci_sysfs_init);
1798−#endif
1799−
18001779 static struct attribute *pci_dev_dev_attrs[] = {
18011780 &dev_attr_boot_vga.attr,
18021781 &dev_attr_serial_number.attr,
drivers/pci/pci.h+0−8
@@ -358,14 +358,6 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; } · 357 unmodified lines
358358 int pci_hp_add_bridge(struct pci_dev *dev);
359359 bool pci_hp_spurious_link_change(struct pci_dev *pdev);
360360
361−#if defined(CONFIG_SYSFS) && defined(HAVE_PCI_LEGACY)
362−void pci_create_legacy_files(struct pci_bus *bus);
363−void pci_remove_legacy_files(struct pci_bus *bus);
364−#else
365−static inline void pci_create_legacy_files(struct pci_bus *bus) { }
366−static inline void pci_remove_legacy_files(struct pci_bus *bus) { }
367−#endif
368−
369361 /* Lock for read/write access to pci device and bus lists */
370362 extern struct rw_semaphore pci_bus_sem;
371363 extern struct mutex pci_slot_mutex;
drivers/pci/probe.c+0−6
@@ -1073,9 +1073,6 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) · 1072 unmodified lines
10731073 dev_err(&bus->dev, "failed to add bus: %d\n", err);
10741074 }
10751075
1076− /* Create legacy_io and legacy_mem files for this bus */
1077− pci_create_legacy_files(bus);
1078−
10791076 if (parent)
10801077 dev_info(parent, "PCI host bridge to bus %s\n", name);
10811078 else
@@ -1281,9 +1278,6 @@ add_dev: · 199 unmodified lines
12811278 dev_err(&child->dev, "failed to add bus: %d\n", ret);
12821279 }
12831280
1284− /* Create legacy_io and legacy_mem files for this bus */
1285− pci_create_legacy_files(child);
1286−
12871281 return child;
12881282 }
12891283
drivers/pci/remove.c+0−2
@@ -65,8 +65,6 @@ void pci_remove_bus(struct pci_bus *bus) · 64 unmodified lines
6565 list_del(&bus->node);
6666 pci_bus_release_busn_res(bus);
6767 up_write(&pci_bus_sem);
68− pci_remove_legacy_files(bus);
69−
7068 if (bus->ops->remove_bus)
7169 bus->ops->remove_bus(bus);
7270
include/linux/pci.h+0−2
@@ -726,8 +726,6 @@ struct pci_bus { · 725 unmodified lines
726726 pci_bus_flags_t bus_flags; /* Inherited by child buses */
727727 struct device *bridge;
728728 struct device dev;
729− struct bin_attribute *legacy_io; /* Legacy I/O for this bus */
730− struct bin_attribute *legacy_mem; /* Legacy mem */
731729 unsigned int is_added:1;
732730 unsigned int unsafe_warn:1; /* warned about RW1C config write */
733731 unsigned int flit_mode:1; /* Link in Flit mode */