From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFl31-0001jT-TI for qemu-devel@nongnu.org; Sat, 31 Aug 2013 09:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFl2w-0006WX-S1 for qemu-devel@nongnu.org; Sat, 31 Aug 2013 09:17:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46151 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFl2w-0006WR-Ih for qemu-devel@nongnu.org; Sat, 31 Aug 2013 09:16:58 -0400 Message-ID: <5221ECC3.8080506@suse.de> Date: Sat, 31 Aug 2013 15:16:51 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1377927237-6092-1-git-send-email-antonynpavlov@gmail.com> <1377927237-6092-3-git-send-email-antonynpavlov@gmail.com> In-Reply-To: <1377927237-6092-3-git-send-email-antonynpavlov@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Antony Pavlov Cc: Peter Crosthwaite , Paolo Bonzini , Michael Walle , qemu-devel@nongnu.org, Anthony Liguori Am 31.08.2013 07:33, schrieb Antony Pavlov: > url=3D"http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg0474= 8.html"> > Use of SysBusDevice::init is deprecated. Please use > Device::realize instead of SysBusDevice::init. > Check dma/pl330.c for an example of the pattern. > >=20 > Signed-off-by: Antony Pavlov > CC: Peter Crosthwaite > CC: Michael Walle > --- > hw/char/milkymist-uart.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) Thanks for looking into this! Some small issues... Please replace the XML quote above with a proper textual description, such as "Use of SysBusDevice::init is deprecated, use Device::realize instead." You can add a line Reported-by: Peter Crosthwaite before your Sob to attribute that to him. (Subject is perfect, thanks.) > diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c > index 6e4bc20..66fba82 100644 > --- a/hw/char/milkymist-uart.c > +++ b/hw/char/milkymist-uart.c > @@ -195,22 +195,20 @@ static void milkymist_uart_reset(DeviceState *d) > s->regs[R_STAT] =3D STAT_THRE; > } > =20 > -static int milkymist_uart_init(SysBusDevice *dev) > +static void milkymist_uart_realize(DeviceState *dev, Error **errp) > { > MilkymistUartState *s =3D MILKYMIST_UART(dev); > =20 > - sysbus_init_irq(dev, &s->irq); > + sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); > =20 > 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); > + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->regs_region); Please avoid repeated casts by using a local sbd variable, ordered from most abstract to concrete. However, since s->irq and R_MAX don't seem to depend on user-settable properties, please move all of the above - sysbus_init_irq(), memory_region_init_io() and sysbus_init_mmio() - into a TypeInfo::instance_init function named milkymist_uart_init(Object *obj) above or below ..._realize. Otherwise patch looks good. Please CC me on v2 and I'll queue this one on the qom-next tree. Regards, Andreas > =20 > s->chr =3D qemu_char_get_next_serial(); > if (s->chr) { > qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event= , s); > } > - > - return 0; > } > =20 > static const VMStateDescription vmstate_milkymist_uart =3D { > @@ -227,9 +225,8 @@ static const VMStateDescription vmstate_milkymist_u= art =3D { > static void milkymist_uart_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc =3D DEVICE_CLASS(klass); > - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); > =20 > - k->init =3D milkymist_uart_init; > + dc->realize =3D milkymist_uart_realize; > dc->reset =3D milkymist_uart_reset; > dc->vmsd =3D &vmstate_milkymist_uart; > } --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg