aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-11-13 13:57:55 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-12-17 19:32:26 +0100
commit3c75e12ea64666f2fc9f822675490e8672f45453 (patch)
treec0b0a9e095782dd3014ac6544bd5e72e2fd38297 /accel
parent1fff3c206f320104e929b22e6b9e82fc6e4c2ae6 (diff)
downloadqemu-3c75e12ea64666f2fc9f822675490e8672f45453.zip
qemu-3c75e12ea64666f2fc9f822675490e8672f45453.tar.gz
qemu-3c75e12ea64666f2fc9f822675490e8672f45453.tar.bz2
qom: add object_new_with_class
Similar to CPU and machine classes, "-accel" class names are mangled, so we have to first get a class via accel_find and then instantiate it. Provide a new function to instantiate a class without going through object_class_get_name, and use it for CPUs and machines already. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'accel')
-rw-r--r--accel/accel.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/accel/accel.c b/accel/accel.c
index 60c3827..dd38a46 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -48,9 +48,7 @@ AccelClass *accel_find(const char *opt_name)
int accel_init_machine(AccelClass *acc, MachineState *ms)
{
- ObjectClass *oc = OBJECT_CLASS(acc);
- const char *cname = object_class_get_name(oc);
- AccelState *accel = ACCEL(object_new(cname));
+ AccelState *accel = ACCEL(object_new_with_class(OBJECT_CLASS(acc)));
int ret;
ms->accelerator = accel;
*(acc->allowed) = true;