linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] convert swiotlb to use dma_get_mask
@ 2008-09-18 17:02 FUJITA Tomonori
  2008-09-19  8:20 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: FUJITA Tomonori @ 2008-09-18 17:02 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel, tony.luck

This is against tip/x86/iommu.

=
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Subject: [PATCH] convert swiotlb to use dma_get_mask

swiotlb can use dma_get_mask() instead of the homegrown function.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 include/linux/dma-mapping.h |    2 +-
 lib/swiotlb.c               |    6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 0dba743..ba9114e 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -65,7 +65,7 @@ static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
 
 static inline u64 dma_get_mask(struct device *dev)
 {
-	if (dev->dma_mask && *dev->dma_mask)
+	if (dev && dev->dma_mask && *dev->dma_mask)
 		return *dev->dma_mask;
 	return DMA_32BIT_MASK;
 }
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 240a67c..f8eebd4 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -276,11 +276,7 @@ cleanup1:
 static int
 address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
 {
-	dma_addr_t mask = 0xffffffff;
-	/* If the device has a mask, use it, otherwise default to 32 bits */
-	if (hwdev && hwdev->dma_mask)
-		mask = *hwdev->dma_mask;
-	return !is_buffer_dma_capable(mask, addr, size);
+	return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size);
 }
 
 static int is_swiotlb_buffer(char *addr)
-- 
1.5.4.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] convert swiotlb to use dma_get_mask
  2008-09-18 17:02 [PATCH] convert swiotlb to use dma_get_mask FUJITA Tomonori
@ 2008-09-19  8:20 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-09-19  8:20 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-kernel, tony.luck


* FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:

> This is against tip/x86/iommu.
> 
> =
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Subject: [PATCH] convert swiotlb to use dma_get_mask
> 
> swiotlb can use dma_get_mask() instead of the homegrown function.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

applied to tip/x86/iommu, thanks!

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-19  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 17:02 [PATCH] convert swiotlb to use dma_get_mask FUJITA Tomonori
2008-09-19  8:20 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).