hw/timer/bcm2835: Introduce BCM2835_SYSTIMER_COUNT definition
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sat, 10 Oct 2020 20:37:06 +0000 (22:37 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 20 Oct 2020 15:12:00 +0000 (16:12 +0100)
Use the BCM2835_SYSTIMER_COUNT definition instead of the
magic '4' value.

Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20201010203709.3116542-2-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/timer/bcm2835_systmr.c
include/hw/timer/bcm2835_systmr.h

index 3387a6214a2371392f930b93e872fe6568f76366..ff8c553661013d6529afeee1b8598a39afd4a1ab 100644 (file)
@@ -134,7 +134,8 @@ static const VMStateDescription bcm2835_systmr_vmstate = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(reg.status, BCM2835SystemTimerState),
-        VMSTATE_UINT32_ARRAY(reg.compare, BCM2835SystemTimerState, 4),
+        VMSTATE_UINT32_ARRAY(reg.compare, BCM2835SystemTimerState,
+                             BCM2835_SYSTIMER_COUNT),
         VMSTATE_END_OF_LIST()
     }
 };
index 7ce8f6ef4d8ac20f3776533f8585df3fbfdeedc1..43df7ee488c3e7db46e2d7aa2b7277f444364300 100644 (file)
@@ -16,6 +16,8 @@
 #define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
 OBJECT_DECLARE_SIMPLE_TYPE(BCM2835SystemTimerState, BCM2835_SYSTIMER)
 
+#define BCM2835_SYSTIMER_COUNT 4
+
 struct BCM2835SystemTimerState {
     /*< private >*/
     SysBusDevice parent_obj;
@@ -26,7 +28,7 @@ struct BCM2835SystemTimerState {
 
     struct {
         uint32_t status;
-        uint32_t compare[4];
+        uint32_t compare[BCM2835_SYSTIMER_COUNT];
     } reg;
 };