summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Tantilov <emil.s.tantilov@intel.com>2013-08-13 04:59:29 +0000
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2013-08-29 03:17:11 -0700
commit31c7d2b06bbfe496746ef47606230447456ecf9d (patch)
tree95b4c37249eace4a09859a8d9cf9a663c690895c
parent1b1bf31a12f11f4e08239845e70aa10389312eba (diff)
downloadlinux-31c7d2b06bbfe496746ef47606230447456ecf9d.tar.gz
linux-31c7d2b06bbfe496746ef47606230447456ecf9d.tar.bz2
linux-31c7d2b06bbfe496746ef47606230447456ecf9d.zip
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>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c9
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,
u32 status = IXGBE_ERR_PHY_ADDR_INVALID;
u8 databyte = 0xFF;
int i = 0;
- int ret_val = 0;
if (ee->len == 0)
return -EINVAL;
- for (i = ee->offset; i < ee->len; i++) {
+ for (i = ee->offset; i < ee->offset + ee->len; i++) {
/* I2C reads can take long time */
if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
return -EBUSY;
if (i < ETH_MODULE_SFF_8079_LEN)
- status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte);
+ status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte);
else
status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte);
if (status != 0)
- ret_val = -EIO;
+ return -EIO;
data[i - ee->offset] = databyte;
}
- return ret_val;
+ return 0;
}
static const struct ethtool_ops ixgbe_ethtool_ops = {