diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-03-05 15:10:17 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:31 -0400 |
commit | 0ede76fcec5415ef82a423a95120286895822e2d (patch) | |
tree | 61aa2a0b499a0101033c59b8884328bdb31e5956 /drivers/usb/storage | |
parent | 749da5f82fe33ff68dd4aa1a5e35cd9aa6246dab (diff) |
USB: remove uses of URB_NO_SETUP_DMA_MAP
This patch (as1350) removes all usages of coherent buffers for USB
control-request setup-packet buffers. There's no good reason to
reserve coherent memory for these things; control requests are hardly
ever used in large quantity (the major exception is firmware
transfers, and they aren't time-critical). Furthermore, only seven
drivers used it. We might as well always use streaming DMA mappings
for setup-packet buffers, and remove some extra complexity from
usbcore.
The DMA-mapping portion of hcd.c is currently in flux. A separate
patch will be submitted to remove support for URB_NO_SETUP_DMA_MAP
after everything else settles down. The removal should go smoothly,
as by then nobody will be using it.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/transport.c | 2 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 15 | ||||
-rw-r--r-- | drivers/usb/storage/usb.h | 3 |
3 files changed, 6 insertions, 14 deletions
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index f253edec3bb8..44716427c51c 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -147,11 +147,9 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
147 | * hasn't been mapped for DMA. Yes, this is clunky, but it's | 147 | * hasn't been mapped for DMA. Yes, this is clunky, but it's |
148 | * easier than always having the caller tell us whether the | 148 | * easier than always having the caller tell us whether the |
149 | * transfer buffer has already been mapped. */ | 149 | * transfer buffer has already been mapped. */ |
150 | us->current_urb->transfer_flags = URB_NO_SETUP_DMA_MAP; | ||
151 | if (us->current_urb->transfer_buffer == us->iobuf) | 150 | if (us->current_urb->transfer_buffer == us->iobuf) |
152 | us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 151 | us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
153 | us->current_urb->transfer_dma = us->iobuf_dma; | 152 | us->current_urb->transfer_dma = us->iobuf_dma; |
154 | us->current_urb->setup_dma = us->cr_dma; | ||
155 | 153 | ||
156 | /* submit the URB */ | 154 | /* submit the URB */ |
157 | status = usb_submit_urb(us->current_urb, GFP_NOIO); | 155 | status = usb_submit_urb(us->current_urb, GFP_NOIO); |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index bbeeb92a2131..c54a370c76c5 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -407,9 +407,8 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) | |||
407 | /* Store our private data in the interface */ | 407 | /* Store our private data in the interface */ |
408 | usb_set_intfdata(intf, us); | 408 | usb_set_intfdata(intf, us); |
409 | 409 | ||
410 | /* Allocate the device-related DMA-mapped buffers */ | 410 | /* Allocate the control/setup and DMA-mapped buffers */ |
411 | us->cr = usb_buffer_alloc(us->pusb_dev, sizeof(*us->cr), | 411 | us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL); |
412 | GFP_KERNEL, &us->cr_dma); | ||
413 | if (!us->cr) { | 412 | if (!us->cr) { |
414 | US_DEBUGP("usb_ctrlrequest allocation failed\n"); | 413 | US_DEBUGP("usb_ctrlrequest allocation failed\n"); |
415 | return -ENOMEM; | 414 | return -ENOMEM; |
@@ -757,13 +756,9 @@ static void dissociate_dev(struct us_data *us) | |||
757 | { | 756 | { |
758 | US_DEBUGP("-- %s\n", __func__); | 757 | US_DEBUGP("-- %s\n", __func__); |
759 | 758 | ||
760 | /* Free the device-related DMA-mapped buffers */ | 759 | /* Free the buffers */ |
761 | if (us->cr) | 760 | kfree(us->cr); |
762 | usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, | 761 | usb_buffer_free(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma); |
763 | us->cr_dma); | ||
764 | if (us->iobuf) | ||
765 | usb_buffer_free(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, | ||
766 | us->iobuf_dma); | ||
767 | 762 | ||
768 | /* Remove our private data from the interface */ | 763 | /* Remove our private data from the interface */ |
769 | usb_set_intfdata(us->pusb_intf, NULL); | 764 | usb_set_intfdata(us->pusb_intf, NULL); |
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 69717134231b..89d3bfff98df 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h | |||
@@ -139,8 +139,7 @@ struct us_data { | |||
139 | struct usb_ctrlrequest *cr; /* control requests */ | 139 | struct usb_ctrlrequest *cr; /* control requests */ |
140 | struct usb_sg_request current_sg; /* scatter-gather req. */ | 140 | struct usb_sg_request current_sg; /* scatter-gather req. */ |
141 | unsigned char *iobuf; /* I/O buffer */ | 141 | unsigned char *iobuf; /* I/O buffer */ |
142 | dma_addr_t cr_dma; /* buffer DMA addresses */ | 142 | dma_addr_t iobuf_dma; /* buffer DMA addresses */ |
143 | dma_addr_t iobuf_dma; | ||
144 | struct task_struct *ctl_thread; /* the control thread */ | 143 | struct task_struct *ctl_thread; /* the control thread */ |
145 | 144 | ||
146 | /* mutual exclusion and synchronization structures */ | 145 | /* mutual exclusion and synchronization structures */ |