aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/dma-mapping.h18
-rw-r--r--arch/x86/kernel/pci-dma.c17
2 files changed, 20 insertions, 15 deletions
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 63393202b9ec..1f5b7287d1ad 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -133,20 +133,8 @@ dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
133 133
134#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) 134#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
135 135
136static inline void dma_free_attrs(struct device *dev, size_t size, 136void dma_free_attrs(struct device *dev, size_t size,
137 void *vaddr, dma_addr_t bus, 137 void *vaddr, dma_addr_t bus,
138 struct dma_attrs *attrs) 138 struct dma_attrs *attrs);
139{
140 struct dma_map_ops *ops = get_dma_ops(dev);
141
142 WARN_ON(irqs_disabled()); /* for portability */
143
144 if (dma_release_from_coherent(dev, get_order(size), vaddr))
145 return;
146
147 debug_dma_free_coherent(dev, size, vaddr, bus);
148 if (ops->free)
149 ops->free(dev, size, vaddr, bus, attrs);
150}
151 139
152#endif 140#endif
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index f9f7656e1d41..353972c1946c 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -168,6 +168,23 @@ void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
168} 168}
169EXPORT_SYMBOL(dma_alloc_attrs); 169EXPORT_SYMBOL(dma_alloc_attrs);
170 170
171void dma_free_attrs(struct device *dev, size_t size,
172 void *vaddr, dma_addr_t bus,
173 struct dma_attrs *attrs)
174{
175 struct dma_map_ops *ops = get_dma_ops(dev);
176
177 WARN_ON(irqs_disabled()); /* for portability */
178
179 if (dma_release_from_coherent(dev, get_order(size), vaddr))
180 return;
181
182 debug_dma_free_coherent(dev, size, vaddr, bus);
183 if (ops->free)
184 ops->free(dev, size, vaddr, bus, attrs);
185}
186EXPORT_SYMBOL(dma_free_attrs);
187
171/* 188/*
172 * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel 189 * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
173 * parameter documentation. 190 * parameter documentation.