Re: [PATCH v2 1/1] Guard pci_create_sysfs_dev_files with atomic value

From: Oliver Neukum
Date: Tue Mar 21 2023 - 05:10:00 EST


Am Donnerstag, 16. März 2023, 15:01:25 CET schrieb Oliver Neukum:
I'm not sure if I can follow you here. Can you elaborate?

There are far better reasons to leave the setup of a PCI bus as the firmware
has done it than to leave a USB as is.


How is it necessary? How do these PCI devices get attaches to the pci_bus_type bus without calling pci_bus_add_device?

AFAICT they don't. But somebody has to call it.


Okay, so which dependency is provided by pci_sysfs_init, which are required by drivers then?

It isn't. It is missing from the code. But it exists in reality. That is the point.
You have a race condition between two probes. We cannot have that.
Hence IMHO the dependency would be best expressed by waiting for pci_sysfs_init()
to finish in the init sequence before you add any PCI bridges or devices to the system.

Regards
Oliver