diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2016-01-11 12:15:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2016-02-08 10:47:28 -0500 |
commit | 2841029393fad551b49b6de34d44bfa9ef256441 (patch) | |
tree | 8e4d1040e2a6cba7a1a09729abad19fe7c0a50c8 | |
parent | 9023cc8268c6ba358417d31112ed96e1feb73e56 (diff) |
ARM: make virt_to_idmap() return unsigned long
Make virt_to_idmap() return an unsigned long rather than phys_addr_t.
Returning phys_addr_t here makes no sense, because the definition of
virt_to_idmap() is that it shall return a physical address which maps
identically with the virtual address. Since virtual addresses are
limited to 32-bit, identity mapped physical addresses are as well.
Almost all users already had an implicit narrowing cast to unsigned long
so let's make this official and part of this interface.
Tested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/include/asm/memory.h | 6 | ||||
-rw-r--r-- | arch/arm/kernel/reboot.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-keystone/keystone.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/idmap.c | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index c79b57bf71c4..49bf6b1e2177 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -273,14 +273,14 @@ static inline void *phys_to_virt(phys_addr_t x) | |||
273 | #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) | 273 | #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) |
274 | #define pfn_to_kaddr(pfn) __va((phys_addr_t)(pfn) << PAGE_SHIFT) | 274 | #define pfn_to_kaddr(pfn) __va((phys_addr_t)(pfn) << PAGE_SHIFT) |
275 | 275 | ||
276 | extern phys_addr_t (*arch_virt_to_idmap)(unsigned long x); | 276 | extern unsigned long (*arch_virt_to_idmap)(unsigned long x); |
277 | 277 | ||
278 | /* | 278 | /* |
279 | * These are for systems that have a hardware interconnect supported alias of | 279 | * These are for systems that have a hardware interconnect supported alias of |
280 | * physical memory for idmap purposes. Most cases should leave these | 280 | * physical memory for idmap purposes. Most cases should leave these |
281 | * untouched. | 281 | * untouched. Note: this can only return addresses less than 4GiB. |
282 | */ | 282 | */ |
283 | static inline phys_addr_t __virt_to_idmap(unsigned long x) | 283 | static inline unsigned long __virt_to_idmap(unsigned long x) |
284 | { | 284 | { |
285 | if (IS_ENABLED(CONFIG_MMU) && arch_virt_to_idmap) | 285 | if (IS_ENABLED(CONFIG_MMU) && arch_virt_to_idmap) |
286 | return arch_virt_to_idmap(x); | 286 | return arch_virt_to_idmap(x); |
diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c index 38269358fd25..71a2ff9ec490 100644 --- a/arch/arm/kernel/reboot.c +++ b/arch/arm/kernel/reboot.c | |||
@@ -50,7 +50,7 @@ static void __soft_restart(void *addr) | |||
50 | flush_cache_all(); | 50 | flush_cache_all(); |
51 | 51 | ||
52 | /* Switch to the identity mapping. */ | 52 | /* Switch to the identity mapping. */ |
53 | phys_reset = (phys_reset_t)(unsigned long)virt_to_idmap(cpu_reset); | 53 | phys_reset = (phys_reset_t)virt_to_idmap(cpu_reset); |
54 | phys_reset((unsigned long)addr); | 54 | phys_reset((unsigned long)addr); |
55 | 55 | ||
56 | /* Should never get here. */ | 56 | /* Should never get here. */ |
diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index c279293f084c..d80879ce4963 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c | |||
@@ -63,7 +63,7 @@ static void __init keystone_init(void) | |||
63 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 63 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
64 | } | 64 | } |
65 | 65 | ||
66 | static phys_addr_t keystone_virt_to_idmap(unsigned long x) | 66 | static unsigned long keystone_virt_to_idmap(unsigned long x) |
67 | { | 67 | { |
68 | return (phys_addr_t)(x) - CONFIG_PAGE_OFFSET + KEYSTONE_LOW_PHYS_START; | 68 | return (phys_addr_t)(x) - CONFIG_PAGE_OFFSET + KEYSTONE_LOW_PHYS_START; |
69 | } | 69 | } |
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index d65909697165..bd274a05b8ff 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * page tables. | 15 | * page tables. |
16 | */ | 16 | */ |
17 | pgd_t *idmap_pgd; | 17 | pgd_t *idmap_pgd; |
18 | phys_addr_t (*arch_virt_to_idmap) (unsigned long x); | 18 | unsigned long (*arch_virt_to_idmap)(unsigned long x); |
19 | 19 | ||
20 | #ifdef CONFIG_ARM_LPAE | 20 | #ifdef CONFIG_ARM_LPAE |
21 | static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, | 21 | static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, |