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 | |
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')
-rw-r--r-- | drivers/net/e100.c | 2 | ||||
-rw-r--r-- | drivers/net/mdio.c | 3 | ||||
-rw-r--r-- | drivers/net/mii.c | 3 | ||||
-rw-r--r-- | drivers/net/pch_gbe/pch_gbe_main.c | 6 | ||||
-rw-r--r-- | drivers/net/pch_gbe/pch_gbe_phy.c | 2 | ||||
-rw-r--r-- | drivers/net/pcnet32.c | 16 | ||||
-rw-r--r-- | drivers/net/sfc/mdio_10g.c | 4 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac_ethtool.c | 5 | ||||
-rw-r--r-- | drivers/net/usb/asix.c | 28 | ||||
-rw-r--r-- | drivers/net/usb/dm9601.c | 6 | ||||
-rw-r--r-- | drivers/net/usb/smsc75xx.c | 7 | ||||
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 7 |
12 files changed, 49 insertions, 40 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index b0aa9e68990a..66ba596a4d37 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1668,7 +1668,7 @@ static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex) | |||
1668 | static void e100_watchdog(unsigned long data) | 1668 | static void e100_watchdog(unsigned long data) |
1669 | { | 1669 | { |
1670 | struct nic *nic = (struct nic *)data; | 1670 | struct nic *nic = (struct nic *)data; |
1671 | struct ethtool_cmd cmd; | 1671 | struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET }; |
1672 | 1672 | ||
1673 | netif_printk(nic, timer, KERN_DEBUG, nic->netdev, | 1673 | netif_printk(nic, timer, KERN_DEBUG, nic->netdev, |
1674 | "right now = %ld\n", jiffies); | 1674 | "right now = %ld\n", jiffies); |
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index e85bf04cf813..f2d10abd0403 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c | |||
@@ -176,6 +176,9 @@ static u32 mdio45_get_an(const struct mdio_if_info *mdio, u16 addr) | |||
176 | * @npage_adv: Modes currently advertised on next pages | 176 | * @npage_adv: Modes currently advertised on next pages |
177 | * @npage_lpa: Modes advertised by link partner on next pages | 177 | * @npage_lpa: Modes advertised by link partner on next pages |
178 | * | 178 | * |
179 | * The @ecmd parameter is expected to have been cleared before calling | ||
180 | * mdio45_ethtool_gset_npage(). | ||
181 | * | ||
179 | * Since the CSRs for auto-negotiation using next pages are not fully | 182 | * Since the CSRs for auto-negotiation using next pages are not fully |
180 | * standardised, this function does not attempt to decode them. The | 183 | * standardised, this function does not attempt to decode them. The |
181 | * caller must pass them in. | 184 | * caller must pass them in. |
diff --git a/drivers/net/mii.c b/drivers/net/mii.c index 0a6c6a2e7550..05acca78f63a 100644 --- a/drivers/net/mii.c +++ b/drivers/net/mii.c | |||
@@ -58,6 +58,9 @@ static u32 mii_get_an(struct mii_if_info *mii, u16 addr) | |||
58 | * @mii: MII interface | 58 | * @mii: MII interface |
59 | * @ecmd: requested ethtool_cmd | 59 | * @ecmd: requested ethtool_cmd |
60 | * | 60 | * |
61 | * The @ecmd parameter is expected to have been cleared before calling | ||
62 | * mii_ethtool_gset(). | ||
63 | * | ||
61 | * Returns 0 for success, negative on error. | 64 | * Returns 0 for success, negative on error. |
62 | */ | 65 | */ |
63 | int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) | 66 | int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c index 4cc9872f5ec4..f3e4b0adae93 100644 --- a/drivers/net/pch_gbe/pch_gbe_main.c +++ b/drivers/net/pch_gbe/pch_gbe_main.c | |||
@@ -888,12 +888,12 @@ static void pch_gbe_watchdog(unsigned long data) | |||
888 | struct pch_gbe_adapter *adapter = (struct pch_gbe_adapter *)data; | 888 | struct pch_gbe_adapter *adapter = (struct pch_gbe_adapter *)data; |
889 | struct net_device *netdev = adapter->netdev; | 889 | struct net_device *netdev = adapter->netdev; |
890 | struct pch_gbe_hw *hw = &adapter->hw; | 890 | struct pch_gbe_hw *hw = &adapter->hw; |
891 | struct ethtool_cmd cmd; | ||
892 | 891 | ||
893 | pr_debug("right now = %ld\n", jiffies); | 892 | pr_debug("right now = %ld\n", jiffies); |
894 | 893 | ||
895 | pch_gbe_update_stats(adapter); | 894 | pch_gbe_update_stats(adapter); |
896 | if ((mii_link_ok(&adapter->mii)) && (!netif_carrier_ok(netdev))) { | 895 | if ((mii_link_ok(&adapter->mii)) && (!netif_carrier_ok(netdev))) { |
896 | struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET }; | ||
897 | netdev->tx_queue_len = adapter->tx_queue_len; | 897 | netdev->tx_queue_len = adapter->tx_queue_len; |
898 | /* mii library handles link maintenance tasks */ | 898 | /* mii library handles link maintenance tasks */ |
899 | if (mii_ethtool_gset(&adapter->mii, &cmd)) { | 899 | if (mii_ethtool_gset(&adapter->mii, &cmd)) { |
@@ -903,7 +903,7 @@ static void pch_gbe_watchdog(unsigned long data) | |||
903 | PCH_GBE_WATCHDOG_PERIOD)); | 903 | PCH_GBE_WATCHDOG_PERIOD)); |
904 | return; | 904 | return; |
905 | } | 905 | } |
906 | hw->mac.link_speed = cmd.speed; | 906 | hw->mac.link_speed = ethtool_cmd_speed(&cmd); |
907 | hw->mac.link_duplex = cmd.duplex; | 907 | hw->mac.link_duplex = cmd.duplex; |
908 | /* Set the RGMII control. */ | 908 | /* Set the RGMII control. */ |
909 | pch_gbe_set_rgmii_ctrl(adapter, hw->mac.link_speed, | 909 | pch_gbe_set_rgmii_ctrl(adapter, hw->mac.link_speed, |
@@ -913,7 +913,7 @@ static void pch_gbe_watchdog(unsigned long data) | |||
913 | hw->mac.link_duplex); | 913 | hw->mac.link_duplex); |
914 | netdev_dbg(netdev, | 914 | netdev_dbg(netdev, |
915 | "Link is Up %d Mbps %s-Duplex\n", | 915 | "Link is Up %d Mbps %s-Duplex\n", |
916 | cmd.speed, | 916 | hw->mac.link_speed, |
917 | cmd.duplex == DUPLEX_FULL ? "Full" : "Half"); | 917 | cmd.duplex == DUPLEX_FULL ? "Full" : "Half"); |
918 | netif_carrier_on(netdev); | 918 | netif_carrier_on(netdev); |
919 | netif_wake_queue(netdev); | 919 | netif_wake_queue(netdev); |
diff --git a/drivers/net/pch_gbe/pch_gbe_phy.c b/drivers/net/pch_gbe/pch_gbe_phy.c index 923a687acd30..9a8207f686fd 100644 --- a/drivers/net/pch_gbe/pch_gbe_phy.c +++ b/drivers/net/pch_gbe/pch_gbe_phy.c | |||
@@ -247,7 +247,7 @@ inline void pch_gbe_phy_set_rgmii(struct pch_gbe_hw *hw) | |||
247 | void pch_gbe_phy_init_setting(struct pch_gbe_hw *hw) | 247 | void pch_gbe_phy_init_setting(struct pch_gbe_hw *hw) |
248 | { | 248 | { |
249 | struct pch_gbe_adapter *adapter; | 249 | struct pch_gbe_adapter *adapter; |
250 | struct ethtool_cmd cmd; | 250 | struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET }; |
251 | int ret; | 251 | int ret; |
252 | u16 mii_reg; | 252 | u16 mii_reg; |
253 | 253 | ||
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 | } |
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c index 19e68c26d103..71159145b4bf 100644 --- a/drivers/net/sfc/mdio_10g.c +++ b/drivers/net/sfc/mdio_10g.c | |||
@@ -232,12 +232,12 @@ void efx_mdio_set_mmds_lpower(struct efx_nic *efx, | |||
232 | */ | 232 | */ |
233 | int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) | 233 | int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) |
234 | { | 234 | { |
235 | struct ethtool_cmd prev; | 235 | struct ethtool_cmd prev = { .cmd = ETHTOOL_GSET }; |
236 | 236 | ||
237 | efx->phy_op->get_settings(efx, &prev); | 237 | efx->phy_op->get_settings(efx, &prev); |
238 | 238 | ||
239 | if (ecmd->advertising == prev.advertising && | 239 | if (ecmd->advertising == prev.advertising && |
240 | ecmd->speed == prev.speed && | 240 | ethtool_cmd_speed(ecmd) == ethtool_cmd_speed(&prev) && |
241 | ecmd->duplex == prev.duplex && | 241 | ecmd->duplex == prev.duplex && |
242 | ecmd->port == prev.port && | 242 | ecmd->port == prev.port && |
243 | ecmd->autoneg == prev.autoneg) | 243 | ecmd->autoneg == prev.autoneg) |
diff --git a/drivers/net/stmmac/stmmac_ethtool.c b/drivers/net/stmmac/stmmac_ethtool.c index 0e61ac8707cb..6f5aaeb986ff 100644 --- a/drivers/net/stmmac/stmmac_ethtool.c +++ b/drivers/net/stmmac/stmmac_ethtool.c | |||
@@ -237,13 +237,12 @@ stmmac_set_pauseparam(struct net_device *netdev, | |||
237 | 237 | ||
238 | if (phy->autoneg) { | 238 | if (phy->autoneg) { |
239 | if (netif_running(netdev)) { | 239 | if (netif_running(netdev)) { |
240 | struct ethtool_cmd cmd; | 240 | struct ethtool_cmd cmd = { .cmd = ETHTOOL_SSET }; |
241 | /* auto-negotiation automatically restarted */ | 241 | /* auto-negotiation automatically restarted */ |
242 | cmd.cmd = ETHTOOL_NWAY_RST; | ||
243 | cmd.supported = phy->supported; | 242 | cmd.supported = phy->supported; |
244 | cmd.advertising = phy->advertising; | 243 | cmd.advertising = phy->advertising; |
245 | cmd.autoneg = phy->autoneg; | 244 | cmd.autoneg = phy->autoneg; |
246 | cmd.speed = phy->speed; | 245 | ethtool_cmd_speed_set(&cmd, phy->speed); |
247 | cmd.duplex = phy->duplex; | 246 | cmd.duplex = phy->duplex; |
248 | cmd.phy_address = phy->addr; | 247 | cmd.phy_address = phy->addr; |
249 | ret = phy_ethtool_sset(phy, &cmd); | 248 | ret = phy_ethtool_sset(phy, &cmd); |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 6140b56cce53..6998aa6b7bb7 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -847,7 +847,7 @@ static void ax88172_set_multicast(struct net_device *net) | |||
847 | static int ax88172_link_reset(struct usbnet *dev) | 847 | static int ax88172_link_reset(struct usbnet *dev) |
848 | { | 848 | { |
849 | u8 mode; | 849 | u8 mode; |
850 | struct ethtool_cmd ecmd; | 850 | struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; |
851 | 851 | ||
852 | mii_check_media(&dev->mii, 1, 1); | 852 | mii_check_media(&dev->mii, 1, 1); |
853 | mii_ethtool_gset(&dev->mii, &ecmd); | 853 | mii_ethtool_gset(&dev->mii, &ecmd); |
@@ -856,8 +856,8 @@ static int ax88172_link_reset(struct usbnet *dev) | |||
856 | if (ecmd.duplex != DUPLEX_FULL) | 856 | if (ecmd.duplex != DUPLEX_FULL) |
857 | mode |= ~AX88172_MEDIUM_FD; | 857 | mode |= ~AX88172_MEDIUM_FD; |
858 | 858 | ||
859 | netdev_dbg(dev->net, "ax88172_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n", | 859 | netdev_dbg(dev->net, "ax88172_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n", |
860 | ecmd.speed, ecmd.duplex, mode); | 860 | ethtool_cmd_speed(&ecmd), ecmd.duplex, mode); |
861 | 861 | ||
862 | asix_write_medium_mode(dev, mode); | 862 | asix_write_medium_mode(dev, mode); |
863 | 863 | ||
@@ -947,20 +947,20 @@ static const struct ethtool_ops ax88772_ethtool_ops = { | |||
947 | static int ax88772_link_reset(struct usbnet *dev) | 947 | static int ax88772_link_reset(struct usbnet *dev) |
948 | { | 948 | { |
949 | u16 mode; | 949 | u16 mode; |
950 | struct ethtool_cmd ecmd; | 950 | struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; |
951 | 951 | ||
952 | mii_check_media(&dev->mii, 1, 1); | 952 | mii_check_media(&dev->mii, 1, 1); |
953 | mii_ethtool_gset(&dev->mii, &ecmd); | 953 | mii_ethtool_gset(&dev->mii, &ecmd); |
954 | mode = AX88772_MEDIUM_DEFAULT; | 954 | mode = AX88772_MEDIUM_DEFAULT; |
955 | 955 | ||
956 | if (ecmd.speed != SPEED_100) | 956 | if (ethtool_cmd_speed(&ecmd) != SPEED_100) |
957 | mode &= ~AX_MEDIUM_PS; | 957 | mode &= ~AX_MEDIUM_PS; |
958 | 958 | ||
959 | if (ecmd.duplex != DUPLEX_FULL) | 959 | if (ecmd.duplex != DUPLEX_FULL) |
960 | mode &= ~AX_MEDIUM_FD; | 960 | mode &= ~AX_MEDIUM_FD; |
961 | 961 | ||
962 | netdev_dbg(dev->net, "ax88772_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n", | 962 | netdev_dbg(dev->net, "ax88772_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n", |
963 | ecmd.speed, ecmd.duplex, mode); | 963 | ethtool_cmd_speed(&ecmd), ecmd.duplex, mode); |
964 | 964 | ||
965 | asix_write_medium_mode(dev, mode); | 965 | asix_write_medium_mode(dev, mode); |
966 | 966 | ||
@@ -1173,18 +1173,20 @@ static int marvell_led_status(struct usbnet *dev, u16 speed) | |||
1173 | static int ax88178_link_reset(struct usbnet *dev) | 1173 | static int ax88178_link_reset(struct usbnet *dev) |
1174 | { | 1174 | { |
1175 | u16 mode; | 1175 | u16 mode; |
1176 | struct ethtool_cmd ecmd; | 1176 | struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; |
1177 | struct asix_data *data = (struct asix_data *)&dev->data; | 1177 | struct asix_data *data = (struct asix_data *)&dev->data; |
1178 | u32 speed; | ||
1178 | 1179 | ||
1179 | netdev_dbg(dev->net, "ax88178_link_reset()\n"); | 1180 | netdev_dbg(dev->net, "ax88178_link_reset()\n"); |
1180 | 1181 | ||
1181 | mii_check_media(&dev->mii, 1, 1); | 1182 | mii_check_media(&dev->mii, 1, 1); |
1182 | mii_ethtool_gset(&dev->mii, &ecmd); | 1183 | mii_ethtool_gset(&dev->mii, &ecmd); |
1183 | mode = AX88178_MEDIUM_DEFAULT; | 1184 | mode = AX88178_MEDIUM_DEFAULT; |
1185 | speed = ethtool_cmd_speed(&ecmd); | ||
1184 | 1186 | ||
1185 | if (ecmd.speed == SPEED_1000) | 1187 | if (speed == SPEED_1000) |
1186 | mode |= AX_MEDIUM_GM; | 1188 | mode |= AX_MEDIUM_GM; |
1187 | else if (ecmd.speed == SPEED_100) | 1189 | else if (speed == SPEED_100) |
1188 | mode |= AX_MEDIUM_PS; | 1190 | mode |= AX_MEDIUM_PS; |
1189 | else | 1191 | else |
1190 | mode &= ~(AX_MEDIUM_PS | AX_MEDIUM_GM); | 1192 | mode &= ~(AX_MEDIUM_PS | AX_MEDIUM_GM); |
@@ -1196,13 +1198,13 @@ static int ax88178_link_reset(struct usbnet *dev) | |||
1196 | else | 1198 | else |
1197 | mode &= ~AX_MEDIUM_FD; | 1199 | mode &= ~AX_MEDIUM_FD; |
1198 | 1200 | ||
1199 | netdev_dbg(dev->net, "ax88178_link_reset() speed: %d duplex: %d setting mode to 0x%04x\n", | 1201 | netdev_dbg(dev->net, "ax88178_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n", |
1200 | ecmd.speed, ecmd.duplex, mode); | 1202 | speed, ecmd.duplex, mode); |
1201 | 1203 | ||
1202 | asix_write_medium_mode(dev, mode); | 1204 | asix_write_medium_mode(dev, mode); |
1203 | 1205 | ||
1204 | if (data->phymode == PHY_MODE_MARVELL && data->ledmode) | 1206 | if (data->phymode == PHY_MODE_MARVELL && data->ledmode) |
1205 | marvell_led_status(dev, ecmd.speed); | 1207 | marvell_led_status(dev, speed); |
1206 | 1208 | ||
1207 | return 0; | 1209 | return 0; |
1208 | } | 1210 | } |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 5002f5be47be..1d93133e9b74 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -599,13 +599,13 @@ static void dm9601_status(struct usbnet *dev, struct urb *urb) | |||
599 | 599 | ||
600 | static int dm9601_link_reset(struct usbnet *dev) | 600 | static int dm9601_link_reset(struct usbnet *dev) |
601 | { | 601 | { |
602 | struct ethtool_cmd ecmd; | 602 | struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; |
603 | 603 | ||
604 | mii_check_media(&dev->mii, 1, 1); | 604 | mii_check_media(&dev->mii, 1, 1); |
605 | mii_ethtool_gset(&dev->mii, &ecmd); | 605 | mii_ethtool_gset(&dev->mii, &ecmd); |
606 | 606 | ||
607 | netdev_dbg(dev->net, "link_reset() speed: %d duplex: %d\n", | 607 | netdev_dbg(dev->net, "link_reset() speed: %u duplex: %d\n", |
608 | ecmd.speed, ecmd.duplex); | 608 | ethtool_cmd_speed(&ecmd), ecmd.duplex); |
609 | 609 | ||
610 | return 0; | 610 | return 0; |
611 | } | 611 | } |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 860a20c938b4..15b3d6888ae9 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -503,7 +503,7 @@ static int smsc75xx_update_flowcontrol(struct usbnet *dev, u8 duplex, | |||
503 | static int smsc75xx_link_reset(struct usbnet *dev) | 503 | static int smsc75xx_link_reset(struct usbnet *dev) |
504 | { | 504 | { |
505 | struct mii_if_info *mii = &dev->mii; | 505 | struct mii_if_info *mii = &dev->mii; |
506 | struct ethtool_cmd ecmd; | 506 | struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; |
507 | u16 lcladv, rmtadv; | 507 | u16 lcladv, rmtadv; |
508 | int ret; | 508 | int ret; |
509 | 509 | ||
@@ -519,8 +519,9 @@ static int smsc75xx_link_reset(struct usbnet *dev) | |||
519 | lcladv = smsc75xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE); | 519 | lcladv = smsc75xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE); |
520 | rmtadv = smsc75xx_mdio_read(dev->net, mii->phy_id, MII_LPA); | 520 | rmtadv = smsc75xx_mdio_read(dev->net, mii->phy_id, MII_LPA); |
521 | 521 | ||
522 | netif_dbg(dev, link, dev->net, "speed: %d duplex: %d lcladv: %04x" | 522 | netif_dbg(dev, link, dev->net, "speed: %u duplex: %d lcladv: %04x" |
523 | " rmtadv: %04x", ecmd.speed, ecmd.duplex, lcladv, rmtadv); | 523 | " rmtadv: %04x", ethtool_cmd_speed(&ecmd), |
524 | ecmd.duplex, lcladv, rmtadv); | ||
524 | 525 | ||
525 | return smsc75xx_update_flowcontrol(dev, ecmd.duplex, lcladv, rmtadv); | 526 | return smsc75xx_update_flowcontrol(dev, ecmd.duplex, lcladv, rmtadv); |
526 | } | 527 | } |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 24f4b3739dd2..b374a9997908 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -457,7 +457,7 @@ static int smsc95xx_link_reset(struct usbnet *dev) | |||
457 | { | 457 | { |
458 | struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); | 458 | struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); |
459 | struct mii_if_info *mii = &dev->mii; | 459 | struct mii_if_info *mii = &dev->mii; |
460 | struct ethtool_cmd ecmd; | 460 | struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; |
461 | unsigned long flags; | 461 | unsigned long flags; |
462 | u16 lcladv, rmtadv; | 462 | u16 lcladv, rmtadv; |
463 | u32 intdata; | 463 | u32 intdata; |
@@ -472,8 +472,9 @@ static int smsc95xx_link_reset(struct usbnet *dev) | |||
472 | lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE); | 472 | lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE); |
473 | rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA); | 473 | rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA); |
474 | 474 | ||
475 | netif_dbg(dev, link, dev->net, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x\n", | 475 | netif_dbg(dev, link, dev->net, |
476 | ecmd.speed, ecmd.duplex, lcladv, rmtadv); | 476 | "speed: %u duplex: %d lcladv: %04x rmtadv: %04x\n", |
477 | ethtool_cmd_speed(&ecmd), ecmd.duplex, lcladv, rmtadv); | ||
477 | 478 | ||
478 | spin_lock_irqsave(&pdata->mac_cr_lock, flags); | 479 | spin_lock_irqsave(&pdata->mac_cr_lock, flags); |
479 | if (ecmd.duplex != DUPLEX_FULL) { | 480 | if (ecmd.duplex != DUPLEX_FULL) { |