Lines Matching full:us
67 * sets the machine state and the ABORTING bit in us->dflags to prevent
69 * below, which atomically tests-and-clears the URB_ACTIVE bit in us->dflags
74 * When a disconnect occurs, the DISCONNECTING bit in us->dflags is set to
98 * This is the completion handler which will wake us up when an URB
115 static int usb_stor_msg_common(struct us_data *us, int timeout) in usb_stor_msg_common() argument
122 if (test_bit(US_FLIDX_ABORTING, &us->dflags)) in usb_stor_msg_common()
129 us->current_urb->context = &urb_done; in usb_stor_msg_common()
130 us->current_urb->transfer_flags = 0; in usb_stor_msg_common()
133 * we assume that if transfer_buffer isn't us->iobuf then it in usb_stor_msg_common()
135 * easier than always having the caller tell us whether the in usb_stor_msg_common()
138 if (us->current_urb->transfer_buffer == us->iobuf) in usb_stor_msg_common()
139 us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usb_stor_msg_common()
140 us->current_urb->transfer_dma = us->iobuf_dma; in usb_stor_msg_common()
143 status = usb_submit_urb(us->current_urb, GFP_NOIO); in usb_stor_msg_common()
153 set_bit(US_FLIDX_URB_ACTIVE, &us->dflags); in usb_stor_msg_common()
156 if (test_bit(US_FLIDX_ABORTING, &us->dflags)) { in usb_stor_msg_common()
159 if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags)) { in usb_stor_msg_common()
160 usb_stor_dbg(us, "-- cancelling URB\n"); in usb_stor_msg_common()
161 usb_unlink_urb(us->current_urb); in usb_stor_msg_common()
169 clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags); in usb_stor_msg_common()
172 usb_stor_dbg(us, "%s -- cancelling URB\n", in usb_stor_msg_common()
174 usb_kill_urb(us->current_urb); in usb_stor_msg_common()
178 return us->current_urb->status; in usb_stor_msg_common()
185 int usb_stor_control_msg(struct us_data *us, unsigned int pipe, in usb_stor_control_msg() argument
191 usb_stor_dbg(us, "rq=%02x rqtype=%02x value=%04x index=%02x len=%u\n", in usb_stor_control_msg()
195 us->cr->bRequestType = requesttype; in usb_stor_control_msg()
196 us->cr->bRequest = request; in usb_stor_control_msg()
197 us->cr->wValue = cpu_to_le16(value); in usb_stor_control_msg()
198 us->cr->wIndex = cpu_to_le16(index); in usb_stor_control_msg()
199 us->cr->wLength = cpu_to_le16(size); in usb_stor_control_msg()
202 usb_fill_control_urb(us->current_urb, us->pusb_dev, pipe, in usb_stor_control_msg()
203 (unsigned char*) us->cr, data, size, in usb_stor_control_msg()
205 status = usb_stor_msg_common(us, timeout); in usb_stor_control_msg()
209 status = us->current_urb->actual_length; in usb_stor_control_msg()
227 int usb_stor_clear_halt(struct us_data *us, unsigned int pipe) in usb_stor_clear_halt() argument
235 result = usb_stor_control_msg(us, us->send_ctrl_pipe, in usb_stor_clear_halt()
241 usb_reset_endpoint(us->pusb_dev, endp); in usb_stor_clear_halt()
243 usb_stor_dbg(us, "result = %d\n", result); in usb_stor_clear_halt()
256 static int interpret_urb_result(struct us_data *us, unsigned int pipe, in interpret_urb_result() argument
259 usb_stor_dbg(us, "Status code %d; transferred %u/%u\n", in interpret_urb_result()
266 usb_stor_dbg(us, "-- short transfer\n"); in interpret_urb_result()
270 usb_stor_dbg(us, "-- transfer complete\n"); in interpret_urb_result()
280 usb_stor_dbg(us, "-- stall on control pipe\n"); in interpret_urb_result()
285 usb_stor_dbg(us, "clearing endpoint halt for pipe 0x%x\n", in interpret_urb_result()
287 if (usb_stor_clear_halt(us, pipe) < 0) in interpret_urb_result()
293 usb_stor_dbg(us, "-- babble\n"); in interpret_urb_result()
298 usb_stor_dbg(us, "-- transfer cancelled\n"); in interpret_urb_result()
303 usb_stor_dbg(us, "-- short read transfer\n"); in interpret_urb_result()
308 usb_stor_dbg(us, "-- abort or disconnect in progress\n"); in interpret_urb_result()
313 usb_stor_dbg(us, "-- unknown error\n"); in interpret_urb_result()
322 int usb_stor_ctrl_transfer(struct us_data *us, unsigned int pipe, in usb_stor_ctrl_transfer() argument
328 usb_stor_dbg(us, "rq=%02x rqtype=%02x value=%04x index=%02x len=%u\n", in usb_stor_ctrl_transfer()
332 us->cr->bRequestType = requesttype; in usb_stor_ctrl_transfer()
333 us->cr->bRequest = request; in usb_stor_ctrl_transfer()
334 us->cr->wValue = cpu_to_le16(value); in usb_stor_ctrl_transfer()
335 us->cr->wIndex = cpu_to_le16(index); in usb_stor_ctrl_transfer()
336 us->cr->wLength = cpu_to_le16(size); in usb_stor_ctrl_transfer()
339 usb_fill_control_urb(us->current_urb, us->pusb_dev, pipe, in usb_stor_ctrl_transfer()
340 (unsigned char*) us->cr, data, size, in usb_stor_ctrl_transfer()
342 result = usb_stor_msg_common(us, 0); in usb_stor_ctrl_transfer()
344 return interpret_urb_result(us, pipe, size, result, in usb_stor_ctrl_transfer()
345 us->current_urb->actual_length); in usb_stor_ctrl_transfer()
353 * This routine always uses us->recv_intr_pipe as the pipe and
354 * us->ep_bInterval as the interrupt interval.
356 static int usb_stor_intr_transfer(struct us_data *us, void *buf, in usb_stor_intr_transfer() argument
360 unsigned int pipe = us->recv_intr_pipe; in usb_stor_intr_transfer()
363 usb_stor_dbg(us, "xfer %u bytes\n", length); in usb_stor_intr_transfer()
366 maxp = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe)); in usb_stor_intr_transfer()
371 usb_fill_int_urb(us->current_urb, us->pusb_dev, pipe, buf, in usb_stor_intr_transfer()
373 us->ep_bInterval); in usb_stor_intr_transfer()
374 result = usb_stor_msg_common(us, 0); in usb_stor_intr_transfer()
376 return interpret_urb_result(us, pipe, length, result, in usb_stor_intr_transfer()
377 us->current_urb->actual_length); in usb_stor_intr_transfer()
385 int usb_stor_bulk_transfer_buf(struct us_data *us, unsigned int pipe, in usb_stor_bulk_transfer_buf() argument
390 usb_stor_dbg(us, "xfer %u bytes\n", length); in usb_stor_bulk_transfer_buf()
393 usb_fill_bulk_urb(us->current_urb, us->pusb_dev, pipe, buf, length, in usb_stor_bulk_transfer_buf()
395 result = usb_stor_msg_common(us, 0); in usb_stor_bulk_transfer_buf()
399 *act_len = us->current_urb->actual_length; in usb_stor_bulk_transfer_buf()
400 return interpret_urb_result(us, pipe, length, result, in usb_stor_bulk_transfer_buf()
401 us->current_urb->actual_length); in usb_stor_bulk_transfer_buf()
411 static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, in usb_stor_bulk_transfer_sglist() argument
418 if (test_bit(US_FLIDX_ABORTING, &us->dflags)) in usb_stor_bulk_transfer_sglist()
422 usb_stor_dbg(us, "xfer %u bytes, %d entries\n", length, num_sg); in usb_stor_bulk_transfer_sglist()
423 result = usb_sg_init(&us->current_sg, us->pusb_dev, pipe, 0, in usb_stor_bulk_transfer_sglist()
426 usb_stor_dbg(us, "usb_sg_init returned %d\n", result); in usb_stor_bulk_transfer_sglist()
434 set_bit(US_FLIDX_SG_ACTIVE, &us->dflags); in usb_stor_bulk_transfer_sglist()
437 if (test_bit(US_FLIDX_ABORTING, &us->dflags)) { in usb_stor_bulk_transfer_sglist()
440 if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags)) { in usb_stor_bulk_transfer_sglist()
441 usb_stor_dbg(us, "-- cancelling sg request\n"); in usb_stor_bulk_transfer_sglist()
442 usb_sg_cancel(&us->current_sg); in usb_stor_bulk_transfer_sglist()
447 usb_sg_wait(&us->current_sg); in usb_stor_bulk_transfer_sglist()
448 clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags); in usb_stor_bulk_transfer_sglist()
450 result = us->current_sg.status; in usb_stor_bulk_transfer_sglist()
452 *act_len = us->current_sg.bytes; in usb_stor_bulk_transfer_sglist()
453 return interpret_urb_result(us, pipe, length, result, in usb_stor_bulk_transfer_sglist()
454 us->current_sg.bytes); in usb_stor_bulk_transfer_sglist()
461 int usb_stor_bulk_srb(struct us_data* us, unsigned int pipe, in usb_stor_bulk_srb() argument
465 int result = usb_stor_bulk_transfer_sglist(us, pipe, scsi_sglist(srb), in usb_stor_bulk_srb()
483 int usb_stor_bulk_transfer_sg(struct us_data* us, unsigned int pipe, in usb_stor_bulk_transfer_sg() argument
492 result = usb_stor_bulk_transfer_sglist(us, pipe, in usb_stor_bulk_transfer_sg()
498 result = usb_stor_bulk_transfer_buf(us, pipe, buf, in usb_stor_bulk_transfer_sg()
519 static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb) in last_sector_hacks() argument
539 if (!us->use_last_sector_hacks) in last_sector_hacks()
564 us->use_last_sector_hacks = 0; in last_sector_hacks()
576 if (++us->last_sector_retries < 3) in last_sector_hacks()
590 us->last_sector_retries = 0; in last_sector_hacks()
599 void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) in usb_stor_invoke_transport() argument
606 result = us->transport(srb, us); in usb_stor_invoke_transport()
612 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { in usb_stor_invoke_transport()
613 usb_stor_dbg(us, "-- command was aborted\n"); in usb_stor_invoke_transport()
620 usb_stor_dbg(us, "-- transport indicates error, resetting\n"); in usb_stor_invoke_transport()
628 last_sector_hacks(us, srb); in usb_stor_invoke_transport()
648 if ((us->protocol == USB_PR_CB || us->protocol == USB_PR_DPCM_USB) && in usb_stor_invoke_transport()
650 usb_stor_dbg(us, "-- CB transport device requiring auto-sense\n"); in usb_stor_invoke_transport()
660 usb_stor_dbg(us, "-- transport indicates command failure\n"); in usb_stor_invoke_transport()
672 !(us->fflags & US_FL_SANE_SENSE) && in usb_stor_invoke_transport()
673 !(us->fflags & US_FL_BAD_SENSE) && in usb_stor_invoke_transport()
675 usb_stor_dbg(us, "-- SAT supported, increasing auto-sense\n"); in usb_stor_invoke_transport()
676 us->fflags |= US_FL_SANE_SENSE; in usb_stor_invoke_transport()
689 usb_stor_dbg(us, "-- unexpectedly short transfer\n"); in usb_stor_invoke_transport()
702 if (us->fflags & US_FL_SANE_SENSE) in usb_stor_invoke_transport()
705 usb_stor_dbg(us, "Issuing auto-REQUEST_SENSE\n"); in usb_stor_invoke_transport()
710 if (us->subclass == USB_SC_RBC || us->subclass == USB_SC_SCSI || in usb_stor_invoke_transport()
711 us->subclass == USB_SC_CYP_ATACB) in usb_stor_invoke_transport()
718 temp_result = us->transport(us->srb, us); in usb_stor_invoke_transport()
723 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { in usb_stor_invoke_transport()
724 usb_stor_dbg(us, "-- auto-sense aborted\n"); in usb_stor_invoke_transport()
729 us->fflags &= ~US_FL_SANE_SENSE; in usb_stor_invoke_transport()
730 us->fflags |= US_FL_BAD_SENSE; in usb_stor_invoke_transport()
743 usb_stor_dbg(us, "-- auto-sense failure, retry small sense\n"); in usb_stor_invoke_transport()
745 us->fflags &= ~US_FL_SANE_SENSE; in usb_stor_invoke_transport()
746 us->fflags |= US_FL_BAD_SENSE; in usb_stor_invoke_transport()
752 usb_stor_dbg(us, "-- auto-sense failure\n"); in usb_stor_invoke_transport()
760 if (!(us->fflags & US_FL_SCM_MULT_TARG)) in usb_stor_invoke_transport()
771 !(us->fflags & US_FL_SANE_SENSE) && in usb_stor_invoke_transport()
772 !(us->fflags & US_FL_BAD_SENSE) && in usb_stor_invoke_transport()
774 usb_stor_dbg(us, "-- SANE_SENSE support enabled\n"); in usb_stor_invoke_transport()
775 us->fflags |= US_FL_SANE_SENSE; in usb_stor_invoke_transport()
781 usb_stor_dbg(us, "-- Sense data truncated to %i from %i\n", in usb_stor_invoke_transport()
790 usb_stor_dbg(us, "-- Result from auto-sense is %d\n", in usb_stor_invoke_transport()
792 usb_stor_dbg(us, "-- code: 0x%x, key: 0x%x, ASC: 0x%x, ASCQ: 0x%x\n", in usb_stor_invoke_transport()
796 usb_stor_show_sense(us, sshdr.sense_key, sshdr.asc, sshdr.ascq); in usb_stor_invoke_transport()
857 if (unlikely((us->fflags & US_FL_INITIAL_READ10) && in usb_stor_invoke_transport()
860 set_bit(US_FLIDX_READ10_WORKED, &us->dflags); in usb_stor_invoke_transport()
861 } else if (test_bit(US_FLIDX_READ10_WORKED, &us->dflags)) { in usb_stor_invoke_transport()
862 clear_bit(US_FLIDX_READ10_WORKED, &us->dflags); in usb_stor_invoke_transport()
863 set_bit(US_FLIDX_REDO_READ10, &us->dflags); in usb_stor_invoke_transport()
871 if (test_bit(US_FLIDX_REDO_READ10, &us->dflags)) { in usb_stor_invoke_transport()
872 clear_bit(US_FLIDX_REDO_READ10, &us->dflags); in usb_stor_invoke_transport()
883 last_sector_hacks(us, srb); in usb_stor_invoke_transport()
897 scsi_lock(us_to_host(us)); in usb_stor_invoke_transport()
898 set_bit(US_FLIDX_RESETTING, &us->dflags); in usb_stor_invoke_transport()
899 clear_bit(US_FLIDX_ABORTING, &us->dflags); in usb_stor_invoke_transport()
900 scsi_unlock(us_to_host(us)); in usb_stor_invoke_transport()
906 mutex_unlock(&us->dev_mutex); in usb_stor_invoke_transport()
907 result = usb_stor_port_reset(us); in usb_stor_invoke_transport()
908 mutex_lock(&us->dev_mutex); in usb_stor_invoke_transport()
911 scsi_lock(us_to_host(us)); in usb_stor_invoke_transport()
912 usb_stor_report_device_reset(us); in usb_stor_invoke_transport()
913 scsi_unlock(us_to_host(us)); in usb_stor_invoke_transport()
914 us->transport_reset(us); in usb_stor_invoke_transport()
916 clear_bit(US_FLIDX_RESETTING, &us->dflags); in usb_stor_invoke_transport()
917 last_sector_hacks(us, srb); in usb_stor_invoke_transport()
921 void usb_stor_stop_transport(struct us_data *us) in usb_stor_stop_transport() argument
929 if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags)) { in usb_stor_stop_transport()
930 usb_stor_dbg(us, "-- cancelling URB\n"); in usb_stor_stop_transport()
931 usb_unlink_urb(us->current_urb); in usb_stor_stop_transport()
935 if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags)) { in usb_stor_stop_transport()
936 usb_stor_dbg(us, "-- cancelling sg request\n"); in usb_stor_stop_transport()
937 usb_sg_cancel(&us->current_sg); in usb_stor_stop_transport()
945 int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us) in usb_stor_CB_transport() argument
955 * Stack may be vmallocated. So no DMA for us. Make a copy. in usb_stor_CB_transport()
957 memcpy(us->iobuf, srb->cmnd, srb->cmd_len); in usb_stor_CB_transport()
958 result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, in usb_stor_CB_transport()
961 us->ifnum, us->iobuf, srb->cmd_len); in usb_stor_CB_transport()
964 usb_stor_dbg(us, "Call to usb_stor_ctrl_transfer() returned %d\n", in usb_stor_CB_transport()
981 us->recv_bulk_pipe : us->send_bulk_pipe; in usb_stor_CB_transport()
982 result = usb_stor_bulk_srb(us, pipe, srb); in usb_stor_CB_transport()
983 usb_stor_dbg(us, "CBI data stage result is 0x%x\n", result); in usb_stor_CB_transport()
998 if (us->protocol != USB_PR_CBI) in usb_stor_CB_transport()
1001 result = usb_stor_intr_transfer(us, us->iobuf, 2); in usb_stor_CB_transport()
1002 usb_stor_dbg(us, "Got interrupt data (0x%x, 0x%x)\n", in usb_stor_CB_transport()
1003 us->iobuf[0], us->iobuf[1]); in usb_stor_CB_transport()
1008 * UFI gives us ASC and ASCQ, like a request sense in usb_stor_CB_transport()
1015 if (us->subclass == USB_SC_UFI) { in usb_stor_CB_transport()
1019 if (us->iobuf[0]) in usb_stor_CB_transport()
1031 if (us->iobuf[0]) { in usb_stor_CB_transport()
1032 usb_stor_dbg(us, "CBI IRQ data showed reserved bType 0x%x\n", in usb_stor_CB_transport()
1033 us->iobuf[0]); in usb_stor_CB_transport()
1039 switch (us->iobuf[1] & 0x0F) { in usb_stor_CB_transport()
1053 usb_stor_clear_halt(us, pipe); in usb_stor_CB_transport()
1063 int usb_stor_Bulk_max_lun(struct us_data *us) in usb_stor_Bulk_max_lun() argument
1068 us->iobuf[0] = 0; in usb_stor_Bulk_max_lun()
1069 result = usb_stor_control_msg(us, us->recv_ctrl_pipe, in usb_stor_Bulk_max_lun()
1073 0, us->ifnum, us->iobuf, 1, 10*HZ); in usb_stor_Bulk_max_lun()
1075 usb_stor_dbg(us, "GetMaxLUN command result is %d, data is %d\n", in usb_stor_Bulk_max_lun()
1076 result, us->iobuf[0]); in usb_stor_Bulk_max_lun()
1084 if (us->iobuf[0] < 16) { in usb_stor_Bulk_max_lun()
1085 return us->iobuf[0]; in usb_stor_Bulk_max_lun()
1087 dev_info(&us->pusb_intf->dev, in usb_stor_Bulk_max_lun()
1089 us->iobuf[0]); in usb_stor_Bulk_max_lun()
1103 int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) in usb_stor_Bulk_transport() argument
1105 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; in usb_stor_Bulk_transport()
1106 struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf; in usb_stor_Bulk_transport()
1115 if (unlikely(us->fflags & US_FL_BULK32)) { in usb_stor_Bulk_transport()
1117 us->iobuf[31] = 0; in usb_stor_Bulk_transport()
1125 bcb->Tag = ++us->tag; in usb_stor_Bulk_transport()
1127 if (us->fflags & US_FL_SCM_MULT_TARG) in usb_stor_Bulk_transport()
1136 usb_stor_dbg(us, "Bulk Command S 0x%x T 0x%x L %d F %d Trg %d LUN %d CL %d\n", in usb_stor_Bulk_transport()
1141 result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, in usb_stor_Bulk_transport()
1143 usb_stor_dbg(us, "Bulk command transfer result=%d\n", result); in usb_stor_Bulk_transport()
1151 * Some USB-IDE converter chips need a 100us delay between the in usb_stor_Bulk_transport()
1155 if (unlikely(us->fflags & US_FL_GO_SLOW)) in usb_stor_Bulk_transport()
1160 us->recv_bulk_pipe : us->send_bulk_pipe; in usb_stor_Bulk_transport()
1161 result = usb_stor_bulk_srb(us, pipe, srb); in usb_stor_Bulk_transport()
1162 usb_stor_dbg(us, "Bulk data transfer result 0x%x\n", result); in usb_stor_Bulk_transport()
1168 * amount requested, the spec requires us to transfer in usb_stor_Bulk_transport()
1195 usb_stor_dbg(us, "Device skipped data phase\n"); in usb_stor_Bulk_transport()
1208 usb_stor_dbg(us, "Attempting to get CSW...\n"); in usb_stor_Bulk_transport()
1209 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in usb_stor_Bulk_transport()
1218 usb_stor_dbg(us, "Received 0-length CSW; retrying...\n"); in usb_stor_Bulk_transport()
1219 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in usb_stor_Bulk_transport()
1227 usb_stor_dbg(us, "Attempting to get CSW (2nd try)...\n"); in usb_stor_Bulk_transport()
1228 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in usb_stor_Bulk_transport()
1233 usb_stor_dbg(us, "Bulk status result = %d\n", result); in usb_stor_Bulk_transport()
1240 usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", in usb_stor_Bulk_transport()
1243 if (!(bcs->Tag == us->tag || (us->fflags & US_FL_BULK_IGNORE_TAG)) || in usb_stor_Bulk_transport()
1245 usb_stor_dbg(us, "Bulk logical error\n"); in usb_stor_Bulk_transport()
1254 if (!us->bcs_signature) { in usb_stor_Bulk_transport()
1255 us->bcs_signature = bcs->Signature; in usb_stor_Bulk_transport()
1256 if (us->bcs_signature != cpu_to_le32(US_BULK_CS_SIGN)) in usb_stor_Bulk_transport()
1257 usb_stor_dbg(us, "Learnt BCS signature 0x%08X\n", in usb_stor_Bulk_transport()
1258 le32_to_cpu(us->bcs_signature)); in usb_stor_Bulk_transport()
1259 } else if (bcs->Signature != us->bcs_signature) { in usb_stor_Bulk_transport()
1260 usb_stor_dbg(us, "Signature mismatch: got %08X, expecting %08X\n", in usb_stor_Bulk_transport()
1262 le32_to_cpu(us->bcs_signature)); in usb_stor_Bulk_transport()
1268 * was really transferred and what the device tells us in usb_stor_Bulk_transport()
1270 if (residue && !(us->fflags & US_FL_IGNORE_RESIDUE)) { in usb_stor_Bulk_transport()
1283 us->fflags |= US_FL_IGNORE_RESIDUE; in usb_stor_Bulk_transport()
1335 static int usb_stor_reset_common(struct us_data *us, in usb_stor_reset_common() argument
1342 if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { in usb_stor_reset_common()
1343 usb_stor_dbg(us, "No reset during disconnect\n"); in usb_stor_reset_common()
1347 result = usb_stor_control_msg(us, us->send_ctrl_pipe, in usb_stor_reset_common()
1351 usb_stor_dbg(us, "Soft reset failed: %d\n", result); in usb_stor_reset_common()
1359 wait_event_interruptible_timeout(us->delay_wait, in usb_stor_reset_common()
1360 test_bit(US_FLIDX_DISCONNECTING, &us->dflags), in usb_stor_reset_common()
1362 if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { in usb_stor_reset_common()
1363 usb_stor_dbg(us, "Reset interrupted by disconnect\n"); in usb_stor_reset_common()
1367 usb_stor_dbg(us, "Soft reset: clearing bulk-in endpoint halt\n"); in usb_stor_reset_common()
1368 result = usb_stor_clear_halt(us, us->recv_bulk_pipe); in usb_stor_reset_common()
1370 usb_stor_dbg(us, "Soft reset: clearing bulk-out endpoint halt\n"); in usb_stor_reset_common()
1371 result2 = usb_stor_clear_halt(us, us->send_bulk_pipe); in usb_stor_reset_common()
1377 usb_stor_dbg(us, "Soft reset failed\n"); in usb_stor_reset_common()
1379 usb_stor_dbg(us, "Soft reset done\n"); in usb_stor_reset_common()
1386 int usb_stor_CB_reset(struct us_data *us) in usb_stor_CB_reset() argument
1388 memset(us->iobuf, 0xFF, CB_RESET_CMD_SIZE); in usb_stor_CB_reset()
1389 us->iobuf[0] = SEND_DIAGNOSTIC; in usb_stor_CB_reset()
1390 us->iobuf[1] = 4; in usb_stor_CB_reset()
1391 return usb_stor_reset_common(us, US_CBI_ADSC, in usb_stor_CB_reset()
1393 0, us->ifnum, us->iobuf, CB_RESET_CMD_SIZE); in usb_stor_CB_reset()
1401 int usb_stor_Bulk_reset(struct us_data *us) in usb_stor_Bulk_reset() argument
1403 return usb_stor_reset_common(us, US_BULK_RESET_REQUEST, in usb_stor_Bulk_reset()
1405 0, us->ifnum, NULL, 0); in usb_stor_Bulk_reset()
1411 * us->dev_mutex.
1413 int usb_stor_port_reset(struct us_data *us) in usb_stor_port_reset() argument
1418 if (us->pusb_dev->quirks & USB_QUIRK_RESET) in usb_stor_port_reset()
1421 result = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf); in usb_stor_port_reset()
1423 usb_stor_dbg(us, "unable to lock device for reset: %d\n", in usb_stor_port_reset()
1427 if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { in usb_stor_port_reset()
1429 usb_stor_dbg(us, "No reset during disconnect\n"); in usb_stor_port_reset()
1431 result = usb_reset_device(us->pusb_dev); in usb_stor_port_reset()
1432 usb_stor_dbg(us, "usb_reset_device returns %d\n", in usb_stor_port_reset()
1435 usb_unlock_device(us->pusb_dev); in usb_stor_port_reset()