aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-11-02 15:29:12 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-11-03 14:57:19 -0500
commit18ee91fa9815fa3bb4e51cdcb8229bd0a0f11a70 (patch)
treee1725a4cc51c73007b14045e548956b490d4b694 /drivers/usb
parent9b823b43ff308c914530ec7fde5e2d79cb37b51a (diff)
USB: use MII hooks only if CONFIG_MII is enabled
Fix mcs7830 patch The recent mcs7830 update to make the MII support sharable goofed various pre-existing configurations in two ways: - it made the usbnet infrastructure reference MII symbols even when they're not needed in the kernel being built - it didn't enable MII along with the mcs7830 minidriver This patch fixes these two problems. However, there does seem to be a Kconfig reverse dependency bug in that MII gets wrongly enabled in some cases (like USBNET=y and USBNET_MII=n); I think I've noticed that same problem in other situations too. So the result can mean kernels being bloated by stuff that's needlessly enabled ... better than wrongly being disabled, but contributing to bloat. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/net/Kconfig8
-rw-r--r--drivers/usb/net/usbnet.c58
2 files changed, 39 insertions, 27 deletions
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
index 454a186b64ad..e081836014ac 100644
--- a/drivers/usb/net/Kconfig
+++ b/drivers/usb/net/Kconfig
@@ -92,8 +92,13 @@ config USB_RTL8150
92 To compile this driver as a module, choose M here: the 92 To compile this driver as a module, choose M here: the
93 module will be called rtl8150. 93 module will be called rtl8150.
94 94
95config USB_USBNET_MII
96 tristate
97 default n
98
95config USB_USBNET 99config USB_USBNET
96 tristate "Multi-purpose USB Networking Framework" 100 tristate "Multi-purpose USB Networking Framework"
101 select MII if USBNET_MII != n
97 ---help--- 102 ---help---
98 This driver supports several kinds of network links over USB, 103 This driver supports several kinds of network links over USB,
99 with "minidrivers" built around a common network driver core 104 with "minidrivers" built around a common network driver core
@@ -129,7 +134,7 @@ config USB_NET_AX8817X
129 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" 134 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters"
130 depends on USB_USBNET && NET_ETHERNET 135 depends on USB_USBNET && NET_ETHERNET
131 select CRC32 136 select CRC32
132 select MII 137 select USB_USBNET_MII
133 default y 138 default y
134 help 139 help
135 This option adds support for ASIX AX88xxx based USB 2.0 140 This option adds support for ASIX AX88xxx based USB 2.0
@@ -210,6 +215,7 @@ config USB_NET_PLUSB
210config USB_NET_MCS7830 215config USB_NET_MCS7830
211 tristate "MosChip MCS7830 based Ethernet adapters" 216 tristate "MosChip MCS7830 based Ethernet adapters"
212 depends on USB_USBNET 217 depends on USB_USBNET
218 select USB_USBNET_MII
213 help 219 help
214 Choose this option if you're using a 10/100 Ethernet USB2 220 Choose this option if you're using a 10/100 Ethernet USB2
215 adapter based on the MosChip 7830 controller. This includes 221 adapter based on the MosChip 7830 controller. This includes
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 40873635d80e..760b5327b81b 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -669,6 +669,9 @@ done:
669 * they'll probably want to use this base set. 669 * they'll probably want to use this base set.
670 */ 670 */
671 671
672#if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE)
673#define HAVE_MII
674
672int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) 675int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
673{ 676{
674 struct usbnet *dev = netdev_priv(net); 677 struct usbnet *dev = netdev_priv(net);
@@ -699,20 +702,6 @@ int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd)
699} 702}
700EXPORT_SYMBOL_GPL(usbnet_set_settings); 703EXPORT_SYMBOL_GPL(usbnet_set_settings);
701 704
702
703void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
704{
705 struct usbnet *dev = netdev_priv(net);
706
707 /* REVISIT don't always return "usbnet" */
708 strncpy (info->driver, driver_name, sizeof info->driver);
709 strncpy (info->version, DRIVER_VERSION, sizeof info->version);
710 strncpy (info->fw_version, dev->driver_info->description,
711 sizeof info->fw_version);
712 usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
713}
714EXPORT_SYMBOL_GPL(usbnet_get_drvinfo);
715
716u32 usbnet_get_link (struct net_device *net) 705u32 usbnet_get_link (struct net_device *net)
717{ 706{
718 struct usbnet *dev = netdev_priv(net); 707 struct usbnet *dev = netdev_priv(net);
@@ -730,40 +719,57 @@ u32 usbnet_get_link (struct net_device *net)
730} 719}
731EXPORT_SYMBOL_GPL(usbnet_get_link); 720EXPORT_SYMBOL_GPL(usbnet_get_link);
732 721
733u32 usbnet_get_msglevel (struct net_device *net) 722int usbnet_nway_reset(struct net_device *net)
734{ 723{
735 struct usbnet *dev = netdev_priv(net); 724 struct usbnet *dev = netdev_priv(net);
736 725
737 return dev->msg_enable; 726 if (!dev->mii.mdio_write)
727 return -EOPNOTSUPP;
728
729 return mii_nway_restart(&dev->mii);
738} 730}
739EXPORT_SYMBOL_GPL(usbnet_get_msglevel); 731EXPORT_SYMBOL_GPL(usbnet_nway_reset);
740 732
741void usbnet_set_msglevel (struct net_device *net, u32 level) 733#endif /* HAVE_MII */
734
735void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
742{ 736{
743 struct usbnet *dev = netdev_priv(net); 737 struct usbnet *dev = netdev_priv(net);
744 738
745 dev->msg_enable = level; 739 /* REVISIT don't always return "usbnet" */
740 strncpy (info->driver, driver_name, sizeof info->driver);
741 strncpy (info->version, DRIVER_VERSION, sizeof info->version);
742 strncpy (info->fw_version, dev->driver_info->description,
743 sizeof info->fw_version);
744 usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
746} 745}
747EXPORT_SYMBOL_GPL(usbnet_set_msglevel); 746EXPORT_SYMBOL_GPL(usbnet_get_drvinfo);
748 747
749int usbnet_nway_reset(struct net_device *net) 748u32 usbnet_get_msglevel (struct net_device *net)
750{ 749{
751 struct usbnet *dev = netdev_priv(net); 750 struct usbnet *dev = netdev_priv(net);
752 751
753 if (!dev->mii.mdio_write) 752 return dev->msg_enable;
754 return -EOPNOTSUPP; 753}
754EXPORT_SYMBOL_GPL(usbnet_get_msglevel);
755 755
756 return mii_nway_restart(&dev->mii); 756void usbnet_set_msglevel (struct net_device *net, u32 level)
757{
758 struct usbnet *dev = netdev_priv(net);
759
760 dev->msg_enable = level;
757} 761}
758EXPORT_SYMBOL_GPL(usbnet_nway_reset); 762EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
759 763
760/* drivers may override default ethtool_ops in their bind() routine */ 764/* drivers may override default ethtool_ops in their bind() routine */
761static struct ethtool_ops usbnet_ethtool_ops = { 765static struct ethtool_ops usbnet_ethtool_ops = {
766#ifdef HAVE_MII
762 .get_settings = usbnet_get_settings, 767 .get_settings = usbnet_get_settings,
763 .set_settings = usbnet_set_settings, 768 .set_settings = usbnet_set_settings,
764 .get_drvinfo = usbnet_get_drvinfo,
765 .get_link = usbnet_get_link, 769 .get_link = usbnet_get_link,
766 .nway_reset = usbnet_nway_reset, 770 .nway_reset = usbnet_nway_reset,
771#endif
772 .get_drvinfo = usbnet_get_drvinfo,
767 .get_msglevel = usbnet_get_msglevel, 773 .get_msglevel = usbnet_get_msglevel,
768 .set_msglevel = usbnet_set_msglevel, 774 .set_msglevel = usbnet_set_msglevel,
769}; 775};