Skip to content

Commit 121f343

Browse files
bjorn-rivospalmer-dabbelt
authored andcommitted
riscv: Replace function-like macro by static inline function
The flush_icache_range() function is implemented as a "function-like macro with unused parameters", which can result in "unused variables" warnings. Replace the macro with a static inline function, as advised by Documentation/process/coding-style.rst. Fixes: 08f051e ("RISC-V: Flush I$ when making a dirty page executable") Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Link: https://lore.kernel.org/r/20250419111402.1660267-1-bjorn@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 9c32cda commit 121f343

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/riscv/include/asm/cacheflush.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ static inline void flush_dcache_page(struct page *page)
3434
flush_dcache_folio(page_folio(page));
3535
}
3636

37-
/*
38-
* RISC-V doesn't have an instruction to flush parts of the instruction cache,
39-
* so instead we just flush the whole thing.
40-
*/
41-
#define flush_icache_range(start, end) flush_icache_all()
4237
#define flush_icache_user_page(vma, pg, addr, len) \
4338
do { \
4439
if (vma->vm_flags & VM_EXEC) \
@@ -78,6 +73,16 @@ void flush_icache_mm(struct mm_struct *mm, bool local);
7873

7974
#endif /* CONFIG_SMP */
8075

76+
/*
77+
* RISC-V doesn't have an instruction to flush parts of the instruction cache,
78+
* so instead we just flush the whole thing.
79+
*/
80+
#define flush_icache_range flush_icache_range
81+
static inline void flush_icache_range(unsigned long start, unsigned long end)
82+
{
83+
flush_icache_all();
84+
}
85+
8186
extern unsigned int riscv_cbom_block_size;
8287
extern unsigned int riscv_cboz_block_size;
8388
void riscv_init_cbo_blocksizes(void);

0 commit comments

Comments
 (0)