e1000e: cleanup SPACING checkpatch checks
[pandora-kernel.git] / drivers / net / ethernet / intel / e1000e / phy.c
index 0930c13..50e84ed 100644 (file)
@@ -175,7 +175,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
                e_dbg("MDI Error\n");
                return -E1000_ERR_PHY;
        }
-       *data = (u16) mdic;
+       *data = (u16)mdic;
 
        /* Allow some time after each MDIC transaction to avoid
         * reading duplicate data in the next MDIC transaction.
@@ -324,7 +324,7 @@ s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page)
  *  semaphores before exiting.
  **/
 static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data,
-                                    bool locked)
+                                    bool locked)
 {
        s32 ret_val = 0;
 
@@ -391,7 +391,7 @@ s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data)
  *  at the offset.  Release any acquired semaphores before exiting.
  **/
 static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data,
-                                     bool locked)
+                                     bool locked)
 {
        s32 ret_val = 0;
 
@@ -410,8 +410,7 @@ static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data,
                                                    (u16)offset);
        if (!ret_val)
                ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS &
-                                                       offset,
-                                                   data);
+                                                   offset, data);
        if (!locked)
                hw->phy.ops.release(hw);
 
@@ -458,7 +457,7 @@ s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data)
  *  Release any acquired semaphores before exiting.
  **/
 static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data,
-                                 bool locked)
+                                bool locked)
 {
        u32 kmrnctrlsta;
 
@@ -531,7 +530,7 @@ s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data)
  *  before exiting.
  **/
 static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data,
-                                  bool locked)
+                                 bool locked)
 {
        u32 kmrnctrlsta;
 
@@ -1296,7 +1295,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
                e_dbg("Waiting for forced speed/duplex link on M88 phy.\n");
 
                ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
-                                                    100000, &link);
+                                                     100000, &link);
                if (ret_val)
                        return ret_val;
 
@@ -1319,7 +1318,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
 
                /* Try once more */
                ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
-                                                    100000, &link);
+                                                     100000, &link);
                if (ret_val)
                        return ret_val;
        }
@@ -1609,9 +1608,9 @@ s32 e1000_check_polarity_m88(struct e1000_hw *hw)
        ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &data);
 
        if (!ret_val)
-               phy->cable_polarity = (data & M88E1000_PSSR_REV_POLARITY)
-                                     ? e1000_rev_polarity_reversed
-                                     : e1000_rev_polarity_normal;
+               phy->cable_polarity = ((data & M88E1000_PSSR_REV_POLARITY)
+                                      ? e1000_rev_polarity_reversed
+                                      : e1000_rev_polarity_normal);
 
        return ret_val;
 }
@@ -1653,9 +1652,9 @@ s32 e1000_check_polarity_igp(struct e1000_hw *hw)
        ret_val = e1e_rphy(hw, offset, &data);
 
        if (!ret_val)
-               phy->cable_polarity = (data & mask)
-                                     ? e1000_rev_polarity_reversed
-                                     : e1000_rev_polarity_normal;
+               phy->cable_polarity = ((data & mask)
+                                      ? e1000_rev_polarity_reversed
+                                      : e1000_rev_polarity_normal);
 
        return ret_val;
 }
@@ -1685,9 +1684,9 @@ s32 e1000_check_polarity_ife(struct e1000_hw *hw)
        ret_val = e1e_rphy(hw, offset, &phy_data);
 
        if (!ret_val)
-               phy->cable_polarity = (phy_data & mask)
-                                      ? e1000_rev_polarity_reversed
-                                      : e1000_rev_polarity_normal;
+               phy->cable_polarity = ((phy_data & mask)
+                                      ? e1000_rev_polarity_reversed
+                                      : e1000_rev_polarity_normal);
 
        return ret_val;
 }
@@ -1733,7 +1732,7 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
  *  Polls the PHY status register for link, 'iterations' number of times.
  **/
 s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
-                              u32 usec_interval, bool *success)
+                               u32 usec_interval, bool *success)
 {
        s32 ret_val = 0;
        u16 i, phy_status;
@@ -1756,7 +1755,7 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
                if (phy_status & BMSR_LSTATUS)
                        break;
                if (usec_interval >= 1000)
-                       mdelay(usec_interval/1000);
+                       mdelay(usec_interval / 1000);
                else
                        udelay(usec_interval);
        }
@@ -1791,8 +1790,8 @@ s32 e1000e_get_cable_length_m88(struct e1000_hw *hw)
        if (ret_val)
                return ret_val;
 
-       index = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >>
-               M88E1000_PSSR_CABLE_LENGTH_SHIFT;
+       index = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >>
+                M88E1000_PSSR_CABLE_LENGTH_SHIFT);
 
        if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1)
                return -E1000_ERR_PHY;
@@ -1824,10 +1823,10 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)
        u16 cur_agc_index, max_agc_index = 0;
        u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1;
        static const u16 agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = {
-              IGP02E1000_PHY_AGC_A,
-              IGP02E1000_PHY_AGC_B,
-              IGP02E1000_PHY_AGC_C,
-              IGP02E1000_PHY_AGC_D
+               IGP02E1000_PHY_AGC_A,
+               IGP02E1000_PHY_AGC_B,
+               IGP02E1000_PHY_AGC_C,
+               IGP02E1000_PHY_AGC_D
        };
 
        /* Read the AGC registers for all channels */
@@ -1841,8 +1840,8 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)
                 * that can be put into the lookup table to obtain the
                 * approximate cable length.
                 */
