Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10825
b: refs/heads/master
c: bbafa46
h: refs/heads/master
i:
  10823: c70fd78
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent 597ed03 commit ef45568
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b876aef7f890d8c59a45b78858a36cf60fddf522
refs/heads/master: bbafa4668f37f5093a3ae2a8b0cbe327e24e12da
5 changes: 3 additions & 2 deletions trunk/drivers/usb/storage/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,11 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)

/* use the new buffer we have */
old_request_buffer = srb->request_buffer;
srb->request_buffer = srb->sense_buffer;
srb->request_buffer = us->sensebuf;

/* set the buffer length for transfer */
old_request_bufflen = srb->request_bufflen;
srb->request_bufflen = 18;
srb->request_bufflen = US_SENSE_SIZE;

/* set up for no scatter-gather use */
old_sg = srb->use_sg;
Expand All @@ -652,6 +652,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
temp_result = us->transport(us->srb, us);

/* let's clean up right away */
memcpy(srb->sense_buffer, us->sensebuf, US_SENSE_SIZE);
srb->resid = old_resid;
srb->request_buffer = old_request_buffer;
srb->request_bufflen = old_request_bufflen;
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/usb/storage/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,12 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
US_DEBUGP("I/O buffer allocation failed\n");
return -ENOMEM;
}

us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL);
if (!us->sensebuf) {
US_DEBUGP("Sense buffer allocation failed\n");
return -ENOMEM;
}
return 0;
}

Expand Down Expand Up @@ -800,6 +806,8 @@ static void dissociate_dev(struct us_data *us)
{
US_DEBUGP("-- %s\n", __FUNCTION__);

kfree(us->sensebuf);

/* Free the device-related DMA-mapped buffers */
if (us->cr)
usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr,
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/usb/storage/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ enum { US_DO_ALL_FLAGS };
*/

#define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */
#define US_SENSE_SIZE 18 /* Size of the autosense data buffer */

typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*);
typedef int (*trans_reset)(struct us_data*);
Expand Down Expand Up @@ -168,6 +169,7 @@ struct us_data {
struct usb_ctrlrequest *cr; /* control requests */
struct usb_sg_request current_sg; /* scatter-gather req. */
unsigned char *iobuf; /* I/O buffer */
unsigned char *sensebuf; /* sense data buffer */
dma_addr_t cr_dma; /* buffer DMA addresses */
dma_addr_t iobuf_dma;

Expand Down

0 comments on commit ef45568

Please sign in to comment.