clocksource: arc_timer: eliminate redefined macro error
Subsystems (2)
PATCH v2 1/1 clocksource: 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 */
---
v2: prefix both TIMER_CTRL_xx macros with ARC_ (suggested by
Shahab Vahedi <[email protected]>
drivers/clocksource/arc_timer.c | 6 +++--- include/soc/arc/timers.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
include/soc/arc/timers.h +2 -2
@@ -17,8 +17,8 @@#define ARC_REG_TIMER1_CNT 0x100/* timer 1 count */ /* CTRL reg bits */ -#define TIMER_CTRL_IE (1 << 0)/* Interrupt when Count reaches limit */ -#define TIMER_CTRL_NH (1 << 1)/* Count only when CPU NOT halted */ +#define ARC_TIMER_CTRL_IE (1 << 0)/* Interrupt when Count reaches limit */ +#define ARC_TIMER_CTRL_NH (1 << 1)/* Count only when CPU NOT halted */ #define ARC_TIMERN_MAX 0xFFFFFFFF
drivers/clocksource/arc_timer.c +3 -3
@@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(stwrite_aux_reg (ARC_REG_TIMER1_LIMIT ,ARC_TIMERN_MAX );write_aux_reg (ARC_REG_TIMER1_CNT ,0 ); -write_aux_reg (ARC_REG_TIMER1_CTRL ,TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER1_CTRL ,ARC_TIMER_CTRL_NH );sched_clock_register (arc_timer1_clock_read,32 , arc_timer_freq);
@@ -245,7 +245,7 @@ static void arc_timer_event_setup(unsignwrite_aux_reg (ARC_REG_TIMER0_LIMIT , cycles);write_aux_reg (ARC_REG_TIMER0_CNT ,0 );/* start from 0 */ -write_aux_reg (ARC_REG_TIMER0_CTRL ,TIMER_CTRL_IE |TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER0_CTRL ,ARC_TIMER_CTRL_IE |ARC_TIMER_CTRL_NH ); }
@@ -294,7 +294,7 @@ static irqreturn_t timer_irq_handler(int* explicitly clears IP bit * 2. Re-arm interrupt if periodic by writing to IE bit [0] */ -write_aux_reg (ARC_REG_TIMER0_CTRL , irq_reenable |TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER0_CTRL , irq_reenable |ARC_TIMER_CTRL_NH ); evt->event_handler (evt);
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 16 lines · Randy Dunlap
In
drivers/clocksource/, 3 drivers use "TIMER_CTRL_IE" with 3 different values. Two of them (mps2-timer.candtimer-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 theTIMER_CTRL_NHmacro 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 | #defineTIMER_CTRL_IE(1 << 0) /* Interrupt when Count reaches limit */
Quoted 7 lines
Fixes b26c2e3823ba ("ARC: breakout timer include code into separate header")Signed-off-by Randy Dunlap <[email protected]>Cc Vineet Gupta <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Shahab Vahedi <[email protected]>
Thx,
-Vineet
Quoted 50 lines
---
v2: prefix bothTIMER_CTRL_xxmacros withARC_(suggested by
Shahab Vahedi <[email protected]>drivers/clocksource/arc_timer.c | 6 +++--- include/soc/arc/timers.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)include/soc/arc/timers.h +2
-2@@ -17,8 +17,8 @@#define ARC_REG_TIMER1_CNT 0x100/* timer 1 count */ /* CTRL reg bits */ -#define TIMER_CTRL_IE (1 << 0)/* Interrupt when Count reaches limit */ -#define TIMER_CTRL_NH (1 << 1)/* Count only when CPU NOT halted */ +#define ARC_TIMER_CTRL_IE (1 << 0)/* Interrupt when Count reaches limit */ +#define ARC_TIMER_CTRL_NH (1 << 1)/* Count only when CPU NOT halted */ #define ARC_TIMERN_MAX 0xFFFFFFFFdrivers/clocksource/arc_timer.c +3
-3@@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(stwrite_aux_reg (ARC_REG_TIMER1_LIMIT ,ARC_TIMERN_MAX );write_aux_reg (ARC_REG_TIMER1_CNT ,0 ); -write_aux_reg (ARC_REG_TIMER1_CTRL ,TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER1_CTRL ,ARC_TIMER_CTRL_NH );sched_clock_register (arc_timer1_clock_read,32 , arc_timer_freq);@@ -245,7 +245,7 @@ static void arc_timer_event_setup(unsignwrite_aux_reg (ARC_REG_TIMER0_LIMIT , cycles);write_aux_reg (ARC_REG_TIMER0_CNT ,0 );/* start from 0 */ -write_aux_reg (ARC_REG_TIMER0_CTRL ,TIMER_CTRL_IE |TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER0_CTRL ,ARC_TIMER_CTRL_IE |ARC_TIMER_CTRL_NH ); }@@ -294,7 +294,7 @@ static irqreturn_t timer_irq_handler(int* explicitly clears IP bit * 2. Re-arm interrupt if periodic by writing to IE bit [0] */ -write_aux_reg (ARC_REG_TIMER0_CTRL , irq_reenable |TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER0_CTRL , irq_reenable |ARC_TIMER_CTRL_NH ); evt->event_handler (evt);
[tip: timers/core] clocksource/drivers/arc_timer: Eliminate redefined macro error
In reply to Randy DunlapThe following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 58100c34f7827ddf64309c5a7c8c4e5bd6415b95 Gitweb: https://git.kernel.org/tip/58100c34f7827ddf64309c5a7c8c4e5bd6415b95 Author: Randy Dunlap <[email protected]> AuthorDate: Thu, 23 Sep 2021 19:08:25 -07:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Sat, 16 Oct 2021 22:15:01 +02:00
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 */
--- drivers/clocksource/arc_timer.c | 6 +++--- include/soc/arc/timers.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/clocksource/arc_timer.c +3 -3
@@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(struct device_node *node)write_aux_reg (ARC_REG_TIMER1_LIMIT ,ARC_TIMERN_MAX );write_aux_reg (ARC_REG_TIMER1_CNT ,0 ); -write_aux_reg (ARC_REG_TIMER1_CTRL ,TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER1_CTRL ,ARC_TIMER_CTRL_NH );sched_clock_register (arc_timer1_clock_read,32 , arc_timer_freq);
@@ -245,7 +245,7 @@ static void arc_timer_event_setup(unsigned int cycles)write_aux_reg (ARC_REG_TIMER0_LIMIT , cycles);write_aux_reg (ARC_REG_TIMER0_CNT ,0 );/* start from 0 */ -write_aux_reg (ARC_REG_TIMER0_CTRL ,TIMER_CTRL_IE |TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER0_CTRL ,ARC_TIMER_CTRL_IE |ARC_TIMER_CTRL_NH ); }
@@ -294,7 +294,7 @@ static irqreturn_t timer_irq_handler(int irq, void *dev_id)* explicitly clears IP bit * 2. Re-arm interrupt if periodic by writing to IE bit [0] */ -write_aux_reg (ARC_REG_TIMER0_CTRL , irq_reenable |TIMER_CTRL_NH ); +write_aux_reg (ARC_REG_TIMER0_CTRL , irq_reenable |ARC_TIMER_CTRL_NH ); evt->event_handler (evt);
include/soc/arc/timers.h +2 -2
@@ -17,8 +17,8 @@#define ARC_REG_TIMER1_CNT 0x100/* timer 1 count */ /* CTRL reg bits */ -#define TIMER_CTRL_IE (1 << 0)/* Interrupt when Count reaches limit */ -#define TIMER_CTRL_NH (1 << 1)/* Count only when CPU NOT halted */ +#define ARC_TIMER_CTRL_IE (1 << 0)/* Interrupt when Count reaches limit */ +#define ARC_TIMER_CTRL_NH (1 << 1)/* Count only when CPU NOT halted */ #define ARC_TIMERN_MAX 0xFFFFFFFF