On Wed, 17 Apr 2019, Raul Rangel wrote: > > > Also where would be a good place to document this? > > > > Documentation/ABI/ is a good start. > I'll add something to Documentation/ABI/testing/xhci-uevent Your patch will apply to all host controllers, not just xhci. The documentation filename should reflect this. Perhaps "usb-uevent"? > > Why do you need to lock something that is "dead"? And why is the idr > > lock the correct one here? > We need to ensure that root_hub is not null. Though I'm not sure the > lock is entirely necessary in this case. usb_remove_hcd stops the work > item before it sets the rhdev to null. The reason I picked > usb_bus_idr_lock was because it's the same lock that usb_remove_hcd uses > when setting rhdev = NULL. > > Alan, what do you think? Should I remove the lock? You're both right; the lock isn't needed because the work is stopped before the root hub gets removed. Acquiring the lock doesn't do any harm, but it isn't needed so you probably should remove it. In fact, you don't even need to test for whether hcd->self.root_hub is non-NULL. Alan Stern