From c32ecfaaac759c0cd1f263083b3c63e17bdf54bd Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 27 Mar 2012 08:27:29 +0200
Subject: [PATCH 2/3] ehci: fix ehci_child_detach

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1332836849-29065-1-git-send-email-kraxel@redhat.com>
Patchwork-id: 38999
O-Subject: [RHEL-6.3 qemu-kvm PATCH] ehci: fix ehci_child_detach
Bugzilla: 769760
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

Looks like a cut+paste bug from ehci_detach.  When the device itself is
detached from a ehci port (ehci_detach op) we have to clear the
device pointer for the companion port too.  When a device gets removed
from a downstream port of a usb hub (ehci_child_detach op) the ehci port
where the usb hub is plugged in is not affected.

bugzilla: #769760 - Formatting of usb-storage disk attached on usb-hub
                    fails to end
upstream: http://patchwork.ozlabs.org/patch/148734/

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-ehci.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Signed-off-by: Michal Novotny <mignov@gmail.com>
---
 hw/usb-ehci.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 131bad2..59f8a53 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -786,7 +786,6 @@ static void ehci_child_detach(USBPort *port, USBDevice *child)
     if (portsc & PORTSC_POWNER) {
         USBPort *companion = s->companion_ports[port->index];
         companion->ops->child_detach(companion, child);
-        companion->dev = NULL;
         return;
     }
 
-- 
1.7.7.6

