diff mbox series

[01/13] hw/timer/allwinner: Use the AW_A10_PIT_TIMER_NR definition

Message ID 20191219185127.24388-2-f4bug@amsat.org
State New
Headers show
Series [01/13] hw/timer/allwinner: Use the AW_A10_PIT_TIMER_NR definition | expand

Commit Message

Philippe Mathieu-Daudé Dec. 19, 2019, 6:51 p.m. UTC
We have a definition for this magic value '6', use it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/timer/allwinner-a10-pit.h | 2 +-
 hw/timer/allwinner-a10-pit.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Niek Linnenbank Dec. 20, 2019, 9:19 p.m. UTC | #1
On Thu, Dec 19, 2019 at 7:51 PM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> We have a definition for this magic value '6', use it.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/timer/allwinner-a10-pit.h | 2 +-
>  hw/timer/allwinner-a10-pit.c         | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/hw/timer/allwinner-a10-pit.h
> b/include/hw/timer/allwinner-a10-pit.h
> index 871c95b512..6aceda81ee 100644
> --- a/include/hw/timer/allwinner-a10-pit.h
> +++ b/include/hw/timer/allwinner-a10-pit.h
> @@ -32,7 +32,7 @@
>
>  #define AW_A10_PIT_TIMER_BASE      0x10
>  #define AW_A10_PIT_TIMER_BASE_END  \
> -    (AW_A10_PIT_TIMER_BASE * 6 + AW_A10_PIT_TIMER_COUNT)
> +    (AW_A10_PIT_TIMER_BASE * AW_A10_PIT_TIMER_NR + AW_A10_PIT_TIMER_COUNT)
>
>  #define AW_A10_PIT_DEFAULT_CLOCK   0x4
>
> diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
> index aae880f5b3..117e5c7bf8 100644
> --- a/hw/timer/allwinner-a10-pit.c
> +++ b/hw/timer/allwinner-a10-pit.c
> @@ -225,7 +225,7 @@ static void a10_pit_reset(DeviceState *dev)
>      s->irq_status = 0;
>      a10_pit_update_irq(s);
>
> -    for (i = 0; i < 6; i++) {
> +    for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) {
>          s->control[i] = AW_A10_PIT_DEFAULT_CLOCK;
>          s->interval[i] = 0;
>          s->count[i] = 0;
> --
> 2.21.0
>
> Change looks fine to me:
  Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>

Works fine with -M orangepi-pc and -M cubieboard:
  Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
diff mbox series

Patch

diff --git a/include/hw/timer/allwinner-a10-pit.h b/include/hw/timer/allwinner-a10-pit.h
index 871c95b512..6aceda81ee 100644
--- a/include/hw/timer/allwinner-a10-pit.h
+++ b/include/hw/timer/allwinner-a10-pit.h
@@ -32,7 +32,7 @@ 
 
 #define AW_A10_PIT_TIMER_BASE      0x10
 #define AW_A10_PIT_TIMER_BASE_END  \
-    (AW_A10_PIT_TIMER_BASE * 6 + AW_A10_PIT_TIMER_COUNT)
+    (AW_A10_PIT_TIMER_BASE * AW_A10_PIT_TIMER_NR + AW_A10_PIT_TIMER_COUNT)
 
 #define AW_A10_PIT_DEFAULT_CLOCK   0x4
 
diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
index aae880f5b3..117e5c7bf8 100644
--- a/hw/timer/allwinner-a10-pit.c
+++ b/hw/timer/allwinner-a10-pit.c
@@ -225,7 +225,7 @@  static void a10_pit_reset(DeviceState *dev)
     s->irq_status = 0;
     a10_pit_update_irq(s);
 
-    for (i = 0; i < 6; i++) {
+    for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) {
         s->control[i] = AW_A10_PIT_DEFAULT_CLOCK;
         s->interval[i] = 0;
         s->count[i] = 0;