diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2008-11-22 00:30:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-22 00:30:24 -0500 |
commit | f5f4cf08467db10de061a1b90037a56a360d3554 (patch) | |
tree | f590f5a39dca1a57012f5eb62302ca56b7d3e27a /drivers/net/igb/igb_main.c | |
parent | 21fc578dcaa66dd30bad3c2f2cd7578e2865e8f2 (diff) |
igb: do not use phy ops in ethtool test cleanup for non-copper parts
Currently the igb driver is experiencing a panic due to a null function
pointer being used during the cleanup of the ethtool looback test on
fiber/serdes parts. This patch prevents that and adds a check prior to
calling any phy function.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/igb_main.c')
-rw-r--r-- | drivers/net/igb/igb_main.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index eca5684d5655..b64c41a44dfc 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -931,8 +931,7 @@ void igb_reset(struct igb_adapter *adapter) | |||
931 | wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE); | 931 | wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE); |
932 | 932 | ||
933 | igb_reset_adaptive(&adapter->hw); | 933 | igb_reset_adaptive(&adapter->hw); |
934 | if (adapter->hw.phy.ops.get_phy_info) | 934 | igb_get_phy_info(&adapter->hw); |
935 | adapter->hw.phy.ops.get_phy_info(&adapter->hw); | ||
936 | } | 935 | } |
937 | 936 | ||
938 | /** | 937 | /** |
@@ -1305,7 +1304,7 @@ err_register: | |||
1305 | igb_release_hw_control(adapter); | 1304 | igb_release_hw_control(adapter); |
1306 | err_eeprom: | 1305 | err_eeprom: |
1307 | if (!igb_check_reset_block(hw)) | 1306 | if (!igb_check_reset_block(hw)) |
1308 | hw->phy.ops.reset_phy(hw); | 1307 | igb_reset_phy(hw); |
1309 | 1308 | ||
1310 | if (hw->flash_address) | 1309 | if (hw->flash_address) |
1311 | iounmap(hw->flash_address); | 1310 | iounmap(hw->flash_address); |
@@ -1365,9 +1364,8 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
1365 | 1364 | ||
1366 | unregister_netdev(netdev); | 1365 | unregister_netdev(netdev); |
1367 | 1366 | ||
1368 | if (adapter->hw.phy.ops.reset_phy && | 1367 | if (!igb_check_reset_block(&adapter->hw)) |
1369 | !igb_check_reset_block(&adapter->hw)) | 1368 | igb_reset_phy(&adapter->hw); |
1370 | adapter->hw.phy.ops.reset_phy(&adapter->hw); | ||
1371 | 1369 | ||
1372 | igb_remove_device(&adapter->hw); | 1370 | igb_remove_device(&adapter->hw); |
1373 | igb_reset_interrupt_capability(adapter); | 1371 | igb_reset_interrupt_capability(adapter); |
@@ -2283,8 +2281,7 @@ static void igb_set_multi(struct net_device *netdev) | |||
2283 | static void igb_update_phy_info(unsigned long data) | 2281 | static void igb_update_phy_info(unsigned long data) |
2284 | { | 2282 | { |
2285 | struct igb_adapter *adapter = (struct igb_adapter *) data; | 2283 | struct igb_adapter *adapter = (struct igb_adapter *) data; |
2286 | if (adapter->hw.phy.ops.get_phy_info) | 2284 | igb_get_phy_info(&adapter->hw); |
2287 | adapter->hw.phy.ops.get_phy_info(&adapter->hw); | ||
2288 | } | 2285 | } |
2289 | 2286 | ||
2290 | /** | 2287 | /** |
@@ -3258,7 +3255,7 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3258 | /* Phy Stats */ | 3255 | /* Phy Stats */ |
3259 | if (hw->phy.media_type == e1000_media_type_copper) { | 3256 | if (hw->phy.media_type == e1000_media_type_copper) { |
3260 | if ((adapter->link_speed == SPEED_1000) && | 3257 | if ((adapter->link_speed == SPEED_1000) && |
3261 | (!hw->phy.ops.read_phy_reg(hw, PHY_1000T_STATUS, | 3258 | (!igb_read_phy_reg(hw, PHY_1000T_STATUS, |
3262 | &phy_tmp))) { | 3259 | &phy_tmp))) { |
3263 | phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; | 3260 | phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; |
3264 | adapter->phy_stats.idle_errors += phy_tmp; | 3261 | adapter->phy_stats.idle_errors += phy_tmp; |
@@ -4111,9 +4108,8 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4111 | case SIOCGMIIREG: | 4108 | case SIOCGMIIREG: |
4112 | if (!capable(CAP_NET_ADMIN)) | 4109 | if (!capable(CAP_NET_ADMIN)) |
4113 | return -EPERM; | 4110 | return -EPERM; |
4114 | if (adapter->hw.phy.ops.read_phy_reg(&adapter->hw, | 4111 | if (igb_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, |
4115 | data->reg_num | 4112 | &data->val_out)) |
4116 | & 0x1F, &data->val_out)) | ||
4117 | return -EIO; | 4113 | return -EIO; |
4118 | break; | 4114 | break; |
4119 | case SIOCSMIIREG: | 4115 | case SIOCSMIIREG: |