Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: Adjust pci_sysfs_init() to device_initcall
@ 2024-08-07 10:34 Ian
  2024-08-07 20:16 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Ian @ 2024-08-07 10:34 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, Ian Ding

From: Ian Ding <4dark@outlook.com>

When the controller driver uses async probe
(.probe_type = PROBE_PREFER_ASYNCHRONOUS), pci_host_probe() is not
guaranteed to run before pci_sysfs_init(), kernel may call
pci_create_sysfs_dev_files() twice in pci_sysfs_init() and
pci_host_probe() -> pci_bus_add_device(), and dump stack:

    sysfs: cannot create duplicate filename

Signed-off-by: Ian Ding <4dark@outlook.com>
---
 drivers/pci/pci-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index dd0d9d9bc..bef25fecb 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1534,7 +1534,7 @@ static int __init pci_sysfs_init(void)
 
 	return 0;
 }
-late_initcall(pci_sysfs_init);
+device_initcall(pci_sysfs_init);
 
 static struct attribute *pci_dev_dev_attrs[] = {
 	&dev_attr_boot_vga.attr,
-- 
2.25.1


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

end of thread, other threads:[~2024-08-07 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 10:34 [PATCH] PCI: Adjust pci_sysfs_init() to device_initcall Ian
2024-08-07 20:16 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox