diff options
Diffstat (limited to 'arch/arm/common/dmabounce.c')
-rw-r--r-- | arch/arm/common/dmabounce.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 22aec95c9863..f030f0775be7 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -289,6 +289,7 @@ static inline void unmap_single(struct device *dev, dma_addr_t dma_addr, | |||
289 | 289 | ||
290 | if (buf) { | 290 | if (buf) { |
291 | BUG_ON(buf->size != size); | 291 | BUG_ON(buf->size != size); |
292 | BUG_ON(buf->direction != dir); | ||
292 | 293 | ||
293 | dev_dbg(dev, | 294 | dev_dbg(dev, |
294 | "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", | 295 | "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", |
@@ -334,7 +335,7 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, | |||
334 | dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", | 335 | dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", |
335 | __func__, ptr, size, dir); | 336 | __func__, ptr, size, dir); |
336 | 337 | ||
337 | BUG_ON(dir == DMA_NONE); | 338 | BUG_ON(!valid_dma_direction(dir)); |
338 | 339 | ||
339 | return map_single(dev, ptr, size, dir); | 340 | return map_single(dev, ptr, size, dir); |
340 | } | 341 | } |
@@ -346,7 +347,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, | |||
346 | dev_dbg(dev, "%s(page=%p,off=%#lx,size=%zx,dir=%x)\n", | 347 | dev_dbg(dev, "%s(page=%p,off=%#lx,size=%zx,dir=%x)\n", |
347 | __func__, page, offset, size, dir); | 348 | __func__, page, offset, size, dir); |
348 | 349 | ||
349 | BUG_ON(dir == DMA_NONE); | 350 | BUG_ON(!valid_dma_direction(dir)); |
350 | 351 | ||
351 | return map_single(dev, page_address(page) + offset, size, dir); | 352 | return map_single(dev, page_address(page) + offset, size, dir); |
352 | } | 353 | } |
@@ -365,8 +366,6 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
365 | dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", | 366 | dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", |
366 | __func__, (void *) dma_addr, size, dir); | 367 | __func__, (void *) dma_addr, size, dir); |
367 | 368 | ||
368 | BUG_ON(dir == DMA_NONE); | ||
369 | |||
370 | unmap_single(dev, dma_addr, size, dir); | 369 | unmap_single(dev, dma_addr, size, dir); |
371 | } | 370 | } |
372 | EXPORT_SYMBOL(dma_unmap_single); | 371 | EXPORT_SYMBOL(dma_unmap_single); |
@@ -383,6 +382,8 @@ int dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr, | |||
383 | if (!buf) | 382 | if (!buf) |
384 | return 1; | 383 | return 1; |
385 | 384 | ||
385 | BUG_ON(buf->direction != dir); | ||
386 | |||
386 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", | 387 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", |
387 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), | 388 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), |
388 | buf->safe, buf->safe_dma_addr); | 389 | buf->safe, buf->safe_dma_addr); |
@@ -410,6 +411,8 @@ int dmabounce_sync_for_device(struct device *dev, dma_addr_t addr, | |||
410 | if (!buf) | 411 | if (!buf) |
411 | return 1; | 412 | return 1; |
412 | 413 | ||
414 | BUG_ON(buf->direction != dir); | ||
415 | |||
413 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", | 416 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", |
414 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), | 417 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), |
415 | buf->safe, buf->safe_dma_addr); | 418 | buf->safe, buf->safe_dma_addr); |