* [Qemu-devel] [PATCH qom-next] target-i386: Use uint32 visitor for [x]level properties
@ 2012-06-06 21:57 Andreas Färber
2012-06-06 23:28 ` Michael Roth
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Färber @ 2012-06-06 21:57 UTC (permalink / raw)
To: qemu-devel
Cc: ehabkost, mdroth, anthony, imammedo, pbonzini, Andreas Färber
This simplifies the code and resolves TODOs.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH qom-next] target-i386: Use uint32 visitor for [x]level properties
2012-06-06 21:57 [Qemu-devel] [PATCH qom-next] target-i386: Use uint32 visitor for [x]level properties Andreas Färber
@ 2012-06-06 23:28 ` Michael Roth
0 siblings, 0 replies; 2+ messages in thread
From: Michael Roth @ 2012-06-06 23:28 UTC (permalink / raw)
To: Andreas Färber; +Cc: pbonzini, ehabkost, qemu-devel, anthony, imammedo
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 <afaerber@suse.de>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-06 23:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06 21:57 [Qemu-devel] [PATCH qom-next] target-i386: Use uint32 visitor for [x]level properties Andreas Färber
2012-06-06 23:28 ` Michael Roth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.