[Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
Use of SysBusDevice::init is deprecated. Use Device::realize instead of SysBusDevice::init. Check dma/pl330.c for an example of the pattern. Also introduce TypeInfo::instance_init milkymist_uart_init() as char/pl011.c does. Reported-by: Peter Crosthwaite Signed-off-by: Antony Pavlov CC: Peter Crosthwaite CC: Michael Walle CC: Andreas Färber --- hw/char/milkymist-uart.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index 6e4bc20..da51f82 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -195,22 +195,26 @@ static void milkymist_uart_reset(DeviceState *d) s->regs[R_STAT] = STAT_THRE; } -static int milkymist_uart_init(SysBusDevice *dev) +static void milkymist_uart_realize(DeviceState *dev, Error **errp) { MilkymistUartState *s = MILKYMIST_UART(dev); -sysbus_init_irq(dev, &s->irq); - -memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s, - "milkymist-uart", R_MAX * 4); -sysbus_init_mmio(dev, &s->regs_region); - s->chr = qemu_char_get_next_serial(); if (s->chr) { qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s); } +} -return 0; +static void milkymist_uart_init(Object *obj) +{ +SysBusDevice *sbd = SYS_BUS_DEVICE(obj); +MilkymistUartState *s = MILKYMIST_UART(obj); + +sysbus_init_irq(sbd, &s->irq); + +memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s, + "milkymist-uart", R_MAX * 4); +sysbus_init_mmio(sbd, &s->regs_region); } static const VMStateDescription vmstate_milkymist_uart = { @@ -227,9 +231,8 @@ static const VMStateDescription vmstate_milkymist_uart = { static void milkymist_uart_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); -SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); -k->init = milkymist_uart_init; +dc->realize = milkymist_uart_realize; dc->reset = milkymist_uart_reset; dc->vmsd = &vmstate_milkymist_uart; } @@ -238,6 +241,7 @@ static const TypeInfo milkymist_uart_info = { .name = TYPE_MILKYMIST_UART, .parent= TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MilkymistUartState), +.instance_init = milkymist_uart_init, .class_init= milkymist_uart_class_init, }; -- 1.8.4.rc3
Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
Am 31.08.2013 19:22, schrieb Antony Pavlov: > Use of SysBusDevice::init is deprecated. > Use Device::realize instead of SysBusDevice::init. > Check dma/pl330.c for an example of the pattern. > > Also introduce TypeInfo::instance_init milkymist_uart_init() > as char/pl011.c does. > > Reported-by: Peter Crosthwaite > Signed-off-by: Antony Pavlov > CC: Peter Crosthwaite > CC: Michael Walle > CC: Andreas Färber > --- > hw/char/milkymist-uart.c | 24 ++-- > 1 file changed, 14 insertions(+), 10 deletions(-) Thanks, applied to qom-next (with shortened commit message): https://github.com/afaerber/qemu-cpu/commits/qom-next Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
On Sat, 31 Aug 2013 21:09:20 +0200 Andreas Färber wrote: > Am 31.08.2013 19:22, schrieb Antony Pavlov: > > Use of SysBusDevice::init is deprecated. > > Use Device::realize instead of SysBusDevice::init. > > Check dma/pl330.c for an example of the pattern. > > > > Also introduce TypeInfo::instance_init milkymist_uart_init() > > as char/pl011.c does. > > > > Reported-by: Peter Crosthwaite > > Signed-off-by: Antony Pavlov > > CC: Peter Crosthwaite > > CC: Michael Walle > > CC: Andreas Färber > > --- > > hw/char/milkymist-uart.c | 24 ++-- > > 1 file changed, 14 insertions(+), 10 deletions(-) > > Thanks, applied to qom-next (with shortened commit message): > https://github.com/afaerber/qemu-cpu/commits/qom-next > That's about the patch number 1 ( milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()) ? -- Best regards, Antony Pavlov
Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
On Sun, Sep 1, 2013 at 3:22 AM, Antony Pavlov wrote: > Use of SysBusDevice::init is deprecated. > Use Device::realize instead of SysBusDevice::init. > Check dma/pl330.c for an example of the pattern. > I think Andreas may have fixed in enqueue, but informal suggestion of change patterns arent really suitable for commit messages. So drop sentances like this one. Regards, Peter
Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
Am 01.09.2013 20:28, schrieb Antony Pavlov: > On Sat, 31 Aug 2013 21:09:20 +0200 > Andreas Färber wrote: > >> Am 31.08.2013 19:22, schrieb Antony Pavlov: >>> Use of SysBusDevice::init is deprecated. >>> Use Device::realize instead of SysBusDevice::init. >>> Check dma/pl330.c for an example of the pattern. >>> >>> Also introduce TypeInfo::instance_init milkymist_uart_init() >>> as char/pl011.c does. >>> >>> Reported-by: Peter Crosthwaite >>> Signed-off-by: Antony Pavlov >>> CC: Peter Crosthwaite >>> CC: Michael Walle >>> CC: Andreas Färber >>> --- >>> hw/char/milkymist-uart.c | 24 ++-- >>> 1 file changed, 14 insertions(+), 10 deletions(-) >> >> Thanks, applied to qom-next (with shortened commit message): >> https://github.com/afaerber/qemu-cpu/commits/qom-next >> > > That's about the patch number 1 ( milkymist-uart: use qemu_chr_fe_write_all() > instead of qemu_chr_fe_write()) ? No, it's about patch 2, which I replied to. Patch 1 is not a QOM conversion but an unrelated bug fix - it can be handled either by the lm32 maintainer or by whomever takes care of the char layer these days (Anthony/Gerd). Regards, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg