diff options
author | Emil Tantilov <emil.s.tantilov@intel.com> | 2013-08-13 00:59:29 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2013-08-29 06:17:11 -0400 |
commit | 31c7d2b06bbfe496746ef47606230447456ecf9d (patch) | |
tree | 95b4c37249eace4a09859a8d9cf9a663c690895c /drivers/net/ethernet/intel | |
parent | 1b1bf31a12f11f4e08239845e70aa10389312eba (diff) |
ixgbe: fix SFF data dumps of SFP+ modules from an offset
This patch fixes the read loop for the I2C data to account for the offset.
Also includes a whitespace cleanup and removes ret_val as it is not needed.
CC: Ben Hutchings <bhutchings@solarflare.com>
Reported-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index b6f1592bbcc8..2d0308ed3bdd 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -2946,28 +2946,27 @@ static int ixgbe_get_module_eeprom(struct net_device *dev, | |||
2946 | u32 status = IXGBE_ERR_PHY_ADDR_INVALID; | 2946 | u32 status = IXGBE_ERR_PHY_ADDR_INVALID; |
2947 | u8 databyte = 0xFF; | 2947 | u8 databyte = 0xFF; |
2948 | int i = 0; | 2948 | int i = 0; |
2949 | int ret_val = 0; | ||
2950 | 2949 | ||
2951 | if (ee->len == 0) | 2950 | if (ee->len == 0) |
2952 | return -EINVAL; | 2951 | return -EINVAL; |
2953 | 2952 | ||
2954 | for (i = ee->offset; i < ee->len; i++) { | 2953 | for (i = ee->offset; i < ee->offset + ee->len; i++) { |
2955 | /* I2C reads can take long time */ | 2954 | /* I2C reads can take long time */ |
2956 | if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) | 2955 | if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) |
2957 | return -EBUSY; | 2956 | return -EBUSY; |
2958 | 2957 | ||
2959 | if (i < ETH_MODULE_SFF_8079_LEN) | 2958 | if (i < ETH_MODULE_SFF_8079_LEN) |
2960 | status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); | 2959 | status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); |
2961 | else | 2960 | else |
2962 | status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); | 2961 | status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); |
2963 | 2962 | ||
2964 | if (status != 0) | 2963 | if (status != 0) |
2965 | ret_val = -EIO; | 2964 | return -EIO; |
2966 | 2965 | ||
2967 | data[i - ee->offset] = databyte; | 2966 | data[i - ee->offset] = databyte; |
2968 | } | 2967 | } |
2969 | 2968 | ||
2970 | return ret_val; | 2969 | return 0; |
2971 | } | 2970 | } |
2972 | 2971 | ||
2973 | static const struct ethtool_ops ixgbe_ethtool_ops = { | 2972 | static const struct ethtool_ops ixgbe_ethtool_ops = { |