]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/e1000e/ethtool.c
Merge branch 'ec' into test
[linux-2.6-omap-h63xx.git] / drivers / net / e1000e / ethtool.c
index cf9679f2b7c41fc94906f81872f452bdf9750b71..33a3ff17b5d07d80556dd394efed6d692f7faf05 100644 (file)
@@ -177,7 +177,7 @@ static u32 e1000_get_link(struct net_device *netdev)
        u32 status;
        
        status = er32(STATUS);
-       return (status & E1000_STATUS_LU);
+       return (status & E1000_STATUS_LU) ? 1 : 0;
 }
 
 static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
@@ -432,6 +432,10 @@ static void e1000_get_regs(struct net_device *netdev,
        regs_buff[11] = er32(TIDV);
 
        regs_buff[12] = adapter->hw.phy.type;  /* PHY type (IGP=1, M88=0) */
+
+       /* ethtool doesn't use anything past this point, so all this
+        * code is likely legacy junk for apps that may or may not
+        * exist */
        if (hw->phy.type == e1000_phy_m88) {
                e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
                regs_buff[13] = (u32)phy_data; /* cable length */
@@ -447,7 +451,7 @@ static void e1000_get_regs(struct net_device *netdev,
                regs_buff[22] = adapter->phy_stats.receive_errors;
                regs_buff[23] = regs_buff[13]; /* mdix mode */
        }
-       regs_buff[21] = adapter->phy_stats.idle_errors;  /* phy idle errors */
+       regs_buff[21] = 0; /* was idle_errors */
        e1e_rphy(hw, PHY_1000T_STATUS, &phy_data);
        regs_buff[24] = (u32)phy_data;  /* phy local receiver status */
        regs_buff[25] = regs_buff[24];  /* phy remote receiver status */
@@ -529,6 +533,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
        if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16)))
                return -EFAULT;
 
+       if (adapter->flags & FLAG_READ_ONLY_NVM)
+               return -EINVAL;
+
        max_len = hw->nvm.word_size * 2;
 
        first_word = eeprom->offset >> 1;