linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] PCI: Convert dynamic sysfs objects into static
@ 2021-04-16 20:58 Krzysztof Wilczyński
  2021-04-16 20:58 ` [PATCH 01/20] PCI: Convert dynamic "config" sysfs object " Krzysztof Wilczyński
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: Krzysztof Wilczyński @ 2021-04-16 20:58 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Pali Rohár, Oliver O'Halloran, Greg Kroah-Hartman,
	Daniel Vetter, Joe Perches, Dan Williams, Mauro Carvalho Chehab,
	David Sterba, linux-pci

Hello,

Currently, a lot of PCI-related sysfs objects that are created when
either the PCI driver is initialised or when a new device is added are
dynamically created under the "/sys/bus/pci/devices/..." path.

All the attributes are added when late_initcall() function executes when
the PCI driver, and hence the PCI sub-system, is initialised, and also
when the function pci_bus_add_devices() executes when a device is added:

  late_initcall()
    pci_sysfs_init()
      pci_create_sysfs_dev_files()
        sysfs_create_bin_file()

  pci_bus_add_devices()
    pci_bus_add_device()
      pci_create_sysfs_dev_files()
        ...

When a device is stopped and removed the pci_remove_sysfs_dev_files()
function executes dynamically removing all the attributes that were
previously added:

  pci_stop_bus_device()
    pci_stop_dev()
      pci_remove_sysfs_dev_files()
        sysfs_remove_bin_file()

The current implementation is known to cause problems [1].

As most of the PCI-related attributes does not need to be created and
removed dynamically, and thus there is no need to also manage their
create and remove life cycle manually.

This series aims to convert the majority of the dynamic sysfs objects
into static ones so that the PCI driver core can manage them
automatically when the device is either added or removed.

The aim is also to first reduce the reliance on using late_initcall()
and eventually remove the need for it completely - this hopefully should
move everything closer towards addressing the issue that has been
identified in [1].

Aside from converting sysfs objects, this series also offers a series of
style clean-up patches offering updates, style changes, etc.

1. https://lore.kernel.org/linux-pci/20200716110423.xtfyb3n6tn5ixedh@pali/

Krzysztof

Krzysztof Wilczyński (20):
  PCI: Convert dynamic "config" sysfs object into static
  PCI: Convert dynamic "rom" sysfs object into static
  PCI: Convert dynamic "reset" sysfs object into static
  PCI/VPD: Convert dynamic "vpd" sysfs object into static
  PCI: Convert dynamic "index" and "label" sysfs objects into static
  sysfs: Introduce BIN_ATTR_ADMIN_RO and BIN_ATTR_ADMIN_RW
  PCI: Convert PCI sysfs objects to use BIN_ATTR_ADMIN_RW macro
  PCI: Move to kstrtobool() to handle user input
  PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions
  PCI: Update style to be more consistent
  PCI: Rearrange attributes from the pci_dev_group
  PCI: Rearrange attributes from the pci_dev_config_attr_group
  PCI: Rearrange attributes from the pci_dev_rom_attr_group
  PCI: Rearrange attributes from the pci_dev_reset_attr_group
  PCI: Rearrange attributes from the pci_dev_attr_group
  PCI: Rearrange attributes from the pci_dev_hp_attr_group
  PCI: Rearrange attributes from the pci_bridge_attr_group
  PCI: Rearrange attributes from the pcie_dev_attr_group
  PCI: Rearrange attributes from the pci_bus_group
  PCI: Rearrange attributes from the pcibus_group

 drivers/pci/pci-label.c |  241 ++----
 drivers/pci/pci-sysfs.c | 1655 ++++++++++++++++++++-------------------
 drivers/pci/pci.h       |   16 +-
 drivers/pci/remove.c    |    2 +
 drivers/pci/vpd.c       |   58 +-
 include/linux/pci.h     |    1 -
 include/linux/sysfs.h   |   23 +
 7 files changed, 976 insertions(+), 1020 deletions(-)

-- 
2.31.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-04-16 20:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 20:58 [PATCH 00/20] PCI: Convert dynamic sysfs objects into static Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 01/20] PCI: Convert dynamic "config" sysfs object " Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 02/20] PCI: Convert dynamic "rom" " Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 03/20] PCI: Convert dynamic "reset" " Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 04/20] PCI/VPD: Convert dynamic "vpd" " Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 05/20] PCI: Convert dynamic "index" and "label" sysfs objects " Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 06/20] sysfs: Introduce BIN_ATTR_ADMIN_RO and BIN_ATTR_ADMIN_RW Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 07/20] PCI: Convert PCI sysfs objects to use BIN_ATTR_ADMIN_RW macro Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 08/20] PCI: Move to kstrtobool() to handle user input Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 09/20] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 10/20] PCI: Update style to be more consistent Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 11/20] PCI: Rearrange attributes from the pci_dev_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 12/20] PCI: Rearrange attributes from the pci_dev_config_attr_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 13/20] PCI: Rearrange attributes from the pci_dev_rom_attr_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 14/20] PCI: Rearrange attributes from the pci_dev_reset_attr_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 15/20] PCI: Rearrange attributes from the pci_dev_attr_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 16/20] PCI: Rearrange attributes from the pci_dev_hp_attr_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 17/20] PCI: Rearrange attributes from the pci_bridge_attr_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 18/20] PCI: Rearrange attributes from the pcie_dev_attr_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 19/20] PCI: Rearrange attributes from the pci_bus_group Krzysztof Wilczyński
2021-04-16 20:58 ` [PATCH 20/20] PCI: Rearrange attributes from the pcibus_group Krzysztof Wilczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).