diff options
author | David Brownell <david-b@pacbell.net> | 2006-11-02 15:29:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-11-03 14:57:19 -0500 |
commit | 18ee91fa9815fa3bb4e51cdcb8229bd0a0f11a70 (patch) | |
tree | e1725a4cc51c73007b14045e548956b490d4b694 /drivers/usb/net/usbnet.c | |
parent | 9b823b43ff308c914530ec7fde5e2d79cb37b51a (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/net/usbnet.c')
-rw-r--r-- | drivers/usb/net/usbnet.c | 58 |
1 files changed, 32 insertions, 26 deletions
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 | |||
672 | int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) | 675 | int 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 | } |
700 | EXPORT_SYMBOL_GPL(usbnet_set_settings); | 703 | EXPORT_SYMBOL_GPL(usbnet_set_settings); |
701 | 704 | ||
702 | |||
703 | void 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 | } | ||
714 | EXPORT_SYMBOL_GPL(usbnet_get_drvinfo); | ||
715 | |||
716 | u32 usbnet_get_link (struct net_device *net) | 705 | u32 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 | } |
731 | EXPORT_SYMBOL_GPL(usbnet_get_link); | 720 | EXPORT_SYMBOL_GPL(usbnet_get_link); |
732 | 721 | ||
733 | u32 usbnet_get_msglevel (struct net_device *net) | 722 | int 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 | } |
739 | EXPORT_SYMBOL_GPL(usbnet_get_msglevel); | 731 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); |
740 | 732 | ||
741 | void usbnet_set_msglevel (struct net_device *net, u32 level) | 733 | #endif /* HAVE_MII */ |
734 | |||
735 | void 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 | } |
747 | EXPORT_SYMBOL_GPL(usbnet_set_msglevel); | 746 | EXPORT_SYMBOL_GPL(usbnet_get_drvinfo); |
748 | 747 | ||
749 | int usbnet_nway_reset(struct net_device *net) | 748 | u32 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 | } |
754 | EXPORT_SYMBOL_GPL(usbnet_get_msglevel); | ||
755 | 755 | ||
756 | return mii_nway_restart(&dev->mii); | 756 | void 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 | } |
758 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); | 762 | EXPORT_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 */ |
761 | static struct ethtool_ops usbnet_ethtool_ops = { | 765 | static 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 | }; |