From 797a75686528e9f6f9bfee2a719a00b47868c999 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 14 May 2009 16:23:10 +0000 Subject: sparc: use dma_map_page instead of dma_map_single This patch converts dma_map_single and dma_unmap_single to use map_page and unmap_page respectively and removes unnecessary map_single and unmap_single. map_page can be used to implement map_single but the opposite is impossible. Having only dma_map_page in struct dma_ops is enough. Signed-off-by: FUJITA Tomonori Tested-by: Robert Reif Signed-off-by: David S. Miller --- arch/sparc/include/asm/dma-mapping_64.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'arch/sparc/include') diff --git a/arch/sparc/include/asm/dma-mapping_64.h b/arch/sparc/include/asm/dma-mapping_64.h index 0c4fb1f81ca..579757e00a2 100644 --- a/arch/sparc/include/asm/dma-mapping_64.h +++ b/arch/sparc/include/asm/dma-mapping_64.h @@ -9,12 +9,12 @@ struct dma_ops { dma_addr_t *dma_handle, gfp_t flag); void (*free_coherent)(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle); - dma_addr_t (*map_single)(struct device *dev, void *cpu_addr, - size_t size, - enum dma_data_direction direction); - void (*unmap_single)(struct device *dev, dma_addr_t dma_addr, - size_t size, - enum dma_data_direction direction); + dma_addr_t (*map_page)(struct device *dev, struct page *page, + unsigned long offset, size_t size, + enum dma_data_direction direction); + void (*unmap_page)(struct device *dev, dma_addr_t dma_addr, + size_t size, + enum dma_data_direction direction); int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction); void (*unmap_sg)(struct device *dev, struct scatterlist *sg, @@ -51,29 +51,30 @@ static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, enum dma_data_direction direction) { - return dma_ops->map_single(dev, cpu_addr, size, direction); + return dma_ops->map_page(dev, virt_to_page(cpu_addr), + (unsigned long)cpu_addr & ~PAGE_MASK, size, + direction); } static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction direction) { - dma_ops->unmap_single(dev, dma_addr, size, direction); + dma_ops->unmap_page(dev, dma_addr, size, direction); } static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction) { - return dma_ops->map_single(dev, page_address(page) + offset, - size, direction); + return dma_ops->map_page(dev, page, offset, size, direction); } static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, enum dma_data_direction direction) { - dma_ops->unmap_single(dev, dma_address, size, direction); + dma_ops->unmap_page(dev, dma_address, size, direction); } static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, -- cgit