PCI/sysfs: Convert "rom" to static attribute
authorKrzysztof Wilczyński <kw@linux.com>
Fri, 16 Apr 2021 20:58:38 +0000 (20:58 +0000)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 27 Apr 2021 22:53:17 +0000 (17:53 -0500)
commit527139d738d7f2e9f929c752eebf3cbf0f74c754
treeaf505f656c57f653f7b98979a16ab13cca8f01eb
parente1d3f3268b0e512ceb811dd4765e476626bde71c
PCI/sysfs: Convert "rom" to static attribute

The "rom" sysfs attribute allows access to the PCI Option ROM.  Previously
it was dynamically created either by pci_bus_add_device() or the
pci_sysfs_init() initcall, but since it doesn't need to be created or
removed dynamically, we can use a static attribute so the device model
takes care of addition and removal automatically.

Convert "rom" to a static attribute and use the .is_bin_visible() callback
to set the correct object size based on the ROM size.

Remove "rom_attr" from the struct pci_dev since it is no longer needed.

This attribute was added in the pre-git era by https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/drivers/pci/pci-sysfs.c?id=f6d553444da2

[bhelgaas: commit log]
Suggested-by: Oliver O'Halloran <oohall@gmail.com>
Link: https://lore.kernel.org/r/20210416205856.3234481-3-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci-sysfs.c
include/linux/pci.h