From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScPeN-0000Xq-Sx for qemu-devel@nongnu.org; Wed, 06 Jun 2012 19:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ScPeM-00087u-0j for qemu-devel@nongnu.org; Wed, 06 Jun 2012 19:28:27 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:53326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScPeL-00087o-Q2 for qemu-devel@nongnu.org; Wed, 06 Jun 2012 19:28:25 -0400 Received: by ghrr14 with SMTP id r14so6468858ghr.4 for ; Wed, 06 Jun 2012 16:28:23 -0700 (PDT) Sender: fluxion Date: Wed, 6 Jun 2012 18:28:18 -0500 From: Michael Roth Message-ID: <20120606232818.GT2916@illuin> References: <1339019874-18996-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1339019874-18996-1-git-send-email-afaerber@suse.de> Subject: Re: [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: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: pbonzini@redhat.com, ehabkost@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws, imammedo@redhat.com On Wed, Jun 06, 2012 at 11:57:54PM +0200, Andreas Färber wrote: > This simplifies the code and resolves TODOs. > > Signed-off-by: Andreas Färber Reviewed-by: Michael Roth > --- > 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, Visitor *v, void *opaque, > const char *name, Error **errp) > { > X86CPU *cpu = X86_CPU(obj); > - int64_t value; > > - value = 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); > } > > static void x86_cpuid_set_level(Object *obj, Visitor *v, void *opaque, > const char *name, Error **errp) > { > X86CPU *cpu = X86_CPU(obj); > - const int64_t min = 0; > - const int64_t max = 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; > - } > > - cpu->env.cpuid_level = value; > + visit_type_uint32(v, &cpu->env.cpuid_level, name, errp); > } > > static void x86_cpuid_get_xlevel(Object *obj, Visitor *v, void *opaque, > const char *name, Error **errp) > { > X86CPU *cpu = X86_CPU(obj); > - int64_t value; > > - value = 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); > } > > static void x86_cpuid_set_xlevel(Object *obj, Visitor *v, void *opaque, > const char *name, Error **errp) > { > X86CPU *cpu = X86_CPU(obj); > - const int64_t min = 0; > - const int64_t max = 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; > - } > > - cpu->env.cpuid_xlevel = value; > + visit_type_uint32(v, &cpu->env.cpuid_xlevel, name, errp); > } > > static char *x86_cpuid_get_vendor(Object *obj, Error **errp) > -- > 1.7.7 >