diff options
Diffstat (limited to 'drivers/base/dma-mapping.c')
-rw-r--r-- | drivers/base/dma-mapping.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index db5db02e885f..3fbedc75e7c5 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c | |||
@@ -218,6 +218,24 @@ void dmam_release_declared_memory(struct device *dev) | |||
218 | } | 218 | } |
219 | EXPORT_SYMBOL(dmam_release_declared_memory); | 219 | EXPORT_SYMBOL(dmam_release_declared_memory); |
220 | 220 | ||
221 | /* | ||
222 | * Create scatter-list for the already allocated DMA buffer. | ||
223 | */ | ||
224 | int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, | ||
225 | void *cpu_addr, dma_addr_t handle, size_t size) | ||
226 | { | ||
227 | struct page *page = virt_to_page(cpu_addr); | ||
228 | int ret; | ||
229 | |||
230 | ret = sg_alloc_table(sgt, 1, GFP_KERNEL); | ||
231 | if (unlikely(ret)) | ||
232 | return ret; | ||
233 | |||
234 | sg_set_page(sgt->sgl, page, PAGE_ALIGN(size), 0); | ||
235 | return 0; | ||
236 | } | ||
237 | EXPORT_SYMBOL(dma_common_get_sgtable); | ||
238 | |||
221 | #endif | 239 | #endif |
222 | 240 | ||
223 | /* | 241 | /* |