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 <sys/uio.h> in bluetooth code rather than rely on <sys/vnode.h>
to do so.

The fact that some of the USB code needs to include <sys/vnode.h>
still disturbs me greatly, but I do not have time to chase that.
This commit is contained in:
Poul-Henning Kamp 2003-09-28 20:48:13 +00:00
parent 6dcf0a53d2
commit ed692400eb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120559
9 changed files with 5 additions and 65 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
#endif
#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/vnode.h>
#include <sys/syslog.h>
#include <sys/sysctl.h>
@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -40,7 +40,7 @@
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/poll.h>
#include <sys/vnode.h>
#include <sys/uio.h>
#include <machine/bus.h>
#include <dev/usb/usb.h>
@ -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;
}

View File

@ -39,7 +39,7 @@
#include <sys/poll.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/vnode.h>
#include <sys/uio.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -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;
}