Message ID | 1409344310-5441-5-git-send-email-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
Il 29/08/2014 22:31, Eduardo Habkost ha scritto: > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/core/accel.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/hw/core/accel.c b/hw/core/accel.c > index c23c04b..00a71c0 100644 > --- a/hw/core/accel.c > +++ b/hw/core/accel.c > @@ -62,6 +62,7 @@ int configure_accelerator(MachineClass *mc) > int i, ret; > bool accel_initialised = false; > bool init_failed = false; > + AccelType *acc = NULL; > > p = qemu_opt_get(qemu_get_machine_opts(), "accel"); > if (p == NULL) { > @@ -75,20 +76,21 @@ int configure_accelerator(MachineClass *mc) > } > p = get_opt_name(buf, sizeof(buf), p, ':'); > for (i = 0; i < ARRAY_SIZE(accel_list); i++) { > - if (strcmp(accel_list[i].opt_name, buf) == 0) { > - if (!accel_list[i].available()) { > + acc = &accel_list[i]; > + if (strcmp(acc->opt_name, buf) == 0) { > + if (!acc->available()) { > printf("%s not supported for this target\n", > - accel_list[i].name); > + acc->name); > break; > } > - *(accel_list[i].allowed) = true; > - ret = accel_list[i].init(mc); > + *(acc->allowed) = true; > + ret = acc->init(mc); > if (ret < 0) { > init_failed = true; > fprintf(stderr, "failed to initialize %s: %s\n", > - accel_list[i].name, > + acc->name, > strerror(-ret)); > - *(accel_list[i].allowed) = false; > + *(acc->allowed) = false; > } else { > accel_initialised = true; > } > @@ -108,7 +110,7 @@ int configure_accelerator(MachineClass *mc) > } > > if (init_failed) { > - fprintf(stderr, "Back to %s accelerator.\n", accel_list[i].name); > + fprintf(stderr, "Back to %s accelerator.\n", acc->name); > } > > return !accel_initialised; > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/hw/core/accel.c b/hw/core/accel.c index c23c04b..00a71c0 100644 --- a/hw/core/accel.c +++ b/hw/core/accel.c @@ -62,6 +62,7 @@ int configure_accelerator(MachineClass *mc) int i, ret; bool accel_initialised = false; bool init_failed = false; + AccelType *acc = NULL; p = qemu_opt_get(qemu_get_machine_opts(), "accel"); if (p == NULL) { @@ -75,20 +76,21 @@ int configure_accelerator(MachineClass *mc) } p = get_opt_name(buf, sizeof(buf), p, ':'); for (i = 0; i < ARRAY_SIZE(accel_list); i++) { - if (strcmp(accel_list[i].opt_name, buf) == 0) { - if (!accel_list[i].available()) { + acc = &accel_list[i]; + if (strcmp(acc->opt_name, buf) == 0) { + if (!acc->available()) { printf("%s not supported for this target\n", - accel_list[i].name); + acc->name); break; } - *(accel_list[i].allowed) = true; - ret = accel_list[i].init(mc); + *(acc->allowed) = true; + ret = acc->init(mc); if (ret < 0) { init_failed = true; fprintf(stderr, "failed to initialize %s: %s\n", - accel_list[i].name, + acc->name, strerror(-ret)); - *(accel_list[i].allowed) = false; + *(acc->allowed) = false; } else { accel_initialised = true; } @@ -108,7 +110,7 @@ int configure_accelerator(MachineClass *mc) } if (init_failed) { - fprintf(stderr, "Back to %s accelerator.\n", accel_list[i].name); + fprintf(stderr, "Back to %s accelerator.\n", acc->name); } return !accel_initialised;
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- hw/core/accel.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)