From c0df07cad90a9bbad801e23b95ce5a4b0d92062e Mon Sep 17 00:00:00 2001
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 17 Mar 2010 22:45:53 +0000
Subject: [PATCH] Remove two instances of the evil hack to get the ifnet. 
 mii_ifp is set early enough that we don't need to do these hacks anymore.

---
 sys/dev/mii/mii.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index 63b625450be3..352ff9735682 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -259,13 +259,7 @@ miibus_statchg(device_t dev)
 	MIIBUS_STATCHG(parent);
 
 	mii = device_get_softc(dev);
-
-	/*
-	 * Note that each NIC's softc must start with an ifnet pointer.
-	 * XXX: EVIL HACK!
-	 */
-	ifp = *(struct ifnet **)device_get_softc(parent);
-	ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active);
+	mii->mii_ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active);
 	return;
 }
 
@@ -288,11 +282,7 @@ miibus_linkchg(device_t dev)
 			link_state = LINK_STATE_DOWN;
 	} else
 		link_state = LINK_STATE_UNKNOWN;
-	/*
-	 * Note that each NIC's softc must start with an ifnet pointer.
-	 * XXX: EVIL HACK!
-	 */
-	if_link_state_change(*(struct ifnet**)device_get_softc(parent), link_state);
+	if_link_state_change(mii->mii_ifp, link_state);
 }
 
 static void