Skip to content

Commit

Permalink
microblaze: Use static inline functions in cacheflush.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michal Simek committed Jun 3, 2013
1 parent 8706a6b commit 62bc82a
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions arch/microblaze/include/asm/cacheflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,23 @@ do { \

#define flush_cache_range(vma, start, len) do { } while (0)

#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
do { \
u32 addr = virt_to_phys(dst); \
memcpy((dst), (src), (len)); \
if (vma->vm_flags & VM_EXEC) { \
invalidate_icache_range((unsigned) (addr), \
(unsigned) (addr) + PAGE_SIZE); \
flush_dcache_range((unsigned) (addr), \
(unsigned) (addr) + PAGE_SIZE); \
} \
} while (0)

#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
do { \
memcpy((dst), (src), (len)); \
} while (0)
static inline void copy_to_user_page(struct vm_area_struct *vma,
struct page *page, unsigned long vaddr,
void *dst, void *src, int len)
{
u32 addr = virt_to_phys(dst);
memcpy(dst, src, len);
if (vma->vm_flags & VM_EXEC) {
invalidate_icache_range(addr, addr + PAGE_SIZE);
flush_dcache_range(addr, addr + PAGE_SIZE);
}
}

static inline void copy_from_user_page(struct vm_area_struct *vma,
struct page *page, unsigned long vaddr,
void *dst, void *src, int len)
{
memcpy(dst, src, len);
}

#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */

0 comments on commit 62bc82a

Please sign in to comment.