diff options
author | kevlo <kevlo@FreeBSD.org> | 2013-06-14 05:36:47 +0000 |
---|---|---|
committer | kevlo <kevlo@FreeBSD.org> | 2013-06-14 05:36:47 +0000 |
commit | a80685b9ce0c47ca222eb9c637898898cffa7752 (patch) | |
tree | b2a11f5b9d79d6ff49428c1332757926c07d39f9 /sys/dev | |
parent | 1f0a53a66f87e788b7ce601706e85f6b04724261 (diff) | |
download | FreeBSD-src-a80685b9ce0c47ca222eb9c637898898cffa7752.zip FreeBSD-src-a80685b9ce0c47ca222eb9c637898898cffa7752.tar.gz |
- Use the consistenly PHY-specific reset routine PHY_RESET() rather than
generic mii_phy_reset().
- Return the result of mii_mediachg() rather than blindly returning 0.
- on smsc(4), driver lock should be held to get current
mii_media_active/mii_media_status value.
Reviewed by: yongari
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/rt/if_rt.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/net/if_aue.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/net/if_mos.c | 11 | ||||
-rw-r--r-- | sys/dev/usb/net/if_rue.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/net/if_smsc.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/net/if_udav.c | 5 |
6 files changed, 22 insertions, 30 deletions
diff --git a/sys/dev/rt/if_rt.c b/sys/dev/rt/if_rt.c index ebbbba5..ce2b7a9 100644 --- a/sys/dev/rt/if_rt.c +++ b/sys/dev/rt/if_rt.c @@ -475,20 +475,16 @@ rt_ifmedia_upd(struct ifnet *ifp) struct rt_softc *sc; #ifdef IF_RT_PHY_SUPPORT struct mii_data *mii; + struct mii_softc *miisc; int error = 0; sc = ifp->if_softc; RT_SOFTC_LOCK(sc); mii = device_get_softc(sc->rt_miibus); - if (mii->mii_instance) { - struct mii_softc *miisc; - for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL; - miisc = LIST_NEXT(miisc, mii_list)) - mii_phy_reset(miisc); - } - if (mii) - error = mii_mediachg(mii); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + error = mii_mediachg(mii); RT_SOFTC_UNLOCK(sc); return (error); diff --git a/sys/dev/usb/net/if_aue.c b/sys/dev/usb/net/if_aue.c index 33ed236..1681a2a 100644 --- a/sys/dev/usb/net/if_aue.c +++ b/sys/dev/usb/net/if_aue.c @@ -1008,14 +1008,15 @@ aue_ifmedia_upd(struct ifnet *ifp) struct aue_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); struct mii_softc *miisc; + int error; AUE_LOCK_ASSERT(sc, MA_OWNED); sc->sc_flags &= ~AUE_FLAG_LINK; LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); - mii_mediachg(mii); - return (0); + error = mii_mediachg(mii); + return (error); } /* diff --git a/sys/dev/usb/net/if_mos.c b/sys/dev/usb/net/if_mos.c index 00b6c92..050bf38 100644 --- a/sys/dev/usb/net/if_mos.c +++ b/sys/dev/usb/net/if_mos.c @@ -526,16 +526,15 @@ mos_ifmedia_upd(struct ifnet *ifp) struct mos_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); struct mii_softc *miisc; + int error; MOS_LOCK_ASSERT(sc, MA_OWNED); sc->mos_link = 0; - if (mii->mii_instance) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } - mii_mediachg(mii); - return (0); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + error = mii_mediachg(mii); + return (error); } /* diff --git a/sys/dev/usb/net/if_rue.c b/sys/dev/usb/net/if_rue.c index a08d851..17f82b0 100644 --- a/sys/dev/usb/net/if_rue.c +++ b/sys/dev/usb/net/if_rue.c @@ -866,14 +866,15 @@ rue_ifmedia_upd(struct ifnet *ifp) struct rue_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); struct mii_softc *miisc; + int error; RUE_LOCK_ASSERT(sc, MA_OWNED); sc->sc_flags &= ~RUE_FLAG_LINK; LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); - mii_mediachg(mii); - return (0); + error = mii_mediachg(mii); + return (error); } /* diff --git a/sys/dev/usb/net/if_smsc.c b/sys/dev/usb/net/if_smsc.c index 03033cd..93762cf 100644 --- a/sys/dev/usb/net/if_smsc.c +++ b/sys/dev/usb/net/if_smsc.c @@ -606,16 +606,13 @@ smsc_ifmedia_upd(struct ifnet *ifp) { struct smsc_softc *sc = ifp->if_softc; struct mii_data *mii = uether_getmii(&sc->sc_ue); + struct mii_softc *miisc; int err; SMSC_LOCK_ASSERT(sc, MA_OWNED); - if (mii->mii_instance) { - struct mii_softc *miisc; - - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); err = mii_mediachg(mii); return (err); } @@ -638,13 +635,10 @@ smsc_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) struct mii_data *mii = uether_getmii(&sc->sc_ue); SMSC_LOCK(sc); - mii_pollstat(mii); - - SMSC_UNLOCK(sc); - ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + SMSC_UNLOCK(sc); } /** diff --git a/sys/dev/usb/net/if_udav.c b/sys/dev/usb/net/if_udav.c index ff57e25..2e7c271 100644 --- a/sys/dev/usb/net/if_udav.c +++ b/sys/dev/usb/net/if_udav.c @@ -750,14 +750,15 @@ udav_ifmedia_upd(struct ifnet *ifp) struct udav_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); struct mii_softc *miisc; + int error; UDAV_LOCK_ASSERT(sc, MA_OWNED); sc->sc_flags &= ~UDAV_FLAG_LINK; LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); - mii_mediachg(mii); - return (0); + error = mii_mediachg(mii); + return (error); } static void |