diff options
Diffstat (limited to 'arch/powerpc/kernel/dma_64.c')
-rw-r--r-- | arch/powerpc/kernel/dma_64.c | 65 |
1 files changed, 28 insertions, 37 deletions
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c index 36aaa7663f02..6c168f6ea142 100644 --- a/arch/powerpc/kernel/dma_64.c +++ b/arch/powerpc/kernel/dma_64.c | |||
@@ -35,10 +35,9 @@ int dma_supported(struct device *dev, u64 mask) | |||
35 | { | 35 | { |
36 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 36 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
37 | 37 | ||
38 | if (dma_ops) | 38 | BUG_ON(!dma_ops); |
39 | return dma_ops->dma_supported(dev, mask); | 39 | |
40 | BUG(); | 40 | return dma_ops->dma_supported(dev, mask); |
41 | return 0; | ||
42 | } | 41 | } |
43 | EXPORT_SYMBOL(dma_supported); | 42 | EXPORT_SYMBOL(dma_supported); |
44 | 43 | ||
@@ -66,10 +65,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, | |||
66 | { | 65 | { |
67 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 66 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
68 | 67 | ||
69 | if (dma_ops) | 68 | BUG_ON(!dma_ops); |
70 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); | 69 | |
71 | BUG(); | 70 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); |
72 | return NULL; | ||
73 | } | 71 | } |
74 | EXPORT_SYMBOL(dma_alloc_coherent); | 72 | EXPORT_SYMBOL(dma_alloc_coherent); |
75 | 73 | ||
@@ -78,10 +76,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | |||
78 | { | 76 | { |
79 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 77 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
80 | 78 | ||
81 | if (dma_ops) | 79 | BUG_ON(!dma_ops); |
82 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | 80 | |
83 | else | 81 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); |
84 | BUG(); | ||
85 | } | 82 | } |
86 | EXPORT_SYMBOL(dma_free_coherent); | 83 | EXPORT_SYMBOL(dma_free_coherent); |
87 | 84 | ||
@@ -90,10 +87,9 @@ dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, | |||
90 | { | 87 | { |
91 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 88 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
92 | 89 | ||
93 | if (dma_ops) | 90 | BUG_ON(!dma_ops); |
94 | return dma_ops->map_single(dev, cpu_addr, size, direction); | 91 | |
95 | BUG(); | 92 | return dma_ops->map_single(dev, cpu_addr, size, direction); |
96 | return (dma_addr_t)0; | ||
97 | } | 93 | } |
98 | EXPORT_SYMBOL(dma_map_single); | 94 | EXPORT_SYMBOL(dma_map_single); |
99 | 95 | ||
@@ -102,10 +98,9 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
102 | { | 98 | { |
103 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 99 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
104 | 100 | ||
105 | if (dma_ops) | 101 | BUG_ON(!dma_ops); |
106 | dma_ops->unmap_single(dev, dma_addr, size, direction); | 102 | |
107 | else | 103 | dma_ops->unmap_single(dev, dma_addr, size, direction); |
108 | BUG(); | ||
109 | } | 104 | } |
110 | EXPORT_SYMBOL(dma_unmap_single); | 105 | EXPORT_SYMBOL(dma_unmap_single); |
111 | 106 | ||
@@ -115,11 +110,10 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, | |||
115 | { | 110 | { |
116 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 111 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
117 | 112 | ||
118 | if (dma_ops) | 113 | BUG_ON(!dma_ops); |
119 | return dma_ops->map_single(dev, | 114 | |
120 | (page_address(page) + offset), size, direction); | 115 | return dma_ops->map_single(dev, page_address(page) + offset, size, |
121 | BUG(); | 116 | direction); |
122 | return (dma_addr_t)0; | ||
123 | } | 117 | } |
124 | EXPORT_SYMBOL(dma_map_page); | 118 | EXPORT_SYMBOL(dma_map_page); |
125 | 119 | ||
@@ -128,10 +122,9 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | |||
128 | { | 122 | { |
129 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 123 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
130 | 124 | ||
131 | if (dma_ops) | 125 | BUG_ON(!dma_ops); |
132 | dma_ops->unmap_single(dev, dma_address, size, direction); | 126 | |
133 | else | 127 | dma_ops->unmap_single(dev, dma_address, size, direction); |
134 | BUG(); | ||
135 | } | 128 | } |
136 | EXPORT_SYMBOL(dma_unmap_page); | 129 | EXPORT_SYMBOL(dma_unmap_page); |
137 | 130 | ||
@@ -140,10 +133,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
140 | { | 133 | { |
141 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 134 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
142 | 135 | ||
143 | if (dma_ops) | 136 | BUG_ON(!dma_ops); |
144 | return dma_ops->map_sg(dev, sg, nents, direction); | 137 | |
145 | BUG(); | 138 | return dma_ops->map_sg(dev, sg, nents, direction); |
146 | return 0; | ||
147 | } | 139 | } |
148 | EXPORT_SYMBOL(dma_map_sg); | 140 | EXPORT_SYMBOL(dma_map_sg); |
149 | 141 | ||
@@ -152,9 +144,8 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | |||
152 | { | 144 | { |
153 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 145 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
154 | 146 | ||
155 | if (dma_ops) | 147 | BUG_ON(!dma_ops); |
156 | dma_ops->unmap_sg(dev, sg, nhwentries, direction); | 148 | |
157 | else | 149 | dma_ops->unmap_sg(dev, sg, nhwentries, direction); |
158 | BUG(); | ||
159 | } | 150 | } |
160 | EXPORT_SYMBOL(dma_unmap_sg); | 151 | EXPORT_SYMBOL(dma_unmap_sg); |