* [Qemu-devel] [PATCH v2 0/2] Eliminate usb_enabled()
@ 2016-06-08 20:50 Eduardo Habkost
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 1/2] pxa2xx: Unconditionally enable USB controller Eduardo Habkost
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Eduardo Habkost @ 2016-06-08 20:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Marcel Apfelbaum
usb_enabled() is just a wrapper for machine_usb(current_machine)
and is not necessary, replace all usages of usb_enabled() with
machine_usb().
In the case of pxa2xx, just remove usb_enabled() usage
completely.
Eduardo Habkost (2):
pxa2xx: Unconditionally enable USB controller
vl: Eliminate usb_enabled()
hw/arm/nseries.c | 2 +-
hw/arm/pxa2xx.c | 12 ++++--------
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, 14 insertions(+), 24 deletions(-)
--
2.5.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] pxa2xx: Unconditionally enable USB controller
2016-06-08 20:50 [Qemu-devel] [PATCH v2 0/2] Eliminate usb_enabled() Eduardo Habkost
@ 2016-06-08 20:50 ` Eduardo Habkost
2016-06-09 16:21 ` Peter Maydell
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled() Eduardo Habkost
2016-06-13 11:21 ` [Qemu-devel] [PATCH v2 0/2] " Gerd Hoffmann
2 siblings, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2016-06-08 20:50 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Marcel Apfelbaum, Peter Maydell,
Andrzej Zaborowski, qemu-arm
Simplify initialization logic by removing the usb_enabled()
check. The USB controller is part of the SoC, so it doesn't make
sense to create a system where it is not present.
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: qemu-arm@nongnu.org,
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/arm/pxa2xx.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index e41a7c9..cb55704 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -2165,10 +2165,8 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
}
- if (usb_enabled()) {
- sysbus_create_simple("sysbus-ohci", 0x4c000000,
- qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
- }
+ sysbus_create_simple("sysbus-ohci", 0x4c000000,
+ qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000);
s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000);
@@ -2298,10 +2296,8 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
}
- if (usb_enabled()) {
- sysbus_create_simple("sysbus-ohci", 0x4c000000,
- qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
- }
+ sysbus_create_simple("sysbus-ohci", 0x4c000000,
+ qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000);
s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000);
--
2.5.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled()
2016-06-08 20:50 [Qemu-devel] [PATCH v2 0/2] Eliminate usb_enabled() Eduardo Habkost
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 1/2] pxa2xx: Unconditionally enable USB controller Eduardo Habkost
@ 2016-06-08 20:50 ` Eduardo Habkost
2016-06-09 5:58 ` Marcel Apfelbaum
2016-06-09 6:43 ` Thomas Huth
2016-06-13 11:21 ` [Qemu-devel] [PATCH v2 0/2] " Gerd Hoffmann
2 siblings, 2 replies; 7+ messages in thread
From: Eduardo Habkost @ 2016-06-08 20:50 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Marcel Apfelbaum, Peter Maydell,
Michael S. Tsirkin, Alexander Graf, qemu-arm, qemu-ppc
This wrapper for machine_usb(current_machine) is not necessary,
replace all usages of usb_enabled() with machine_usb().
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-arm@nongnu.org
Cc: qemu-ppc@nongnu.org
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* pxa2xx doesn't have a usb_enabled() check anymore
---
hw/arm/nseries.c | 2 +-
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 +++--------
9 files changed, 10 insertions(+), 16 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/realview.c b/hw/arm/realview.c
index 7d0aa6f..8eafcca 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -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);
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 20dd356..8ae5392 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -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);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 14dd0cc..82c7c0a 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -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");
}
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04aae89..31a6a59 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -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);
}
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index a9bb1c2..4479487 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -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");
}
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 07ffe72..054af1e 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -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");
}
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 9428141..7313673 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -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;
diff --git a/vl.c b/vl.c
index b0bcc25..45eff56 100644
--- a/vl.c
+++ b/vl.c
@@ -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)
{
@@ -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;
}
@@ -1425,7 +1420,7 @@ static int usb_device_del(const char *devname)
return -1;
}
- if (!usb_enabled()) {
+ if (!machine_usb(current_machine)) {
return -1;
}
@@ -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);
}
--
2.5.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled()
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled() Eduardo Habkost
@ 2016-06-09 5:58 ` Marcel Apfelbaum
2016-06-09 6:43 ` Thomas Huth
1 sibling, 0 replies; 7+ messages in thread
From: Marcel Apfelbaum @ 2016-06-09 5:58 UTC (permalink / raw)
To: Eduardo Habkost, qemu-devel
Cc: Paolo Bonzini, Peter Maydell, Michael S. Tsirkin, Alexander Graf,
qemu-arm, qemu-ppc
On 06/08/2016 11:50 PM, Eduardo Habkost wrote:
> This wrapper for machine_usb(current_machine) is not necessary,
> replace all usages of usb_enabled() with machine_usb().
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
> * pxa2xx doesn't have a usb_enabled() check anymore
> ---
> hw/arm/nseries.c | 2 +-
> 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 +++--------
> 9 files changed, 10 insertions(+), 16 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/realview.c b/hw/arm/realview.c
> index 7d0aa6f..8eafcca 100644
> --- a/hw/arm/realview.c
> +++ b/hw/arm/realview.c
> @@ -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);
> diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
> index 20dd356..8ae5392 100644
> --- a/hw/arm/versatilepb.c
> +++ b/hw/arm/versatilepb.c
> @@ -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);
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 14dd0cc..82c7c0a 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -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");
> }
>
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 04aae89..31a6a59 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -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);
> }
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index a9bb1c2..4479487 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -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");
> }
>
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index 07ffe72..054af1e 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -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");
> }
>
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 9428141..7313673 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -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;
> diff --git a/vl.c b/vl.c
> index b0bcc25..45eff56 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -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)
> {
> @@ -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;
> }
>
> @@ -1425,7 +1420,7 @@ static int usb_device_del(const char *devname)
> return -1;
> }
>
> - if (!usb_enabled()) {
> + if (!machine_usb(current_machine)) {
> return -1;
> }
>
> @@ -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);
> }
>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Thanks,
Marcel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled()
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled() Eduardo Habkost
2016-06-09 5:58 ` Marcel Apfelbaum
@ 2016-06-09 6:43 ` Thomas Huth
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2016-06-09 6:43 UTC (permalink / raw)
To: Eduardo Habkost, qemu-devel
Cc: Peter Maydell, Michael S. Tsirkin, Alexander Graf, qemu-arm,
qemu-ppc, Marcel Apfelbaum, Paolo Bonzini
On 08.06.2016 22:50, Eduardo Habkost wrote:
> This wrapper for machine_usb(current_machine) is not necessary,
> replace all usages of usb_enabled() with machine_usb().
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
> * pxa2xx doesn't have a usb_enabled() check anymore
> ---
> hw/arm/nseries.c | 2 +-
> 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 +++--------
> 9 files changed, 10 insertions(+), 16 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/realview.c b/hw/arm/realview.c
> index 7d0aa6f..8eafcca 100644
> --- a/hw/arm/realview.c
> +++ b/hw/arm/realview.c
> @@ -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);
> diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
> index 20dd356..8ae5392 100644
> --- a/hw/arm/versatilepb.c
> +++ b/hw/arm/versatilepb.c
> @@ -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);
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 14dd0cc..82c7c0a 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -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");
> }
>
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 04aae89..31a6a59 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -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);
> }
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index a9bb1c2..4479487 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -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");
> }
>
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index 07ffe72..054af1e 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -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");
> }
>
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 9428141..7313673 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -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;
> diff --git a/vl.c b/vl.c
> index b0bcc25..45eff56 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -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)
> {
> @@ -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;
> }
>
> @@ -1425,7 +1420,7 @@ static int usb_device_del(const char *devname)
> return -1;
> }
>
> - if (!usb_enabled()) {
> + if (!machine_usb(current_machine)) {
> return -1;
> }
>
> @@ -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);
> }
>
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] pxa2xx: Unconditionally enable USB controller
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 1/2] pxa2xx: Unconditionally enable USB controller Eduardo Habkost
@ 2016-06-09 16:21 ` Peter Maydell
0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2016-06-09 16:21 UTC (permalink / raw)
To: Eduardo Habkost
Cc: QEMU Developers, Paolo Bonzini, Marcel Apfelbaum,
Andrzej Zaborowski, qemu-arm
On 8 June 2016 at 21:50, Eduardo Habkost <ehabkost@redhat.com> wrote:
> Simplify initialization logic by removing the usb_enabled()
> check. The USB controller is part of the SoC, so it doesn't make
> sense to create a system where it is not present.
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Andrzej Zaborowski <balrogg@gmail.com>
> Cc: qemu-arm@nongnu.org,
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] Eliminate usb_enabled()
2016-06-08 20:50 [Qemu-devel] [PATCH v2 0/2] Eliminate usb_enabled() Eduardo Habkost
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 1/2] pxa2xx: Unconditionally enable USB controller Eduardo Habkost
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled() Eduardo Habkost
@ 2016-06-13 11:21 ` Gerd Hoffmann
2 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2016-06-13 11:21 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: qemu-devel, Marcel Apfelbaum, Paolo Bonzini
On Mi, 2016-06-08 at 17:50 -0300, Eduardo Habkost wrote:
> usb_enabled() is just a wrapper for machine_usb(current_machine)
> and is not necessary, replace all usages of usb_enabled() with
> machine_usb().
>
> In the case of pxa2xx, just remove usb_enabled() usage
> completely.
>
> Eduardo Habkost (2):
> pxa2xx: Unconditionally enable USB controller
> vl: Eliminate usb_enabled()
Added to usb patch queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-06-13 11:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08 20:50 [Qemu-devel] [PATCH v2 0/2] Eliminate usb_enabled() Eduardo Habkost
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 1/2] pxa2xx: Unconditionally enable USB controller Eduardo Habkost
2016-06-09 16:21 ` Peter Maydell
2016-06-08 20:50 ` [Qemu-devel] [PATCH v2 2/2] vl: Eliminate usb_enabled() Eduardo Habkost
2016-06-09 5:58 ` Marcel Apfelbaum
2016-06-09 6:43 ` Thomas Huth
2016-06-13 11:21 ` [Qemu-devel] [PATCH v2 0/2] " Gerd Hoffmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.