Skip to contentSkip to conversation

igb: simplify and clean up igb_enable_mas()

PATCH New Todd Fujinaka 3 participants 3 messages Apr 3, 2015 – Apr 16, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
v2: made igb_enable_mas() static based on feedback from automated testing

---
 drivers/net/ethernet/intel/igb/igb_main.c |   27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +7 -20
index 8457d03..e636646 100644
@@ -1834,31 +1834,19 @@ void igb_reinit_locked(struct igb_adapter *adapter)
  *
  * @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;
-	u32 connsw;
-	s32 ret_val = 0;
-
-	connsw = rd32(E1000_CONNSW);
-	if (!(hw->phy.media_type == e1000_media_type_copper))
-		return ret_val;
+	u32 connsw = rd32(E1000_CONNSW);
 
 	/* 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_AUTOSENSE_EN;
 		wr32(E1000_CONNSW, connsw);
 		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)
@@ -1978,10 +1966,9 @@ void igb_reset(struct igb_adapter *adapter)
 		adapter->ei.get_invariants(hw);
 		adapter->flags &= ~IGB_FLAG_MEDIA_RESET;
 	}
-	if (adapter->flags & IGB_FLAG_MAS_ENABLE) {
-		if (igb_enable_mas(adapter))
-			dev_err(&pdev->dev,
-				"Error enabling Media Auto Sense\n");
+	if ((mac->type == e1000_82575) &&
+	    (adapter->flags & IGB_FLAG_MAS_ENABLE)) {
+		igb_enable_mas(adapter);
 	}
 	if (hw->mac.ops.init_hw(hw))
 		dev_err(&pdev->dev, "Hardware Error\n");
Applied
#1 lore raw

PATCH v2 1/1 igb: simplify and clean up igb_enable_mas()

Quoted 7 lines · Todd Fujinaka

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.

Quoted 7 lines

---
v2: made igb_enable_mas() static based on feedback from automated testing

---
 drivers/net/ethernet/intel/igb/igb_main.c |   27
+++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

I have applied your patch to my queue.

Signature · 9 lines
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git
dev-queue
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20150403/e7f747cc/attachment.asc>
#2 lore raw

PATCH v2 1/1 igb: simplify and clean up igb_enable_mas()

In reply to Todd Fujinaka
Quoted 12 lines

From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Todd Fujinaka
Sent: Friday, April 03, 2015 1:52 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [net-next v2] 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.

Quoted 8 lines

---
v2: made igb_enable_mas() static based on feedback from automated testing

---
 drivers/net/ethernet/intel/igb/igb_main.c |   27 +++++++-----------------
---
 1 file changed, 7 insertions(+), 20 deletions(-)