From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 4/3] ioapic: change pre_save/post_load methods to get/put Date: Tue, 30 Oct 2012 19:18:17 +0100 Message-ID: <509019E9.1080309@web.de> References: <1351599394-24876-1-git-send-email-pbonzini@redhat.com> <1351599394-24876-5-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCCE82D43B336A3F30FD66912" Cc: qemu-devel@nongnu.org, avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org To: Paolo Bonzini Return-path: Received: from mout.web.de ([212.227.15.3]:51111 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965317Ab2J3SSW (ORCPT ); Tue, 30 Oct 2012 14:18:22 -0400 In-Reply-To: <1351599394-24876-5-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCCE82D43B336A3F30FD66912 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2012-10-30 13:16, Paolo Bonzini wrote: > Similar to the APIC, add get/put methods that can be called from common= > IOAPIC code. Use them already for pre_save/post_load, since they are > exact replacements. Also here: I don't see a benefit and prefer the current style. Jan >=20 > Signed-off-by: Paolo Bonzini > --- > hw/ioapic_common.c | 40 +++++++++++++++++++++++++--------------- > hw/ioapic_internal.h | 4 ++-- > hw/kvm/ioapic.c | 4 ++-- > 3 files changed, 29 insertions(+), 19 deletions(-) >=20 > diff --git a/hw/ioapic_common.c b/hw/ioapic_common.c > index 653eef2..1f3ea37 100644 > --- a/hw/ioapic_common.c > +++ b/hw/ioapic_common.c > @@ -23,7 +23,25 @@ > #include "ioapic_internal.h" > #include "sysbus.h" > =20 > -void ioapic_reset_common(DeviceState *dev) > +static void ioapic_get(IOAPICCommonState *s) > +{ > + IOAPICCommonClass *info =3D IOAPIC_COMMON_GET_CLASS(s); > + > + if (info->get) { > + info->get(s); > + } > +} > + > +static void ioapic_put(IOAPICCommonState *s) > +{ > + IOAPICCommonClass *info =3D IOAPIC_COMMON_GET_CLASS(s); > + > + if (info->put) { > + info->put(s); > + } > +} > + > +static void ioapic_reset_common(DeviceState *dev) > { > IOAPICCommonState *s =3D IOAPIC_COMMON(dev); > int i; > @@ -36,24 +54,16 @@ void ioapic_reset_common(DeviceState *dev) > } > } > =20 > -static void ioapic_dispatch_pre_save(void *opaque) > +static void ioapic_pre_save(void *opaque) > { > IOAPICCommonState *s =3D IOAPIC_COMMON(opaque); > - IOAPICCommonClass *info =3D IOAPIC_COMMON_GET_CLASS(s); > - > - if (info->pre_save) { > - info->pre_save(s); > - } > + ioapic_get(s); > } > =20 > -static int ioapic_dispatch_post_load(void *opaque, int version_id) > +static int ioapic_post_load(void *opaque, int version_id) > { > IOAPICCommonState *s =3D IOAPIC_COMMON(opaque); > - IOAPICCommonClass *info =3D IOAPIC_COMMON_GET_CLASS(s); > - > - if (info->post_load) { > - info->post_load(s); > - } > + ioapic_put(s); > return 0; > } > =20 > @@ -81,8 +91,8 @@ static const VMStateDescription vmstate_ioapic_common= =3D { > .version_id =3D 3, > .minimum_version_id =3D 1, > .minimum_version_id_old =3D 1, > - .pre_save =3D ioapic_dispatch_pre_save, > - .post_load =3D ioapic_dispatch_post_load, > + .pre_save =3D ioapic_pre_save, > + .post_load =3D ioapic_post_load, > .fields =3D (VMStateField[]) { > VMSTATE_UINT8(id, IOAPICCommonState), > VMSTATE_UINT8(ioregsel, IOAPICCommonState), > diff --git a/hw/ioapic_internal.h b/hw/ioapic_internal.h > index e04c9f3..7311ad0 100644 > --- a/hw/ioapic_internal.h > +++ b/hw/ioapic_internal.h > @@ -84,8 +84,8 @@ typedef struct IOAPICCommonState IOAPICCommonState; > typedef struct IOAPICCommonClass { > SysBusDeviceClass parent_class; > void (*init)(IOAPICCommonState *s, int instance_no); > - void (*pre_save)(IOAPICCommonState *s); > - void (*post_load)(IOAPICCommonState *s); > + void (*get)(IOAPICCommonState *s); > + void (*put)(IOAPICCommonState *s); > } IOAPICCommonClass; > =20 > struct IOAPICCommonState { > diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c > index 6c3b8fe..03cb36c 100644 > --- a/hw/kvm/ioapic.c > +++ b/hw/kvm/ioapic.c > @@ -104,8 +104,8 @@ static void kvm_ioapic_class_init(ObjectClass *klas= s, void *data) > DeviceClass *dc =3D DEVICE_CLASS(klass); > =20 > k->init =3D kvm_ioapic_init; > - k->pre_save =3D kvm_ioapic_get; > - k->post_load =3D kvm_ioapic_put; > + k->get =3D kvm_ioapic_get; > + k->put =3D kvm_ioapic_put; > dc->reset =3D kvm_ioapic_reset; > dc->props =3D kvm_ioapic_properties; > } >=20 --------------enigCCE82D43B336A3F30FD66912 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlCQGekACgkQitSsb3rl5xTD2gCg1H7ECiCyWmeaYREuknX+gIe0 JdcAoItSCGHZ5yqDHp3D/Ap/CBhQPrP8 =S8oz -----END PGP SIGNATURE----- --------------enigCCE82D43B336A3F30FD66912--