diff options
author | jlemon <jlemon@FreeBSD.org> | 2001-09-29 19:18:52 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2001-09-29 19:18:52 +0000 |
commit | 6689cad44720247770c3439271c41126ceb5476e (patch) | |
tree | e747bfa7e8d363f3c895759cfbfa10fc7ec0841e /sys/dev/mii/tlphy.c | |
parent | 8bad7ad549c81c7741eb484b254cbe6200cba4c3 (diff) | |
download | FreeBSD-src-6689cad44720247770c3439271c41126ceb5476e.zip FreeBSD-src-6689cad44720247770c3439271c41126ceb5476e.tar.gz |
Cleanup pass for mii drivers.
. Make internal service routines static.
. Use a consistent ordering of checks in MII_TICK. Do the work in the
mii_phy_tick() subroutine if appropriate.
. Call mii_phy_update() to trigger the callbacks.
Diffstat (limited to 'sys/dev/mii/tlphy.c')
-rw-r--r-- | sys/dev/mii/tlphy.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c index a3b1ee5..c5efc35 100644 --- a/sys/dev/mii/tlphy.c +++ b/sys/dev/mii/tlphy.c @@ -125,10 +125,10 @@ static driver_t tlphy_driver = { DRIVER_MODULE(tlphy, miibus, tlphy_driver, tlphy_devclass, 0, 0); -int tlphy_service __P((struct mii_softc *, struct mii_data *, int)); -int tlphy_auto __P((struct tlphy_softc *, int)); -void tlphy_acomp __P((struct tlphy_softc *)); -void tlphy_status __P((struct tlphy_softc *)); +static int tlphy_service __P((struct mii_softc *, struct mii_data *, int)); +static int tlphy_auto __P((struct tlphy_softc *, int)); +static void tlphy_acomp __P((struct tlphy_softc *)); +static void tlphy_status __P((struct tlphy_softc *)); static int tlphy_probe(dev) device_t dev; @@ -241,7 +241,7 @@ static int tlphy_detach(dev) return(0); } -int +static int tlphy_service(self, mii, cmd) struct mii_softc *self; struct mii_data *mii; @@ -312,16 +312,16 @@ tlphy_service(self, mii, cmd) return (0); /* - * Only used for autonegotiation. + * Is the interface even up? */ - if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) return (0); /* - * Is the interface even up? + * Only used for autonegotiation. */ - if ((mii->mii_ifp->if_flags & IFF_UP) == 0) - return (0); + if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) + break; /* * Check to see if we have link. If we do, we don't @@ -333,7 +333,7 @@ tlphy_service(self, mii, cmd) reg = PHY_READ(&sc->sc_mii, MII_BMSR) | PHY_READ(&sc->sc_mii, MII_BMSR); if (reg & BMSR_LINK) - return (0); + break; /* * Only retry autonegotiation every 5 seconds. @@ -352,15 +352,11 @@ tlphy_service(self, mii, cmd) tlphy_status(sc); /* Callback if something changed. */ - if (sc->sc_mii.mii_active != mii->mii_media_active || - cmd == MII_MEDIACHG) { - MIIBUS_STATCHG(sc->sc_mii.mii_dev); - sc->sc_mii.mii_active = mii->mii_media_active; - } + mii_phy_update(&sc->sc_mii, cmd); return (0); } -void +static void tlphy_status(sc) struct tlphy_softc *sc; { @@ -403,7 +399,7 @@ tlphy_status(sc) mii->mii_media_active |= IFM_10_T; } -int +static int tlphy_auto(sc, waitfor) struct tlphy_softc *sc; int waitfor; @@ -431,7 +427,7 @@ tlphy_auto(sc, waitfor) return (error); } -void +static void tlphy_acomp(sc) struct tlphy_softc *sc; { |