aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/common/dmabounce.c31
-rw-r--r--include/asm-arm/device.h10
2 files changed, 16 insertions, 25 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 2e635b814c14..490e1fe286d5 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -66,8 +66,6 @@ struct dmabounce_pool {
66}; 66};
67 67
68struct dmabounce_device_info { 68struct dmabounce_device_info {
69 struct list_head node;
70
71 struct device *dev; 69 struct device *dev;
72 struct list_head safe_buffers; 70 struct list_head safe_buffers;
73#ifdef STATS 71#ifdef STATS
@@ -81,8 +79,6 @@ struct dmabounce_device_info {
81 rwlock_t lock; 79 rwlock_t lock;
82}; 80};
83 81
84static LIST_HEAD(dmabounce_devs);
85
86#ifdef STATS 82#ifdef STATS
87static void print_alloc_stats(struct dmabounce_device_info *device_info) 83static void print_alloc_stats(struct dmabounce_device_info *device_info)
88{ 84{
@@ -96,19 +92,6 @@ static void print_alloc_stats(struct dmabounce_device_info *device_info)
96} 92}
97#endif 93#endif
98 94
99/* find the given device in the dmabounce device list */
100static inline struct dmabounce_device_info *
101find_dmabounce_dev(struct device *dev)
102{
103 struct dmabounce_device_info *d;
104
105 list_for_each_entry(d, &dmabounce_devs, node)
106 if (d->dev == dev)
107 return d;
108
109 return NULL;
110}
111
112 95
113/* allocate a 'safe' buffer and keep track of it */ 96/* allocate a 'safe' buffer and keep track of it */
114static inline struct safe_buffer * 97static inline struct safe_buffer *
@@ -231,7 +214,7 @@ static inline dma_addr_t
231map_single(struct device *dev, void *ptr, size_t size, 214map_single(struct device *dev, void *ptr, size_t size,
232 enum dma_data_direction dir) 215 enum dma_data_direction dir)
233{ 216{
234 struct dmabounce_device_info *device_info = find_dmabounce_dev(dev); 217 struct dmabounce_device_info *device_info = dev->archdata.dmabounce;
235 dma_addr_t dma_addr; 218 dma_addr_t dma_addr;
236 int needs_bounce = 0; 219 int needs_bounce = 0;
237 220
@@ -292,7 +275,7 @@ static inline void
292unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 275unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
293 enum dma_data_direction dir) 276 enum dma_data_direction dir)
294{ 277{
295 struct dmabounce_device_info *device_info = find_dmabounce_dev(dev); 278 struct dmabounce_device_info *device_info = dev->archdata.dmabounce;
296 struct safe_buffer *buf = NULL; 279 struct safe_buffer *buf = NULL;
297 280
298 /* 281 /*
@@ -343,7 +326,7 @@ static inline void
343sync_single(struct device *dev, dma_addr_t dma_addr, size_t size, 326sync_single(struct device *dev, dma_addr_t dma_addr, size_t size,
344 enum dma_data_direction dir) 327 enum dma_data_direction dir)
345{ 328{
346 struct dmabounce_device_info *device_info = find_dmabounce_dev(dev); 329 struct dmabounce_device_info *device_info = dev->archdata.dmabounce;
347 struct safe_buffer *buf = NULL; 330 struct safe_buffer *buf = NULL;
348 331
349 if (device_info) 332 if (device_info)
@@ -606,7 +589,7 @@ dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size,
606 device_info->bounce_count = 0; 589 device_info->bounce_count = 0;
607#endif 590#endif
608 591
609 list_add(&device_info->node, &dmabounce_devs); 592 dev->archdata.dmabounce = device_info;
610 593
611 printk(KERN_INFO "dmabounce: registered device %s on %s bus\n", 594 printk(KERN_INFO "dmabounce: registered device %s on %s bus\n",
612 dev->bus_id, dev->bus->name); 595 dev->bus_id, dev->bus->name);
@@ -623,7 +606,9 @@ dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size,
623void 606void
624dmabounce_unregister_dev(struct device *dev) 607dmabounce_unregister_dev(struct device *dev)
625{ 608{
626 struct dmabounce_device_info *device_info = find_dmabounce_dev(dev); 609 struct dmabounce_device_info *device_info = dev->archdata.dmabounce;
610
611 dev->archdata.dmabounce = NULL;
627 612
628 if (!device_info) { 613 if (!device_info) {
629 printk(KERN_WARNING 614 printk(KERN_WARNING
@@ -649,8 +634,6 @@ dmabounce_unregister_dev(struct device *dev)
649 print_map_stats(device_info); 634 print_map_stats(device_info);
650#endif 635#endif
651 636
652 list_del(&device_info->node);
653
654 kfree(device_info); 637 kfree(device_info);
655 638
656 printk(KERN_INFO "dmabounce: device %s on %s bus unregistered\n", 639 printk(KERN_INFO "dmabounce: device %s on %s bus unregistered\n",
diff --git a/include/asm-arm/device.h b/include/asm-arm/device.h
index d8f9872b0e2d..c61642b40603 100644
--- a/include/asm-arm/device.h
+++ b/include/asm-arm/device.h
@@ -3,5 +3,13 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6#ifndef ASMARM_DEVICE_H
7#define ASMARM_DEVICE_H
7 8
9struct dev_archdata {
10#ifdef CONFIG_DMABOUNCE
11 struct dmabounce_device_info *dmabounce;
12#endif
13};
14
15#endif