libpayload: Detach devices behind removed USB hubs
When a USB hub got removed, we should also remove all devices that were attached to it. Change-Id: I73c0da1b7570f1af9726925ca222781b3d752557 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/1903 Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
ef88e102bb
commit
b2db28babe
|
@ -53,6 +53,17 @@ typedef struct {
|
|||
static void
|
||||
usb_hub_destroy (usbdev_t *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* First, detach all devices behind this hub. */
|
||||
int *const ports = HUB_INST (dev)->ports;
|
||||
for (i = 1; i <= HUB_INST (dev)->num_ports; i++) {
|
||||
if (ports[i] != -1) {
|
||||
usb_detach_device(dev->controller, ports[i]);
|
||||
ports[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
free (HUB_INST (dev)->ports);
|
||||
free (HUB_INST (dev)->descriptor);
|
||||
free (HUB_INST (dev));
|
||||
|
|
Loading…
Reference in New Issue