• Alan Stern's avatar
    [PATCH] Hold the device's parent's lock during probe and remove · bf74ad5b
    Alan Stern authored
    This patch (as604) makes the driver core hold a device's parent's lock
    as well as the device's lock during calls to the probe and remove
    methods in a driver.  This facility is needed by USB device drivers,
    owing to the peculiar way USB devices work:
    
    	A device provides multiple interfaces, and drivers are bound
    	to interfaces rather than to devices;
    
    	Nevertheless a reset, reset-configuration, suspend, or resume
    	affects the entire device and requires the caller to hold the
    	lock for the device, not just a lock for one of the interfaces.
    
    Since a USB driver's probe method is always called with the interface
    lock held, the locking order rules (always lock parent before child)
    prevent these methods from acquiring the device lock.  The solution
    provided here is to call all probe and remove methods, for all devices
    (not just USB), with the parent lock already acquired.
    
    Although currently only the USB subsystem requires these changes, people
    have...
    bf74ad5b
dd.c 6.59 KB