@@ -18,6 +18,8 @@ typedef struct BCM2835SystemTimerState BCM2835SystemTimerState;
DECLARE_INSTANCE_CHECKER(BCM2835SystemTimerState, BCM2835_SYSTIMER,
TYPE_BCM2835_SYSTIMER)
+#define BCM2835_SYSTIMER_COUNT 4
+
struct BCM2835SystemTimerState {
/*< private >*/
SysBusDevice parent_obj;
@@ -28,7 +30,7 @@ struct BCM2835SystemTimerState {
struct {
uint32_t status;
- uint32_t compare[4];
+ uint32_t compare[BCM2835_SYSTIMER_COUNT];
} reg;
};
@@ -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()
}
};
Use the BCM2835_SYSTIMER_COUNT definition instead of the magic '4' value. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- include/hw/timer/bcm2835_systmr.h | 4 +++- hw/timer/bcm2835_systmr.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)