svn commit: r277190 - in projects/ifnet/sys/dev: mii msk xl

Gleb Smirnoff glebius at FreeBSD.org
Wed Jan 14 19:45:21 UTC 2015


Author: glebius
Date: Wed Jan 14 19:45:19 2015
New Revision: 277190
URL: https://svnweb.freebsd.org/changeset/base/277190

Log:
  Remove miibus_linkchg, it has zero usage.  Only on driver defines
  it and function is a copy-n-paste of miibus_statchg.
  
  Thus, call miibus_statchg for both status and link events.
  
  Drivers are expected to handle if_baudrate and if_link_state
  in the miibus_linkchg.
  
  Sponsored by:	Nginx, Inc.

Modified:
  projects/ifnet/sys/dev/mii/mii.c
  projects/ifnet/sys/dev/mii/mii_physubr.c
  projects/ifnet/sys/dev/mii/miibus_if.m
  projects/ifnet/sys/dev/msk/if_msk.c
  projects/ifnet/sys/dev/xl/if_xl.c

Modified: projects/ifnet/sys/dev/mii/mii.c
==============================================================================
--- projects/ifnet/sys/dev/mii/mii.c	Wed Jan 14 19:42:36 2015	(r277189)
+++ projects/ifnet/sys/dev/mii/mii.c	Wed Jan 14 19:45:19 2015	(r277190)
@@ -67,7 +67,6 @@ static bus_read_ivar_t miibus_read_ivar;
 static miibus_readreg_t miibus_readreg;
 static miibus_statchg_t miibus_statchg;
 static miibus_writereg_t miibus_writereg;
-static miibus_linkchg_t miibus_linkchg;
 static miibus_readvar_t miibus_readvar;
 static miibus_mediainit_t miibus_mediainit;
 
@@ -91,7 +90,6 @@ static device_method_t miibus_methods[] 
 	DEVMETHOD(miibus_readreg,	miibus_readreg),
 	DEVMETHOD(miibus_writereg,	miibus_writereg),
 	DEVMETHOD(miibus_statchg,	miibus_statchg),
-	DEVMETHOD(miibus_linkchg,	miibus_linkchg),
 	DEVMETHOD(miibus_readvar,	miibus_readvar),
 	DEVMETHOD(miibus_mediainit,	miibus_mediainit),
 
@@ -300,13 +298,6 @@ miibus_statchg(device_t dev)
 	MIIBUS_STATCHG(device_get_parent(dev));
 }
 
