diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-05-14 12:23:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-16 07:56:47 -0400 |
commit | d69864158e24f323e818403c6b89ad4871aea6f6 (patch) | |
tree | 2fe0ec981c9bc96b5195956defd1b5989aa694a5 /arch/sparc/kernel/dma.c | |
parent | 797a75686528e9f6f9bfee2a719a00b47868c999 (diff) |
sparc: remove dma-mapping_{32|64}.h
This modifies SPARC32 to use struct dma_map ops. It means that we can
remove dma-mapping_{32|64}.h.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tested-by: Robert Reif <reif@earthlink.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/dma.c')
-rw-r--r-- | arch/sparc/kernel/dma.c | 99 |
1 files changed, 40 insertions, 59 deletions
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c index 3c9ff4f8af3a..524c32f97c55 100644 --- a/arch/sparc/kernel/dma.c +++ b/arch/sparc/kernel/dma.c | |||
@@ -35,8 +35,8 @@ int dma_set_mask(struct device *dev, u64 dma_mask) | |||
35 | } | 35 | } |
36 | EXPORT_SYMBOL(dma_set_mask); | 36 | EXPORT_SYMBOL(dma_set_mask); |
37 | 37 | ||
38 | void *dma_alloc_coherent(struct device *dev, size_t size, | 38 | static void *dma32_alloc_coherent(struct device *dev, size_t size, |
39 | dma_addr_t *dma_handle, gfp_t flag) | 39 | dma_addr_t *dma_handle, gfp_t flag) |
40 | { | 40 | { |
41 | #ifdef CONFIG_PCI | 41 | #ifdef CONFIG_PCI |
42 | if (dev->bus == &pci_bus_type) | 42 | if (dev->bus == &pci_bus_type) |
@@ -44,10 +44,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, | |||
44 | #endif | 44 | #endif |
45 | return sbus_alloc_consistent(dev, size, dma_handle); | 45 | return sbus_alloc_consistent(dev, size, dma_handle); |
46 | } | 46 | } |
47 | EXPORT_SYMBOL(dma_alloc_coherent); | ||
48 | 47 | ||
49 | void dma_free_coherent(struct device *dev, size_t size, | 48 | static void dma32_free_coherent(struct device *dev, size_t size, |
50 | void *cpu_addr, dma_addr_t dma_handle) | 49 | void *cpu_addr, dma_addr_t dma_handle) |
51 | { | 50 | { |
52 | #ifdef CONFIG_PCI | 51 | #ifdef CONFIG_PCI |
53 | if (dev->bus == &pci_bus_type) { | 52 | if (dev->bus == &pci_bus_type) { |
@@ -58,38 +57,10 @@ void dma_free_coherent(struct device *dev, size_t size, | |||
58 | #endif | 57 | #endif |
59 | sbus_free_consistent(dev, size, cpu_addr, dma_handle); | 58 | sbus_free_consistent(dev, size, cpu_addr, dma_handle); |
60 | } | 59 | } |
61 | EXPORT_SYMBOL(dma_free_coherent); | ||
62 | 60 | ||
63 | dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, | 61 | static dma_addr_t dma32_map_page(struct device *dev, struct page *page, |
64 | size_t size, enum dma_data_direction direction) | 62 | unsigned long offset, size_t size, |
65 | { | 63 | enum dma_data_direction direction) |
66 | #ifdef CONFIG_PCI | ||
67 | if (dev->bus == &pci_bus_type) | ||
68 | return pci_map_single(to_pci_dev(dev), cpu_addr, | ||
69 | size, (int)direction); | ||
70 | #endif | ||
71 | return sbus_map_single(dev, cpu_addr, size, (int)direction); | ||
72 | } | ||
73 | EXPORT_SYMBOL(dma_map_single); | ||
74 | |||
75 | void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, | ||
76 | size_t size, | ||
77 | enum dma_data_direction direction) | ||
78 | { | ||
79 | #ifdef CONFIG_PCI | ||
80 | if (dev->bus == &pci_bus_type) { | ||
81 | pci_unmap_single(to_pci_dev(dev), dma_addr, | ||
82 | size, (int)direction); | ||
83 | return; | ||
84 | } | ||
85 | #endif | ||
86 | sbus_unmap_single(dev, dma_addr, size, (int)direction); | ||
87 | } | ||
88 | EXPORT_SYMBOL(dma_unmap_single); | ||
89 | |||
90 | dma_addr_t dma_map_page(struct device *dev, struct page *page, | ||
91 | unsigned long offset, size_t size, | ||
92 | enum dma_data_direction direction) | ||
93 | { | 64 | { |
94 | #ifdef CONFIG_PCI | 65 | #ifdef CONFIG_PCI |
95 | if (dev->bus == &pci_bus_type) | 66 | if (dev->bus == &pci_bus_type) |
@@ -99,10 +70,9 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, | |||
99 | return sbus_map_single(dev, page_address(page) + offset, | 70 | return sbus_map_single(dev, page_address(page) + offset, |
100 | size, (int)direction); | 71 | size, (int)direction); |
101 | } | 72 | } |
102 | EXPORT_SYMBOL(dma_map_page); | ||
103 | 73 | ||
104 | void dma_unmap_page(struct device *dev, dma_addr_t dma_address, | 74 | static void dma32_unmap_page(struct device *dev, dma_addr_t dma_address, |
105 | size_t size, enum dma_data_direction direction) | 75 | size_t size, enum dma_data_direction direction) |
106 | { | 76 | { |
107 | #ifdef CONFIG_PCI | 77 | #ifdef CONFIG_PCI |
108 | if (dev->bus == &pci_bus_type) { | 78 | if (dev->bus == &pci_bus_type) { |
@@ -113,10 +83,9 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address, | |||
113 | #endif | 83 | #endif |
114 | sbus_unmap_single(dev, dma_address, size, (int)direction); | 84 | sbus_unmap_single(dev, dma_address, size, (int)direction); |
115 | } | 85 | } |
116 | EXPORT_SYMBOL(dma_unmap_page); | ||
117 | 86 | ||
118 | int dma_map_sg(struct device *dev, struct scatterlist *sg, | 87 | static int dma32_map_sg(struct device *dev, struct scatterlist *sg, |
119 | int nents, enum dma_data_direction direction) | 88 | int nents, enum dma_data_direction direction) |
120 | { | 89 | { |
121 | #ifdef CONFIG_PCI | 90 | #ifdef CONFIG_PCI |
122 | if (dev->bus == &pci_bus_type) | 91 | if (dev->bus == &pci_bus_type) |
@@ -124,10 +93,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, | |||
124 | #endif | 93 | #endif |
125 | return sbus_map_sg(dev, sg, nents, direction); | 94 | return sbus_map_sg(dev, sg, nents, direction); |
126 | } | 95 | } |
127 | EXPORT_SYMBOL(dma_map_sg); | ||
128 | 96 | ||
129 | void dma_unmap_sg(struct device *dev, struct scatterlist *sg, | 97 | void dma32_unmap_sg(struct device *dev, struct scatterlist *sg, |
130 | int nents, enum dma_data_direction direction) | 98 | int nents, enum dma_data_direction direction) |
131 | { | 99 | { |
132 | #ifdef CONFIG_PCI | 100 | #ifdef CONFIG_PCI |
133 | if (dev->bus == &pci_bus_type) { | 101 | if (dev->bus == &pci_bus_type) { |
@@ -137,10 +105,10 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, | |||
137 | #endif | 105 | #endif |
138 | sbus_unmap_sg(dev, sg, nents, (int)direction); | 106 | sbus_unmap_sg(dev, sg, nents, (int)direction); |
139 | } | 107 | } |
140 | EXPORT_SYMBOL(dma_unmap_sg); | ||
141 | 108 | ||
142 | void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | 109 | static void dma32_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, |
143 | size_t size, enum dma_data_direction direction) | 110 | size_t size, |
111 | enum dma_data_direction direction) | ||
144 | { | 112 | { |
145 | #ifdef CONFIG_PCI | 113 | #ifdef CONFIG_PCI |
146 | if (dev->bus == &pci_bus_type) { | 114 | if (dev->bus == &pci_bus_type) { |
@@ -151,10 +119,10 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | |||
151 | #endif | 119 | #endif |
152 | sbus_dma_sync_single_for_cpu(dev, dma_handle, size, (int) direction); | 120 | sbus_dma_sync_single_for_cpu(dev, dma_handle, size, (int) direction); |
153 | } | 121 | } |
154 | EXPORT_SYMBOL(dma_sync_single_for_cpu); | ||
155 | 122 | ||
156 | void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, | 123 | static void dma32_sync_single_for_device(struct device *dev, |
157 | size_t size, enum dma_data_direction direction) | 124 | dma_addr_t dma_handle, size_t size, |
125 | enum dma_data_direction direction) | ||
158 | { | 126 | { |
159 | #ifdef CONFIG_PCI | 127 | #ifdef CONFIG_PCI |
160 | if (dev->bus == &pci_bus_type) { | 128 | if (dev->bus == &pci_bus_type) { |
@@ -165,10 +133,9 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, | |||
165 | #endif | 133 | #endif |
166 | sbus_dma_sync_single_for_device(dev, dma_handle, size, (int) direction); | 134 | sbus_dma_sync_single_for_device(dev, dma_handle, size, (int) direction); |
167 | } | 135 | } |
168 | EXPORT_SYMBOL(dma_sync_single_for_device); | ||
169 | 136 | ||
170 | void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | 137 | static void dma32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, |
171 | int nelems, enum dma_data_direction direction) | 138 | int nelems, enum dma_data_direction direction) |
172 | { | 139 | { |
173 | #ifdef CONFIG_PCI | 140 | #ifdef CONFIG_PCI |
174 | if (dev->bus == &pci_bus_type) { | 141 | if (dev->bus == &pci_bus_type) { |
@@ -179,11 +146,10 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | |||
179 | #endif | 146 | #endif |
180 | BUG(); | 147 | BUG(); |
181 | } | 148 | } |
182 | EXPORT_SYMBOL(dma_sync_sg_for_cpu); | ||
183 | 149 | ||
184 | void dma_sync_sg_for_device(struct device *dev, | 150 | static void dma32_sync_sg_for_device(struct device *dev, |
185 | struct scatterlist *sg, int nelems, | 151 | struct scatterlist *sg, int nelems, |
186 | enum dma_data_direction direction) | 152 | enum dma_data_direction direction) |
187 | { | 153 | { |
188 | #ifdef CONFIG_PCI | 154 | #ifdef CONFIG_PCI |
189 | if (dev->bus == &pci_bus_type) { | 155 | if (dev->bus == &pci_bus_type) { |
@@ -194,4 +160,19 @@ void dma_sync_sg_for_device(struct device *dev, | |||
194 | #endif | 160 | #endif |
195 | BUG(); | 161 | BUG(); |
196 | } | 162 | } |
197 | EXPORT_SYMBOL(dma_sync_sg_for_device); | 163 | |
164 | static const struct dma_ops dma32_dma_ops = { | ||
165 | .alloc_coherent = dma32_alloc_coherent, | ||
166 | .free_coherent = dma32_free_coherent, | ||
167 | .map_page = dma32_map_page, | ||
168 | .unmap_page = dma32_unmap_page, | ||
169 | .map_sg = dma32_map_sg, | ||
170 | .unmap_sg = dma32_unmap_sg, | ||
171 | .sync_single_for_cpu = dma32_sync_single_for_cpu, | ||
172 | .sync_single_for_device = dma32_sync_single_for_device, | ||
173 | .sync_sg_for_cpu = dma32_sync_sg_for_cpu, | ||
174 | .sync_sg_for_device = dma32_sync_sg_for_device, | ||
175 | }; | ||
176 | |||
177 | const struct dma_ops *dma_ops = &dma32_dma_ops; | ||
178 | EXPORT_SYMBOL(dma_ops); | ||