aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mii/tlphy.c
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2006-12-02 19:36:25 +0000
committerMarius Strobl <marius@FreeBSD.org>2006-12-02 19:36:25 +0000
commit028ccec4636dc4204441e74ea1456e51b40a7bff (patch)
tree0a8173ea0887896b2cd6a3f0ad42c1684b04c2b4 /sys/dev/mii/tlphy.c
parentd00947d83af65a3ff545b9494c5cf67b40398dd3 (diff)
downloadsrc-028ccec4636dc4204441e74ea1456e51b40a7bff.tar.gz
src-028ccec4636dc4204441e74ea1456e51b40a7bff.zip
Some style changes to a couple of PHY drivers:
- Fix some whitespace nits. - Fix some spelling in comments. - Use MII_ANEGTICKS instead of 5. - Don't define variables in nested scope. - Remove superfluous returns at the end of void functions. - Remove unused static global rgephy_mii_model. - Remove dupe $Id$ in tdkphy(4). - Sort brgphys table. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=164830
Diffstat (limited to 'sys/dev/mii/tlphy.c')
-rw-r--r--sys/dev/mii/tlphy.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c
index 7543d6cbd7ac..d21fe7f910e0 100644
--- a/sys/dev/mii/tlphy.c
+++ b/sys/dev/mii/tlphy.c
@@ -142,11 +142,13 @@ tlphy_probe(device_t dev)
static int
tlphy_attach(device_t dev)
{
+ device_t *devlist;
struct tlphy_softc *sc;
+ struct mii_softc *other;
struct mii_attach_args *ma;
struct mii_data *mii;
const char *sep = "";
- int capmask = 0xFFFFFFFF;
+ int capmask, devs, i;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
@@ -159,11 +161,8 @@ tlphy_attach(device_t dev)
sc->sc_mii.mii_service = tlphy_service;
sc->sc_mii.mii_pdata = mii;
+ capmask = 0xFFFFFFFF;
if (mii->mii_instance) {
- struct mii_softc *other;
- device_t *devlist;
- int devs, i;
-
device_get_children(sc->sc_mii.mii_dev, &devlist, &devs);
for (i = 0; i < devs; i++) {
if (strcmp(device_get_name(devlist[i]), "tlphy")) {
@@ -216,7 +215,7 @@ tlphy_attach(device_t dev)
#undef ADD
#undef PRINT
MIIBUS_MEDIAINIT(sc->sc_mii.mii_dev);
- return(0);
+ return (0);
}
static int
@@ -248,7 +247,7 @@ tlphy_service(struct mii_softc *self, struct mii_data *mii, int cmd)
PHY_WRITE(&sc->sc_mii, MII_BMCR, reg | BMCR_ISO);
return (0);
}
-
+
/*
* If the interface is not up, don't do anything.
*/
@@ -313,7 +312,7 @@ tlphy_service(struct mii_softc *self, struct mii_data *mii, int cmd)
/*
* Only retry autonegotiation every 5 seconds.
*/
- if (++sc->sc_mii.mii_ticks <= 5)
+ if (++sc->sc_mii.mii_ticks <= MII_ANEGTICKS)
break;
sc->sc_mii.mii_ticks = 0;
@@ -342,7 +341,7 @@ tlphy_status(struct tlphy_softc *sc)
bmcr = PHY_READ(&sc->sc_mii, MII_BMCR);
if (bmcr & BMCR_ISO) {
mii->mii_media_active |= IFM_NONE;
- mii->mii_media_status = 0;
+ mii->mii_media_status = 0;
return;
}
@@ -355,7 +354,7 @@ tlphy_status(struct tlphy_softc *sc)
bmsr = PHY_READ(&sc->sc_mii, MII_BMSR) |
PHY_READ(&sc->sc_mii, MII_BMSR);
- if (bmsr & BMSR_LINK)
+ if (bmsr & BMSR_LINK)
mii->mii_media_status |= IFM_ACTIVE;
if (bmcr & BMCR_LOOP)