-               cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
-                               IGP02E1000_AGC_LENGTH_MASK;
+               cur_agc_index = ((phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
+                                IGP02E1000_AGC_LENGTH_MASK);
 
                /* Array index bound check. */
                if ((cur_agc_index >= IGP02E1000_CABLE_LENGTH_TABLE_SIZE) ||
@@ -1865,8 +1864,8 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)
        agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2);
 
        /* Calculate cable length with the error range of +/- 10 meters. */
-       phy->min_cable_length = ((agc_value - IGP02E1000_AGC_RANGE) > 0) ?
-                                (agc_value - IGP02E1000_AGC_RANGE) : 0;
+       phy->min_cable_length = (((agc_value - IGP02E1000_AGC_RANGE) > 0) ?
+                                (agc_value - IGP02E1000_AGC_RANGE) : 0);
        phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE;
 
        phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2;
@@ -2040,9 +2039,9 @@ s32 e1000_get_phy_info_ife(struct e1000_hw *hw)
                        return ret_val;
        } else {
                /* Polarity is forced */
-               phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY)
-                                     ? e1000_rev_polarity_reversed
-                                     : e1000_rev_polarity_normal;
+               phy->cable_polarity = ((data & IFE_PSC_FORCE_POLARITY)
+                                      ? e1000_rev_polarity_reversed
+                                      : e1000_rev_polarity_normal);
        }
 
        ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data);
@@ -2375,13 +2374,13 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
 
                /* Page is shifted left, PHY expects (page x 32) */
                ret_val = e1000e_write_phy_reg_mdic(hw, page_select,
-                                                   (page << page_shift));
+                                                   (page << page_shift));
                if (ret_val)
                        goto release;
        }
 
        ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
-                                           data);
+                                           data);
 
 release:
        hw->phy.ops.release(hw);
@@ -2433,13 +2432,13 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
 
                /* Page is shifted left, PHY expects (page x 32) */
                ret_val = e1000e_write_phy_reg_mdic(hw, page_select,
-                                                   (page << page_shift));
+                                                   (page << page_shift));
                if (ret_val)
                        goto release;
        }
 
        ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
-                                          data);
+                                          data);
 release:
        hw->phy.ops.release(hw);
        return ret_val;
@@ -2674,7 +2673,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
        if (read) {
                /* Read the Wakeup register page value using opcode 0x12 */
                ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE,
-                                                  data);
+                                                  data);
        } else {
                /* Write the Wakeup register page value using opcode 0x12 */
                ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE,
@@ -2763,7 +2762,7 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
 
        if (page > 0 && page < HV_INTC_FC_PAGE_START) {
                ret_val = e1000_access_phy_debug_regs_hv(hw, offset,
-                                                        data, true);
+                                                        data, true);
                goto out;
        }
 
@@ -2786,8 +2785,7 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
        e_dbg("reading PHY page %d (or 0x%x shifted) reg 0x%x\n", page,
              page << IGP_PAGE_SHIFT, reg);
 
-       ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
-                                         data);
+       ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, data);
 out:
        if (!locked)
                hw->phy.ops.release(hw);
@@ -2871,7 +2869,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
 
        if (page > 0 && page < HV_INTC_FC_PAGE_START) {
                ret_val = e1000_access_phy_debug_regs_hv(hw, offset,
-                                                        &data, false);
+                                                        &data, false);
                goto out;
        }
 
@@ -2910,7 +2908,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
              page << IGP_PAGE_SHIFT, reg);
 
        ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
-                                         data);
+                                           data);
 
 out:
        if (!locked)
@@ -2988,15 +2986,15 @@ static u32 e1000_get_phy_addr_for_hv_page(u32 page)
  *  These accesses done with PHY address 2 and without using pages.
  **/
 static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
-                                          u16 *data, bool read)
+                                         u16 *data, bool read)
 {
        s32 ret_val;
        u32 addr_reg;
        u32 data_reg;
 
        /* This takes care of the difference with desktop vs mobile phy */
-       addr_reg = (hw->phy.type == e1000_phy_82578) ?
-                  I82578_ADDR_REG : I82577_ADDR_REG;
+       addr_reg = ((hw->phy.type == e1000_phy_82578) ?
+                   I82578_ADDR_REG : I82577_ADDR_REG);
        data_reg = addr_reg + 1;
 
        /* All operations in this function are phy address 2 */
@@ -3050,8 +3048,8 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw)
        if (ret_val)
                return ret_val;
 
-       data &= BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED |
-               BM_CS_STATUS_SPEED_MASK;
+       data &= (BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED |
+                BM_CS_STATUS_SPEED_MASK);
 
        if (data != (BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED |
                     BM_CS_STATUS_SPEED_1000))
@@ -3086,9 +3084,9 @@ s32 e1000_check_polarity_82577(struct e1000_hw *hw)
        ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data);
 
        if (!ret_val)
-               phy->cable_polarity = (data & I82577_PHY_STATUS2_REV_POLARITY)
-                                     ? e1000_rev_polarity_reversed
-                                     : e1000_rev_polarity_normal;
+               phy->cable_polarity = ((data & I82577_PHY_STATUS2_REV_POLARITY)
+                                      ? e1000_rev_polarity_reversed
+                                      : e1000_rev_polarity_normal);
 
        return ret_val;
 }
@@ -3215,8 +3213,8 @@ s32 e1000_get_cable_length_82577(struct e1000_hw *hw)
        if (ret_val)
                return ret_val;
 
-       length = (phy_data & I82577_DSTATUS_CABLE_LENGTH) >>
-                I82577_DSTATUS_CABLE_LENGTH_SHIFT;
+       length = ((phy_data & I82577_DSTATUS_CABLE_LENGTH) >>
+                 I82577_DSTATUS_CABLE_LENGTH_SHIFT);
 
        if (length == E1000_CABLE_LENGTH_UNDEFINED)
                return -E1000_ERR_PHY;