forked from Minki/linux
igb: simplify and clean up igb_enable_mas()
igb_enable_mas() should only be called for the 82575 and has no clear return so changing it to void. Also simplify the odd conditional expression. Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
4256af62c4
commit
8cfb879d1b
@ -1834,31 +1834,19 @@ void igb_reinit_locked(struct igb_adapter *adapter)
|
|||||||
*
|
*
|
||||||
* @adapter: adapter struct
|
* @adapter: adapter struct
|
||||||
**/
|
**/
|
||||||
static s32 igb_enable_mas(struct igb_adapter *adapter)
|
static void igb_enable_mas(struct igb_adapter *adapter)
|
||||||
{
|
{
|
||||||
struct e1000_hw *hw = &adapter->hw;
|
struct e1000_hw *hw = &adapter->hw;
|
||||||
u32 connsw;
|
u32 connsw = rd32(E1000_CONNSW);
|
||||||
s32 ret_val = 0;
|
|
||||||
|
|
||||||
connsw = rd32(E1000_CONNSW);
|
|
||||||
if (!(hw->phy.media_type == e1000_media_type_copper))
|
|
||||||
return ret_val;
|
|
||||||
|
|
||||||
/* configure for SerDes media detect */
|
/* configure for SerDes media detect */
|
||||||
if (!(connsw & E1000_CONNSW_SERDESD)) {
|
if ((hw->phy.media_type == e1000_media_type_copper) &&
|
||||||
|
(!(connsw & E1000_CONNSW_SERDESD))) {
|
||||||
connsw |= E1000_CONNSW_ENRGSRC;
|
connsw |= E1000_CONNSW_ENRGSRC;
|
||||||
connsw |= E1000_CONNSW_AUTOSENSE_EN;
|
connsw |= E1000_CONNSW_AUTOSENSE_EN;
|
||||||
wr32(E1000_CONNSW, connsw);
|
wr32(E1000_CONNSW, connsw);
|
||||||
wrfl();
|
wrfl();
|
||||||
} else if (connsw & E1000_CONNSW_SERDESD) {
|
|
||||||
/* already SerDes, no need to enable anything */
|
|
||||||
return ret_val;
|
|
||||||
} else {
|
|
||||||
netdev_info(adapter->netdev,
|
|
||||||
"MAS: Unable to configure feature, disabling..\n");
|
|
||||||
adapter->flags &= ~IGB_FLAG_MAS_ENABLE;
|
|
||||||
}
|
}
|
||||||
return ret_val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void igb_reset(struct igb_adapter *adapter)
|
void igb_reset(struct igb_adapter *adapter)
|
||||||
@ -1978,10 +1966,9 @@ void igb_reset(struct igb_adapter *adapter)
|
|||||||
adapter->ei.get_invariants(hw);
|
adapter->ei.get_invariants(hw);
|
||||||
adapter->flags &= ~IGB_FLAG_MEDIA_RESET;
|
adapter->flags &= ~IGB_FLAG_MEDIA_RESET;
|
||||||
}
|
}
|
||||||
if (adapter->flags & IGB_FLAG_MAS_ENABLE) {
|
if ((mac->type == e1000_82575) &&
|
||||||
if (igb_enable_mas(adapter))
|
(adapter->flags & IGB_FLAG_MAS_ENABLE)) {
|
||||||
dev_err(&pdev->dev,
|
igb_enable_mas(adapter);
|
||||||
"Error enabling Media Auto Sense\n");
|
|
||||||
}
|
}
|
||||||
if (hw->mac.ops.init_hw(hw))
|
if (hw->mac.ops.init_hw(hw))
|
||||||
dev_err(&pdev->dev, "Hardware Error\n");
|
dev_err(&pdev->dev, "Hardware Error\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user