From ed692400eba222d9abc1884e9bb7746c9bc71437 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 28 Sep 2003 20:48:13 +0000 Subject: [PATCH] I don't know from where the notion that device driver should or even could call VOP_REVOKE() on vnodes associated with its dev_t's has originated, but it stops right here. If there are things people belive destroy_dev() needs to learn how to do, please tell me about it, preferably with a reproducible test case. Include in bluetooth code rather than rely on to do so. The fact that some of the USB code needs to include still disturbs me greatly, but I do not have time to chase that. --- sys/dev/nmdm/nmdm.c | 4 ++-- sys/dev/usb/ugen.c | 8 -------- sys/dev/usb/uhid.c | 6 ------ sys/dev/usb/ulpt.c | 10 ---------- sys/dev/usb/ums.c | 5 ----- sys/dev/usb/uscanner.c | 4 ---- sys/net/if.c | 2 +- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 15 +-------------- .../bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 16 +--------------- 9 files changed, 5 insertions(+), 65 deletions(-) diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index a899176b4e4..1511e9b2c98 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -604,8 +604,8 @@ nmdmshutdown(void) nextdev2 = makedev(CDEV_MAJOR, (i+i) + 1); ptr1 = nextdev1->si_drv1; if (ptr1) { - revoke_and_destroy_dev(nextdev1); - revoke_and_destroy_dev(nextdev2); + destroy_dev(nextdev1); + destroy_dev(nextdev2); free(ptr1, M_NLMDM); } else { freedev(nextdev1); diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index b056d2f1040..6232918c547 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -273,7 +273,6 @@ ugen_destroy_devnodes(struct ugen_softc *sc) { int endptno; dev_t dev; - struct vnode *vp; /* destroy all devices for the other (existing) endpoints as well */ for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) { @@ -289,9 +288,6 @@ ugen_destroy_devnodes(struct ugen_softc *sc) */ dev = makedev(UGEN_CDEV_MAJOR, UGENMINOR(USBDEVUNIT(sc->sc_dev), endptno)); - vp = SLIST_FIRST(&dev->si_hlist); - if (vp) - VOP_REVOKE(vp, REVOKEALL); destroy_dev(dev); } @@ -860,7 +856,6 @@ USB_DETACH(ugen) int maj, mn; #elif defined(__FreeBSD__) dev_t dev; - struct vnode *vp; #endif #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -901,9 +896,6 @@ USB_DETACH(ugen) #elif defined(__FreeBSD__) /* destroy the device for the control endpoint */ dev = makedev(UGEN_CDEV_MAJOR, UGENMINOR(USBDEVUNIT(sc->sc_dev), 0)); - vp = SLIST_FIRST(&dev->si_hlist); - if (vp) - VOP_REVOKE(vp, REVOKEALL); destroy_dev(dev); ugen_destroy_devnodes(sc); #endif diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 57f8e290465..1a2c42bd269 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -304,8 +304,6 @@ USB_DETACH(uhid) int s; #if defined(__NetBSD__) || defined(__OpenBSD__) int maj, mn; -#elif defined(__FreeBSD__) - struct vnode *vp; #endif #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -339,10 +337,6 @@ USB_DETACH(uhid) mn = self->dv_unit; vdevgone(maj, mn, mn, VCHR); #elif defined(__FreeBSD__) - vp = SLIST_FIRST(&sc->dev->si_hlist); - if (vp) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->dev); #endif diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 46a452ccd6e..6df5ff3a2fe 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #endif #include #include -#include #include #include @@ -376,8 +375,6 @@ USB_DETACH(ulpt) int s; #if defined(__NetBSD__) || defined(__OpenBSD__) int maj, mn; -#elif defined(__FreeBSD__) - struct vnode *vp; #endif #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -414,13 +411,6 @@ USB_DETACH(ulpt) mn = self->dv_unit; vdevgone(maj, mn, mn, VCHR); #elif defined(__FreeBSD__) - vp = SLIST_FIRST(&sc->dev->si_hlist); - if (vp) - VOP_REVOKE(vp, REVOKEALL); - vp = SLIST_FIRST(&sc->dev_noprime->si_hlist); - if (vp) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->dev); destroy_dev(sc->dev_noprime); #endif diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 72240bf6b57..d3acf92e514 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -367,7 +367,6 @@ Static int ums_detach(device_t self) { struct ums_softc *sc = device_get_softc(self); - struct vnode *vp; if (sc->sc_enabled) ums_disable(sc); @@ -377,10 +376,6 @@ ums_detach(device_t self) free(sc->sc_loc_btn, M_USB); free(sc->sc_ibuf, M_USB); - vp = SLIST_FIRST(&sc->dev->si_hlist); - if (vp) - VOP_REVOKE(vp, REVOKEALL); - /* someone waiting for data */ /* * XXX If we wakeup the process here, the device will be gone by diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 8615d9a8fd3..5d82960f427 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -620,7 +620,6 @@ USB_DETACH(uscanner) int maj, mn; #elif defined(__FreeBSD__) dev_t dev; - struct vnode *vp; #endif #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -657,9 +656,6 @@ USB_DETACH(uscanner) #elif defined(__FreeBSD__) /* destroy the device for the control endpoint */ dev = makedev(USCANNER_CDEV_MAJOR, USBDEVUNIT(sc->sc_dev)); - vp = SLIST_FIRST(&dev->si_hlist); - if (vp) - VOP_REVOKE(vp, REVOKEALL); destroy_dev(dev); #endif diff --git a/sys/net/if.c b/sys/net/if.c index bddf781ef27..42e3c577acd 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -470,7 +470,7 @@ if_detach(ifp) * Clean up all addresses. */ ifaddr_byindex(ifp->if_index) = NULL; - revoke_and_destroy_dev(ifdev_byindex(ifp->if_index)); + destroy_dev(ifdev_byindex(ifp->if_index)); ifdev_byindex(ifp->if_index) = NULL; while (if_index > 0 && ifaddr_byindex(if_index) == NULL) diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index 625e92b8f5e..5f98d8dcb7b 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include @@ -2704,7 +2704,6 @@ ubt_create_device_nodes(ubt_softc_p sc) Static void ubt_destroy_device_nodes(ubt_softc_p sc) { - struct vnode *vp = NULL; /* * Wait for processes to go away. This should be safe as we will not @@ -2721,28 +2720,16 @@ ubt_destroy_device_nodes(ubt_softc_p sc) /* Destroy device nodes */ if (sc->sc_bulk_dev != NODEV) { - vp = SLIST_FIRST(&sc->sc_bulk_dev->si_hlist); - if (vp != NULL) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->sc_bulk_dev); sc->sc_bulk_dev = NODEV; } if (sc->sc_intr_dev != NODEV) { - vp = SLIST_FIRST(&sc->sc_intr_dev->si_hlist); - if (vp != NULL) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->sc_intr_dev); sc->sc_intr_dev = NODEV; } if (sc->sc_ctrl_dev != NODEV) { - vp = SLIST_FIRST(&sc->sc_ctrl_dev->si_hlist); - if (vp != NULL) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->sc_ctrl_dev); sc->sc_ctrl_dev = NODEV; } diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index acd51cec48a..5fbcd06114b 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include @@ -220,8 +220,6 @@ USB_DETACH(ubtbcmfw) { USB_DETACH_START(ubtbcmfw, sc); - struct vnode *vp = NULL; - sc->sc_dying = 1; if (-- sc->sc_refcnt >= 0) { @@ -236,28 +234,16 @@ USB_DETACH(ubtbcmfw) /* Destroy device nodes */ if (sc->sc_bulk_out_dev != NODEV) { - vp = SLIST_FIRST(&sc->sc_bulk_out_dev->si_hlist); - if (vp != NULL) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->sc_bulk_out_dev); sc->sc_bulk_out_dev = NODEV; } if (sc->sc_intr_in_dev != NODEV) { - vp = SLIST_FIRST(&sc->sc_intr_in_dev->si_hlist); - if (vp != NULL) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->sc_intr_in_dev); sc->sc_intr_in_dev = NODEV; } if (sc->sc_ctrl_dev != NODEV) { - vp = SLIST_FIRST(&sc->sc_ctrl_dev->si_hlist); - if (vp != NULL) - VOP_REVOKE(vp, REVOKEALL); - destroy_dev(sc->sc_ctrl_dev); sc->sc_ctrl_dev = NODEV; }