summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2000-12-04 22:46:50 +0000
committerwpaul <wpaul@FreeBSD.org>2000-12-04 22:46:50 +0000
commit9e208c7442e565fc1de970045410945e52702467 (patch)
tree3933565b0c0070018517c21c29b3ccc39d115ccb /sys/pci
parente01a4c0fd9aff88ae8d9b70d8f82aaf56c9c9116 (diff)
downloadFreeBSD-src-9e208c7442e565fc1de970045410945e52702467.zip
FreeBSD-src-9e208c7442e565fc1de970045410945e52702467.tar.gz
Initialize/grab the mutex earlier in the attach phase, so that
bailing out to the fail: label where we release/destroy the mutex will work without exploding.
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/if_dc.c5
-rw-r--r--sys/pci/if_pcn.c8
-rw-r--r--sys/pci/if_rl.c6
-rw-r--r--sys/pci/if_sf.c4
-rw-r--r--sys/pci/if_sis.c6
-rw-r--r--sys/pci/if_sk.c5
-rw-r--r--sys/pci/if_ste.c5
-rw-r--r--sys/pci/if_ti.c6
-rw-r--r--sys/pci/if_tl.c6
-rw-r--r--sys/pci/if_vr.c5
-rw-r--r--sys/pci/if_wb.c6
-rw-r--r--sys/pci/if_xl.c6
12 files changed, 36 insertions, 32 deletions
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index a23706a..a07c4dc 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/if_dc.c
@@ -1770,6 +1770,9 @@ 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);
+ DC_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -1833,8 +1836,6 @@ static int dc_attach(dev)
goto fail;
}
- mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_DEF);
- DC_LOCK(sc);
/* Need this info to decide on a chip type. */
sc->dc_info = dc_devtype(dev);
revision = pci_read_config(dev, DC_PCI_CFRV, 4) & 0x000000FF;
diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c
index aa9549e..c5139ef 100644
--- a/sys/pci/if_pcn.c
+++ b/sys/pci/if_pcn.c
@@ -496,6 +496,10 @@ static int pcn_attach(dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
+ /* Initialize our mutex. */
+ mtx_init(&sc->pcn_mtx, device_get_nameunit(dev), MTX_DEF);
+ PCN_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -582,10 +586,6 @@ static int pcn_attach(dev)
goto fail;
}
- /* Initialize our mutex. */
- mtx_init(&sc->pcn_mtx, device_get_nameunit(dev), MTX_DEF);
- PCN_LOCK(sc);
-
/* Reset the adapter. */
pcn_reset(sc);
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index 7fb1415..f8b3606 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -802,6 +802,9 @@ static int rl_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct rl_softc));
+ mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_DEF);
+ RL_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -899,9 +902,6 @@ static int rl_attach(dev)
callout_handle_init(&sc->rl_stat_ch);
- mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_DEF);
- RL_LOCK(sc);
-
/* Reset the adapter. */
rl_reset(sc);
sc->rl_eecmd_read = RL_EECMD_READ_6BIT;
diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c
index f2ca1e8..aa33e7d 100644
--- a/sys/pci/if_sf.c
+++ b/sys/pci/if_sf.c
@@ -679,6 +679,8 @@ 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);
+ SF_LOCK(sc);
/*
* Handle power management nonsense.
*/
@@ -765,8 +767,6 @@ static int sf_attach(dev)
}
callout_handle_init(&sc->sf_stat_ch);
- mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_DEF);
- SF_LOCK(sc);
/* Reset the adapter. */
sf_reset(sc);
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index d59c99c..8f9b4d6 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -638,6 +638,9 @@ static int sis_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct sis_softc));
+ mtx_init(&sc->sis_mtx, device_get_nameunit(dev), MTX_DEF);
+ SIS_LOCK(sc);
+
if (pci_get_device(dev) == SIS_DEVICEID_900)
sc->sis_type = SIS_TYPE_900;
if (pci_get_device(dev) == SIS_DEVICEID_7016)
@@ -731,9 +734,6 @@ static int sis_attach(dev)
goto fail;
}
- mtx_init(&sc->sis_mtx, device_get_nameunit(dev), MTX_DEF);
- SIS_LOCK(sc);
-
/* Reset the adapter. */
sis_reset(sc);
diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c
index befe974..143c4e4 100644
--- a/sys/pci/if_sk.c
+++ b/sys/pci/if_sk.c
@@ -1194,6 +1194,9 @@ 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);
+ SK_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -1279,8 +1282,6 @@ static int sk_attach(dev)
goto fail;
}
- mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_DEF);
- SK_LOCK(sc);
/* Reset the adapter. */
sk_reset(sc);
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index 4120762..7b099e8 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -917,6 +917,9 @@ static int ste_attach(dev)
unit = device_get_unit(dev);
bzero(sc, sizeof(struct ste_softc));
+ mtx_init(&sc->ste_mtx, device_get_nameunit(dev), MTX_DEF);
+ STE_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -1002,8 +1005,6 @@ static int ste_attach(dev)
}
callout_handle_init(&sc->ste_stat_ch);
- mtx_init(&sc->ste_mtx, device_get_nameunit(dev), MTX_DEF);
- STE_LOCK(sc);
/* Reset the adapter. */
ste_reset(sc);
diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c
index 1a88f0d..7f6660f 100644
--- a/sys/pci/if_ti.c
+++ b/sys/pci/if_ti.c
@@ -1476,6 +1476,9 @@ 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);
+ TI_LOCK(sc);
+
/*
* Map control/status registers.
*/
@@ -1527,9 +1530,6 @@ static int ti_attach(dev)
goto fail;
}
- mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_DEF);
- TI_LOCK(sc);
-
sc->ti_unit = unit;
if (ti_chipinit(sc)) {
diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c
index c109e81..7bf6901 100644
--- a/sys/pci/if_tl.c
+++ b/sys/pci/if_tl.c
@@ -1132,6 +1132,9 @@ static int tl_attach(dev)
goto fail;
}
+ mtx_init(&sc->tl_mtx, device_get_nameunit(dev), MTX_DEF);
+ TL_LOCK(sc);
+
/*
* Map control/status registers.
*/
@@ -1244,9 +1247,6 @@ static int tl_attach(dev)
if (t->tl_vid == OLICOM_VENDORID)
sc->tl_eeaddr = TL_EEPROM_EADDR_OC;
- mtx_init(&sc->tl_mtx, device_get_nameunit(dev), MTX_DEF);
- TL_LOCK(sc);
-
/* Reset the adapter. */
tl_softreset(sc, 1);
tl_hardreset(dev);
diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c
index 38677fd..a1fa0c0 100644
--- a/sys/pci/if_vr.c
+++ b/sys/pci/if_vr.c
@@ -643,6 +643,9 @@ 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);
+ VR_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -728,8 +731,6 @@ static int vr_attach(dev)
goto fail;
}
- mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_DEF);
- VR_LOCK(sc);
/* Reset the adapter. */
vr_reset(sc);
diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c
index bb93b3f..19893cf 100644
--- a/sys/pci/if_wb.c
+++ b/sys/pci/if_wb.c
@@ -817,6 +817,9 @@ static int wb_attach(dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
+ mtx_init(&sc->wb_mtx, device_get_nameunit(dev), MTX_DEF);
+ WB_LOCK(sc);
+
/*
* Handle power management nonsense.
*/
@@ -906,9 +909,6 @@ static int wb_attach(dev)
/* Save the cache line size. */
sc->wb_cachesize = pci_read_config(dev, WB_PCI_CACHELEN, 4) & 0xFF;
- mtx_init(&sc->wb_mtx, device_get_nameunit(dev), MTX_DEF);
- WB_LOCK(sc);
-
/* Reset the adapter. */
wb_reset(sc);
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index cfe67b6..eaa8901 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -1239,6 +1239,9 @@ static int xl_attach(dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
+ mtx_init(&sc->xl_mtx, device_get_nameunit(dev), MTX_DEF);
+ XL_LOCK(sc);
+
sc->xl_flags = 0;
if (pci_get_device(dev) == TC_DEVICEID_HURRICANE_556 ||
pci_get_device(dev) == TC_DEVICEID_HURRICANE_556B)
@@ -1382,9 +1385,6 @@ static int xl_attach(dev)
goto fail;
}
- mtx_init(&sc->xl_mtx, device_get_nameunit(dev), MTX_DEF);
- XL_LOCK(sc);
-
/* Reset the adapter. */
xl_reset(sc);
OpenPOWER on IntegriCloud