From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAby8-000693-JI for qemu-devel@nongnu.org; Wed, 08 Jun 2016 07:48:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAby3-00053f-AK for qemu-devel@nongnu.org; Wed, 08 Jun 2016 07:48:19 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:39062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAby3-00053K-2G for qemu-devel@nongnu.org; Wed, 08 Jun 2016 07:48:15 -0400 Date: Wed, 8 Jun 2016 07:48:12 -0400 (EDT) From: Paolo Bonzini Message-ID: <2031741745.20794862.1465386492642.JavaMail.zimbra@redhat.com> In-Reply-To: <575800B5.10608@redhat.com> References: <1465318599-14137-1-git-send-email-ehabkost@redhat.com> <575800B5.10608@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vl: Eliminate usb_enabled() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: Eduardo Habkost , qemu-devel@nongnu.org, Andrzej Zaborowski , Peter Maydell , "Michael S. Tsirkin" , Alexander Graf ----- Original Message ----- > From: "Marcel Apfelbaum" > To: "Eduardo Habkost" , qemu-devel@nongnu.org > Cc: "Paolo Bonzini" , "Andrzej Zaborowski" , "Peter Maydell" > , "Michael S. Tsirkin" , "Alexander Graf" > Sent: Wednesday, June 8, 2016 1:25:41 PM > Subject: Re: [PATCH] vl: Eliminate usb_enabled() > > On 06/07/2016 07:56 PM, Eduardo Habkost wrote: > > This wrapper for machine_usb(current_machine) is not necessary, > > replace all usages of usb_enabled() with machine_usb(). > > > > Signed-off-by: Eduardo Habkost > > --- > > hw/arm/nseries.c | 2 +- > > hw/arm/pxa2xx.c | 7 +++++-- > > hw/arm/realview.c | 2 +- > > hw/arm/versatilepb.c | 2 +- > > hw/i386/pc_piix.c | 2 +- > > hw/i386/pc_q35.c | 2 +- > > hw/ppc/mac_oldworld.c | 2 +- > > hw/ppc/prep.c | 2 +- > > include/sysemu/sysemu.h | 1 - > > vl.c | 11 +++-------- > > 10 files changed, 15 insertions(+), 18 deletions(-) > > > > diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c > > index d4eb141..fea911e 100644 > > --- a/hw/arm/nseries.c > > +++ b/hw/arm/nseries.c > > @@ -1351,7 +1351,7 @@ static void n8x0_init(MachineState *machine, > > n8x0_dss_setup(s); > > n8x0_cbus_setup(s); > > n8x0_uart_setup(s); > > - if (usb_enabled()) { > > + if (machine_usb(machine)) { > > n8x0_usb_setup(s); > > } > > > > diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c > > index e41a7c9..6d8606d 100644 > > --- a/hw/arm/pxa2xx.c > > +++ b/hw/arm/pxa2xx.c > > @@ -13,6 +13,7 @@ > > #include "cpu.h" > > #include "hw/sysbus.h" > > #include "hw/arm/pxa.h" > > +#include "hw/boards.h" > > #include "sysemu/sysemu.h" > > #include "hw/char/serial.h" > > #include "hw/i2c/i2c.h" > > Hi Eduardo, > > > @@ -2062,6 +2063,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, > > int i; > > DriveInfo *dinfo; > > s = g_new0(PXA2xxState, 1); > > + MachineState *machine = MACHINE(qdev_get_machine()); > > > > All the callers of pxa270_init have a reference to the machine, > you can pass it as parameter IMO. Another possibility is to pass a "bool usb_enabled" argument. Paolo