From f8c369f7e5ced10460a44577e47774f38701b831 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 28 Apr 2002 19:25:07 +0000 Subject: Don't pass three args when one will do just fine, and even prevent mistakes like the one brgphy.c (now corrected). --- sys/dev/mii/acphy.c | 2 +- sys/dev/mii/amphy.c | 2 +- sys/dev/mii/brgphy.c | 6 +++--- sys/dev/mii/dcphy.c | 2 +- sys/dev/mii/exphy.c | 2 +- sys/dev/mii/inphy.c | 2 +- sys/dev/mii/lxtphy.c | 2 +- sys/dev/mii/mii_physubr.c | 12 +++++++++--- sys/dev/mii/miivar.h | 2 +- sys/dev/mii/mlphy.c | 2 +- sys/dev/mii/nsphy.c | 2 +- sys/dev/mii/pnphy.c | 2 +- sys/dev/mii/qsphy.c | 2 +- sys/dev/mii/rlphy.c | 2 +- sys/dev/mii/tdkphy.c | 2 +- sys/dev/mii/tlphy.c | 3 +-- sys/dev/mii/ukphy.c | 2 +- 17 files changed, 27 insertions(+), 22 deletions(-) (limited to 'sys/dev/mii') diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c index 6295891..07b3e08 100644 --- a/sys/dev/mii/acphy.c +++ b/sys/dev/mii/acphy.c @@ -161,7 +161,7 @@ static int acphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/amphy.c b/sys/dev/mii/amphy.c index 5692d78..64292d6 100644 --- a/sys/dev/mii/amphy.c +++ b/sys/dev/mii/amphy.c @@ -142,7 +142,7 @@ static int amphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c index 132ce06..b9f5732 100644 --- a/sys/dev/mii/brgphy.c +++ b/sys/dev/mii/brgphy.c @@ -159,10 +159,10 @@ static int brgphy_attach(dev) mii_phy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities &= ~BMSR_ANEG; device_printf(dev, " "); - mii_add_media(mii, (sc->mii_capabilities & ~BMSR_ANEG), sc->mii_inst); + mii_add_media(sc); ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_TX, 0, sc->mii_inst), BRGPHY_BMCR_FDX); PRINT(", 1000baseTX"); diff --git a/sys/dev/mii/dcphy.c b/sys/dev/mii/dcphy.c index 86912d7..4138b3c 100644 --- a/sys/dev/mii/dcphy.c +++ b/sys/dev/mii/dcphy.c @@ -196,7 +196,7 @@ static int dcphy_attach(dev) sc->mii_capabilities &= ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c index 71ec9b7..5b887ba 100644 --- a/sys/dev/mii/exphy.c +++ b/sys/dev/mii/exphy.c @@ -195,7 +195,7 @@ static int exphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/inphy.c b/sys/dev/mii/inphy.c index bb273a6..58e070f 100644 --- a/sys/dev/mii/inphy.c +++ b/sys/dev/mii/inphy.c @@ -144,7 +144,7 @@ inphy_attach(device_t dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/lxtphy.c b/sys/dev/mii/lxtphy.c index 3c2194a..f575fc3 100644 --- a/sys/dev/mii/lxtphy.c +++ b/sys/dev/mii/lxtphy.c @@ -178,7 +178,7 @@ static int lxtphy_attach(dev) printf("100baseFX-FDX, "); #undef ADD - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index 7c908b3..1fc46c9 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -290,12 +290,15 @@ mii_media_from_bmcr(bmcr) * of media names. Does not print a newline. */ void -mii_add_media(mii, bmsr, instance) - struct mii_data *mii; - int bmsr, instance; +mii_add_media(struct mii_softc *sc) { const char *sep = ""; + int bmsr, instance; + struct mii_data *mii; + bmsr = sc->mii_capabilities; + instance = sc->mii_inst; + mii = device_get_softc(sc->mii_dev); if ((bmsr & BMSR_MEDIAMASK) == 0) { printf("no media present"); return; @@ -339,6 +342,9 @@ mii_add_media(mii, bmsr, instance) BMCR_AUTOEN); PRINT("auto"); } + + + #undef ADD #undef PRINT } diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index a4c2a28..d890f46 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -166,7 +166,7 @@ int mii_mediachg(struct mii_data *); void mii_tick(struct mii_data *); void mii_pollstat(struct mii_data *); int mii_phy_probe(device_t, device_t *, ifm_change_cb_t, ifm_stat_cb_t); -void mii_add_media(struct mii_data *, int, int); +void mii_add_media(struct mii_softc *); int mii_media_from_bmcr(int); diff --git a/sys/dev/mii/mlphy.c b/sys/dev/mii/mlphy.c index 0cda976..e5c4195 100644 --- a/sys/dev/mii/mlphy.c +++ b/sys/dev/mii/mlphy.c @@ -167,7 +167,7 @@ static int mlphy_attach(dev) PHY_READ(sc, MII_BMSR) & ma->mii_capmask; ma->mii_capmask = ~sc->mii_capabilities; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c index 9059230..3e47c7d 100644 --- a/sys/dev/mii/nsphy.c +++ b/sys/dev/mii/nsphy.c @@ -181,7 +181,7 @@ static int nsphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD diff --git a/sys/dev/mii/pnphy.c b/sys/dev/mii/pnphy.c index 1a187d0..b3ff923 100644 --- a/sys/dev/mii/pnphy.c +++ b/sys/dev/mii/pnphy.c @@ -153,7 +153,7 @@ static int pnphy_attach(dev) BMSR_100TXFDX|BMSR_100TXHDX|BMSR_10TFDX|BMSR_10THDX; sc->mii_capabilities &= ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), BMCR_ISO); diff --git a/sys/dev/mii/qsphy.c b/sys/dev/mii/qsphy.c index aeedd1e..cdb1e4c 100644 --- a/sys/dev/mii/qsphy.c +++ b/sys/dev/mii/qsphy.c @@ -165,7 +165,7 @@ static int qsphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c index 898ee54..e21ad80 100644 --- a/sys/dev/mii/rlphy.c +++ b/sys/dev/mii/rlphy.c @@ -167,7 +167,7 @@ static int rlphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); diff --git a/sys/dev/mii/tdkphy.c b/sys/dev/mii/tdkphy.c index 4b8abde..2017abf 100644 --- a/sys/dev/mii/tdkphy.c +++ b/sys/dev/mii/tdkphy.c @@ -148,7 +148,7 @@ tdkphy_attach(device_t dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c index 7457bb1..f6c5b62 100644 --- a/sys/dev/mii/tlphy.c +++ b/sys/dev/mii/tlphy.c @@ -216,8 +216,7 @@ static int tlphy_attach(dev) if (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) { printf("%s", sep); - mii_add_media(mii, sc->sc_mii.mii_capabilities, - sc->sc_mii.mii_inst); + mii_add_media(&sc->sc_mii); } printf("\n"); diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c index 4bb57ba..9449814 100644 --- a/sys/dev/mii/ukphy.c +++ b/sys/dev/mii/ukphy.c @@ -171,7 +171,7 @@ ukphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(mii, sc->mii_capabilities, sc->mii_inst); + mii_add_media(sc); printf("\n"); #undef ADD -- cgit v1.1