All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clocksource: arc_timer: eliminate redefined macro error
@ 2021-09-24  2:08 ` Randy Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2021-09-24  2:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Vineet Gupta, linux-snps-arc, Daniel Lezcano,
	Thomas Gleixner, Shahab Vahedi

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: b26c2e3823ba ("ARC: breakout timer include code into separate header")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
---
v2: prefix both TIMER_CTRL_xx macros with ARC_ (suggested by
    Shahab Vahedi <Shahab.Vahedi@synopsys.com>

 drivers/clocksource/arc_timer.c |    6 +++---
 include/soc/arc/timers.h        |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

--- linux-next-20210917.orig/include/soc/arc/timers.h
+++ linux-next-20210917/include/soc/arc/timers.h
@@ -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
 
--- linux-next-20210917.orig/drivers/clocksource/arc_timer.c
+++ linux-next-20210917/drivers/clocksource/arc_timer.c
@@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(st
 
 	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(unsign
 	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
 	 *      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);
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] clocksource: arc_timer: eliminate redefined macro error
@ 2021-09-24  2:08 ` Randy Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2021-09-24  2:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Vineet Gupta, linux-snps-arc, Daniel Lezcano,
	Thomas Gleixner, Shahab Vahedi

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: b26c2e3823ba ("ARC: breakout timer include code into separate header")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
---
v2: prefix both TIMER_CTRL_xx macros with ARC_ (suggested by
    Shahab Vahedi <Shahab.Vahedi@synopsys.com>

 drivers/clocksource/arc_timer.c |    6 +++---
 include/soc/arc/timers.h        |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

--- linux-next-20210917.orig/include/soc/arc/timers.h
+++ linux-next-20210917/include/soc/arc/timers.h
@@ -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
 
--- linux-next-20210917.orig/drivers/clocksource/arc_timer.c
+++ linux-next-20210917/drivers/clocksource/arc_timer.c
@@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(st
 
 	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(unsign
 	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
 	 *      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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] clocksource: arc_timer: eliminate redefined macro error
  2021-09-24  2:08 ` Randy Dunlap
@ 2021-09-24  2:49   ` Vineet Gupta
  -1 siblings, 0 replies; 6+ messages in thread
From: Vineet Gupta @ 2021-09-24  2:49 UTC (permalink / raw)
  To: Randy Dunlap, linux-kernel
  Cc: Vineet Gupta, linux-snps-arc, Daniel Lezcano, Thomas Gleixner,
	Shahab Vahedi



On 9/23/21 7:08 PM, Randy Dunlap wrote:
> 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: b26c2e3823ba ("ARC: breakout timer include code into separate header")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: linux-snps-arc@lists.infradead.org
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>

Acked-by: Vineet Gupta <vgupta@kernel.org>

Thx,
-Vineet

> ---
> v2: prefix both TIMER_CTRL_xx macros with ARC_ (suggested by
>      Shahab Vahedi <Shahab.Vahedi@synopsys.com>
>
>   drivers/clocksource/arc_timer.c |    6 +++---
>   include/soc/arc/timers.h        |    4 ++--
>   2 files changed, 5 insertions(+), 5 deletions(-)
>
> --- linux-next-20210917.orig/include/soc/arc/timers.h
> +++ linux-next-20210917/include/soc/arc/timers.h
> @@ -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
>   
> --- linux-next-20210917.orig/drivers/clocksource/arc_timer.c
> +++ linux-next-20210917/drivers/clocksource/arc_timer.c
> @@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(st
>   
>   	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(unsign
>   	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
>   	 *      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);
>   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] clocksource: arc_timer: eliminate redefined macro error
@ 2021-09-24  2:49   ` Vineet Gupta
  0 siblings, 0 replies; 6+ messages in thread
From: Vineet Gupta @ 2021-09-24  2:49 UTC (permalink / raw)
  To: Randy Dunlap, linux-kernel
  Cc: Vineet Gupta, linux-snps-arc, Daniel Lezcano, Thomas Gleixner,
	Shahab Vahedi



On 9/23/21 7:08 PM, Randy Dunlap wrote:
> 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: b26c2e3823ba ("ARC: breakout timer include code into separate header")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: linux-snps-arc@lists.infradead.org
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>

Acked-by: Vineet Gupta <vgupta@kernel.org>

Thx,
-Vineet

> ---
> v2: prefix both TIMER_CTRL_xx macros with ARC_ (suggested by
>      Shahab Vahedi <Shahab.Vahedi@synopsys.com>
>
>   drivers/clocksource/arc_timer.c |    6 +++---
>   include/soc/arc/timers.h        |    4 ++--
>   2 files changed, 5 insertions(+), 5 deletions(-)
>
> --- linux-next-20210917.orig/include/soc/arc/timers.h
> +++ linux-next-20210917/include/soc/arc/timers.h
> @@ -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
>   
> --- linux-next-20210917.orig/drivers/clocksource/arc_timer.c
> +++ linux-next-20210917/drivers/clocksource/arc_timer.c
> @@ -225,7 +225,7 @@ static int __init arc_cs_setup_timer1(st
>   
>   	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(unsign
>   	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
>   	 *      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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip: timers/core] clocksource/drivers/arc_timer: Eliminate redefined macro error
  2021-09-24  2:08 ` Randy Dunlap
@ 2021-10-24 15:40   ` tip-bot2 for Randy Dunlap
  -1 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Randy Dunlap @ 2021-10-24 15:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Randy Dunlap, Vineet Gupta, linux-snps-arc, Daniel Lezcano,
	Thomas Gleixner, Shahab Vahedi, x86, linux-kernel

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 <rdunlap@infradead.org>
AuthorDate:    Thu, 23 Sep 2021 19:08:25 -07:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
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 */

Fixes: b26c2e3823ba ("ARC: breakout timer include code into separate header")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
Acked-by: Vineet Gupta <vgupta@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210924020825.20317-1-rdunlap@infradead.org
---
 drivers/clocksource/arc_timer.c | 6 +++---
 include/soc/arc/timers.h        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/arc_timer.c b/drivers/clocksource/arc_timer.c
index de93dd1..cb18524 100644
--- a/drivers/clocksource/arc_timer.c
+++ b/drivers/clocksource/arc_timer.c
@@ -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);
 
diff --git a/include/soc/arc/timers.h b/include/soc/arc/timers.h
index 7ecde3b..ae99d3e 100644
--- a/include/soc/arc/timers.h
+++ b/include/soc/arc/timers.h
@@ -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
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [tip: timers/core] clocksource/drivers/arc_timer: Eliminate redefined macro error
@ 2021-10-24 15:40   ` tip-bot2 for Randy Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Randy Dunlap @ 2021-10-24 15:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Randy Dunlap, Vineet Gupta, linux-snps-arc, Daniel Lezcano,
	Thomas Gleixner, Shahab Vahedi, x86, linux-kernel

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 <rdunlap@infradead.org>
AuthorDate:    Thu, 23 Sep 2021 19:08:25 -07:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
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 */

Fixes: b26c2e3823ba ("ARC: breakout timer include code into separate header")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
Acked-by: Vineet Gupta <vgupta@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210924020825.20317-1-rdunlap@infradead.org
---
 drivers/clocksource/arc_timer.c | 6 +++---
 include/soc/arc/timers.h        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/arc_timer.c b/drivers/clocksource/arc_timer.c
index de93dd1..cb18524 100644
--- a/drivers/clocksource/arc_timer.c
+++ b/drivers/clocksource/arc_timer.c
@@ -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);
 
diff --git a/include/soc/arc/timers.h b/include/soc/arc/timers.h
index 7ecde3b..ae99d3e 100644
--- a/include/soc/arc/timers.h
+++ b/include/soc/arc/timers.h
@@ -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
 

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-25 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  2:08 [PATCH v2] clocksource: arc_timer: eliminate redefined macro error Randy Dunlap
2021-09-24  2:08 ` Randy Dunlap
2021-09-24  2:49 ` Vineet Gupta
2021-09-24  2:49   ` Vineet Gupta
2021-10-24 15:40 ` [tip: timers/core] clocksource/drivers/arc_timer: Eliminate " tip-bot2 for Randy Dunlap
2021-10-24 15:40   ` tip-bot2 for Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.