From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXX5p-0005SN-6K for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:06:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXX5d-0002oO-9u for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:05:57 -0400 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:43509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXX5d-0002nP-1B for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:05:45 -0400 Received: by mail-wi0-f174.google.com with SMTP id hi2so1236254wib.1 for ; Fri, 26 Sep 2014 08:05:39 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <542580C0.5000905@redhat.com> Date: Fri, 26 Sep 2014 17:05:36 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1409344310-5441-1-git-send-email-ehabkost@redhat.com> <1409344310-5441-13-git-send-email-ehabkost@redhat.com> In-Reply-To: <1409344310-5441-13-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 12/17] accel: Move accel init/allowed code to separate function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Michael Mueller , "Michael S. Tsirkin" , Marcel Apfelbaum , Alexander Graf , Christian Borntraeger , "Jason J. Herne" , =?windows-1252?Q?Andreas_?= =?windows-1252?Q?F=E4rber?= Il 29/08/2014 22:31, Eduardo Habkost ha scritto: > Signed-off-by: Eduardo Habkost > --- > hw/core/accel.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/hw/core/accel.c b/hw/core/accel.c > index aeb779a..5817c3c 100644 > --- a/hw/core/accel.c > +++ b/hw/core/accel.c > @@ -57,6 +57,17 @@ static AccelClass *accel_find(const char *opt_name) > return ac; > } > > +static int accel_init(AccelClass *acc, MachineClass *mc) > +{ > + int ret; > + *(acc->allowed) = true; > + ret = acc->init(mc); > + if (ret < 0) { > + *(acc->allowed) = false; > + } > + return ret; > +} > + > int configure_accelerator(MachineClass *mc) > { > const char *p; > @@ -87,14 +98,12 @@ int configure_accelerator(MachineClass *mc) > acc->name); > continue; > } > - *(acc->allowed) = true; > - ret = acc->init(mc); > + ret = accel_init(acc, mc); > if (ret < 0) { > init_failed = true; > fprintf(stderr, "failed to initialize %s: %s\n", > acc->name, > strerror(-ret)); > - *(acc->allowed) = false; > } else { > accel_initialised = true; > } > Reviewed-by: Paolo Bonzini