From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrguF-00050y-Is for qemu-devel@nongnu.org; Sun, 29 Jan 2012 21:23:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrguE-0002FW-Jn for qemu-devel@nongnu.org; Sun, 29 Jan 2012 21:23:43 -0500 Received: from mail-tul01m020-f173.google.com ([209.85.214.173]:58976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrguE-0002FS-FX for qemu-devel@nongnu.org; Sun, 29 Jan 2012 21:23:42 -0500 Received: by obbup16 with SMTP id up16so4123685obb.4 for ; Sun, 29 Jan 2012 18:23:42 -0800 (PST) Message-ID: <4F25FF2B.2050600@codemonkey.ws> Date: Sun, 29 Jan 2012 20:23:39 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1327843531-32403-1-git-send-email-afaerber@suse.de> <1327881028-9775-1-git-send-email-afaerber@suse.de> In-Reply-To: <1327881028-9775-1-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH RFC 8/7] target-arm: Use IoC for CPU init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: qemu-devel@nongnu.org On 01/29/2012 05:50 PM, Andreas Färber wrote: > Instead of having each CPU's class_init function call its parent's > function, indirect this through arm_cpu_class_init(). > > Signed-off-by: Andreas Färber > --- > target-arm/cpu-core.c | 10 +++++++++- > 1 files changed, 9 insertions(+), 1 deletions(-) > > diff --git a/target-arm/cpu-core.c b/target-arm/cpu-core.c > index b1ac22c..cdd049e 100644 > --- a/target-arm/cpu-core.c > +++ b/target-arm/cpu-core.c > @@ -246,6 +246,13 @@ static void arm_cpu_realize(Object *obj) > cpu->env.cp15.c0_cpuid = cpu_class->id; > } > > +static void arm_cpu_class_init(ObjectClass *klass, void *data) > +{ > + const struct ARMCPUDef *d = data; > + > + (*d->class_init)(klass, NULL); > +} > + > static void cpu_register(const struct ARMCPUDef *def) > { > TypeInfo type = { > @@ -254,7 +261,8 @@ static void cpu_register(const struct ARMCPUDef *def) > .instance_size = sizeof(ARMCPU), > .instance_init = arm_cpu_realize, > .class_size = sizeof(ARMCPUClass), > - .class_init = def->class_init, > + .class_init = arm_cpu_class_init, > + .class_data = (void *)def, Would be better IMHO to embed the data needed by class_init in class_data. That way we're not going through multiple method tables. Regards, Anthony Liguori > }; > > type_register_static(&type);