Don't pass three args when one will do just fine, and even prevent

mistakes like the one brgphy.c (now corrected).
This commit is contained in:
Poul-Henning Kamp 2002-04-28 19:25:07 +00:00
parent afe18bfe77
commit 07dd938303
19 changed files with 29 additions and 24 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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
}

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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");

View File

@ -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