diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-07-12 22:52:17 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-07-18 19:28:45 +0100 |
commit | 3d5e0995cef7722144e89f4623b7a513f92af068 (patch) | |
tree | 07e31a21f95bf4bbccb32eec3f9cfd59c2db0f16 /hw/input | |
parent | 0a3c1e1bf883afa5cd9df102742f087030b49c80 (diff) |
pl050: move logic from pl050_realize() to pl050_init()
The logic for initialising the register memory region and the sysbus output IRQ
does not depend upon any device properties and so can be moved from
pl050_realize() to pl050_init().
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Helge Deller <deller@gmx.de>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220712215251.7944-7-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/input')
-rw-r--r-- | hw/input/pl050.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 88459997e0..e32d86005a 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -152,11 +152,7 @@ static const MemoryRegionOps pl050_ops = { static void pl050_realize(DeviceState *dev, Error **errp) { PL050State *s = PL050(dev); - SysBusDevice *sbd = SYS_BUS_DEVICE(dev); - memory_region_init_io(&s->iomem, OBJECT(s), &pl050_ops, s, "pl050", 0x1000); - sysbus_init_mmio(sbd, &s->iomem); - sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { s->ps2dev = ps2_mouse_init(); } else { @@ -197,6 +193,13 @@ static const TypeInfo pl050_mouse_info = { static void pl050_init(Object *obj) { + PL050State *s = PL050(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + + memory_region_init_io(&s->iomem, obj, &pl050_ops, s, "pl050", 0x1000); + sysbus_init_mmio(sbd, &s->iomem); + sysbus_init_irq(sbd, &s->irq); + qdev_init_gpio_in_named(DEVICE(obj), pl050_set_irq, "ps2-input-irq", 1); } |