Skip to content

Commit

Permalink
vl: Eliminate usb_enabled()
Browse files Browse the repository at this point in the history
This wrapper for machine_usb(current_machine) is not necessary,
replace all usages of usb_enabled() with machine_usb().

Cc: Peter Maydell <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Alexander Graf <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-id: [email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
ehabkost authored and kraxel committed Jun 13, 2016
1 parent c92cfba commit 4bcbe0b
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion hw/arm/nseries.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion hw/arm/realview.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,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()) {
if (machine_usb(machine)) {
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
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static void versatile_init(MachineState *machine, int board_id)
pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);
}
}
if (usb_enabled()) {
if (machine_usb(machine)) {
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
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static void pc_init1(MachineState *machine,

pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);

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

Expand Down
2 changes: 1 addition & 1 deletion hw/i386/pc_q35.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,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()) {
if (machine_usb(machine)) {
/* 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_oldworld.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static void ppc_heathrow_init(MachineState *machine)
dev = qdev_create(adb_bus, TYPE_ADB_MOUSE);
qdev_init_nofail(dev);

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

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

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

Expand Down
1 change: 0 additions & 1 deletion include/sysemu/sysemu.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ void qemu_boot_set(const char *boot_order, Error **errp);
QemuOpts *qemu_get_machine_opts(void);

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

extern QemuOptsList qemu_legacy_drive_opts;
extern QemuOptsList qemu_common_drive_opts;
Expand Down
11 changes: 3 additions & 8 deletions vl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,11 +1072,6 @@ bool defaults_enabled(void)
return has_defaults;
}

bool usb_enabled(void)
{
return machine_usb(current_machine);
}

#ifndef _WIN32
static int parse_add_fd(void *opaque, QemuOpts *opts, Error **errp)
{
Expand Down Expand Up @@ -1393,7 +1388,7 @@ static int usb_device_add(const char *devname)
const char *p;
#endif

if (!usb_enabled()) {
if (!machine_usb(current_machine)) {
return -1;
}

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

if (!usb_enabled()) {
if (!machine_usb(current_machine)) {
return -1;
}

Expand Down Expand Up @@ -4501,7 +4496,7 @@ int main(int argc, char **argv, char **envp)
}

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

0 comments on commit 4bcbe0b

Please sign in to comment.