diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-07-04 03:32:21 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-07-04 03:39:55 -0400 |
commit | 0703ed2a6b260cd743adf49a8281eb064d728832 (patch) | |
tree | 95740f9e1beb8901f163c7168b3e2666eb2158c9 /arch/arm/common/dmabounce.c | |
parent | c289b2e0ccff1142908e20398930dc2e14697e74 (diff) |
ARM: dmabounce: get rid of dma_needs_bounce global function
Pass the device type specific needs_bounce function in at dmabounce
register time, avoiding the need for a platform specific global
function to do this.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common/dmabounce.c')
-rw-r--r-- | arch/arm/common/dmabounce.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 4f13505ac93..595ecd290eb 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -79,6 +79,8 @@ struct dmabounce_device_info { | |||
79 | struct dmabounce_pool large; | 79 | struct dmabounce_pool large; |
80 | 80 | ||
81 | rwlock_t lock; | 81 | rwlock_t lock; |
82 | |||
83 | int (*needs_bounce)(struct device *, dma_addr_t, size_t); | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | #ifdef STATS | 86 | #ifdef STATS |
@@ -236,7 +238,7 @@ static int needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) | |||
236 | return 1; | 238 | return 1; |
237 | } | 239 | } |
238 | 240 | ||
239 | return dma_needs_bounce(dev, dma_addr, size) ? 1 : 0; | 241 | return !!dev->archdata.dmabounce->needs_bounce(dev, dma_addr, size); |
240 | } | 242 | } |
241 | 243 | ||
242 | static inline dma_addr_t map_single(struct device *dev, void *ptr, size_t size, | 244 | static inline dma_addr_t map_single(struct device *dev, void *ptr, size_t size, |
@@ -430,7 +432,8 @@ static int dmabounce_init_pool(struct dmabounce_pool *pool, struct device *dev, | |||
430 | } | 432 | } |
431 | 433 | ||
432 | int dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size, | 434 | int dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size, |
433 | unsigned long large_buffer_size) | 435 | unsigned long large_buffer_size, |
436 | int (*needs_bounce_fn)(struct device *, dma_addr_t, size_t)) | ||
434 | { | 437 | { |
435 | struct dmabounce_device_info *device_info; | 438 | struct dmabounce_device_info *device_info; |
436 | int ret; | 439 | int ret; |
@@ -466,6 +469,7 @@ int dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size, | |||
466 | device_info->dev = dev; | 469 | device_info->dev = dev; |
467 | INIT_LIST_HEAD(&device_info->safe_buffers); | 470 | INIT_LIST_HEAD(&device_info->safe_buffers); |
468 | rwlock_init(&device_info->lock); | 471 | rwlock_init(&device_info->lock); |
472 | device_info->needs_bounce = needs_bounce_fn; | ||
469 | 473 | ||
470 | #ifdef STATS | 474 | #ifdef STATS |
471 | device_info->total_allocs = 0; | 475 | device_info->total_allocs = 0; |