-static void
-miibus_linkchg(device_t dev)
-{
-
-	MIIBUS_LINKCHG(device_get_parent(dev));
-}
-
 static uint64_t
 miibus_readvar(device_t dev, int var)
 {

Modified: projects/ifnet/sys/dev/mii/mii_physubr.c
==============================================================================
--- projects/ifnet/sys/dev/mii/mii_physubr.c	Wed Jan 14 19:42:36 2015	(r277189)
+++ projects/ifnet/sys/dev/mii/mii_physubr.c	Wed Jan 14 19:45:19 2015	(r277190)
@@ -284,12 +284,10 @@ mii_phy_update(struct mii_softc *sc, int
 	struct mii_data *mii = sc->mii_pdata;
 
 	if (sc->mii_media_active != mii->mii_media_active ||
+	    sc->mii_media_status != mii->mii_media_status ||
 	    cmd == MII_MEDIACHG) {
 		MIIBUS_STATCHG(sc->mii_dev);
 		sc->mii_media_active = mii->mii_media_active;
-	}
-	if (sc->mii_media_status != mii->mii_media_status) {
-		MIIBUS_LINKCHG(sc->mii_dev);
 		sc->mii_media_status = mii->mii_media_status;
 	}
 }

Modified: projects/ifnet/sys/dev/mii/miibus_if.m
==============================================================================
--- projects/ifnet/sys/dev/mii/miibus_if.m	Wed Jan 14 19:42:36 2015	(r277189)
+++ projects/ifnet/sys/dev/mii/miibus_if.m	Wed Jan 14 19:45:19 2015	(r277190)
@@ -31,13 +31,6 @@ METHOD void statchg {
 };
 
 #
-# Notify bus about PHY link change.
-#
-METHOD void linkchg {
-	device_t		dev;
-};
-
-#
 # Read software configuration data from device on MII bus.
 #
 METHOD uint64_t readvar {

Modified: projects/ifnet/sys/dev/msk/if_msk.c
==============================================================================
--- projects/ifnet/sys/dev/msk/if_msk.c	Wed Jan 14 19:42:36 2015	(r277189)
+++ projects/ifnet/sys/dev/msk/if_msk.c	Wed Jan 14 19:45:19 2015	(r277190)
@@ -312,7 +312,6 @@ static int msk_phy_writereg(struct msk_i
 static int msk_miibus_readreg(device_t, int, int);
 static int msk_miibus_writereg(device_t, int, int, int);
 static void msk_miibus_statchg(device_t);
-static void msk_miibus_linkchg(device_t);
 
 static void msk_rxfilter(struct msk_if_softc *);
 static void msk_setvlan(struct msk_if_softc *, if_t);
@@ -358,7 +357,6 @@ static device_method_t msk_methods[] = {
 	DEVMETHOD(miibus_readreg,	msk_miibus_readreg),
 	DEVMETHOD(miibus_writereg,	msk_miibus_writereg),
 	DEVMETHOD(miibus_statchg,	msk_miibus_statchg),
-	DEVMETHOD(miibus_linkchg,	msk_miibus_linkchg),
 
 	DEVMETHOD_END
 };
@@ -582,22 +580,7 @@ msk_miibus_statchg(device_t dev)
 		}
 	}
 	if_set(ifp, IF_BAUDRATE, ifmedia_baudrate(mii->mii_media_active));
-}
-
-static void
-msk_miibus_linkchg(device_t dev)
-{
-	struct msk_if_softc *sc_if;
-	struct mii_data *mii;
-	if_t ifp;
-
-	sc_if = device_get_softc(dev);
-	mii = device_get_softc(sc_if->msk_miibus);
-	ifp = sc_if->msk_ifp;
-
-	if (ifp != NULL)
-		if_link_state_change(ifp,
-		    ifmedia_link_state(mii->mii_media_status));
+	if_link_state_change(ifp, ifmedia_link_state(mii->mii_media_status));
 }
 
 static void

Modified: projects/ifnet/sys/dev/xl/if_xl.c
==============================================================================
--- projects/ifnet/sys/dev/xl/if_xl.c	Wed Jan 14 19:42:36 2015	(r277189)
+++ projects/ifnet/sys/dev/xl/if_xl.c	Wed Jan 14 19:45:19 2015	(r277190)
@@ -279,7 +279,6 @@ static void xl_testpacket(struct xl_soft
 static int xl_miibus_readreg(device_t, int, int);
 static int xl_miibus_writereg(device_t, int, int, int);
 static void xl_miibus_statchg(device_t);
-static void xl_miibus_linkchg(device_t);
 static void xl_miibus_mediainit(device_t);
 
 /*
@@ -313,7 +312,6 @@ static device_method_t xl_methods[] = {
 	DEVMETHOD(miibus_readreg,	xl_miibus_readreg),
 	DEVMETHOD(miibus_writereg,	xl_miibus_writereg),
 	DEVMETHOD(miibus_statchg,	xl_miibus_statchg),
-	DEVMETHOD(miibus_linkchg,	xl_miibus_linkchg),
 	DEVMETHOD(miibus_mediainit,	xl_miibus_mediainit),
 
 	DEVMETHOD_END
@@ -477,25 +475,12 @@ xl_miibus_statchg(device_t dev)
 			macctl &= ~XL_MACCTRL_FLOW_CONTROL_ENB;
 	}
 	CSR_WRITE_1(sc, XL_W3_MAC_CTRL, macctl);
-	if (sc->xl_ifp != NULL)
+	if (sc->xl_ifp != NULL) {
 		if_set(sc->xl_ifp, IF_BAUDRATE,
 		    ifmedia_baudrate(mii->mii_media_active));
-}
-
-static void
-xl_miibus_linkchg(device_t dev)
-{
-	struct xl_softc *sc;
-	struct mii_data *mii;
-	if_t ifp;
-
-	sc = device_get_softc(dev);
-	mii = device_get_softc(sc->xl_miibus);
-	ifp = sc->xl_ifp;
-
-	if (ifp != NULL)
-		if_link_state_change(ifp,
+		if_link_state_change(sc->xl_ifp,
 		    ifmedia_link_state(mii->mii_media_status));
+	}
 }
 
 /*


More information about the svn-src-projects mailing list