- if (us->sm_state != US_STATE_IDLE) {
- printk(KERN_ERR USB_STORAGE "Error in %s: "
- "invalid state %d\n", __FUNCTION__, us->sm_state);
- return FAILED;
- }
-
- /* set the state and release the lock */
- us->sm_state = US_STATE_RESETTING;
- scsi_unlock(srb->device->host);
-
- /* The USB subsystem doesn't handle synchronisation between
- * a device's several drivers. Therefore we reset only devices
- * with just one interface, which we of course own. */
-
- down(&(us->dev_semaphore));
- if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {
- result = -EIO;
- US_DEBUGP("No reset during disconnect\n");
- } else if (us->pusb_dev->actconfig->desc.bNumInterfaces != 1) {
- result = -EBUSY;
- US_DEBUGP("Refusing to reset a multi-interface device\n");
- } else {
- result = usb_reset_device(us->pusb_dev);
- US_DEBUGP("usb_reset_device returns %d\n", result);
- }
- up(&(us->dev_semaphore));
-
- /* lock access to the state and clear it */
- scsi_lock(srb->device->host);
- us->sm_state = US_STATE_IDLE;