• Tetsuo Handa's avatar
    media: imon: reorganize serialization · db264d4c
    Tetsuo Handa authored
    Since usb_register_dev() from imon_init_display() from imon_probe() holds
    minor_rwsem while display_open() which holds driver_lock and ictx->lock is
    called with minor_rwsem held from usb_open(), holding driver_lock or
    ictx->lock when calling usb_register_dev() causes circular locking
    dependency problem.
    
    Since usb_deregister_dev() from imon_disconnect() holds minor_rwsem while
    display_open() which holds driver_lock is called with minor_rwsem held,
    holding driver_lock when calling usb_deregister_dev() also causes circular
    locking dependency problem.
    
    Sean Young explained that the problem is there are imon devices which have
    two usb interfaces, even though it is one device. The probe and disconnect
    function of both usb interfaces can run concurrently.
    
    Alan Stern responded that the driver and USB cores guarantee that when an
    interface is probed, both the interface and its USB device are locked.
    Ditto for when the disconnect callback gets run. So concurrent probing/
    disc...
    db264d4c
imon.c 70.2 KB