Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

microblaze: Use static inline functions in cacheflush.h

Using static inline functions ensure proper type checking
which also remove compilation warning for no MMU

Compilation warning:
arch/microblaze/include/asm/cacheflush.h: warning: 'addr'
may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

+17 -15
+17 -15
arch/microblaze/include/asm/cacheflush.h
··· 102 102 103 103 #define flush_cache_range(vma, start, len) do { } while (0) 104 104 105 - #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 106 - do { \ 107 - u32 addr = virt_to_phys(dst); \ 108 - memcpy((dst), (src), (len)); \ 109 - if (vma->vm_flags & VM_EXEC) { \ 110 - invalidate_icache_range((unsigned) (addr), \ 111 - (unsigned) (addr) + PAGE_SIZE); \ 112 - flush_dcache_range((unsigned) (addr), \ 113 - (unsigned) (addr) + PAGE_SIZE); \ 114 - } \ 115 - } while (0) 105 + static inline void copy_to_user_page(struct vm_area_struct *vma, 106 + struct page *page, unsigned long vaddr, 107 + void *dst, void *src, int len) 108 + { 109 + u32 addr = virt_to_phys(dst); 110 + memcpy(dst, src, len); 111 + if (vma->vm_flags & VM_EXEC) { 112 + invalidate_icache_range(addr, addr + PAGE_SIZE); 113 + flush_dcache_range(addr, addr + PAGE_SIZE); 114 + } 115 + } 116 116 117 - #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 118 - do { \ 119 - memcpy((dst), (src), (len)); \ 120 - } while (0) 117 + static inline void copy_from_user_page(struct vm_area_struct *vma, 118 + struct page *page, unsigned long vaddr, 119 + void *dst, void *src, int len) 120 + { 121 + memcpy(dst, src, len); 122 + } 121 123 122 124 #endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */