From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNOzz-0007N2-Jo for qemu-devel@nongnu.org; Tue, 11 Mar 2014 11:53:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNOzn-00022r-4D for qemu-devel@nongnu.org; Tue, 11 Mar 2014 11:53:47 -0400 Received: from mail-ea0-x22d.google.com ([2a00:1450:4013:c01::22d]:65432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNOzm-00022d-Sy for qemu-devel@nongnu.org; Tue, 11 Mar 2014 11:53:35 -0400 Received: by mail-ea0-f173.google.com with SMTP id r15so4348425ead.18 for ; Tue, 11 Mar 2014 08:53:33 -0700 (PDT) Message-ID: <1394553226.3981.58.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Tue, 11 Mar 2014 17:53:46 +0200 In-Reply-To: <1394552156-18901-2-git-send-email-marcel.a@redhat.com> References: <1394552156-18901-1-git-send-email-marcel.a@redhat.com> <1394552156-18901-2-git-send-email-marcel.a@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] hw/machine: move QEMUMachine assignment into the core machine Reply-To: marcel.a@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, ehabkost@redhat.com, mst@redhat.com, stefanha@redhat.com, armbru@redhat.com, aliguori@amazon.com, pbonzini@redhat.com, lersek@redhat.com, afaerber@suse.de On Tue, 2014-03-11 at 17:35 +0200, Marcel Apfelbaum wrote: > The QemuMachine assignment into the QOM machine it is common > to all machines until the conversion is over. It is not > specific to vl.c . This also helps with the conversion of the machines to QOM: No need to register the machines with 'machine_init()'. Thanks, Marcel > > Signed-off-by: Marcel Apfelbaum > --- > hw/core/machine.c | 8 ++++++++ > vl.c | 8 -------- > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/hw/core/machine.c b/hw/core/machine.c > index d3ffef7..4b49a7d 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -12,12 +12,20 @@ > > #include "hw/boards.h" > > +static void machine_base_class_init(ObjectClass *oc, void *data) > +{ > + MachineClass *mc = MACHINE_CLASS(oc); > + > + mc->qemu_machine = data; > +} > + > static const TypeInfo machine_info = { > .name = TYPE_MACHINE, > .parent = TYPE_OBJECT, > .abstract = true, > .class_size = sizeof(MachineClass), > .instance_size = sizeof(MachineState), > + .class_base_init = machine_base_class_init, > }; > > static void machine_register_types(void) > diff --git a/vl.c b/vl.c > index d75ca55..6a380d9 100644 > --- a/vl.c > +++ b/vl.c > @@ -1531,19 +1531,11 @@ void pcmcia_info(Monitor *mon, const QDict *qdict) > > MachineState *current_machine; > > -static void machine_class_init(ObjectClass *oc, void *data) > -{ > - MachineClass *mc = MACHINE_CLASS(oc); > - > - mc->qemu_machine = data; > -} > - > int qemu_register_machine(QEMUMachine *m) > { > TypeInfo ti = { > .name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL), > .parent = TYPE_MACHINE, > - .class_init = machine_class_init, > .class_data = (void *)m, > }; I'll remove the casting to void* here, thanks Eric! Marcel >