Skip to content

Commit

Permalink
hw/usb: simplified usb_enabled
Browse files Browse the repository at this point in the history
The argument is not longer used and the implementation
uses now QOM instead of QemuOpts.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
marcel-apf authored and agraf committed Jan 7, 2015
1 parent 759bf45 commit 09f28e5
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion hw/arm/nseries.c
Expand Up @@ -1344,7 +1344,7 @@ static void n8x0_init(MachineState *machine,
n8x0_dss_setup(s);
n8x0_cbus_setup(s);
n8x0_uart_setup(s);
if (usb_enabled(false)) {
if (usb_enabled()) {
n8x0_usb_setup(s);
}

Expand Down
4 changes: 2 additions & 2 deletions hw/arm/pxa2xx.c
Expand Up @@ -2143,7 +2143,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
}

if (usb_enabled(false)) {
if (usb_enabled()) {
sysbus_create_simple("sysbus-ohci", 0x4c000000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
}
Expand Down Expand Up @@ -2276,7 +2276,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
}

if (usb_enabled(false)) {
if (usb_enabled()) {
sysbus_create_simple("sysbus-ohci", 0x4c000000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
}
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/realview.c
Expand Up @@ -261,7 +261,7 @@ static void realview_init(MachineState *machine,
sysbus_connect_irq(busdev, 2, pic[50]);
sysbus_connect_irq(busdev, 3, pic[51]);
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
if (usb_enabled(false)) {
if (usb_enabled()) {
pci_create_simple(pci_bus, -1, "pci-ohci");
}
n = drive_get_max_bus(IF_SCSI);
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/versatilepb.c
Expand Up @@ -281,7 +281,7 @@ static void versatile_init(MachineState *machine, int board_id)
pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);
}
}
if (usb_enabled(false)) {
if (usb_enabled()) {
pci_create_simple(pci_bus, -1, "pci-ohci");
}
n = drive_get_max_bus(IF_SCSI);
Expand Down
2 changes: 1 addition & 1 deletion hw/i386/pc_piix.c
Expand Up @@ -274,7 +274,7 @@ static void pc_init1(MachineState *machine,
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, machine->boot_order,
machine, floppy, idebus[0], idebus[1], rtc_state);

if (pci_enabled && usb_enabled(false)) {
if (pci_enabled && usb_enabled()) {
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
}

Expand Down
2 changes: 1 addition & 1 deletion hw/i386/pc_q35.c
Expand Up @@ -265,7 +265,7 @@ static void pc_q35_init(MachineState *machine)
ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);
ahci_ide_create_devs(ahci, hd);

if (usb_enabled(false)) {
if (usb_enabled()) {
/* Should we create 6 UHCI according to ich9 spec? */
ehci_create_ich9_with_companions(host_bus, 0x1d);
}
Expand Down
2 changes: 1 addition & 1 deletion hw/ppc/mac_newworld.c
Expand Up @@ -418,7 +418,7 @@ static void ppc_core99_init(MachineState *machine)
qdev_init_nofail(dev);

if ((machine_arch == ARCH_MAC99_U3 && defaults_enabled()) ||
usb_enabled(false)) {
usb_enabled()) {
pci_create_simple(pci_bus, -1, "pci-ohci");
/* U3 needs to use USB for input because Linux doesn't support via-cuda
on PPC64 */
Expand Down
2 changes: 1 addition & 1 deletion hw/ppc/mac_oldworld.c
Expand Up @@ -304,7 +304,7 @@ static void ppc_heathrow_init(MachineState *machine)
dev = qdev_create(adb_bus, TYPE_ADB_MOUSE);
qdev_init_nofail(dev);

if (usb_enabled(false)) {
if (usb_enabled()) {
pci_create_simple(pci_bus, -1, "pci-ohci");
}

Expand Down
2 changes: 1 addition & 1 deletion hw/ppc/prep.c
Expand Up @@ -539,7 +539,7 @@ static void ppc_prep_init(MachineState *machine)
memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr);
#endif

if (usb_enabled(false)) {
if (usb_enabled()) {
pci_create_simple(pci_bus, -1, "pci-ohci");
}

Expand Down
2 changes: 1 addition & 1 deletion hw/ppc/spapr.c
Expand Up @@ -1530,7 +1530,7 @@ static void ppc_spapr_init(MachineState *machine)
spapr->has_graphics = true;
}

if ((spapr->has_graphics && defaults_enabled()) || usb_enabled(false)) {
if ((spapr->has_graphics && defaults_enabled()) || usb_enabled()) {
pci_create_simple(phb->bus, -1, "pci-ohci");
if (spapr->has_graphics) {
usbdevice_create("keyboard");
Expand Down
2 changes: 1 addition & 1 deletion include/sysemu/sysemu.h
Expand Up @@ -228,7 +228,7 @@ void qemu_boot_set(const char *boot_order, Error **errp);
QemuOpts *qemu_get_machine_opts(void);

bool defaults_enabled(void);
bool usb_enabled(bool default_usb);
bool usb_enabled(void);

extern QemuOptsList qemu_legacy_drive_opts;
extern QemuOptsList qemu_common_drive_opts;
Expand Down
11 changes: 5 additions & 6 deletions vl.c
Expand Up @@ -1002,10 +1002,9 @@ bool defaults_enabled(void)
return has_defaults;
}

bool usb_enabled(bool default_usb)
bool usb_enabled(void)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
default_usb);
return machine_usb(current_machine);
}

#ifndef _WIN32
Expand Down Expand Up @@ -1229,7 +1228,7 @@ static int usb_device_add(const char *devname)
const char *p;
#endif

if (!usb_enabled(false)) {
if (!usb_enabled()) {
return -1;
}

Expand Down Expand Up @@ -1261,7 +1260,7 @@ static int usb_device_del(const char *devname)
return -1;
}

if (!usb_enabled(false)) {
if (!usb_enabled()) {
return -1;
}

Expand Down Expand Up @@ -4230,7 +4229,7 @@ int main(int argc, char **argv, char **envp)
set_numa_modes();

/* init USB devices */
if (usb_enabled(false)) {
if (usb_enabled()) {
if (foreach_device_config(DEV_USB, usb_parse) < 0)
exit(1);
}
Expand Down

0 comments on commit 09f28e5

Please sign in to comment.