diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-10-31 12:10:10 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-11-23 07:53:55 -0500 |
commit | 29cb8d0d249f6b8fa33683cc17622ff16ada834c (patch) | |
tree | af145bb4d549793fc96aa2db63b32d4c9905ab9c | |
parent | ef1baed8870d1eebb0c08d9a466e703f1a21b484 (diff) |
ARM: dma-mapping: split dma_unmap_page() from dma_unmap_single()
We will need to treat dma_unmap_page() differently from dma_unmap_single()
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-By: Jamie Iles <jamie@jamieiles.com>
-rw-r--r-- | arch/arm/common/dmabounce.c | 21 | ||||
-rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 8 |
2 files changed, 23 insertions, 6 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 734ac9135998..5a375e5fef21 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -342,6 +342,22 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, | |||
342 | } | 342 | } |
343 | EXPORT_SYMBOL(dma_map_single); | 343 | EXPORT_SYMBOL(dma_map_single); |
344 | 344 | ||
345 | /* | ||
346 | * see if a mapped address was really a "safe" buffer and if so, copy | ||
347 | * the data from the safe buffer back to the unsafe buffer and free up | ||
348 | * the safe buffer. (basically return things back to the way they | ||
349 | * should be) | ||
350 | */ | ||
351 | void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
352 | enum dma_data_direction dir) | ||
353 | { | ||
354 | dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", | ||
355 | __func__, (void *) dma_addr, size, dir); | ||
356 | |||
357 | unmap_single(dev, dma_addr, size, dir); | ||
358 | } | ||
359 | EXPORT_SYMBOL(dma_unmap_single); | ||
360 | |||
345 | dma_addr_t dma_map_page(struct device *dev, struct page *page, | 361 | dma_addr_t dma_map_page(struct device *dev, struct page *page, |
346 | unsigned long offset, size_t size, enum dma_data_direction dir) | 362 | unsigned long offset, size_t size, enum dma_data_direction dir) |
347 | { | 363 | { |
@@ -366,8 +382,7 @@ EXPORT_SYMBOL(dma_map_page); | |||
366 | * the safe buffer. (basically return things back to the way they | 382 | * the safe buffer. (basically return things back to the way they |
367 | * should be) | 383 | * should be) |
368 | */ | 384 | */ |
369 | 385 | void dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, | |
370 | void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
371 | enum dma_data_direction dir) | 386 | enum dma_data_direction dir) |
372 | { | 387 | { |
373 | dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", | 388 | dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", |
@@ -375,7 +390,7 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
375 | 390 | ||
376 | unmap_single(dev, dma_addr, size, dir); | 391 | unmap_single(dev, dma_addr, size, dir); |
377 | } | 392 | } |
378 | EXPORT_SYMBOL(dma_unmap_single); | 393 | EXPORT_SYMBOL(dma_unmap_page); |
379 | 394 | ||
380 | int dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr, | 395 | int dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr, |
381 | unsigned long off, size_t sz, enum dma_data_direction dir) | 396 | unsigned long off, size_t sz, enum dma_data_direction dir) |
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index f06d80c22748..a96300bf83fd 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -257,9 +257,11 @@ extern int dma_needs_bounce(struct device*, dma_addr_t, size_t); | |||
257 | */ | 257 | */ |
258 | extern dma_addr_t dma_map_single(struct device *, void *, size_t, | 258 | extern dma_addr_t dma_map_single(struct device *, void *, size_t, |
259 | enum dma_data_direction); | 259 | enum dma_data_direction); |
260 | extern void dma_unmap_single(struct device *, dma_addr_t, size_t, | ||
261 | enum dma_data_direction); | ||
260 | extern dma_addr_t dma_map_page(struct device *, struct page *, | 262 | extern dma_addr_t dma_map_page(struct device *, struct page *, |
261 | unsigned long, size_t, enum dma_data_direction); | 263 | unsigned long, size_t, enum dma_data_direction); |
262 | extern void dma_unmap_single(struct device *, dma_addr_t, size_t, | 264 | extern void dma_unmap_page(struct device *, dma_addr_t, size_t, |
263 | enum dma_data_direction); | 265 | enum dma_data_direction); |
264 | 266 | ||
265 | /* | 267 | /* |
@@ -352,7 +354,6 @@ static inline void dma_unmap_single(struct device *dev, dma_addr_t handle, | |||
352 | { | 354 | { |
353 | /* nothing to do */ | 355 | /* nothing to do */ |
354 | } | 356 | } |
355 | #endif /* CONFIG_DMABOUNCE */ | ||
356 | 357 | ||
357 | /** | 358 | /** |
358 | * dma_unmap_page - unmap a buffer previously mapped through dma_map_page() | 359 | * dma_unmap_page - unmap a buffer previously mapped through dma_map_page() |
@@ -371,8 +372,9 @@ static inline void dma_unmap_single(struct device *dev, dma_addr_t handle, | |||
371 | static inline void dma_unmap_page(struct device *dev, dma_addr_t handle, | 372 | static inline void dma_unmap_page(struct device *dev, dma_addr_t handle, |
372 | size_t size, enum dma_data_direction dir) | 373 | size_t size, enum dma_data_direction dir) |
373 | { | 374 | { |
374 | dma_unmap_single(dev, handle, size, dir); | 375 | /* nothing to do */ |
375 | } | 376 | } |
377 | #endif /* CONFIG_DMABOUNCE */ | ||
376 | 378 | ||
377 | /** | 379 | /** |
378 | * dma_sync_single_range_for_cpu | 380 | * dma_sync_single_range_for_cpu |