Skip to content

Commit 2f3035d

Browse files
riscv: prefix IRQ_ macro names with an RV_ namespace
"IRQ_TIMER", used in the arch/riscv CSR header file, is a sufficiently generic macro name that it's used by several source files across the Linux code base. Some of these other files ultimately include the arch/riscv CSR include file, causing collisions. Fix by prefixing the RISC-V csr.h IRQ_ macro names with an RV_ prefix. Fixes: a4c3733 ("riscv: abstract out CSR names for supervisor vs machine mode") Reported-by: Olof Johansson <[email protected]> Acked-by: Olof Johansson <[email protected]> Signed-off-by: Paul Walmsley <[email protected]>
1 parent 9d05c18 commit 2f3035d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

arch/riscv/include/asm/csr.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@
116116
# define SR_PIE SR_MPIE
117117
# define SR_PP SR_MPP
118118

119-
# define IRQ_SOFT IRQ_M_SOFT
120-
# define IRQ_TIMER IRQ_M_TIMER
121-
# define IRQ_EXT IRQ_M_EXT
119+
# define RV_IRQ_SOFT IRQ_M_SOFT
120+
# define RV_IRQ_TIMER IRQ_M_TIMER
121+
# define RV_IRQ_EXT IRQ_M_EXT
122122
#else /* CONFIG_RISCV_M_MODE */
123123
# define CSR_STATUS CSR_SSTATUS
124124
# define CSR_IE CSR_SIE
@@ -133,15 +133,15 @@
133133
# define SR_PIE SR_SPIE
134134
# define SR_PP SR_SPP
135135

136-
# define IRQ_SOFT IRQ_S_SOFT
137-
# define IRQ_TIMER IRQ_S_TIMER
138-
# define IRQ_EXT IRQ_S_EXT
136+
# define RV_IRQ_SOFT IRQ_S_SOFT
137+
# define RV_IRQ_TIMER IRQ_S_TIMER
138+
# define RV_IRQ_EXT IRQ_S_EXT
139139
#endif /* CONFIG_RISCV_M_MODE */
140140

141141
/* IE/IP (Supervisor/Machine Interrupt Enable/Pending) flags */
142-
#define IE_SIE (_AC(0x1, UL) << IRQ_SOFT)
143-
#define IE_TIE (_AC(0x1, UL) << IRQ_TIMER)
144-
#define IE_EIE (_AC(0x1, UL) << IRQ_EXT)
142+
#define IE_SIE (_AC(0x1, UL) << RV_IRQ_SOFT)
143+
#define IE_TIE (_AC(0x1, UL) << RV_IRQ_TIMER)
144+
#define IE_EIE (_AC(0x1, UL) << RV_IRQ_EXT)
145145

146146
#ifndef __ASSEMBLY__
147147

arch/riscv/kernel/irq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
2323

2424
irq_enter();
2525
switch (regs->cause & ~CAUSE_IRQ_FLAG) {
26-
case IRQ_TIMER:
26+
case RV_IRQ_TIMER:
2727
riscv_timer_interrupt();
2828
break;
2929
#ifdef CONFIG_SMP
30-
case IRQ_SOFT:
30+
case RV_IRQ_SOFT:
3131
/*
3232
* We only use software interrupts to pass IPIs, so if a non-SMP
3333
* system gets one, then we don't know what to do.
3434
*/
3535
riscv_software_interrupt();
3636
break;
3737
#endif
38-
case IRQ_EXT:
38+
case RV_IRQ_EXT:
3939
handle_arch_irq(regs);
4040
break;
4141
default:

drivers/irqchip/irq-sifive-plic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static int __init plic_init(struct device_node *node,
256256
* Skip contexts other than external interrupts for our
257257
* privilege level.
258258
*/
259-
if (parent.args[0] != IRQ_EXT)
259+
if (parent.args[0] != RV_IRQ_EXT)
260260
continue;
261261

262262
hartid = plic_find_hart_id(parent.np);

0 commit comments

Comments
 (0)