@@ -3261,8 +3261,7 @@ static s32 e1000_phy_igp_get_info(struct e1000_hw *hw,
32613261 return ret_val ;
32623262
32633263 phy_info -> mdix_mode =
3264- (e1000_auto_x_mode ) ((phy_data & IGP01E1000_PSSR_MDIX ) >>
3265- IGP01E1000_PSSR_MDIX_SHIFT );
3264+ (e1000_auto_x_mode )FIELD_GET (IGP01E1000_PSSR_MDIX , phy_data );
32663265
32673266 if ((phy_data & IGP01E1000_PSSR_SPEED_MASK ) ==
32683267 IGP01E1000_PSSR_SPEED_1000MBPS ) {
@@ -3273,11 +3272,11 @@ static s32 e1000_phy_igp_get_info(struct e1000_hw *hw,
32733272 if (ret_val )
32743273 return ret_val ;
32753274
3276- phy_info -> local_rx = (( phy_data & SR_1000T_LOCAL_RX_STATUS ) >>
3277- SR_1000T_LOCAL_RX_STATUS_SHIFT ) ?
3275+ phy_info -> local_rx = FIELD_GET ( SR_1000T_LOCAL_RX_STATUS ,
3276+ phy_data ) ?
32783277 e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok ;
3279- phy_info -> remote_rx = (( phy_data & SR_1000T_REMOTE_RX_STATUS ) >>
3280- SR_1000T_REMOTE_RX_STATUS_SHIFT ) ?
3278+ phy_info -> remote_rx = FIELD_GET ( SR_1000T_REMOTE_RX_STATUS ,
3279+ phy_data ) ?
32813280 e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok ;
32823281
32833282 /* Get cable length */
@@ -3327,14 +3326,12 @@ static s32 e1000_phy_m88_get_info(struct e1000_hw *hw,
33273326 return ret_val ;
33283327
33293328 phy_info -> extended_10bt_distance =
3330- ((phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE ) >>
3331- M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT ) ?
3329+ FIELD_GET (M88E1000_PSCR_10BT_EXT_DIST_ENABLE , phy_data ) ?
33323330 e1000_10bt_ext_dist_enable_lower :
33333331 e1000_10bt_ext_dist_enable_normal ;
33343332
33353333 phy_info -> polarity_correction =
3336- ((phy_data & M88E1000_PSCR_POLARITY_REVERSAL ) >>
3337- M88E1000_PSCR_POLARITY_REVERSAL_SHIFT ) ?
3334+ FIELD_GET (M88E1000_PSCR_POLARITY_REVERSAL , phy_data ) ?
33383335 e1000_polarity_reversal_disabled : e1000_polarity_reversal_enabled ;
33393336
33403337 /* Check polarity status */
@@ -3348,27 +3345,25 @@ static s32 e1000_phy_m88_get_info(struct e1000_hw *hw,
33483345 return ret_val ;
33493346
33503347 phy_info -> mdix_mode =
3351- (e1000_auto_x_mode ) ((phy_data & M88E1000_PSSR_MDIX ) >>
3352- M88E1000_PSSR_MDIX_SHIFT );
3348+ (e1000_auto_x_mode )FIELD_GET (M88E1000_PSSR_MDIX , phy_data );
33533349
33543350 if ((phy_data & M88E1000_PSSR_SPEED ) == M88E1000_PSSR_1000MBS ) {
33553351 /* Cable Length Estimation and Local/Remote Receiver Information
33563352 * are only valid at 1000 Mbps.
33573353 */
33583354 phy_info -> cable_length =
3359- (e1000_cable_length ) ((phy_data &
3360- M88E1000_PSSR_CABLE_LENGTH ) >>
3361- M88E1000_PSSR_CABLE_LENGTH_SHIFT );
3355+ (e1000_cable_length )FIELD_GET (M88E1000_PSSR_CABLE_LENGTH ,
3356+ phy_data );
33623357
33633358 ret_val = e1000_read_phy_reg (hw , PHY_1000T_STATUS , & phy_data );
33643359 if (ret_val )
33653360 return ret_val ;
33663361
3367- phy_info -> local_rx = (( phy_data & SR_1000T_LOCAL_RX_STATUS ) >>
3368- SR_1000T_LOCAL_RX_STATUS_SHIFT ) ?
3362+ phy_info -> local_rx = FIELD_GET ( SR_1000T_LOCAL_RX_STATUS ,
3363+ phy_data ) ?
33693364 e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok ;
3370- phy_info -> remote_rx = (( phy_data & SR_1000T_REMOTE_RX_STATUS ) >>
3371- SR_1000T_REMOTE_RX_STATUS_SHIFT ) ?
3365+ phy_info -> remote_rx = FIELD_GET ( SR_1000T_REMOTE_RX_STATUS ,
3366+ phy_data ) ?
33723367 e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok ;
33733368 }
33743369
@@ -3516,7 +3511,7 @@ s32 e1000_init_eeprom_params(struct e1000_hw *hw)
35163511 if (ret_val )
35173512 return ret_val ;
35183513 eeprom_size =
3519- ( eeprom_size & EEPROM_SIZE_MASK ) >> EEPROM_SIZE_SHIFT ;
3514+ FIELD_GET ( EEPROM_SIZE_MASK , eeprom_size ) ;
35203515 /* 256B eeprom size was not supported in earlier hardware, so we
35213516 * bump eeprom_size up one to ensure that "1" (which maps to
35223517 * 256B) is never the result used in the shifting logic below.
@@ -4892,8 +4887,7 @@ static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length,
48924887 & phy_data );
48934888 if (ret_val )
48944889 return ret_val ;
4895- cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH ) >>
4896- M88E1000_PSSR_CABLE_LENGTH_SHIFT ;
4890+ cable_length = FIELD_GET (M88E1000_PSSR_CABLE_LENGTH , phy_data );
48974891
48984892 /* Convert the enum value to ranged values */
48994893 switch (cable_length ) {
@@ -5002,8 +4996,7 @@ static s32 e1000_check_polarity(struct e1000_hw *hw,
50024996 & phy_data );
50034997 if (ret_val )
50044998 return ret_val ;
5005- * polarity = ((phy_data & M88E1000_PSSR_REV_POLARITY ) >>
5006- M88E1000_PSSR_REV_POLARITY_SHIFT ) ?
4999+ * polarity = FIELD_GET (M88E1000_PSSR_REV_POLARITY , phy_data ) ?
50075000 e1000_rev_polarity_reversed : e1000_rev_polarity_normal ;
50085001
50095002 } else if (hw -> phy_type == e1000_phy_igp ) {
@@ -5073,8 +5066,8 @@ static s32 e1000_check_downshift(struct e1000_hw *hw)
50735066 if (ret_val )
50745067 return ret_val ;
50755068
5076- hw -> speed_downgraded = ( phy_data & M88E1000_PSSR_DOWNSHIFT ) >>
5077- M88E1000_PSSR_DOWNSHIFT_SHIFT ;
5069+ hw -> speed_downgraded = FIELD_GET ( M88E1000_PSSR_DOWNSHIFT ,
5070+ phy_data ) ;
50785071 }
50795072
50805073 return E1000_SUCCESS ;
0 commit comments