summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-06-01 06:23:47 +0000
committeralfred <alfred@FreeBSD.org>2002-06-01 06:23:47 +0000
commit0ef59d0f18e5853e3e5fa8f8efd2c8f6e5a3bc62 (patch)
treeb153ab77569ec3a1521fce07d9250e80666817fa /sys/dev
parent2af74b69ca9982132332430013dd2ab031186b52 (diff)
downloadFreeBSD-src-0ef59d0f18e5853e3e5fa8f8efd2c8f6e5a3bc62.zip
FreeBSD-src-0ef59d0f18e5853e3e5fa8f8efd2c8f6e5a3bc62.tar.gz
Call destroy_dev in detach routine to cleanup properly otherwise we
panic because of a repeat make_dev if/when the device is reattached to the system. Remove an "#if __FreeBSD__" in code that's nested under a "#if __NetBSD__" (*sigh*) Reported by: Seth Hettich <sjh@whiskey.ucf.ics.uci.edu> Tested by: Seth Hettich <sjh@whiskey.ucf.ics.uci.edu>
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/urio.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c
index 10049c1..9a90a1b 100644
--- a/sys/dev/usb/urio.c
+++ b/sys/dev/usb/urio.c
@@ -158,6 +158,9 @@ struct urio_softc {
int sc_epaddr[2];
int sc_refcnt;
+#if defined(__FreeBSD__)
+ dev_t sc_dev_t;
+#endif /* defined(__FreeBSD__) */
#if defined(__NetBSD__) || defined(__OpenBSD__)
u_char sc_dying;
#endif
@@ -272,7 +275,7 @@ USB_ATTACH(urio)
#if defined(__FreeBSD__)
#if (__FreeBSD__ >= 4)
/* XXX no error trapping, no storing of dev_t */
- (void) make_dev(&urio_cdevsw, device_get_unit(self),
+ sc->sc_dev_t = make_dev(&urio_cdevsw, device_get_unit(self),
UID_ROOT, GID_OPERATOR,
0644, "urio%d", device_get_unit(self));
#endif
@@ -672,8 +675,6 @@ USB_DETACH(urio)
/* Nuke the vnodes for any open instances (calls close). */
mn = self->dv_unit * USB_MAX_ENDPOINTS;
vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR);
-#elif defined(__FreeBSD__)
- /* XXX not implemented yet */
#endif
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
@@ -687,7 +688,11 @@ USB_DETACH(urio)
Static int
urio_detach(device_t self)
{
+ struct urio_softc *sc = device_get_softc(self);
+
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
+ destroy_dev(sc->sc_dev_t);
+ /* XXX not implemented yet */
device_set_desc(self, NULL);
return 0;
}
OpenPOWER on IntegriCloud