pmu: fix duplicate autopoll mask variable

It seems that during the initial work to introduce the via-pmu ADB support a
duplicate autopoll mask variable was accidentally left in place.

Remove the duplicate autopoll_mask variable and switch everything over to
use adb_poll_mask instead.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200623204936.24064-5-mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland 2020-06-23 21:49:18 +01:00
parent d9b898943d
commit dcb091c40e
2 changed files with 7 additions and 9 deletions

View File

@ -175,11 +175,11 @@ static void pmu_cmd_set_adb_autopoll(PMUState *s, uint16_t mask)
{ {
trace_pmu_cmd_set_adb_autopoll(mask); trace_pmu_cmd_set_adb_autopoll(mask);
if (s->autopoll_mask == mask) { if (s->adb_poll_mask == mask) {
return; return;
} }
s->autopoll_mask = mask; s->adb_poll_mask = mask;
if (mask) { if (mask) {
timer_mod(s->adb_poll_timer, timer_mod(s->adb_poll_timer,
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 30); qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 30);
@ -274,9 +274,9 @@ static void pmu_cmd_adb_poll_off(PMUState *s,
return; return;
} }
if (s->has_adb && s->autopoll_mask) { if (s->has_adb && s->adb_poll_mask) {
timer_del(s->adb_poll_timer); timer_del(s->adb_poll_timer);
s->autopoll_mask = false; s->adb_poll_mask = 0;
} }
} }
@ -698,8 +698,8 @@ static const VMStateDescription vmstate_pmu_adb = {
static const VMStateDescription vmstate_pmu = { static const VMStateDescription vmstate_pmu = {
.name = "pmu", .name = "pmu",
.version_id = 0, .version_id = 1,
.minimum_version_id = 0, .minimum_version_id = 1,
.fields = (VMStateField[]) { .fields = (VMStateField[]) {
VMSTATE_STRUCT(mos6522_pmu.parent_obj, PMUState, 0, vmstate_mos6522, VMSTATE_STRUCT(mos6522_pmu.parent_obj, PMUState, 0, vmstate_mos6522,
MOS6522State), MOS6522State),
@ -715,7 +715,6 @@ static const VMStateDescription vmstate_pmu = {
VMSTATE_UINT8(intbits, PMUState), VMSTATE_UINT8(intbits, PMUState),
VMSTATE_UINT8(intmask, PMUState), VMSTATE_UINT8(intmask, PMUState),
VMSTATE_UINT8(autopoll_rate_ms, PMUState), VMSTATE_UINT8(autopoll_rate_ms, PMUState),
VMSTATE_UINT8(autopoll_mask, PMUState),
VMSTATE_UINT32(tick_offset, PMUState), VMSTATE_UINT32(tick_offset, PMUState),
VMSTATE_TIMER_PTR(one_sec_timer, PMUState), VMSTATE_TIMER_PTR(one_sec_timer, PMUState),
VMSTATE_INT64(one_sec_target, PMUState), VMSTATE_INT64(one_sec_target, PMUState),
@ -735,7 +734,7 @@ static void pmu_reset(DeviceState *dev)
s->intbits = 0; s->intbits = 0;
s->cmd_state = pmu_state_idle; s->cmd_state = pmu_state_idle;
s->autopoll_mask = 0; s->adb_poll_mask = 0;
} }
static void pmu_realize(DeviceState *dev, Error **errp) static void pmu_realize(DeviceState *dev, Error **errp)

View File

@ -220,7 +220,6 @@ typedef struct PMUState {
ADBBusState adb_bus; ADBBusState adb_bus;
uint16_t adb_poll_mask; uint16_t adb_poll_mask;
uint8_t autopoll_rate_ms; uint8_t autopoll_rate_ms;
uint8_t autopoll_mask;
QEMUTimer *adb_poll_timer; QEMUTimer *adb_poll_timer;
uint8_t adb_reply_size; uint8_t adb_reply_size;
uint8_t adb_reply[ADB_MAX_OUT_LEN]; uint8_t adb_reply[ADB_MAX_OUT_LEN];