summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-04-29 13:07:38 +0000
committerphk <phk@FreeBSD.org>2002-04-29 13:07:38 +0000
commitf991342a3516788d7bdcf299d43518fc006fafe2 (patch)
treebb7ef32db222f40e58ca8b187557f694d084d314 /sys/dev/mii
parent0dd30d20d385d2160bcbfeacccc269aa1da113b6 (diff)
downloadFreeBSD-src-f991342a3516788d7bdcf299d43518fc006fafe2.zip
FreeBSD-src-f991342a3516788d7bdcf299d43518fc006fafe2.tar.gz
Make one generic mii_phy_detach() to replace 19 slightly different ones.
Rename mii_phy_auto_stop() mii_phy_down(). Introduce mii_down(), use it from nge. Do not indirect it to 19 identical case's in 19 switchstatements like NetBSD did.
Diffstat (limited to 'sys/dev/mii')
-rw-r--r--sys/dev/mii/acphy.c17
-rw-r--r--sys/dev/mii/amphy.c18
-rw-r--r--sys/dev/mii/brgphy.c20
-rw-r--r--sys/dev/mii/dcphy.c17
-rw-r--r--sys/dev/mii/e1000phy.c21
-rw-r--r--sys/dev/mii/exphy.c18
-rw-r--r--sys/dev/mii/inphy.c18
-rw-r--r--sys/dev/mii/lxtphy.c18
-rw-r--r--sys/dev/mii/mii.c12
-rw-r--r--sys/dev/mii/mii_physubr.c41
-rw-r--r--sys/dev/mii/miivar.h4
-rw-r--r--sys/dev/mii/mlphy.c18
-rw-r--r--sys/dev/mii/nsgphy.c19
-rw-r--r--sys/dev/mii/nsphy.c18
-rw-r--r--sys/dev/mii/pnaphy.c18
-rw-r--r--sys/dev/mii/pnphy.c17
-rw-r--r--sys/dev/mii/qsphy.c17
-rw-r--r--sys/dev/mii/rlphy.c18
-rw-r--r--sys/dev/mii/tdkphy.c17
-rw-r--r--sys/dev/mii/tlphy.c17
-rw-r--r--sys/dev/mii/ukphy.c18
-rw-r--r--sys/dev/mii/xmphy.c19
22 files changed, 61 insertions, 339 deletions
diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c
index 07b3e08..e885bde 100644
--- a/sys/dev/mii/acphy.c
+++ b/sys/dev/mii/acphy.c
@@ -94,13 +94,12 @@ static const char rcsid[] =
static int acphy_probe (device_t);
static int acphy_attach (device_t);
-static int acphy_detach (device_t);
static device_method_t acphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, acphy_probe),
DEVMETHOD(device_attach, acphy_attach),
- DEVMETHOD(device_detach, acphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -168,20 +167,6 @@ static int acphy_attach(dev)
return (0);
}
-static int acphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
acphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/amphy.c b/sys/dev/mii/amphy.c
index 64292d6..16a2455 100644
--- a/sys/dev/mii/amphy.c
+++ b/sys/dev/mii/amphy.c
@@ -62,13 +62,12 @@ static const char rcsid[] =
static int amphy_probe (device_t);
static int amphy_attach (device_t);
-static int amphy_detach (device_t);
static device_method_t amphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, amphy_probe),
DEVMETHOD(device_attach, amphy_attach),
- DEVMETHOD(device_detach, amphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -149,21 +148,6 @@ static int amphy_attach(dev)
return(0);
}
-static int amphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
amphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 1554ff7..08f1ff9 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -64,13 +64,12 @@ static const char rcsid[] =
static int brgphy_probe (device_t);
static int brgphy_attach (device_t);
-static int brgphy_detach (device_t);
static device_method_t brgphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, brgphy_probe),
DEVMETHOD(device_attach, brgphy_attach),
- DEVMETHOD(device_detach, brgphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -179,23 +178,6 @@ static int brgphy_attach(dev)
return(0);
}
-static int brgphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- if (sc->mii_flags & MIIF_DOINGAUTO)
- untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
-
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
brgphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/dcphy.c b/sys/dev/mii/dcphy.c
index 4138b3c..3426b11 100644
--- a/sys/dev/mii/dcphy.c
+++ b/sys/dev/mii/dcphy.c
@@ -95,13 +95,12 @@ static const char rcsid[] =
static int dcphy_probe (device_t);
static int dcphy_attach (device_t);
-static int dcphy_detach (device_t);
static device_method_t dcphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, dcphy_probe),
DEVMETHOD(device_attach, dcphy_attach),
- DEVMETHOD(device_detach, dcphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -204,20 +203,6 @@ static int dcphy_attach(dev)
return(0);
}
-static int dcphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
dcphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/e1000phy.c b/sys/dev/mii/e1000phy.c
index db97a85..86e5bfd 100644
--- a/sys/dev/mii/e1000phy.c
+++ b/sys/dev/mii/e1000phy.c
@@ -56,13 +56,12 @@
static int e1000phy_probe(device_t);
static int e1000phy_attach(device_t);
-static int e1000phy_detach(device_t);
static device_method_t e1000phy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, e1000phy_probe),
DEVMETHOD(device_attach, e1000phy_attach),
- DEVMETHOD(device_detach, e1000phy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -159,24 +158,6 @@ e1000phy_attach(device_t dev)
return(0);
}
-static int
-e1000phy_detach(device_t dev)
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
-
- if (sc->mii_flags & MIIF_DOINGAUTO)
- untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
-
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return 0;
-}
-
static void
e1000phy_reset(struct mii_softc *sc)
{
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
index 5b887ba..3f0286f 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/mii/exphy.c
@@ -93,13 +93,12 @@ static const char rcsid[] =
static int exphy_probe (device_t);
static int exphy_attach (device_t);
-static int exphy_detach (device_t);
static device_method_t exphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, exphy_probe),
DEVMETHOD(device_attach, exphy_attach),
- DEVMETHOD(device_detach, exphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -202,21 +201,6 @@ static int exphy_attach(dev)
return(0);
}
-static int exphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
exphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/inphy.c b/sys/dev/mii/inphy.c
index 6ad444a..a87f340 100644
--- a/sys/dev/mii/inphy.c
+++ b/sys/dev/mii/inphy.c
@@ -53,13 +53,12 @@
static int inphy_probe(device_t dev);
static int inphy_attach(device_t dev);
-static int inphy_detach(device_t dev);
static device_method_t inphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, inphy_probe),
DEVMETHOD(device_attach, inphy_attach),
- DEVMETHOD(device_detach, inphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -153,21 +152,6 @@ inphy_attach(device_t dev)
}
static int
-inphy_detach(device_t dev)
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_softc(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return (0);
-}
-
-static int
inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
diff --git a/sys/dev/mii/lxtphy.c b/sys/dev/mii/lxtphy.c
index f575fc3..15ec110 100644
--- a/sys/dev/mii/lxtphy.c
+++ b/sys/dev/mii/lxtphy.c
@@ -98,13 +98,12 @@ static const char rcsid[] =
static int lxtphy_probe (device_t);
static int lxtphy_attach (device_t);
-static int lxtphy_detach (device_t);
static device_method_t lxtphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, lxtphy_probe),
DEVMETHOD(device_attach, lxtphy_attach),
- DEVMETHOD(device_detach, lxtphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -185,21 +184,6 @@ static int lxtphy_attach(dev)
return(0);
}
-
-static int lxtphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
lxtphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index 078ce4d..9a63276 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -363,3 +363,15 @@ mii_pollstat(mii)
LIST_FOREACH(child, &mii->mii_phys, mii_list)
(void) (*child->mii_service)(child, mii, MII_POLLSTAT);
}
+
+/*
+ * Inform the PHYs that the interface is down.
+ */
+void
+mii_down(struct mii_data *mii)
+{
+ struct mii_softc *child;
+
+ LIST_FOREACH(child, &mii->mii_phys, mii_list)
+ mii_phy_down(child);
+}
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c
index c2b7a11..34f50dd 100644
--- a/sys/dev/mii/mii_physubr.c
+++ b/sys/dev/mii/mii_physubr.c
@@ -230,16 +230,6 @@ mii_phy_auto(struct mii_softc *sc, int waitfor)
}
void
-mii_phy_auto_stop(sc)
- struct mii_softc *sc;
-{
- if (sc->mii_flags & MIIF_DOINGAUTO) {
- sc->mii_flags &= ~MIIF_DOINGAUTO;
- untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
- }
-}
-
-void
mii_phy_auto_timeout(void *arg)
{
struct mii_softc *sc = arg;
@@ -332,13 +322,22 @@ mii_phy_reset(struct mii_softc *sc)
}
void
-mii_phy_update(sc, cmd)
- struct mii_softc *sc;
- int cmd;
+mii_phy_down(struct mii_softc *sc)
+{
+
+ if (sc->mii_flags & MIIF_DOINGAUTO) {
+ sc->mii_flags &= ~MIIF_DOINGAUTO;
+ untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
+ }
+}
+
+void
+mii_phy_update(struct mii_softc *sc, int cmd)
{
struct mii_data *mii = sc->mii_pdata;
- if (sc->mii_media_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
+ if (sc->mii_media_active != mii->mii_media_active ||
+ cmd == MII_MEDIACHG) {
MIIBUS_STATCHG(sc->mii_dev);
sc->mii_media_active = mii->mii_media_active;
}
@@ -580,3 +579,17 @@ mii_phy_add_media(struct mii_softc *sc)
#undef PRINT
}
+int
+mii_phy_detach(device_t dev)
+{
+ struct mii_softc *sc;
+ struct mii_data *mii;
+
+ sc = device_get_softc(dev);
+ mii = device_get_softc(device_get_parent(dev));
+ mii_phy_down(sc);
+ sc->mii_dev = NULL;
+ LIST_REMOVE(sc, mii_list);
+
+ return(0);
+}
diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h
index bc214d9..73a57eb 100644
--- a/sys/dev/mii/miivar.h
+++ b/sys/dev/mii/miivar.h
@@ -192,6 +192,7 @@ int miibus_attach(device_t);
int miibus_detach(device_t);
int mii_anar(int);
+void mii_down(struct mii_data *);
int mii_mediachg(struct mii_data *);
void mii_tick(struct mii_data *);
void mii_pollstat(struct mii_data *);
@@ -202,7 +203,8 @@ void mii_phy_add_media(struct mii_softc *);
int mii_media_from_bmcr(int);
int mii_phy_auto(struct mii_softc *, int);
-void mii_phy_auto_stop(struct mii_softc *);
+int mii_phy_detach(device_t dev);
+void mii_phy_down(struct mii_softc *);
void mii_phy_reset(struct mii_softc *);
void mii_phy_setmedia(struct mii_softc *sc);
void mii_phy_update(struct mii_softc *, int);
diff --git a/sys/dev/mii/mlphy.c b/sys/dev/mii/mlphy.c
index c983b71..44ab59d 100644
--- a/sys/dev/mii/mlphy.c
+++ b/sys/dev/mii/mlphy.c
@@ -74,13 +74,12 @@ struct mlphy_softc {
static int mlphy_probe (device_t);
static int mlphy_attach (device_t);
-static int mlphy_detach (device_t);
static device_method_t mlphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, mlphy_probe),
DEVMETHOD(device_attach, mlphy_attach),
- DEVMETHOD(device_detach, mlphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -174,21 +173,6 @@ static int mlphy_attach(dev)
return(0);
}
-static int mlphy_detach(dev)
- device_t dev;
-{
- struct mlphy_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- mii_phy_auto_stop(&sc->ml_mii);
- sc->ml_mii.mii_dev = NULL;
- LIST_REMOVE(&sc->ml_mii, mii_list);
-
- return(0);
-}
-
static int
mlphy_service(xsc, mii, cmd)
struct mii_softc *xsc;
diff --git a/sys/dev/mii/nsgphy.c b/sys/dev/mii/nsgphy.c
index 0ee59ea..16072a5 100644
--- a/sys/dev/mii/nsgphy.c
+++ b/sys/dev/mii/nsgphy.c
@@ -80,13 +80,12 @@ static const char rcsid[] =
static int nsgphy_probe (device_t);
static int nsgphy_attach (device_t);
-static int nsgphy_detach (device_t);
static device_method_t nsgphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, nsgphy_probe),
DEVMETHOD(device_attach, nsgphy_attach),
- DEVMETHOD(device_detach, nsgphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -160,22 +159,6 @@ nsgphy_attach(device_t dev)
}
static int
-nsgphy_detach(device_t dev)
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- if (sc->mii_flags & MIIF_DOINGAUTO)
- untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
-static int
nsgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c
index 3e47c7d..3667d44 100644
--- a/sys/dev/mii/nsphy.c
+++ b/sys/dev/mii/nsphy.c
@@ -97,13 +97,12 @@ static const char rcsid[] =
static int nsphy_probe (device_t);
static int nsphy_attach (device_t);
-static int nsphy_detach (device_t);
static device_method_t nsphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, nsphy_probe),
DEVMETHOD(device_attach, nsphy_attach),
- DEVMETHOD(device_detach, nsphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -189,21 +188,6 @@ static int nsphy_attach(dev)
return(0);
}
-static int nsphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
nsphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/pnaphy.c b/sys/dev/mii/pnaphy.c
index 744cd86..4a51ca3 100644
--- a/sys/dev/mii/pnaphy.c
+++ b/sys/dev/mii/pnaphy.c
@@ -68,13 +68,12 @@ static const char rcsid[] =
static int pnaphy_probe (device_t);
static int pnaphy_attach (device_t);
-static int pnaphy_detach (device_t);
static device_method_t pnaphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, pnaphy_probe),
DEVMETHOD(device_attach, pnaphy_attach),
- DEVMETHOD(device_detach, pnaphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -160,21 +159,6 @@ pnaphy_attach(dev)
return(0);
}
-static int pnaphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
int
pnaphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/pnphy.c b/sys/dev/mii/pnphy.c
index b3ff923..9b1ec55 100644
--- a/sys/dev/mii/pnphy.c
+++ b/sys/dev/mii/pnphy.c
@@ -82,13 +82,12 @@ static const char rcsid[] =
static int pnphy_probe (device_t);
static int pnphy_attach (device_t);
-static int pnphy_detach (device_t);
static device_method_t pnphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, pnphy_probe),
DEVMETHOD(device_attach, pnphy_attach),
- DEVMETHOD(device_detach, pnphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -167,20 +166,6 @@ static int pnphy_attach(dev)
return(0);
}
-static int pnphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
pnphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/qsphy.c b/sys/dev/mii/qsphy.c
index cdb1e4c..a8f3432 100644
--- a/sys/dev/mii/qsphy.c
+++ b/sys/dev/mii/qsphy.c
@@ -98,13 +98,12 @@ static const char rcsid[] =
static int qsphy_probe (device_t);
static int qsphy_attach (device_t);
-static int qsphy_detach (device_t);
static device_method_t qsphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, qsphy_probe),
DEVMETHOD(device_attach, qsphy_attach),
- DEVMETHOD(device_detach, qsphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -172,20 +171,6 @@ static int qsphy_attach(dev)
return (0);
}
-static int qsphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
qsphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c
index e21ad80..f45046a 100644
--- a/sys/dev/mii/rlphy.c
+++ b/sys/dev/mii/rlphy.c
@@ -62,13 +62,12 @@ static const char rcsid[] =
static int rlphy_probe (device_t);
static int rlphy_attach (device_t);
-static int rlphy_detach (device_t);
static device_method_t rlphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, rlphy_probe),
DEVMETHOD(device_attach, rlphy_attach),
- DEVMETHOD(device_detach, rlphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -174,21 +173,6 @@ static int rlphy_attach(dev)
return(0);
}
-static int rlphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_softc(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
rlphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/tdkphy.c b/sys/dev/mii/tdkphy.c
index 2017abf..a5f08b3 100644
--- a/sys/dev/mii/tdkphy.c
+++ b/sys/dev/mii/tdkphy.c
@@ -71,13 +71,12 @@ static const char rcsid[] =
static int tdkphy_probe (device_t);
static int tdkphy_attach (device_t);
-static int tdkphy_detach (device_t);
static device_method_t tdkphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, tdkphy_probe),
DEVMETHOD(device_attach, tdkphy_attach),
- DEVMETHOD(device_detach, tdkphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -157,20 +156,6 @@ tdkphy_attach(device_t dev)
return(0);
}
-static int tdkphy_detach(device_t dev)
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
tdkphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{
diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c
index f6c5b62..70a79c7 100644
--- a/sys/dev/mii/tlphy.c
+++ b/sys/dev/mii/tlphy.c
@@ -104,13 +104,12 @@ struct tlphy_softc {
static int tlphy_probe (device_t);
static int tlphy_attach (device_t);
-static int tlphy_detach (device_t);
static device_method_t tlphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, tlphy_probe),
DEVMETHOD(device_attach, tlphy_attach),
- DEVMETHOD(device_detach, tlphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -226,20 +225,6 @@ static int tlphy_attach(dev)
return(0);
}
-static int tlphy_detach(dev)
- device_t dev;
-{
- struct tlphy_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- sc->sc_mii.mii_dev = NULL;
- LIST_REMOVE(&sc->sc_mii, mii_list);
-
- return(0);
-}
-
static int
tlphy_service(self, mii, cmd)
struct mii_softc *self;
diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c
index 9449814..c041511 100644
--- a/sys/dev/mii/ukphy.c
+++ b/sys/dev/mii/ukphy.c
@@ -94,13 +94,12 @@ static const char rcsid[] =
static int ukphy_probe (device_t);
static int ukphy_attach (device_t);
-static int ukphy_detach (device_t);
static device_method_t ukphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ukphy_probe),
DEVMETHOD(device_attach, ukphy_attach),
- DEVMETHOD(device_detach, ukphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -180,21 +179,6 @@ ukphy_attach(dev)
return(0);
}
-static int ukphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- mii_phy_auto_stop(sc);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
ukphy_service(sc, mii, cmd)
struct mii_softc *sc;
diff --git a/sys/dev/mii/xmphy.c b/sys/dev/mii/xmphy.c
index ad1e34c..3a75701 100644
--- a/sys/dev/mii/xmphy.c
+++ b/sys/dev/mii/xmphy.c
@@ -64,13 +64,12 @@ static const char rcsid[] =
static int xmphy_probe (device_t);
static int xmphy_attach (device_t);
-static int xmphy_detach (device_t);
static device_method_t xmphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, xmphy_probe),
DEVMETHOD(device_attach, xmphy_attach),
- DEVMETHOD(device_detach, xmphy_detach),
+ DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@@ -163,22 +162,6 @@ static int xmphy_attach(dev)
return(0);
}
-static int xmphy_detach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(device_get_parent(dev));
- if (sc->mii_flags & MIIF_DOINGAUTO)
- untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
- sc->mii_dev = NULL;
- LIST_REMOVE(sc, mii_list);
-
- return(0);
-}
-
static int
xmphy_service(sc, mii, cmd)
struct mii_softc *sc;
OpenPOWER on IntegriCloud