diff options
author | adrian <adrian@FreeBSD.org> | 2012-10-28 18:46:06 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-10-28 18:46:06 +0000 |
commit | 94c194db6e072c66e7e87c451f028af69ea94216 (patch) | |
tree | 86ac11c488bb37545d1571f678a0bacd36227a9f /sys/dev | |
parent | 06a013a7a62e040601f1f24c6aacf678d11b100c (diff) | |
download | FreeBSD-src-94c194db6e072c66e7e87c451f028af69ea94216.zip FreeBSD-src-94c194db6e072c66e7e87c451f028af69ea94216.tar.gz |
Add a temporary (for values of "temporary") work around for hotplug
support with ath(4) and VIMAGE.
Right now the VIMAGE code doesn't supply a default vnet context during:
* hotplug attach;
* any device detach.
It special cases kldload/boot time probing (by setting the context to
vnet0) but that doesn't occur when probing devices during a bus rescan -
eg, adding a cardbus card.
These will eventually go away when the VIMAGE support extends to providing
default contexts to hotplug attach/detach.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ath/if_ath.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 8a47963..0219704 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -281,6 +281,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid); + CURVNET_SET(vnet0); ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(sc->sc_dev, "can not if_alloc()\n"); @@ -292,6 +293,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) /* set these up early for if_printf use */ if_initname(ifp, device_get_name(sc->sc_dev), device_get_unit(sc->sc_dev)); + CURVNET_RESTORE(); ah = ath_hal_attach(devid, sc, sc->sc_st, sc->sc_sh, sc->sc_eepromdata, &status); @@ -887,8 +889,11 @@ bad2: bad: if (ah) ath_hal_detach(ah); - if (ifp != NULL) + if (ifp != NULL) { + CURVNET_SET(ifp->if_vnet); if_free(ifp); + CURVNET_RESTORE(); + } sc->sc_invalid = 1; return error; } @@ -930,7 +935,10 @@ ath_detach(struct ath_softc *sc) ath_rxdma_teardown(sc); ath_tx_cleanup(sc); ath_hal_detach(sc->sc_ah); /* NB: sets chip in full sleep */ + + CURVNET_SET(ifp->if_vnet); if_free(ifp); + CURVNET_RESTORE(); return 0; } |