From: tom.leiming@gmail.com
To: linux@arm.linux.org.uk, joerg.roedel@amd.com
Cc: linux-arm-kernel@lists.arm.linux.org.uk,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH 2/3] ARM:dma-mapping:only provide one set of dma-api wrappers
Date: Sun, 12 Jul 2009 00:07:46 +0800 [thread overview]
Message-ID: <1247328467-24985-3-git-send-email-tom.leiming@gmail.com> (raw)
In-Reply-To: <1247328467-24985-2-git-send-email-tom.leiming@gmail.com>
From: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
arch/arm/include/asm/dma-mapping.h | 53 +++++++++++++++++-------------------
1 files changed, 25 insertions(+), 28 deletions(-)
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 0e87498..86f2964 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -273,22 +273,6 @@ extern dma_addr_t __dma_map_page(struct device *, struct page *,
extern void __dma_unmap_single(struct device *, dma_addr_t, size_t,
enum dma_data_direction);
-static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
- size_t size, enum dma_data_direction dir)
-{
- return __dma_map_single(dev, cpu_addr, size, dir);
-}
-static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
- unsigned long offset, size_t size, enum dma_data_direction dir)
-{
- return __dma_map_page(dev, page, offset, size, dir);
-}
-static inline void dma_unmap_single(struct device *dev, dma_addr_t handle,
- size_t size, enum dma_data_direction dir)
-{
- __dma_unmap_single(dev, handle, size, dir);
-}
-
/*
* Private functions
*/
@@ -309,6 +293,28 @@ static inline int dmabounce_sync_for_device(struct device *d, dma_addr_t addr,
return 1;
}
+static inline dma_addr_t __dma_map_single(struct device *dev, void *cpu_addr,
+ size_t size, enum dma_data_direction dir)
+{
+ if (!arch_is_coherent())
+ dma_cache_maint(cpu_addr, size, dir);
+
+ return virt_to_dma(dev, cpu_addr);
+}
+static inline dma_addr_t __dma_map_page(struct device *dev, struct page *page,
+ unsigned long offset, size_t size, enum dma_data_direction dir)
+{
+ if (!arch_is_coherent())
+ dma_cache_maint_page(page, offset, size, dir);
+
+ return page_to_dma(dev, page) + offset;
+}
+static inline void __dma_unmap_single(struct device *dev, dma_addr_t handle,
+ size_t size, enum dma_data_direction dir)
+{
+ /* nothing to do */
+}
+#endif /* CONFIG_DMABOUNCE */
/**
* dma_map_single - map a single buffer for streaming DMA
@@ -328,11 +334,7 @@ static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
size_t size, enum dma_data_direction dir)
{
BUG_ON(!valid_dma_direction(dir));
-
- if (!arch_is_coherent())
- dma_cache_maint(cpu_addr, size, dir);
-
- return virt_to_dma(dev, cpu_addr);
+ return __dma_map_single(dev, cpu_addr, size, dir);
}
/**
@@ -353,11 +355,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, enum dma_data_direction dir)
{
BUG_ON(!valid_dma_direction(dir));
-
- if (!arch_is_coherent())
- dma_cache_maint_page(page, offset, size, dir);
-
- return page_to_dma(dev, page) + offset;
+ return __dma_map_page(dev, page, offset, size, dir);
}
/**
@@ -377,9 +375,8 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
static inline void dma_unmap_single(struct device *dev, dma_addr_t handle,
size_t size, enum dma_data_direction dir)
{
- /* nothing to do */
+ __dma_unmap_single(dev, handle, size, dir);
}
-#endif /* CONFIG_DMABOUNCE */
/**
* dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
--
1.6.0.GIT
next prev parent reply other threads:[~2009-07-11 16:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-11 16:07 [PATCH 0/3] ARM:dma-mapping:Support DMA-API debugging facility on ARM tom.leiming
2009-07-11 16:07 ` [PATCH 1/3] ARM:dma-mapping:wrappers for dma-api tom.leiming
2009-07-11 16:07 ` tom.leiming [this message]
2009-07-11 16:07 ` [PATCH 3/3] ARM:dma-mapping:Support DMA-API debugging facility on ARM tom.leiming
2009-07-17 0:02 ` [PATCH 0/3] " Ming Lei
2009-07-17 8:11 ` Russell King - ARM Linux
2009-07-17 15:07 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1247328467-24985-3-git-send-email-tom.leiming@gmail.com \
--to=tom.leiming@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=joerg.roedel@amd.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.