Module Name: src
Committed By: jmcneill
Date: Sun May 29 12:37:09 UTC 2011
Modified Files:
src/sys/dev/usb: uhub.c
Log Message:
When a child device is detached and no interfaces are claimed by drivers,
free the port's subdevice list. This allows for detaching a driver from
a USB device and loading a different one without disconnecting the device.
To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/uhub.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.112 src/sys/dev/usb/uhub.c:1.113
--- src/sys/dev/usb/uhub.c:1.112 Wed Nov 3 22:59:40 2010
+++ src/sys/dev/usb/uhub.c Sun May 29 12:37:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.112 2010/11/03 22:59:40 dyoung Exp $ */
+/* $NetBSD: uhub.c,v 1.113 2011/05/29 12:37:09 jmcneill Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.112 2010/11/03 22:59:40 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.113 2011/05/29 12:37:09 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -663,6 +663,11 @@
dev->nifaces_claimed--;
}
}
+ if (dev->nifaces_claimed == 0) {
+ free(dev->subdevs, M_USB);
+ dev->subdevs = NULL;
+ dev->subdevlen = 0;
+ }
}
}