From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayaPB-00017m-J7 for qemu-devel@nongnu.org; Fri, 06 May 2016 03:42:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayaOz-0003wX-Q3 for qemu-devel@nongnu.org; Fri, 06 May 2016 03:42:28 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34592) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayaOy-0003qC-Fn for qemu-devel@nongnu.org; Fri, 06 May 2016 03:42:21 -0400 Received: by mail-wm0-x234.google.com with SMTP id v200so7441152wmv.1 for ; Fri, 06 May 2016 00:42:05 -0700 (PDT) Date: Fri, 6 May 2016 09:42:00 +0200 From: "Edgar E. Iglesias" Message-ID: <20160506074200.GE16305@toto> References: <1458206430-21917-1-git-send-email-zxq_yx_007@163.com> <1458206430-21917-3-git-send-email-zxq_yx_007@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458206430-21917-3-git-send-email-zxq_yx_007@163.com> Subject: Re: [Qemu-devel] [PATCH 2/6] hw/char: QOM'ify etraxfs_ser.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xiaoqiang zhao Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, michael@walle.cc, cornelia.huck@de.ibm.com, agraf@suse.de On Thu, Mar 17, 2016 at 05:20:26PM +0800, xiaoqiang zhao wrote: > Drop the old SysBus init function and use instance_init > > Signed-off-by: xiaoqiang zhao Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias > --- > hw/char/etraxfs_ser.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c > index 146b387..ede7024 100644 > --- a/hw/char/etraxfs_ser.c > +++ b/hw/char/etraxfs_ser.c > @@ -209,12 +209,13 @@ static void etraxfs_ser_reset(DeviceState *d) > > } > > -static int etraxfs_ser_init(SysBusDevice *dev) > +static void etraxfs_ser_init(Object *obj) > { > - ETRAXSerial *s = ETRAX_SERIAL(dev); > + ETRAXSerial *s = ETRAX_SERIAL(obj); > + SysBusDevice *dev = SYS_BUS_DEVICE(obj); > > sysbus_init_irq(dev, &s->irq); > - memory_region_init_io(&s->mmio, OBJECT(s), &ser_ops, s, > + memory_region_init_io(&s->mmio, obj, &ser_ops, s, > "etraxfs-serial", R_MAX * 4); > sysbus_init_mmio(dev, &s->mmio); > > @@ -225,15 +226,12 @@ static int etraxfs_ser_init(SysBusDevice *dev) > serial_can_receive, serial_receive, > serial_event, s); > } > - return 0; > } > > static void etraxfs_ser_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > > - k->init = etraxfs_ser_init; > dc->reset = etraxfs_ser_reset; > /* Reason: init() method uses qemu_char_get_next_serial() */ > dc->cannot_instantiate_with_device_add_yet = true; > @@ -243,6 +241,7 @@ static const TypeInfo etraxfs_ser_info = { > .name = TYPE_ETRAX_FS_SERIAL, > .parent = TYPE_SYS_BUS_DEVICE, > .instance_size = sizeof(ETRAXSerial), > + .instance_init = etraxfs_ser_init, > .class_init = etraxfs_ser_class_init, > }; > > -- > 2.1.4 > >