aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/io-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/io-mapping.h')
-rw-r--r--include/linux/io-mapping.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index f1ed66c43787..0adb0f91568c 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -49,9 +49,8 @@ static inline struct io_mapping *
49io_mapping_create_wc(resource_size_t base, unsigned long size) 49io_mapping_create_wc(resource_size_t base, unsigned long size)
50{ 50{
51 struct io_mapping *iomap; 51 struct io_mapping *iomap;
52 pgprot_t prot;
53 52
54 if (!reserve_io_memtype_wc(base, size, &prot)) 53 if (!is_io_mapping_possible(base, size))
55 return NULL; 54 return NULL;
56 55
57 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL); 56 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL);
@@ -60,14 +59,13 @@ io_mapping_create_wc(resource_size_t base, unsigned long size)
60 59
61 iomap->base = base; 60 iomap->base = base;
62 iomap->size = size; 61 iomap->size = size;
63 iomap->prot = prot; 62 iomap->prot = pgprot_writecombine(__pgprot(__PAGE_KERNEL));
64 return iomap; 63 return iomap;
65} 64}
66 65
67static inline void 66static inline void
68io_mapping_free(struct io_mapping *mapping) 67io_mapping_free(struct io_mapping *mapping)
69{ 68{
70 free_io_memtype(mapping->base, mapping->size);
71 kfree(mapping); 69 kfree(mapping);
72} 70}
73 71
@@ -93,8 +91,11 @@ io_mapping_unmap_atomic(void *vaddr)
93static inline void * 91static inline void *
94io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) 92io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
95{ 93{
94 resource_size_t phys_addr;
95
96 BUG_ON(offset >= mapping->size); 96 BUG_ON(offset >= mapping->size);
97 resource_size_t phys_addr = mapping->base + offset; 97 phys_addr = mapping->base + offset;
98
98 return ioremap_wc(phys_addr, PAGE_SIZE); 99 return ioremap_wc(phys_addr, PAGE_SIZE);
99} 100}
100 101