summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorbmilekic <bmilekic@FreeBSD.org>2001-01-19 01:59:14 +0000
committerbmilekic <bmilekic@FreeBSD.org>2001-01-19 01:59:14 +0000
commit37decc93f5a2dfb49438d1e77245218780583ef6 (patch)
tree2e4b859fb1993ec2fe69e3e946d14a9fdc9cf441 /sys/dev
parent5977e97236d57a51dc2ddf0634bb4a69d30dc36f (diff)
downloadFreeBSD-src-37decc93f5a2dfb49438d1e77245218780583ef6.zip
FreeBSD-src-37decc93f5a2dfb49438d1e77245218780583ef6.tar.gz
Implement MTX_RECURSE flag for mtx_init().
All calls to mtx_init() for mutexes that recurse must now include the MTX_RECURSE bit in the flag argument variable. This change is in preparation for an upcoming (further) mutex API cleanup. The witness code will call panic() if a lock is found to recurse but the MTX_RECURSE bit was not set during the lock's initialization. The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to MTX_RECURSED, which is more appropriate given its meaning. The following locks have been made "recursive," thus far: eventhandler, Giant, callout, sched_lock, possibly some others declared in the architecture-specific code, all of the network card driver locks in pci/, as well as some other locks in dev/ stuff that I've found to be recursive. Reviewed by: jhb
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/an/if_an.c3
-rw-r--r--sys/dev/dc/if_dc.c2
-rw-r--r--sys/dev/fxp/if_fxp.c2
-rw-r--r--sys/dev/sf/if_sf.c2
-rw-r--r--sys/dev/sk/if_sk.c2
-rw-r--r--sys/dev/ti/if_ti.c2
-rw-r--r--sys/dev/usb/if_aue.c3
-rw-r--r--sys/dev/usb/if_cue.c3
-rw-r--r--sys/dev/usb/if_kue.c3
-rw-r--r--sys/dev/vr/if_vr.c2
-rw-r--r--sys/dev/wi/if_wi.c2
11 files changed, 15 insertions, 11 deletions
diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c
index 60c7892..9fd258a 100644
--- a/sys/dev/an/if_an.c
+++ b/sys/dev/an/if_an.c
@@ -288,7 +288,8 @@ int an_attach(sc, unit, flags)
{
struct ifnet *ifp = &sc->arpcom.ac_if;
- mtx_init(&sc->an_mtx, device_get_nameunit(sc->an_dev), MTX_DEF);
+ mtx_init(&sc->an_mtx, device_get_nameunit(sc->an_dev), MTX_DEF |
+ MTX_RECURSE);
AN_LOCK(sc);
sc->an_gone = 0;
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index 63e7adb..3b5e91a 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -1762,7 +1762,7 @@ static int dc_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct dc_softc));
- mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_DEF);
+ mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
DC_LOCK(sc);
/*
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index b6f66d1..e76640e 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -316,7 +316,7 @@ fxp_attach(device_t dev)
u_long val;
int rid;
- mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF);
+ mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
callout_handle_init(&sc->stat_ch);
FXP_LOCK(sc);
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index aa33e7d..d03934f 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -679,7 +679,7 @@ static int sf_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct sf_softc));
- mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_DEF);
+ mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
SF_LOCK(sc);
/*
* Handle power management nonsense.
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c
index 143c4e4..f09df99 100644
--- a/sys/dev/sk/if_sk.c
+++ b/sys/dev/sk/if_sk.c
@@ -1194,7 +1194,7 @@ static int sk_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct sk_softc));
- mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_DEF);
+ mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
SK_LOCK(sc);
/*
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index 7f6660f..9b29e09 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -1476,7 +1476,7 @@ static int ti_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct ti_softc));
- mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_DEF);
+ mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
TI_LOCK(sc);
/*
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index a3b844b..9804573 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -681,7 +681,8 @@ USB_ATTACH(aue)
}
}
- mtx_init(&sc->aue_mtx, device_get_nameunit(self), MTX_DEF);
+ mtx_init(&sc->aue_mtx, device_get_nameunit(self), MTX_DEF |
+ MTX_RECURSE);
AUE_LOCK(sc);
/* Reset the adapter. */
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index c62a0d7..6b71b48 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -504,7 +504,8 @@ USB_ATTACH(cue)
}
}
- mtx_init(&sc->cue_mtx, device_get_nameunit(self), MTX_DEF);
+ mtx_init(&sc->cue_mtx, device_get_nameunit(self), MTX_DEF |
+ MTX_RECURSE);
CUE_LOCK(sc);
#ifdef notdef
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index f3a5581..4d89b70 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -450,7 +450,8 @@ USB_ATTACH(kue)
}
}
- mtx_init(&sc->kue_mtx, device_get_nameunit(self), MTX_DEF);
+ mtx_init(&sc->kue_mtx, device_get_nameunit(self), MTX_DEF |
+ MTX_RECURSE);
KUE_LOCK(sc);
/* Load the firmware into the NIC. */
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c
index a1fa0c0..7c3729f 100644
--- a/sys/dev/vr/if_vr.c
+++ b/sys/dev/vr/if_vr.c
@@ -643,7 +643,7 @@ static int vr_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct vr_softc *));
- mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_DEF);
+ mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
VR_LOCK(sc);
/*
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 70330f1..0b2415d 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -304,7 +304,7 @@ static int wi_pccard_attach(device_t dev)
return (error);
}
- mtx_init(&sc->wi_mtx, device_get_nameunit(dev), MTX_DEF);
+ mtx_init(&sc->wi_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
WI_LOCK(sc);
/* Reset the NIC. */
OpenPOWER on IntegriCloud