From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agEL7-00008X-CJ for qemu-devel@nongnu.org; Wed, 16 Mar 2016 12:30:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agEL4-0003BD-Hj for qemu-devel@nongnu.org; Wed, 16 Mar 2016 12:30:29 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agEL4-0003B1-BJ for qemu-devel@nongnu.org; Wed, 16 Mar 2016 12:30:26 -0400 Received: by mail-wm0-x243.google.com with SMTP id l68so9470562wml.3 for ; Wed, 16 Mar 2016 09:30:26 -0700 (PDT) Sender: Paolo Bonzini References: <1458120244-30976-1-git-send-email-zxq_yx_007@163.com> <1458120244-30976-2-git-send-email-zxq_yx_007@163.com> From: Paolo Bonzini Message-ID: <56E98A20.9050100@redhat.com> Date: Wed, 16 Mar 2016 17:30:24 +0100 MIME-Version: 1.0 In-Reply-To: <1458120244-30976-2-git-send-email-zxq_yx_007@163.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/4] hw/audio: QOM'ify cs4231.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xiaoqiang zhao , qemu-devel@nongnu.org Cc: michael@walle.cc, kraxel@redhat.com, afaerber@suse.de On 16/03/2016 10:24, xiaoqiang zhao wrote: > Drop the old SysBus init function and use instance_init > > Signed-off-by: xiaoqiang zhao > --- > hw/audio/cs4231.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c > index caf97c1..30690f9 100644 > --- a/hw/audio/cs4231.c > +++ b/hw/audio/cs4231.c > @@ -145,16 +145,15 @@ static const VMStateDescription vmstate_cs4231 = { > } > }; > > -static int cs4231_init1(SysBusDevice *dev) > +static void cs4231_init(Object *obj) > { > - CSState *s = CS4231(dev); > + CSState *s = CS4231(obj); > + SysBusDevice *dev = SYS_BUS_DEVICE(obj); > > - memory_region_init_io(&s->iomem, OBJECT(s), &cs_mem_ops, s, "cs4321", > + memory_region_init_io(&s->iomem, obj, &cs_mem_ops, s, "cs4321", > CS_SIZE); > sysbus_init_mmio(dev, &s->iomem); > sysbus_init_irq(dev, &s->irq); > - > - return 0; > } > > static Property cs4231_properties[] = { > @@ -164,9 +163,7 @@ static Property cs4231_properties[] = { > static void cs4231_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > > - k->init = cs4231_init1; > dc->reset = cs_reset; > dc->vmsd = &vmstate_cs4231; > dc->props = cs4231_properties; > @@ -176,6 +173,7 @@ static const TypeInfo cs4231_info = { > .name = TYPE_CS4231, > .parent = TYPE_SYS_BUS_DEVICE, > .instance_size = sizeof(CSState), > + .instance_init = cs4231_init, > .class_init = cs4231_class_init, > }; > > Reviewed-by: Paolo Bonzini