Re: [PATCH] usbip: vhci_hcd: move sysfs attribute setup into probe/remove
Deepanshu Kartikey <[email protected]>
| Newsgroups | org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CADhLXY6zru8nJcv5aXGpswc-tyFJkXz2W=Kta7v=OgdzW=G8ow@mail.gmail.com> |
On Sat, Aug 15, 2026 at 9:02 PM Greg KH <[email protected]> wrote: > > If you are going to move the creation, please do so in a race-free way > and properly make the driver core control this by setting these up as > default attributes. > v2 does this - the group is now registered as dev_groups on the platform driver, so the core creates the files before probe and removes them after remove returns. Both sysfs_create_group() and sysfs_remove_group() are gone from the driver. The attributes have only ever been created on vhci_hcd.0, even though the driver binds to one device per controller, so an is_visible() callback keeps them there rather than changing what userspace sees. vhci_init_attr_group() moves into vhci_hcd_init() ahead of platform_driver_register(), so the group is populated before the core reads it. > WHat has recently changed to make this start to fail now to require this > change? > Nothing recent. The window has been there since 1c9de5bf42861 ("usbip: vhci-hcd: Add USB3 SuperSpeed support"), which added the second hcd and left the group creation guarded by usb_hcd_is_primary_hcd(). That means the attach attribute goes live during the first usb_add_hcd(), before vhci_hcd_ss is set, and survives the first usb_put_hcd() on removal. Thanks Deepanshu