aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 11:19:33 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 11:19:33 -0400
commitdf3d80f5a5c74168be42788364d13cf6c83c7b9c (patch)
tree892a964c2fd28d028f2fb7471e8543d3f4006a58 /drivers/usb/storage
parent3d06f7a5f74a813cee817c4b30b5e6f0398da0be (diff)
parentc8e91b0a8fc8493e3bf3efcb3c8f866e9453cf1c (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (207 commits) [SCSI] gdth: fix CONFIG_ISA build failure [SCSI] esp_scsi: remove __dev{init,exit} [SCSI] gdth: !use_sg cleanup and use of scsi accessors [SCSI] gdth: Move members from SCp to gdth_cmndinfo, stage 2 [SCSI] gdth: Setup proper per-command private data [SCSI] gdth: Remove gdth_ctr_tab[] [SCSI] gdth: switch to modern scsi host registration [SCSI] gdth: gdth_interrupt() gdth_get_status() & gdth_wait() fixes [SCSI] gdth: clean up host private data [SCSI] gdth: Remove virt hosts [SCSI] gdth: Reorder scsi_host_template intitializers [SCSI] gdth: kill gdth_{read,write}[bwl] wrappers [SCSI] gdth: Remove 2.4.x support, in-kernel changelog [SCSI] gdth: split out pci probing [SCSI] gdth: split out eisa probing [SCSI] gdth: split out isa probing gdth: Make one abuse of scsi_cmnd less obvious [SCSI] NCR5380: Use scsi_eh API for REQUEST_SENSE invocation [SCSI] usb storage: use scsi_eh API in REQUEST_SENSE execution [SCSI] scsi_error: Refactoring scsi_error to facilitate in synchronous REQUEST_SENSE ...
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/transport.c46
1 files changed, 4 insertions, 42 deletions
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 323293a3e61f..c646750ccc30 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -50,7 +50,7 @@
50#include <linux/slab.h> 50#include <linux/slab.h>
51 51
52#include <scsi/scsi.h> 52#include <scsi/scsi.h>
53#include <scsi/scsi_cmnd.h> 53#include <scsi/scsi_eh.h>
54#include <scsi/scsi_device.h> 54#include <scsi/scsi_device.h>
55 55
56#include "usb.h" 56#include "usb.h"
@@ -580,25 +580,11 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
580 /* Now, if we need to do the auto-sense, let's do it */ 580 /* Now, if we need to do the auto-sense, let's do it */
581 if (need_auto_sense) { 581 if (need_auto_sense) {
582 int temp_result; 582 int temp_result;
583 void* old_request_buffer; 583 struct scsi_eh_save ses;
584 unsigned short old_sg;
585 unsigned old_request_bufflen;
586 unsigned char old_sc_data_direction;
587 unsigned char old_cmd_len;
588 unsigned char old_cmnd[MAX_COMMAND_SIZE];
589 int old_resid;
590 584
591 US_DEBUGP("Issuing auto-REQUEST_SENSE\n"); 585 US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
592 586
593 /* save the old command */ 587 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, US_SENSE_SIZE);
594 memcpy(old_cmnd, srb->cmnd, MAX_COMMAND_SIZE);
595 old_cmd_len = srb->cmd_len;
596
597 /* set the command and the LUN */
598 memset(srb->cmnd, 0, MAX_COMMAND_SIZE);
599 srb->cmnd[0] = REQUEST_SENSE;
600 srb->cmnd[1] = old_cmnd[1] & 0xE0;
601 srb->cmnd[4] = 18;
602 588
603 /* FIXME: we must do the protocol translation here */ 589 /* FIXME: we must do the protocol translation here */
604 if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI) 590 if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI)
@@ -606,36 +592,12 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
606 else 592 else
607 srb->cmd_len = 12; 593 srb->cmd_len = 12;
608 594
609 /* set the transfer direction */
610 old_sc_data_direction = srb->sc_data_direction;
611 srb->sc_data_direction = DMA_FROM_DEVICE;
612
613 /* use the new buffer we have */
614 old_request_buffer = srb->request_buffer;
615 srb->request_buffer = us->sensebuf;
616
617 /* set the buffer length for transfer */
618 old_request_bufflen = srb->request_bufflen;
619 srb->request_bufflen = US_SENSE_SIZE;
620
621 /* set up for no scatter-gather use */
622 old_sg = srb->use_sg;
623 srb->use_sg = 0;
624
625 /* issue the auto-sense command */ 595 /* issue the auto-sense command */
626 old_resid = srb->resid;
627 srb->resid = 0; 596 srb->resid = 0;
628 temp_result = us->transport(us->srb, us); 597 temp_result = us->transport(us->srb, us);
629 598
630 /* let's clean up right away */ 599 /* let's clean up right away */
631 memcpy(srb->sense_buffer, us->sensebuf, US_SENSE_SIZE); 600 scsi_eh_restore_cmnd(srb, &ses);
632 srb->resid = old_resid;
633 srb->request_buffer = old_request_buffer;
634 srb->request_bufflen = old_request_bufflen;
635 srb->use_sg = old_sg;
636 srb->sc_data_direction = old_sc_data_direction;
637 srb->cmd_len = old_cmd_len;
638 memcpy(srb->cmnd, old_cmnd, MAX_COMMAND_SIZE);
639 601
640 if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { 602 if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) {
641 US_DEBUGP("-- auto-sense aborted\n"); 603 US_DEBUGP("-- auto-sense aborted\n");