On 7/21/25 2:15 AM, Manivannan Sadhasivam wrote:
On Sun, Jul 20, 2025 at 05:34:44PM GMT, Lukas Wunner wrote:
On Sun, Jul 20, 2025 at 10:15:08AM -0500, Mario Limonciello wrote:
There is a desire to avoid creating new sysfs files late, so instead
of dynamically deciding to create the boot_display attribute, make
it static and use sysfs_update_group() to adjust visibility on the
applicable devices.
[...]
@@ -1698,7 +1690,7 @@ int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev)
if (!sysfs_initialized)
return -EACCES;
- retval = pci_create_boot_display_file(pdev);
+ retval = sysfs_update_group(&pdev->dev.kobj, &pci_display_attr_group);
if (retval)
return retval;
pci_create_sysfs_dev_files() is called from two places, pci_bus_add_device()
and the late_initcall pci_sysfs_init().
Separate question: Do we really need to call pci_create_sysfs_dev_files() from
pci_sysfs_init()? It is already getting called from pci_bus_add_device() and it
looks redundant to me. More importantly, it can also lead to a race (though
won't happen practically) [1].
Same goes for pci_proc_attach_device(). I was tempted to submit a patch removing
both these calls from pci_sysfs_init() and pci_proc_init(), but wanted to check
first.
[1] https://lore.kernel.org/linux-pci/r7fgb5xrn6ocstq6ctq4q7r4o2esgh4rqr44c3u234kcep6thk@bge2vzl33ptb/
- Mani
Thanks! It's totally valid.
Lukas raised the same concern. I have respun as a v3 with a fix.
https://lore.kernel.org/linux-pci/20250721023818.2410062-1-superm1@xxxxxxxxxx/T/#u
Thanks,