Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2012 16:31:13 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242777 - head/sys/dev/usb/net
Message-ID:  <201211081631.qA8GVDlG011602@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Nov  8 16:31:13 2012
New Revision: 242777
URL: http://svnweb.freebsd.org/changeset/base/242777

Log:
  Make the USB ethernet methods constant again in if_udav.c,
  so that both adapter variants can be attached at the same
  time.
  
  MFC after:	0 days

Modified:
  head/sys/dev/usb/net/if_udav.c

Modified: head/sys/dev/usb/net/if_udav.c
==============================================================================
--- head/sys/dev/usb/net/if_udav.c	Thu Nov  8 16:17:52 2012	(r242776)
+++ head/sys/dev/usb/net/if_udav.c	Thu Nov  8 16:31:13 2012	(r242777)
@@ -169,7 +169,7 @@ MODULE_DEPEND(udav, ether, 1, 1, 1);
 MODULE_DEPEND(udav, miibus, 1, 1, 1);
 MODULE_VERSION(udav, 1);
 
-static struct usb_ether_methods udav_ue_methods = {
+static const struct usb_ether_methods udav_ue_methods = {
 	.ue_attach_post = udav_attach_post,
 	.ue_start = udav_start,
 	.ue_init = udav_init,
@@ -181,6 +181,15 @@ static struct usb_ether_methods udav_ue_
 	.ue_mii_sts = udav_ifmedia_status,
 };
 
+static const struct usb_ether_methods udav_ue_methods_nophy = {
+	.ue_attach_post = udav_attach_post,
+	.ue_start = udav_start,
+	.ue_init = udav_init,
+	.ue_stop = udav_stop,
+	.ue_setmulti = udav_setmulti,
+	.ue_setpromisc = udav_setpromisc,
+};
+
 #ifdef USB_DEBUG
 static int udav_debug = 0;
 
@@ -264,17 +273,16 @@ udav_attach(device_t dev)
 	 * The JP1082 has an unusable PHY and provides no link information.
 	 */
 	if (sc->sc_flags & UDAV_FLAG_NO_PHY) {
-		udav_ue_methods.ue_tick = NULL;
-		udav_ue_methods.ue_mii_upd = NULL;
-		udav_ue_methods.ue_mii_sts = NULL;
+		ue->ue_methods = &udav_ue_methods_nophy;
 		sc->sc_flags |= UDAV_FLAG_LINK;
+	} else {
+		ue->ue_methods = &udav_ue_methods;
 	}
 
 	ue->ue_sc = sc;
 	ue->ue_dev = dev;
 	ue->ue_udev = uaa->device;
 	ue->ue_mtx = &sc->sc_mtx;
-	ue->ue_methods = &udav_ue_methods;
 
 	error = uether_ifattach(ue);
 	if (error) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211081631.qA8GVDlG011602>