Skip to content

Commit 58100c3

Browse files
rddunlapdlezcano
authored andcommitted
clocksource/drivers/arc_timer: Eliminate redefined macro error
In drivers/clocksource/, 3 drivers use "TIMER_CTRL_IE" with 3 different values. Two of them (mps2-timer.c and timer-sp804.c/timer-sp.h) are localized and left unmodifed. One of them uses a shared header file (<soc/arc/timers.h>), which is what is causing the "redefined" warnings, so change the macro name in that driver only. Also change the TIMER_CTRL_NH macro name. Both macro names are prefixed with "ARC_" to reduce the likelihood of future name collisions. In file included from ../drivers/clocksource/timer-sp804.c:24: ../drivers/clocksource/timer-sp.h:25: error: "TIMER_CTRL_IE" redefined [-Werror] 25 | #define TIMER_CTRL_IE (1 << 5) /* VR */ ../include/soc/arc/timers.h:20: note: this is the location of the previous definition 20 | #define TIMER_CTRL_IE (1 << 0) /* Interrupt when Count reaches limit */ Fixes: b26c2e3 ("ARC: breakout timer include code into separate header") Signed-off-by: Randy Dunlap <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: [email protected] Cc: Daniel Lezcano <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Shahab Vahedi <[email protected]> Acked-by: Vineet Gupta <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d25a025 commit 58100c3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/clocksource/arc_timer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(struct device_node *node)
225225

226226
write_aux_reg(ARC_REG_TIMER1_LIMIT, ARC_TIMERN_MAX);
227227
write_aux_reg(ARC_REG_TIMER1_CNT, 0);
228-
write_aux_reg(ARC_REG_TIMER1_CTRL, TIMER_CTRL_NH);
228+
write_aux_reg(ARC_REG_TIMER1_CTRL, ARC_TIMER_CTRL_NH);
229229

230230
sched_clock_register(arc_timer1_clock_read, 32, arc_timer_freq);
231231

@@ -245,7 +245,7 @@ static void arc_timer_event_setup(unsigned int cycles)
245245
write_aux_reg(ARC_REG_TIMER0_LIMIT, cycles);
246246
write_aux_reg(ARC_REG_TIMER0_CNT, 0); /* start from 0 */
247247

248-
write_aux_reg(ARC_REG_TIMER0_CTRL, TIMER_CTRL_IE | TIMER_CTRL_NH);
248+
write_aux_reg(ARC_REG_TIMER0_CTRL, ARC_TIMER_CTRL_IE | ARC_TIMER_CTRL_NH);
249249
}
250250

251251

@@ -294,7 +294,7 @@ static irqreturn_t timer_irq_handler(int irq, void *dev_id)
294294
* explicitly clears IP bit
295295
* 2. Re-arm interrupt if periodic by writing to IE bit [0]
296296
*/
297-
write_aux_reg(ARC_REG_TIMER0_CTRL, irq_reenable | TIMER_CTRL_NH);
297+
write_aux_reg(ARC_REG_TIMER0_CTRL, irq_reenable | ARC_TIMER_CTRL_NH);
298298

299299
evt->event_handler(evt);
300300

include/soc/arc/timers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#define ARC_REG_TIMER1_CNT 0x100 /* timer 1 count */
1818

1919
/* CTRL reg bits */
20-
#define TIMER_CTRL_IE (1 << 0) /* Interrupt when Count reaches limit */
21-
#define TIMER_CTRL_NH (1 << 1) /* Count only when CPU NOT halted */
20+
#define ARC_TIMER_CTRL_IE (1 << 0) /* Interrupt when Count reaches limit */
21+
#define ARC_TIMER_CTRL_NH (1 << 1) /* Count only when CPU NOT halted */
2222

2323
#define ARC_TIMERN_MAX 0xFFFFFFFF
2424

0 commit comments

Comments
 (0)