qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vl: Eliminate usb_enabled()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] vl: Eliminate usb_enabled()
Date: Wed, 8 Jun 2016 07:48:12 -0400 (EDT)


----- Original Message -----
> From: "Marcel Apfelbaum" <address@hidden>
> To: "Eduardo Habkost" <address@hidden>, address@hidden
> Cc: "Paolo Bonzini" <address@hidden>, "Andrzej Zaborowski" <address@hidden>, 
> "Peter Maydell"
> <address@hidden>, "Michael S. Tsirkin" <address@hidden>, "Alexander Graf" 
> <address@hidden>
> 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 <address@hidden>
> > ---
> >   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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]