From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5ELS-0000SW-HV for qemu-devel@nongnu.org; Fri, 02 Aug 2013 08:20:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5ELM-0006mR-Do for qemu-devel@nongnu.org; Fri, 02 Aug 2013 08:20:34 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44899 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5ELM-0006m6-5c for qemu-devel@nongnu.org; Fri, 02 Aug 2013 08:20:28 -0400 Message-ID: <51FBA408.4080409@suse.de> Date: Fri, 02 Aug 2013 14:20:24 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1375427079-16822-1-git-send-email-hutao@cn.fujitsu.com> <1375427079-16822-2-git-send-email-hutao@cn.fujitsu.com> In-Reply-To: <1375427079-16822-2-git-send-email-hutao@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-1.6 2/2] pvpanic: make pvpanic known to user List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: qemu-devel@nongnu.org Am 02.08.2013 09:04, schrieb Hu Tao: > Thus user can create pvpanic by -device. >=20 > Signed-off-by: Hu Tao > --- > hw/misc/pvpanic.c | 23 ++++++++--------------- > include/hw/i386/pc.h | 3 --- > 2 files changed, 8 insertions(+), 18 deletions(-) >=20 > diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c > index 7bb49a5..6e4c53e 100644 > --- a/hw/misc/pvpanic.c > +++ b/hw/misc/pvpanic.c > @@ -93,14 +93,6 @@ static void pvpanic_isa_initfn(Object *obj) > memory_region_init_io(&s->io, OBJECT(s), &pvpanic_ops, s, "pvpanic= ", 1); > } > =20 > -static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) > -{ > - ISADevice *d =3D ISA_DEVICE(dev); > - PVPanicState *s =3D ISA_PVPANIC_DEVICE(dev); > - > - isa_register_ioport(d, &s->io, s->ioport); > -} > - > static void pvpanic_fw_cfg(ISADevice *dev, FWCfgState *fw_cfg) > { > PVPanicState *s =3D ISA_PVPANIC_DEVICE(dev); > @@ -111,15 +103,16 @@ static void pvpanic_fw_cfg(ISADevice *dev, FWCfgS= tate *fw_cfg) > sizeof(*pvpanic_port)); > } > =20 > -void pvpanic_init(ISABus *bus) > +static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) > { > - ISADevice *dev; > + ISADevice *d =3D ISA_DEVICE(dev); > + PVPanicState *s =3D ISA_PVPANIC_DEVICE(dev); > FWCfgState *fw_cfg =3D fw_cfg_find(); > - if (!fw_cfg) { > - return; > + > + isa_register_ioport(d, &s->io, s->ioport); > + if (fw_cfg) { > + pvpanic_fw_cfg(d, fw_cfg); > } > - dev =3D isa_create_simple (bus, TYPE_ISA_PVPANIC_DEVICE); > - pvpanic_fw_cfg(dev, fw_cfg); > } Doing this in-place above might've been a bit easier to read. ;) The only thing fw_cfg does at realize time is registering its I/O ports, the /machine/fw_cfg path is set up in fw_cfg_init() helper function before, so there are no potential realize ordering problems here. > =20 > static Property pvpanic_isa_properties[] =3D { > @@ -132,8 +125,8 @@ static void pvpanic_isa_class_init(ObjectClass *kla= ss, void *data) > DeviceClass *dc =3D DEVICE_CLASS(klass); > =20 > dc->realize =3D pvpanic_isa_realizefn; > - dc->no_user =3D 1; > dc->props =3D pvpanic_isa_properties; > + dc->bus_type =3D TYPE_ISA_BUS; This is already done in hw/isa/isa-bus.c:isa_device_class_init(), please drop if we go with this. Regards, Andreas > } > =20 > static TypeInfo pvpanic_isa_info =3D { > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index 3a0c4e3..e54751c 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -202,9 +202,6 @@ static inline bool isa_ne2000_init(ISABus *bus, int= base, int irq, NICInfo *nd) > /* pc_sysfw.c */ > void pc_system_firmware_init(MemoryRegion *rom_memory); > =20 > -/* pvpanic.c */ > -void pvpanic_init(ISABus *bus); > - > /* e820 types */ > #define E820_RAM 1 > #define E820_RESERVED 2 >=20 --=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