lkml.org 
[lkml]   [2008]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/11] swiotlb: Allow arch to provide address_needs_mapping
Date
Rename it swiotlb_addr_needs_mapping and make it weak
so architectures can override it if needed.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
lib/swiotlb.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 3d9ac10..9b89a9d 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -272,8 +272,8 @@ cleanup1:
return -ENOMEM;
}

-static int
-address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
+int __weak
+swiotlb_addr_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
{
return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size);
}
@@ -562,7 +562,8 @@ swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
* we can safely return the device addr and not worry about bounce
* buffering it.
*/
- if (!address_needs_mapping(hwdev, dev_addr, size) && !swiotlb_force)
+ if (!swiotlb_addr_needs_mapping(hwdev, dev_addr, size) &&
+ !swiotlb_force)
return dev_addr;

/*
@@ -579,7 +580,7 @@ swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
/*
* Ensure that the address returned is DMA'ble
*/
- if (address_needs_mapping(hwdev, dev_addr, size))
+ if (swiotlb_addr_needs_mapping(hwdev, dev_addr, size))
panic("map_single: bounce buffer is not DMA'ble");

return dev_addr;
@@ -723,7 +724,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
addr = sg_virt(sg);
dev_addr = virt_to_bus(addr);
if (swiotlb_force ||
- address_needs_mapping(hwdev, dev_addr, sg->length)) {
+ swiotlb_addr_needs_mapping(hwdev, dev_addr, sg->length)) {
void *map = map_single(hwdev, addr, sg->length, dir);
if (!map) {
/* Don't panic here, we expect map_sg users
--
1.5.6.5


\
 
 \ /
  Last update: 2008-12-19 06:15    [W:0.189 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site