ChangeSet 1.1474.81.21, 2004/01/16 16:24:11-08:00, dhollis@davehollis.com

[PATCH] USB: usbnet on 2.6.0 -- needs ax8817x_ethtool_ops

On Tue, 2003-12-23 at 22:49, David Brownell wrote:
> > This patch should take care of it.  Additionally, I had to fold one of
> > my patches that's in the queue for 2.6.1 (ethtool link check fix) into
> > this as the other would not apply due to changes.
>
> It looks fine, though it didn't apply against Greg's usb-devel-2.6
> tree ... which has a few more methods added.
>
> I guess I'll just add this one to my tree, and let you merge this
> with those additional ax8817x changes.
>
> - Dave
>

Re-diffed against the usb-2.6-devel tree.


 drivers/usb/net/usbnet.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)


diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
--- a/drivers/usb/net/usbnet.c	Tue Jan 20 17:35:42 2004
+++ b/drivers/usb/net/usbnet.c	Tue Jan 20 17:35:42 2004
@@ -302,6 +302,9 @@
 
 static struct ethtool_ops usbnet_ethtool_ops;
 static void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
+static u32 usbnet_get_link (struct net_device *);
+static u32 usbnet_get_msglevel (struct net_device *);
+static void usbnet_set_msglevel (struct net_device *, u32);
 
 /* mostly for PDA style devices, which are always connected if present */
 static int always_connected (struct usbnet *dev)
@@ -658,6 +661,21 @@
 	return mii_ethtool_sset(&dev->mii,cmd);
 }
 
+/* We need to override some ethtool_ops so we require our
+   own structure so we don't interfere with other usbnet
+   devices that may be connected at the same time. */
+static struct ethtool_ops ax8817x_ethtool_ops = {
+	.get_drvinfo		= ax8817x_get_drvinfo,
+	.get_link		= ax8817x_get_link,
+	.get_msglevel		= usbnet_get_msglevel,
+	.set_msglevel		= usbnet_set_msglevel,
+	.get_wol		= ax8817x_get_wol,
+	.set_wol		= ax8817x_set_wol,
+	.get_eeprom		= ax8817x_get_eeprom,
+	.get_settings		= ax8817x_get_settings,
+	.set_settings		= ax8817x_set_settings,
+};
+
 static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
 {
 	int ret;
@@ -744,14 +762,7 @@
 	}
 
 	dev->net->set_multicast_list = ax8817x_set_multicast;
-
-	usbnet_ethtool_ops.get_drvinfo = &ax8817x_get_drvinfo;
-	usbnet_ethtool_ops.get_link = &ax8817x_get_link;
-	usbnet_ethtool_ops.get_wol = &ax8817x_get_wol;
-	usbnet_ethtool_ops.set_wol = &ax8817x_set_wol;
-	usbnet_ethtool_ops.get_eeprom = &ax8817x_get_eeprom;
-	usbnet_ethtool_ops.get_settings = &ax8817x_get_settings;
-	usbnet_ethtool_ops.set_settings = &ax8817x_set_settings;
+	dev->net->ethtool_ops = &ax8817x_ethtool_ops;
 
 	return 0;
 }
