Skip to content

Commit b7cf2a1

Browse files
Barry Songjcmvbkbc
authored andcommitted
xtensa: remove redundant flush_dcache_page and ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE macros
xtensa's flush_dcache_page() can be a no-op sometimes. There is a generic implementation for this case in include/asm-generic/ cacheflush.h. #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE static inline void flush_dcache_page(struct page *page) { } #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 #endif So remove the superfluous flush_dcache_page() definition, which also helps silence potential build warnings complaining the page variable passed to flush_dcache_page() is not used. In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone': include/crypto/scatterwalk.h:76:30: warning: variable 'page' set but not used [-Wunused-but-set-variable] 76 | struct page *page; | ^~~~ crypto/scompress.c: In function 'scomp_acomp_comp_decomp': >> crypto/scompress.c:174:38: warning: unused variable 'dst_page' [-Wunused-variable] 174 | struct page *dst_page = sg_page(req->dst); | The issue was originally reported on LoongArch by kernel test robot (Huacai fixed it on LoongArch), then reported by Guenter and me on xtensa. This patch also removes lots of redundant macros which have been defined by asm-generic/cacheflush.h. Cc: Huacai Chen <[email protected]> Cc: Herbert Xu <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Reported-by: Barry Song <[email protected]> Closes: https://lore.kernel.org/all/CAGsJ_4yDk1+axbte7FKQEwD7X2oxUCFrEc9M5YOS1BobfDFXPA@mail.gmail.com/ Reported-by: Guenter Roeck <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Fixes: 77292bb ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") Signed-off-by: Barry Song <[email protected]> Message-Id: <[email protected]> Signed-off-by: Max Filippov <[email protected]>
1 parent 11cca8c commit b7cf2a1

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

arch/xtensa/include/asm/cacheflush.h

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ void flush_cache_range(struct vm_area_struct*, ulong, ulong);
100100
void flush_icache_range(unsigned long start, unsigned long end);
101101
void flush_cache_page(struct vm_area_struct*,
102102
unsigned long, unsigned long);
103+
#define flush_cache_all flush_cache_all
104+
#define flush_cache_range flush_cache_range
105+
#define flush_icache_range flush_icache_range
106+
#define flush_cache_page flush_cache_page
103107
#else
104108
#define flush_cache_all local_flush_cache_all
105109
#define flush_cache_range local_flush_cache_range
@@ -136,20 +140,7 @@ void local_flush_cache_page(struct vm_area_struct *vma,
136140

137141
#else
138142

139-
#define flush_cache_all() do { } while (0)
140-
#define flush_cache_mm(mm) do { } while (0)
141-
#define flush_cache_dup_mm(mm) do { } while (0)
142-
143-
#define flush_cache_vmap(start,end) do { } while (0)
144-
#define flush_cache_vmap_early(start,end) do { } while (0)
145-
#define flush_cache_vunmap(start,end) do { } while (0)
146-
147-
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
148-
#define flush_dcache_page(page) do { } while (0)
149-
150143
#define flush_icache_range local_flush_icache_range
151-
#define flush_cache_page(vma, addr, pfn) do { } while (0)
152-
#define flush_cache_range(vma, start, end) do { } while (0)
153144

154145
#endif
155146

@@ -162,15 +153,14 @@ void local_flush_cache_page(struct vm_area_struct *vma,
162153
__invalidate_icache_range(start,(end) - (start)); \
163154
} while (0)
164155

165-
#define flush_dcache_mmap_lock(mapping) do { } while (0)
166-
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
167-
168156
#if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE)
169157

170158
extern void copy_to_user_page(struct vm_area_struct*, struct page*,
171159
unsigned long, void*, const void*, unsigned long);
172160
extern void copy_from_user_page(struct vm_area_struct*, struct page*,
173161
unsigned long, void*, const void*, unsigned long);
162+
#define copy_to_user_page copy_to_user_page
163+
#define copy_from_user_page copy_from_user_page
174164

175165
#else
176166

@@ -186,4 +176,6 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*,
186176

187177
#endif
188178

179+
#include <asm-generic/cacheflush.h>
180+
189181
#endif /* _XTENSA_CACHEFLUSH_H */

0 commit comments

Comments
 (0)