summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii/qsphy.c
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2001-09-29 19:18:52 +0000
committerjlemon <jlemon@FreeBSD.org>2001-09-29 19:18:52 +0000
commit6689cad44720247770c3439271c41126ceb5476e (patch)
treee747bfa7e8d363f3c895759cfbfa10fc7ec0841e /sys/dev/mii/qsphy.c
parent8bad7ad549c81c7741eb484b254cbe6200cba4c3 (diff)
downloadFreeBSD-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/qsphy.c')
-rw-r--r--sys/dev/mii/qsphy.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/sys/dev/mii/qsphy.c b/sys/dev/mii/qsphy.c
index 4f00e46..10ce9f3 100644
--- a/sys/dev/mii/qsphy.c
+++ b/sys/dev/mii/qsphy.c
@@ -119,9 +119,9 @@ static driver_t qsphy_driver = {
DRIVER_MODULE(qsphy, miibus, qsphy_driver, qsphy_devclass, 0, 0);
-int qsphy_service __P((struct mii_softc *, struct mii_data *, int));
-void qsphy_reset __P((struct mii_softc *));
-void qsphy_status __P((struct mii_softc *));
+static int qsphy_service __P((struct mii_softc *, struct mii_data *, int));
+static void qsphy_reset __P((struct mii_softc *));
+static void qsphy_status __P((struct mii_softc *));
static int qsphy_probe(dev)
device_t dev;
@@ -188,7 +188,7 @@ static int qsphy_detach(dev)
return(0);
}
-int
+static int
qsphy_service(sc, mii, cmd)
struct mii_softc *sc;
struct mii_data *mii;
@@ -252,26 +252,24 @@ qsphy_service(sc, 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
- * need to restart the autonegotiation process. Read
- * the BMSR twice in case it's latched.
+ * check for link.
+ * Read the status register twice; BMSR_LINK is latch-low.
*/
- reg = PHY_READ(sc, MII_BMSR) |
- PHY_READ(sc, MII_BMSR);
+ reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
if (reg & BMSR_LINK)
- return (0);
+ break;
/*
* Only retry autonegotiation every 5 seconds.
@@ -280,7 +278,7 @@ qsphy_service(sc, mii, cmd)
return (0);
sc->mii_ticks = 0;
- mii_phy_reset(sc);
+ qsphy_reset(sc);
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
@@ -290,14 +288,11 @@ qsphy_service(sc, mii, cmd)
qsphy_status(sc);
/* Callback if something changed. */
- if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
- MIIBUS_STATCHG(sc->mii_dev);
- sc->mii_active = mii->mii_media_active;
- }
+ mii_phy_update(sc, cmd);
return (0);
}
-void
+static void
qsphy_status(sc)
struct mii_softc *sc;
{
@@ -356,7 +351,7 @@ qsphy_status(sc)
mii->mii_media_active = ife->ifm_media;
}
-void
+static void
qsphy_reset(sc)
struct mii_softc *sc;
{
OpenPOWER on IntegriCloud