diff options
author | David Decotigny <decot@google.com> | 2011-04-27 14:32:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-29 17:01:30 -0400 |
commit | 8ae6daca85c8bbd6a32c382db5e2a2a989f8bed2 (patch) | |
tree | 0c85476c2af6568c3d3a73a960d582d2f91a1256 /drivers/net/pcnet32.c | |
parent | 36504605432996590f889e33d47e2d9c581f7569 (diff) |
ethtool: Call ethtool's get/set_settings callbacks with cleaned data
This makes sure that when a driver calls the ethtool's
get/set_settings() callback of another driver, the data passed to it
is clean. This guarantees that speed_hi will be zeroed correctly if
the called callback doesn't explicitely set it: we are sure we don't
get a corrupted speed from the underlying driver. We also take care of
setting the cmd field appropriately (ETHTOOL_GSET/SSET).
This applies to dev_ethtool_get_settings(), which now makes sure it
sets up that ethtool command parameter correctly before passing it to
drivers. This also means that whoever calls dev_ethtool_get_settings()
does not have to clean the ethtool command parameter. This function
also becomes an exported symbol instead of an inline.
All drivers visible to make allyesconfig under x86_64 have been
updated.
Signed-off-by: David Decotigny <decot@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcnet32.c')
-rw-r--r-- | drivers/net/pcnet32.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 0a1efbae1bc0..b48aba9e4227 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -2099,7 +2099,7 @@ static int pcnet32_open(struct net_device *dev) | |||
2099 | int first_phy = -1; | 2099 | int first_phy = -1; |
2100 | u16 bmcr; | 2100 | u16 bmcr; |
2101 | u32 bcr9; | 2101 | u32 bcr9; |
2102 | struct ethtool_cmd ecmd; | 2102 | struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; |
2103 | 2103 | ||
2104 | /* | 2104 | /* |
2105 | * There is really no good other way to handle multiple PHYs | 2105 | * There is really no good other way to handle multiple PHYs |
@@ -2115,9 +2115,9 @@ static int pcnet32_open(struct net_device *dev) | |||
2115 | ecmd.port = PORT_MII; | 2115 | ecmd.port = PORT_MII; |
2116 | ecmd.transceiver = XCVR_INTERNAL; | 2116 | ecmd.transceiver = XCVR_INTERNAL; |
2117 | ecmd.autoneg = AUTONEG_DISABLE; | 2117 | ecmd.autoneg = AUTONEG_DISABLE; |
2118 | ecmd.speed = | 2118 | ethtool_cmd_speed_set(&ecmd, |
2119 | lp-> | 2119 | (lp->options & PCNET32_PORT_100) ? |
2120 | options & PCNET32_PORT_100 ? SPEED_100 : SPEED_10; | 2120 | SPEED_100 : SPEED_10); |
2121 | bcr9 = lp->a.read_bcr(ioaddr, 9); | 2121 | bcr9 = lp->a.read_bcr(ioaddr, 9); |
2122 | 2122 | ||
2123 | if (lp->options & PCNET32_PORT_FD) { | 2123 | if (lp->options & PCNET32_PORT_FD) { |
@@ -2763,11 +2763,11 @@ static void pcnet32_check_media(struct net_device *dev, int verbose) | |||
2763 | netif_carrier_on(dev); | 2763 | netif_carrier_on(dev); |
2764 | if (lp->mii) { | 2764 | if (lp->mii) { |
2765 | if (netif_msg_link(lp)) { | 2765 | if (netif_msg_link(lp)) { |
2766 | struct ethtool_cmd ecmd; | 2766 | struct ethtool_cmd ecmd = { |
2767 | .cmd = ETHTOOL_GSET }; | ||
2767 | mii_ethtool_gset(&lp->mii_if, &ecmd); | 2768 | mii_ethtool_gset(&lp->mii_if, &ecmd); |
2768 | netdev_info(dev, "link up, %sMbps, %s-duplex\n", | 2769 | netdev_info(dev, "link up, %uMbps, %s-duplex\n", |
2769 | (ecmd.speed == SPEED_100) | 2770 | ethtool_cmd_speed(&ecmd), |
2770 | ? "100" : "10", | ||
2771 | (ecmd.duplex == DUPLEX_FULL) | 2771 | (ecmd.duplex == DUPLEX_FULL) |
2772 | ? "full" : "half"); | 2772 | ? "full" : "half"); |
2773 | } | 2773 | } |