diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-05-14 16:23:10 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-16 04:56:45 -0700 |
commit | 797a75686528e9f6f9bfee2a719a00b47868c999 (patch) | |
tree | 98f5aadddd6b373e69719b95bb2fd68fbe1fe29f /arch/sparc/include/asm/dma-mapping_64.h | |
parent | 2e8fcfe2e51b2ee0fef3313e3c9ec25b9d6ed255 (diff) | |
download | talos-obmc-linux-797a75686528e9f6f9bfee2a719a00b47868c999.tar.gz talos-obmc-linux-797a75686528e9f6f9bfee2a719a00b47868c999.zip |
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 <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/include/asm/dma-mapping_64.h')
-rw-r--r-- | arch/sparc/include/asm/dma-mapping_64.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/sparc/include/asm/dma-mapping_64.h b/arch/sparc/include/asm/dma-mapping_64.h index 0c4fb1f81caf..579757e00a25 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, |