From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sd1Dp-0004sF-Jo for qemu-devel@nongnu.org; Fri, 08 Jun 2012 11:35:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sd1Dm-0005SG-UJ for qemu-devel@nongnu.org; Fri, 08 Jun 2012 11:35:33 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55356 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sd1Dm-0005Rx-Ka for qemu-devel@nongnu.org; Fri, 08 Jun 2012 11:35:30 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 8 Jun 2012 17:35:13 +0200 Message-Id: <1339169713-31205-9-git-send-email-afaerber@suse.de> In-Reply-To: <1339169713-31205-1-git-send-email-afaerber@suse.de> References: <1339169713-31205-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 8/8] 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: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori This simplifies the code and resolves TODOs. Signed-off-by: Andreas F=C3=A4rber Reviewed-by: Michael Roth --- 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