diff options
author | imp <imp@FreeBSD.org> | 2005-09-30 14:51:44 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2005-09-30 14:51:44 +0000 |
commit | b4f3676579808889af958d0d9509e59ccecec1c5 (patch) | |
tree | c991f6aa1fe96286abf5068417e0462ee34307a2 /sys | |
parent | 1bada7078492d10d93c240265cc4a80d92be91b8 (diff) | |
download | FreeBSD-src-b4f3676579808889af958d0d9509e59ccecec1c5.zip FreeBSD-src-b4f3676579808889af958d0d9509e59ccecec1c5.tar.gz |
Add a more generic version of the mii_phy_match routine (mii_phy_match_gen)
which can be used for phy that want to piggy back other data with their
table.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/mii/mii_physubr.c | 12 | ||||
-rw-r--r-- | sys/dev/mii/miivar.h | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index fdeddab..3d71061 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -530,13 +530,21 @@ mii_phy_detach(device_t dev) } const struct mii_phydesc * -mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd) +mii_phy_match_gen(const struct mii_attach_args *ma, + const struct mii_phydesc *mpd, size_t len) { - for (; mpd->mpd_name != NULL; mpd++) { + for (; mpd->mpd_name != NULL; + mpd = (const struct mii_phydesc *) ((const char *) mpd + len)) { if (MII_OUI(ma->mii_id1, ma->mii_id2) == mpd->mpd_oui && MII_MODEL(ma->mii_id2) == mpd->mpd_model) return (mpd); } return (NULL); } + +const struct mii_phydesc * +mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd) +{ + return (mii_phy_match_gen(ma, mpd, sizeof(struct mii_phydesc))); +} diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index f1d16f7..a1017a0 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -220,7 +220,10 @@ void mii_phy_setmedia(struct mii_softc *sc); void mii_phy_update(struct mii_softc *, int); int mii_phy_tick(struct mii_softc *); -const struct mii_phydesc * mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd); +const struct mii_phydesc * mii_phy_match(const struct mii_attach_args *ma, + const struct mii_phydesc *mpd); +const struct mii_phydesc * mii_phy_match_gen(const struct mii_attach_args *ma, + const struct mii_phydesc *mpd, size_t endlen); void ukphy_status(struct mii_softc *); #endif /* _KERNEL */ |