diff options
author | Martin Fuzzey <mfuzzey@gmail.com> | 2010-09-30 18:21:55 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:22:03 -0400 |
commit | 1dae423dd9b247b048eda00cb598c755e5933213 (patch) | |
tree | 8c26248225009634cdff99a53bdb7e5e03b54de9 /drivers/usb | |
parent | 7a7e7896422baced4757070b813ba28ab24a214a (diff) |
USB: introduce unmap_urb_setup_for_dma()
Split unmap_urb_for_dma() to allow just the setup buffer
to be unmapped. This allows HCDs to use PIO for the setup
buffer if it is not suitable for DMA.
Signed-off-by: Martin Fuzzey <mfuzzey@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hcd.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index cb2d894321da..61800f77dac8 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1263,10 +1263,8 @@ static void hcd_free_coherent(struct usb_bus *bus, dma_addr_t *dma_handle, | |||
1263 | *dma_handle = 0; | 1263 | *dma_handle = 0; |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | 1266 | void unmap_urb_setup_for_dma(struct usb_hcd *hcd, struct urb *urb) |
1267 | { | 1267 | { |
1268 | enum dma_data_direction dir; | ||
1269 | |||
1270 | if (urb->transfer_flags & URB_SETUP_MAP_SINGLE) | 1268 | if (urb->transfer_flags & URB_SETUP_MAP_SINGLE) |
1271 | dma_unmap_single(hcd->self.controller, | 1269 | dma_unmap_single(hcd->self.controller, |
1272 | urb->setup_dma, | 1270 | urb->setup_dma, |
@@ -1279,6 +1277,17 @@ void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | |||
1279 | sizeof(struct usb_ctrlrequest), | 1277 | sizeof(struct usb_ctrlrequest), |
1280 | DMA_TO_DEVICE); | 1278 | DMA_TO_DEVICE); |
1281 | 1279 | ||
1280 | /* Make it safe to call this routine more than once */ | ||
1281 | urb->transfer_flags &= ~(URB_SETUP_MAP_SINGLE | URB_SETUP_MAP_LOCAL); | ||
1282 | } | ||
1283 | EXPORT_SYMBOL_GPL(unmap_urb_setup_for_dma); | ||
1284 | |||
1285 | void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | ||
1286 | { | ||
1287 | enum dma_data_direction dir; | ||
1288 | |||
1289 | unmap_urb_setup_for_dma(hcd, urb); | ||
1290 | |||
1282 | dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | 1291 | dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; |
1283 | if (urb->transfer_flags & URB_DMA_MAP_SG) | 1292 | if (urb->transfer_flags & URB_DMA_MAP_SG) |
1284 | dma_unmap_sg(hcd->self.controller, | 1293 | dma_unmap_sg(hcd->self.controller, |
@@ -1303,8 +1312,7 @@ void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | |||
1303 | dir); | 1312 | dir); |
1304 | 1313 | ||
1305 | /* Make it safe to call this routine more than once */ | 1314 | /* Make it safe to call this routine more than once */ |
1306 | urb->transfer_flags &= ~(URB_SETUP_MAP_SINGLE | URB_SETUP_MAP_LOCAL | | 1315 | urb->transfer_flags &= ~(URB_DMA_MAP_SG | URB_DMA_MAP_PAGE | |
1307 | URB_DMA_MAP_SG | URB_DMA_MAP_PAGE | | ||
1308 | URB_DMA_MAP_SINGLE | URB_MAP_LOCAL); | 1316 | URB_DMA_MAP_SINGLE | URB_MAP_LOCAL); |
1309 | } | 1317 | } |
1310 | EXPORT_SYMBOL_GPL(unmap_urb_for_dma); | 1318 | EXPORT_SYMBOL_GPL(unmap_urb_for_dma); |