From 3c98fd266b76e04fd59d294f2fb588cc5cb4c212 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 9 Nov 2016 15:31:00 +0800 Subject: [PATCH 1/3] nios2: Extend !__ASSEMBLY__ section in asm/page.h Some C-only definition from nios2 asm/page.h are exposed to assembly code. Extend the !__ASSEMBLY__ section to prevent this. Signed-off-by: Tobias Klauser Acked-by: Ley Foon Tan --- arch/nios2/include/asm/page.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h index c1683f51ad0f..74477ab66f65 100644 --- a/arch/nios2/include/asm/page.h +++ b/arch/nios2/include/asm/page.h @@ -76,8 +76,6 @@ extern unsigned long memory_size; extern struct page *mem_map; -#endif /* !__ASSEMBLY__ */ - # define __pa(x) \ ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET) # define __va(x) \ @@ -106,4 +104,6 @@ extern struct page *mem_map; #include +#endif /* !__ASSEMBLY__ */ + #endif /* _ASM_NIOS2_PAGE_H */ From 863cf8da0f32a4c822cd9f7a2f47cd5204ce1ca0 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 9 Nov 2016 17:17:41 +0800 Subject: [PATCH 2/3] nios2: Convert pfn_valid to static inline When compiling with 'W=1' warnings such as the following occur all over the place: ./include/linux/pfn.h:21:22: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] which is due to ARCH_PFN_OFFSET being 0 by default (if CONFIG_NIOS2_MEM_BASE is not changed in the Kconfig). Fix these warnings by making pfn_valid a static inline function. Signed-off-by: Tobias Klauser Signed-off-by: Ley Foon Tan --- arch/nios2/include/asm/page.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h index 74477ab66f65..f1fbdc47bdaf 100644 --- a/arch/nios2/include/asm/page.h +++ b/arch/nios2/include/asm/page.h @@ -85,8 +85,15 @@ extern struct page *mem_map; ((void *)(((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) # define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -# define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && \ - (pfn) < max_mapnr) + +static inline bool pfn_valid(unsigned long pfn) +{ + /* avoid include hell */ + extern unsigned long max_mapnr; + unsigned long pfn_offset = ARCH_PFN_OFFSET; + + return pfn >= pfn_offset && pfn < max_mapnr; +} # define virt_to_page(vaddr) pfn_to_page(PFN_DOWN(virt_to_phys(vaddr))) # define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr))) From 744606c76c4a3a73eb34d21f265013426426c4b5 Mon Sep 17 00:00:00 2001 From: Ley Foon Tan Date: Wed, 7 Dec 2016 15:44:19 +0800 Subject: [PATCH 3/3] nios2: add screen_info Fix build error when enable VGA console. drivers/video/console/vgacon.c:586: undefined reference to `screen_info' Signed-off-by: Ley Foon Tan --- arch/nios2/kernel/setup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c index a4ff86d58d5c..a3fa80d1aacc 100644 --- a/arch/nios2/kernel/setup.c +++ b/arch/nios2/kernel/setup.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,10 @@ static struct pt_regs fake_regs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +#ifdef CONFIG_VT +struct screen_info screen_info; +#endif + /* Copy a short hook instruction sequence to the exception address */ static inline void copy_exception_handler(unsigned int addr) {