hi all: I list my environment as below: 1. Arm platform with ehci support 2. plug in NTFS USB HD and play movie 3. plug out device suddenly. I found there will be possibly that driver will reset port even there is no device connected. I purposely add below code in ehci-hub.c when we try to do port reset @@ -1173,7 +1173,12 @@ static int ehci_hub_control ( ehci_writel(ehci, temp, status_reg); + dbg_port (ehci, "in port reset sequence, GetStatus", wIndex + 1, temp); + break; and I found driver will reset even device is disconnected like below log: (I also attach full log in the mail) tntfs info: NTFS volume version 3.1 (cluster_size 4096, PAGE_CACHE_SIZE 4096). Platform-ehci Platform-ehci.0: detected XactErr len 19456/20480 retry 1 hub 4-0:1.0: state 7 ports 1 chg 0000 evt 0002 hub 4-0:1.0: port 1, status 0000, change 0001, 12 Mb/s Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET usb 4-1: USB disconnect, device number 20 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... .................... My questions are: 1. from the log the reason why port reset shows is test_bit(US_FLIDX_DISCONNECTING, &us->dflags) failed in usb_stor_port_reset (in the log, I purposely dump_stack in usb_reset_and_verify_device) Why even "USB disconnect" show, the "US_FLIDX_DISCONNECTING" is not set up in time? 2. shall we add below determination before port reset? --- a/linux-3.8.2/drivers/usb/host/ehci-hub.c ++ b/linux-3.8.2/drivers/usb/host/ehci-hub.c @@ -1139,6 +1139,9 @@ static int ehci_hub_control ( case USB_PORT_FEAT_RESET: if (temp & PORT_RESUME) goto error; + + if (!(temp & PORT_CONNECT)) + goto disconnect; /* line status bits may report this as low speed, * which can be fine if this root hub has a * transaction translator built in. @@ -1219,6 +1223,10 @@ static int ehci_hub_control ( error: /* "stall" on error */ retval = -EPIPE; +disconnect: + + retval = -ENOTCONN; } Appreciate your help,
tntfs info: NTFS volume version 3.1 (cluster_size 4096, PAGE_CACHE_SIZE 4096). Platform-ehci Platform-ehci.0: detected XactErr len 19456/20480 retry 1 hub 4-0:1.0: state 7 ports 1 chg 0000 evt 0002 hub 4-0:1.0: port 1, status 0000, change 0001, 12 Mb/s Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET usb 4-1: USB disconnect, device number 20 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... hub 4-0:1.0: Cannot enable port 1. Maybe the USB cable is bad? Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... hub 4-0:1.0: Cannot enable port 1. Maybe the USB cable is bad? Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... hub 4-0:1.0: Cannot enable port 1. Maybe the USB cable is bad? Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... Platform-ehci Platform-ehci.0: port 1 reset Platform-ehci Platform-ehci.0: in port reset sequence, GetStatus port:1 status 000100 0 ACK sig=se0 RESET Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 Platform-ehci Platform-ehci.0: port 1 reset error -110 hub 4-0:1.0: hub_port_status failed (err = -32) hub 4-0:1.0: port_wait_reset: err = -32 hub 4-0:1.0: port 1 not enabled, trying reset again... hub 4-0:1.0: Cannot enable port 1. Maybe the USB cable is bad? [15:04:31.731][ 3][ 177.871185] Backtrace: [15:04:31.742][ 3][ 177.874030] [<c00175c0>] (dump_backtrace+0x0/0x11c) from [<c03578d0>] (dump_stack+0x20/0x24) [15:04:31.742][ 3][ 177.882873] r6:bf156d58 r5:00000004 r4:e01284c0 r3:00000002 [15:04:31.742][ 3][ 177.889033] [<c03578b0>] (dump_stack+0x0/0x24) from [<bf13d08c>] (usb_reset_and_verify_device+0x144/0x560 [usbcore]) [15:04:31.742][ 3][ 177.900026] [<bf13cf48>] (usb_reset_and_verify_device+0x0/0x560 [usbcore]) from [<bf13d558>] (usb_reset_device+0xb0/0x18c [usbcore]) [15:04:31.742][ 3][ 177.912364] [<bf13d4a8>] (usb_reset_device+0x0/0x18c [usbcore]) from [<bf272d48>] (usb_stor_port_reset+0x64/0x74 [usb_storage]) [15:04:31.742][ 3][ 177.924330] [<bf272ce4>] (usb_stor_port_reset+0x0/0x74 [usb_storage]) from [<bf272ec4>] (usb_stor_invoke_transport+0x16c/0x470 [usb_storage]) [15:04:31.742][ 3][ 177.937512] r5:e01edb1c r4:d278e140 [15:04:31.742][ 3][ 177.941836] [<bf272d58>] (usb_stor_invoke_transport+0x0/0x470 [usb_storage]) from [<bf271d34>] (usb_stor_transparent_scsi_command+0x18/0x1c [usb_storage]) [15:04:31.742][ 3][ 177.956344] [<bf271d1c>] (usb_stor_transparent_scsi_command+0x0/0x1c [usb_storage]) from [<bf274154>] (usb_stor_control_thread+0x16c/0x268 [usb_storage]) [15:04:31.742][ 3][ 177.970999] [<bf273fe8>] (usb_stor_control_thread+0x0/0x268 [usb_storage]) from [<c004de08>] (kthread+0xb4/0xc0) [15:04:31.742][ 3][ 177.981854] [<c004dd54>] (kthread+0x0/0xc0) from [<c0013028>] (ret_from_fork+0x14/0x20) [15:04:31.742][ 3][ 177.990912] r7:00000000 r6:00000000 r5:c004dd54 r4:e275fb04 hub 4-0:1.0: logical disconnect on port 1 usb 4-1: unregistering device sd 10:0:0:0: [sda] Unhandled error code sd 10:0:0:0: [sda]