diff options
author | Thierry Reding <treding@nvidia.com> | 2014-07-28 11:20:33 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-11-10 09:59:21 -0500 |
commit | 4707a341b4af57c72c1573a89d303559cf7bcf88 (patch) | |
tree | adf5f6360dafaf60e00995326b92cf1664828662 /arch | |
parent | dc01201476ec9d62e81c0ee181531bccd8b007ff (diff) |
/dev/mem: Use more consistent data types
The xlate_dev_{kmem,mem}_ptr() functions take either a physical address
or a kernel virtual address, so data types should be phys_addr_t and
void *. They both return a kernel virtual address which is only ever
used in calls to copy_{from,to}_user(), so make variables that store it
void * rather than char * for consistency.
Also only define a weak unxlate_dev_mem_ptr() function if architectures
haven't overridden them in the asm/io.h header file.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/include/asm/io.h | 5 | ||||
-rw-r--r-- | arch/s390/mm/maccess.c | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/io.h | 4 | ||||
-rw-r--r-- | arch/x86/mm/ioremap.c | 4 |
4 files changed, 9 insertions, 8 deletions
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h index cd6b9ee7b69c..d22c2eeae78f 100644 --- a/arch/s390/include/asm/io.h +++ b/arch/s390/include/asm/io.h | |||
@@ -13,9 +13,10 @@ | |||
13 | #include <asm/page.h> | 13 | #include <asm/page.h> |
14 | #include <asm/pci_io.h> | 14 | #include <asm/pci_io.h> |
15 | 15 | ||
16 | void *xlate_dev_mem_ptr(unsigned long phys); | ||
17 | #define xlate_dev_mem_ptr xlate_dev_mem_ptr | 16 | #define xlate_dev_mem_ptr xlate_dev_mem_ptr |
18 | void unxlate_dev_mem_ptr(unsigned long phys, void *addr); | 17 | void *xlate_dev_mem_ptr(phys_addr_t phys); |
18 | #define unxlate_dev_mem_ptr unxlate_dev_mem_ptr | ||
19 | void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr); | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * Convert a virtual cached pointer to an uncached pointer | 22 | * Convert a virtual cached pointer to an uncached pointer |
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 2a2e35416d2f..2eb34bdfc613 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c | |||
@@ -176,7 +176,7 @@ static int is_swapped(unsigned long addr) | |||
176 | * For swapped prefix pages a new buffer is returned that contains a copy of | 176 | * For swapped prefix pages a new buffer is returned that contains a copy of |
177 | * the absolute memory. The buffer size is maximum one page large. | 177 | * the absolute memory. The buffer size is maximum one page large. |
178 | */ | 178 | */ |
179 | void *xlate_dev_mem_ptr(unsigned long addr) | 179 | void *xlate_dev_mem_ptr(phys_addr_t addr) |
180 | { | 180 | { |
181 | void *bounce = (void *) addr; | 181 | void *bounce = (void *) addr; |
182 | unsigned long size; | 182 | unsigned long size; |
@@ -197,7 +197,7 @@ void *xlate_dev_mem_ptr(unsigned long addr) | |||
197 | /* | 197 | /* |
198 | * Free converted buffer for /dev/mem access (if necessary) | 198 | * Free converted buffer for /dev/mem access (if necessary) |
199 | */ | 199 | */ |
200 | void unxlate_dev_mem_ptr(unsigned long addr, void *buf) | 200 | void unxlate_dev_mem_ptr(phys_addr_t addr, void *buf) |
201 | { | 201 | { |
202 | if ((void *) addr != buf) | 202 | if ((void *) addr != buf) |
203 | free_page((unsigned long) buf); | 203 | free_page((unsigned long) buf); |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index b8237d8a1e0c..ae2b593e7c6e 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -310,8 +310,8 @@ BUILDIO(b, b, char) | |||
310 | BUILDIO(w, w, short) | 310 | BUILDIO(w, w, short) |
311 | BUILDIO(l, , int) | 311 | BUILDIO(l, , int) |
312 | 312 | ||
313 | extern void *xlate_dev_mem_ptr(unsigned long phys); | 313 | extern void *xlate_dev_mem_ptr(phys_addr_t phys); |
314 | extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr); | 314 | extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr); |
315 | 315 | ||
316 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, | 316 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, |
317 | unsigned long prot_val); | 317 | unsigned long prot_val); |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index af78e50ca6ce..b12f43c192cf 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -327,7 +327,7 @@ EXPORT_SYMBOL(iounmap); | |||
327 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | 327 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
328 | * access | 328 | * access |
329 | */ | 329 | */ |
330 | void *xlate_dev_mem_ptr(unsigned long phys) | 330 | void *xlate_dev_mem_ptr(phys_addr_t phys) |
331 | { | 331 | { |
332 | void *addr; | 332 | void *addr; |
333 | unsigned long start = phys & PAGE_MASK; | 333 | unsigned long start = phys & PAGE_MASK; |
@@ -343,7 +343,7 @@ void *xlate_dev_mem_ptr(unsigned long phys) | |||
343 | return addr; | 343 | return addr; |
344 | } | 344 | } |
345 | 345 | ||
346 | void unxlate_dev_mem_ptr(unsigned long phys, void *addr) | 346 | void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr) |
347 | { | 347 | { |
348 | if (page_is_ram(phys >> PAGE_SHIFT)) | 348 | if (page_is_ram(phys >> PAGE_SHIFT)) |
349 | return; | 349 | return; |