Skip to content

Commit

Permalink
hw/ssi/pl022: Set up reset function in class init
Browse files Browse the repository at this point in the history
Currently the PL022 calls pl022_reset() from its class init
function. Make it register a DeviceState reset method instead,
so that we reset the device on system reset.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180820141116.9118-17-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
pm215 committed Aug 24, 2018
1 parent 1d52866 commit 66d9aa7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hw/ssi/pl022.c
Expand Up @@ -203,8 +203,10 @@ static void pl022_write(void *opaque, hwaddr offset,
}
}

static void pl022_reset(PL022State *s)
static void pl022_reset(DeviceState *dev)
{
PL022State *s = PL022(dev);

s->rx_fifo_len = 0;
s->tx_fifo_len = 0;
s->im = 0;
Expand Down Expand Up @@ -277,16 +279,17 @@ static int pl022_init(SysBusDevice *sbd)
sysbus_init_mmio(sbd, &s->iomem);
sysbus_init_irq(sbd, &s->irq);
s->ssi = ssi_create_bus(dev, "ssi");
pl022_reset(s);
vmstate_register(dev, -1, &vmstate_pl022, s);
return 0;
}

static void pl022_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);

sdc->init = pl022_init;
dc->reset = pl022_reset;
}

static const TypeInfo pl022_info = {
Expand Down

0 comments on commit 66d9aa7

Please sign in to comment.