From eb2148e0fb4ced0a3ef8c66ce9ba86ba2e8e04e2 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 21 Jul 2011 16:43:48 -0300
Subject: [RHEL6 qemu-kvm PATCH 10/65] usb: Move (initial) call of usb_port_location to usb_fill_port

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1311266648-1179-11-git-send-email-kraxel@redhat.com>
Patchwork-id: 30128
O-Subject: [RHEL-6.2 kvm PATCH 10/30] usb: Move (initial) call of usb_port_location to usb_fill_port
Bugzilla: 723858 723863
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>

From: Hans de Goede <hdegoede@redhat.com>

Cleanup / preparation patch for companion controller support. Note that
as a "side-effect" this patch also fixes the milkymist-softusb controller
not having a port_location set for its ports.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 3631e6c8c263528ca159707b9255117a2c3bb175)
---
 hw/usb-bus.c  |    1 +
 hw/usb-ehci.c |    1 -
 hw/usb-musb.c |    1 -
 hw/usb-ohci.c |    1 -
 hw/usb-uhci.c |    1 -
 5 files changed, 1 insertions(+), 4 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/usb-bus.c  |    1 +
 hw/usb-ehci.c |    1 -
 hw/usb-musb.c |    1 -
 hw/usb-ohci.c |    1 -
 hw/usb-uhci.c |    1 -
 5 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 26af1a9..ad091c2 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -146,6 +146,7 @@ static void usb_fill_port(USBPort *port, void *opaque, int index,
     port->index = index;
     port->ops = ops;
     port->speedmask = speedmask;
+    usb_port_location(port, NULL, index + 1);
 }
 
 void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 3a9680a..bbb9fa0 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -2214,7 +2214,6 @@ static int usb_ehci_initfn(PCIDevice *dev)
     for(i = 0; i < NB_PORTS; i++) {
         usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops,
                           USB_SPEED_MASK_HIGH);
-        usb_port_location(&s->ports[i], NULL, i+1);
         s->ports[i].dev = 0;
     }
 
diff --git a/hw/usb-musb.c b/hw/usb-musb.c
index 8feec65..515f4d1 100644
--- a/hw/usb-musb.c
+++ b/hw/usb-musb.c
@@ -358,7 +358,6 @@ struct MUSBState *musb_init(qemu_irq *irqs)
     usb_bus_new(&s->bus, &musb_bus_ops, NULL /* FIXME */);
     usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,
                       USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
-    usb_port_location(&s->port, NULL, 1);
 
     return s;
 }
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 3f65d2c..45bd6ff 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1707,7 +1707,6 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
     for (i = 0; i < num_ports; i++) {
         usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, &ohci_port_ops,
                           USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
-        usb_port_location(&ohci->rhport[i].port, NULL, i+1);
     }
 
     ohci->async_td = 0;
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index c9a2ef5..fbd8271 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1088,7 +1088,6 @@ static int usb_uhci_common_initfn(UHCIState *s)
     for(i = 0; i < NB_PORTS; i++) {
         usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
                           USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
-        usb_port_location(&s->ports[i].port, NULL, i+1);
     }
     s->frame_timer = qemu_new_timer(vm_clock, uhci_frame_timer, s);
     s->num_ports_vmstate = NB_PORTS;
-- 
1.7.3.2