diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/storage/transport.c | 5 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 8 | ||||
-rw-r--r-- | drivers/usb/storage/usb.h | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index e89e945fc4a7..7ca896a342e3 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -636,11 +636,11 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
636 | 636 | ||
637 | /* use the new buffer we have */ | 637 | /* use the new buffer we have */ |
638 | old_request_buffer = srb->request_buffer; | 638 | old_request_buffer = srb->request_buffer; |
639 | srb->request_buffer = srb->sense_buffer; | 639 | srb->request_buffer = us->sensebuf; |
640 | 640 | ||
641 | /* set the buffer length for transfer */ | 641 | /* set the buffer length for transfer */ |
642 | old_request_bufflen = srb->request_bufflen; | 642 | old_request_bufflen = srb->request_bufflen; |
643 | srb->request_bufflen = 18; | 643 | srb->request_bufflen = US_SENSE_SIZE; |
644 | 644 | ||
645 | /* set up for no scatter-gather use */ | 645 | /* set up for no scatter-gather use */ |
646 | old_sg = srb->use_sg; | 646 | old_sg = srb->use_sg; |
@@ -652,6 +652,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
652 | temp_result = us->transport(us->srb, us); | 652 | temp_result = us->transport(us->srb, us); |
653 | 653 | ||
654 | /* let's clean up right away */ | 654 | /* let's clean up right away */ |
655 | memcpy(srb->sense_buffer, us->sensebuf, US_SENSE_SIZE); | ||
655 | srb->resid = old_resid; | 656 | srb->resid = old_resid; |
656 | srb->request_buffer = old_request_buffer; | 657 | srb->request_buffer = old_request_buffer; |
657 | srb->request_bufflen = old_request_bufflen; | 658 | srb->request_bufflen = old_request_bufflen; |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 92ee079d9172..eb901817b7d2 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -467,6 +467,12 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) | |||
467 | US_DEBUGP("I/O buffer allocation failed\n"); | 467 | US_DEBUGP("I/O buffer allocation failed\n"); |
468 | return -ENOMEM; | 468 | return -ENOMEM; |
469 | } | 469 | } |
470 | |||
471 | us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL); | ||
472 | if (!us->sensebuf) { | ||
473 | US_DEBUGP("Sense buffer allocation failed\n"); | ||
474 | return -ENOMEM; | ||
475 | } | ||
470 | return 0; | 476 | return 0; |
471 | } | 477 | } |
472 | 478 | ||
@@ -800,6 +806,8 @@ static void dissociate_dev(struct us_data *us) | |||
800 | { | 806 | { |
801 | US_DEBUGP("-- %s\n", __FUNCTION__); | 807 | US_DEBUGP("-- %s\n", __FUNCTION__); |
802 | 808 | ||
809 | kfree(us->sensebuf); | ||
810 | |||
803 | /* Free the device-related DMA-mapped buffers */ | 811 | /* Free the device-related DMA-mapped buffers */ |
804 | if (us->cr) | 812 | if (us->cr) |
805 | usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, | 813 | usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, |
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index a195adae57b6..dfa4dc71dd3e 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h | |||
@@ -117,6 +117,7 @@ enum { US_DO_ALL_FLAGS }; | |||
117 | */ | 117 | */ |
118 | 118 | ||
119 | #define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */ | 119 | #define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */ |
120 | #define US_SENSE_SIZE 18 /* Size of the autosense data buffer */ | ||
120 | 121 | ||
121 | typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*); | 122 | typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*); |
122 | typedef int (*trans_reset)(struct us_data*); | 123 | typedef int (*trans_reset)(struct us_data*); |
@@ -168,6 +169,7 @@ struct us_data { | |||
168 | struct usb_ctrlrequest *cr; /* control requests */ | 169 | struct usb_ctrlrequest *cr; /* control requests */ |
169 | struct usb_sg_request current_sg; /* scatter-gather req. */ | 170 | struct usb_sg_request current_sg; /* scatter-gather req. */ |
170 | unsigned char *iobuf; /* I/O buffer */ | 171 | unsigned char *iobuf; /* I/O buffer */ |
172 | unsigned char *sensebuf; /* sense data buffer */ | ||
171 | dma_addr_t cr_dma; /* buffer DMA addresses */ | 173 | dma_addr_t cr_dma; /* buffer DMA addresses */ |
172 | dma_addr_t iobuf_dma; | 174 | dma_addr_t iobuf_dma; |
173 | 175 | ||