summaryrefslogtreecommitdiffstats
path: root/sys/dev/dc
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/dc
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/dc')
-rw-r--r--sys/dev/dc/dcphy.c29
-rw-r--r--sys/dev/dc/pnphy.c21
2 files changed, 19 insertions, 31 deletions
diff --git a/sys/dev/dc/dcphy.c b/sys/dev/dc/dcphy.c
index e2d30b9..0968d4a 100644
--- a/sys/dev/dc/dcphy.c
+++ b/sys/dev/dc/dcphy.c
@@ -116,10 +116,10 @@ static driver_t dcphy_driver = {
DRIVER_MODULE(dcphy, miibus, dcphy_driver, dcphy_devclass, 0, 0);
-int dcphy_service __P((struct mii_softc *, struct mii_data *, int));
-void dcphy_status __P((struct mii_softc *));
-static int dcphy_auto __P((struct mii_softc *, int));
-static void dcphy_reset __P((struct mii_softc *));
+static int dcphy_service __P((struct mii_softc *, struct mii_data *, int));
+static void dcphy_status __P((struct mii_softc *));
+static void dcphy_reset __P((struct mii_softc *));
+static int dcphy_auto __P((struct mii_softc *, int));
static int dcphy_probe(dev)
device_t dev;
@@ -221,7 +221,7 @@ static int dcphy_detach(dev)
return(0);
}
-int
+static int
dcphy_service(sc, mii, cmd)
struct mii_softc *sc;
struct mii_data *mii;
@@ -318,22 +318,22 @@ dcphy_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;
reg = CSR_READ_4(dc_sc, DC_10BTSTAT) &
(DC_TSTAT_LS10|DC_TSTAT_LS100);
if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100))
- return(0);
+ break;
/*
* Only retry autonegotiation every 5 seconds.
@@ -353,14 +353,11 @@ dcphy_service(sc, mii, cmd)
dcphy_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
dcphy_status(sc)
struct mii_softc *sc;
{
diff --git a/sys/dev/dc/pnphy.c b/sys/dev/dc/pnphy.c
index e91ffc6..dce8282 100644
--- a/sys/dev/dc/pnphy.c
+++ b/sys/dev/dc/pnphy.c
@@ -103,8 +103,8 @@ static driver_t pnphy_driver = {
DRIVER_MODULE(pnphy, miibus, pnphy_driver, pnphy_devclass, 0, 0);
-int pnphy_service __P((struct mii_softc *, struct mii_data *, int));
-void pnphy_status __P((struct mii_softc *));
+static int pnphy_service __P((struct mii_softc *, struct mii_data *, int));
+static void pnphy_status __P((struct mii_softc *));
static int pnphy_probe(dev)
device_t dev;
@@ -184,7 +184,7 @@ static int pnphy_detach(dev)
return(0);
}
-int
+static int
pnphy_service(sc, mii, cmd)
struct mii_softc *sc;
struct mii_data *mii;
@@ -257,32 +257,23 @@ pnphy_service(sc, mii, cmd)
return (0);
/*
- * Only used for autonegotiation.
- */
- if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
- return (0);
-
- /*
* Is the interface even up?
*/
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
return (0);
- return(0);
+ break;
}
/* Update the media status. */
pnphy_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
pnphy_status(sc)
struct mii_softc *sc;
{
OpenPOWER on IntegriCloud