summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sun/niu.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-11-17 00:36:59 +0100
committerDavid S. Miller <davem@davemloft.net>2011-11-17 00:36:59 +0100
commit28011cf19b75df9d3f35489a7599a97ec0b3f1a0 (patch)
treecc058e15191db60adb45e426fc3d328e9d246b41 /drivers/net/ethernet/sun/niu.c
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsh... (diff)
downloadlinux-28011cf19b75df9d3f35489a7599a97ec0b3f1a0.tar.xz
linux-28011cf19b75df9d3f35489a7599a97ec0b3f1a0.zip
net: Add ethtool to mii advertisment conversion helpers
Translating between ethtool advertisement settings and MII advertisements are common operations for ethernet drivers. This patch adds a set of helper functions that implements the conversion. The patch then modifies a couple of the drivers to use the new functions. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sun/niu.c')
-rw-r--r--drivers/net/ethernet/sun/niu.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 3ebeb9d400fb..9997be525089 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -1151,19 +1151,8 @@ static int link_status_mii(struct niu *np, int *link_up_p)
supported |= SUPPORTED_1000baseT_Full;
lp->supported = supported;
- advertising = 0;
- if (advert & ADVERTISE_10HALF)
- advertising |= ADVERTISED_10baseT_Half;
- if (advert & ADVERTISE_10FULL)
- advertising |= ADVERTISED_10baseT_Full;
- if (advert & ADVERTISE_100HALF)
- advertising |= ADVERTISED_100baseT_Half;
- if (advert & ADVERTISE_100FULL)
- advertising |= ADVERTISED_100baseT_Full;
- if (ctrl1000 & ADVERTISE_1000HALF)
- advertising |= ADVERTISED_1000baseT_Half;
- if (ctrl1000 & ADVERTISE_1000FULL)
- advertising |= ADVERTISED_1000baseT_Full;
+ advertising = mii_adv_to_ethtool_100bt(advert);
+ advertising |= mii_adv_to_ethtool_1000T(ctrl1000);
if (bmcr & BMCR_ANENABLE) {
int neg, neg1000;