From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNgyY-0006VE-RG for qemu-devel@nongnu.org; Thu, 04 Apr 2013 06:01:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNgyT-0002Ek-KJ for qemu-devel@nongnu.org; Thu, 04 Apr 2013 06:00:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNgyT-0002E5-6Y for qemu-devel@nongnu.org; Thu, 04 Apr 2013 06:00:53 -0400 Date: Thu, 4 Apr 2013 11:59:55 +0200 From: Igor Mammedov Message-ID: <20130404115955.0993bc78@thinkpad.mammed.net> In-Reply-To: <515D41F9.8050107@suse.de> References: <1363876125-8264-1-git-send-email-imammedo@redhat.com> <1363876125-8264-7-git-send-email-imammedo@redhat.com> <515D41F9.8050107@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 06/12] target-i386: replace FROM_SYSBUS() with QOM type cast List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?UTF-8?B?RsOkcmJlcg==?= Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, yang.z.zhang@intel.com, ehabkost@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, stefano.stabellini@eu.citrix.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, aderumier@odiso.com, armbru@redhat.com, blauwirbel@gmail.com, quintela@redhat.com, alex.williamson@redhat.com, kraxel@redhat.com, anthony.perard@citrix.com, pbonzini@redhat.com, lcapitulino@redhat.com, rth@twiddle.net On Thu, 04 Apr 2013 11:03:53 +0200 Andreas F=C3=A4rber wrote: > Am 21.03.2013 15:28, schrieb Igor Mammedov: > > ... and define type name and type cast macro for kvmvapic according > > to accepted convention. > >=20 > > Signed-off-by: Igor Mammedov >=20 > This looks great and a cherry-pick candidate if you agree? Np, BTW I have a second similar clean-up in v2 for IOAPIC >=20 > Just wondering, was there a name conflict for shorter VAPIC()? > It's file-local, so doesn't really matter. Nope, I just followed *_DEVICE model like for SYS_BUS_DEVICE() >=20 > Andreas >=20 > > --- > > hw/i386/kvmvapic.c | 7 +++++-- > > 1 files changed, 5 insertions(+), 2 deletions(-) > >=20 > > diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c > > index c151c95..21551a5 100644 > > --- a/hw/i386/kvmvapic.c > > +++ b/hw/i386/kvmvapic.c > > @@ -62,6 +62,9 @@ typedef struct VAPICROMState { > > bool rom_mapped_writable; > > } VAPICROMState; > > =20 > > +#define TYPE_VAPIC_DEVICE "kvmvapic" > > +#define VAPIC_DEVICE(obj) OBJECT_CHECK(VAPICROMState, (obj), TYPE_VAPI= C_DEVICE) > > + > > #define TPR_INSTR_ABS_MODRM 0x1 > > #define TPR_INSTR_MATCH_MODRM_REG 0x2 > > =20 > > @@ -692,7 +695,7 @@ static const MemoryRegionOps vapic_ops =3D { > > =20 > > static int vapic_init(SysBusDevice *dev) > > { > > - VAPICROMState *s =3D FROM_SYSBUS(VAPICROMState, dev); > > + VAPICROMState *s =3D VAPIC_DEVICE(dev); > > =20 > > memory_region_init_io(&s->io, &vapic_ops, s, "kvmvapic", 2); > > sysbus_add_io(dev, VAPIC_IO_PORT, &s->io); > > @@ -808,7 +811,7 @@ static void vapic_class_init(ObjectClass *klass, vo= id *data) > > } > > =20 > > static const TypeInfo vapic_type =3D { > > - .name =3D "kvmvapic", > > + .name =3D TYPE_VAPIC_DEVICE, > > .parent =3D TYPE_SYS_BUS_DEVICE, > > .instance_size =3D sizeof(VAPICROMState), > > .class_init =3D vapic_class_init, > >=20 >=20 >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3= =BCrnberg >=20 --=20 Regards, Igor