Received: from eggs.gnu.org ([208.118.235.92]:46264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScOF0-0003Bo-7e for qemu-devel@nongnu.org; Wed, 06 Jun 2012 17:58:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ScOEx-000746-Ol for qemu-devel@nongnu.org; Wed, 06 Jun 2012 17:58:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49625 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScOEx-00073c-FK for qemu-devel@nongnu.org; Wed, 06 Jun 2012 17:58:07 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 6 Jun 2012 23:57:54 +0200 Message-Id: <1339019874-18996-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-next] target-i386: Use uint32 visitor for [x]level properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: ehabkost@redhat.com, mdroth@linux.vnet.ibm.com, anthony@codemonkey.ws, imammedo@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= This simplifies the code and resolves TODOs. Signed-off-by: Andreas F=C3=A4rber --- Seems I only submitted this as an attachment once... Can someone please review tomorrow so that I can include it in the PULL? Thanks! target-i386/cpu.c | 42 ++++-------------------------------------- 1 files changed, 4 insertions(+), 38 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 388bc5c..0b61162 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -723,66 +723,32 @@ static void x86_cpuid_get_level(Object *obj, Visito= r *v, void *opaque, const char *name, Error **errp) { X86CPU *cpu =3D X86_CPU(obj); - int64_t value; =20 - value =3D cpu->env.cpuid_level; - /* TODO Use visit_type_uint32() once available */ - visit_type_int(v, &value, name, errp); + visit_type_uint32(v, &cpu->env.cpuid_level, name, errp); } =20 static void x86_cpuid_set_level(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { X86CPU *cpu =3D X86_CPU(obj); - const int64_t min =3D 0; - const int64_t max =3D UINT32_MAX; - int64_t value; - - /* TODO Use visit_type_uint32() once available */ - visit_type_int(v, &value, name, errp); - if (error_is_set(errp)) { - return; - } - if (value < min || value > max) { - error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "", - name ? name : "null", value, min, max); - return; - } =20 - cpu->env.cpuid_level =3D value; + visit_type_uint32(v, &cpu->env.cpuid_level, name, errp); } =20 static void x86_cpuid_get_xlevel(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { X86CPU *cpu =3D X86_CPU(obj); - int64_t value; =20 - value =3D cpu->env.cpuid_xlevel; - /* TODO Use visit_type_uint32() once available */ - visit_type_int(v, &value, name, errp); + visit_type_uint32(v, &cpu->env.cpuid_xlevel, name, errp); } =20 static void x86_cpuid_set_xlevel(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { X86CPU *cpu =3D X86_CPU(obj); - const int64_t min =3D 0; - const int64_t max =3D UINT32_MAX; - int64_t value; - - /* TODO Use visit_type_uint32() once available */ - visit_type_int(v, &value, name, errp); - if (error_is_set(errp)) { - return; - } - if (value < min || value > max) { - error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "", - name ? name : "null", value, min, max); - return; - } =20 - cpu->env.cpuid_xlevel =3D value; + visit_type_uint32(v, &cpu->env.cpuid_xlevel, name, errp); } =20 static char *x86_cpuid_get_vendor(Object *obj, Error **errp) --=20 1.7.7