Skip to contentSkip to conversation

e1000: clean up the checking logic

PATCH New Jεan Sacren 2 participants 10 messages Sep 19, 2015 – Oct 15, 2015

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

PATCH v2 1/8 e1000: clean up the checking logic

From: Jean Sacren <[email protected]>

The checking logic needed some clean-up work, so we rewrite it by checking for break first. With that change in place, we can even move the second check for goto statement outside of the loop.

As this is merely a cleanup, no functional change is involved. The questionable 'tmp != 0xFF' is intentionally left alone.

Mark Rustad and Alexander Duyck contributed to this patch.

Cc "Rustad, Mark D" <[email protected]>
Cc Alexander Duyck <[email protected]>

---
v2:

1) Update the changelog to reflect the rewrite of the checking logic and others' contributions;
2) Update the changelog title accordingly;
3) Add credits and cc the pertinent parties.

 drivers/net/ethernet/intel/e1000/e1000_main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +5 -5
index 97e38cee649f..5ba8d13a068c 100644
@@ -1199,13 +1199,13 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		for (i = 0; i < 32; i++) {
 			hw->phy_addr = i;
 			e1000_read_phy_reg(hw, PHY_ID2, &tmp);
-			if (tmp == 0 || tmp == 0xFF) {
-				if (i == 31)
-					goto err_eeprom;
-				continue;
-			} else
+
+			if (tmp != 0 && tmp != 0xFF)
 				break;
 		}
+
+		if (i >= 32)
+			goto err_eeprom;
 	}
 
 	/* reset the hardware with the new settings */
#1 lore raw

PATCH v2 2/8 e1000: fix a typo in the comment

From: Jean Sacren <[email protected]>

Use 'That' to replace 'The' so that the comment would make sense.

---
v2: No changes.

 drivers/net/ethernet/intel/e1000/e1000_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +1 -1
index 5ba8d13a068c..36d1d48a9c60 100644
@@ -1263,7 +1263,7 @@ err_pci_reg:
  * @pdev: PCI device information struct
  *
  * e1000_remove is called by the PCI subsystem to alert the driver
- * that it should release a PCI device.  The could be caused by a
+ * that it should release a PCI device. That could be caused by a
  * Hot-Plug event, or because the driver is going to be removed from
  * memory.
  **/
#2 lore raw

PATCH v2 3/8 e1000e: clean up the local variable

In reply to Jεan Sacren

From: Jean Sacren <[email protected]>

The local variable 'ret' doesn't serve much purpose so we might as well clean it up.

---
v2: No changes.

 drivers/net/ethernet/intel/e1000e/netdev.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +1 -4
index 7be339eb9927..a501e7744597 100644
@@ -7504,14 +7504,11 @@ static struct pci_driver e1000_driver = {
  **/
 static int __init e1000_init_module(void)
 {
-	int ret;
-
 	pr_info("Intel(R) PRO/1000 Network Driver - %s\n",
 		e1000e_driver_version);
 	pr_info("Copyright(c) 1999 - 2015 Intel Corporation.\n");
-	ret = pci_register_driver(&e1000_driver);
 
-	return ret;
+	return pci_register_driver(&e1000_driver);
 }
 module_init(e1000_init_module);
 
#3 lore raw

PATCH v2 4/8 i40e: fix kernel-doc argument name

In reply to Jεan Sacren

From: Jean Sacren <[email protected]>

The second argument name in the kernel-doc argument list for i40e_features_check() was slightly off. Fix it for the kernel doc.

---
v2: No changes.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index 8707a2e5696e..2d8c0cc23fcf 100644
@@ -8498,7 +8498,7 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 /**
  * i40e_features_check - Validate encapsulated packet conforms to limits
  * @skb: skb buff
- * @netdev: This physical port's netdev
+ * @dev: This physical port's netdev
  * @features: Offload features that the stack believes apply
  **/
 static netdev_features_t i40e_features_check(struct sk_buff *skb,
#4 lore raw

PATCH v2 4/8 i40e: fix kernel-doc argument name

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jean Sacren
Sent: Saturday, September 19, 2015 4:09 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next-queue v2 4/8] i40e: fix kernel-doc argument name

From: Jean Sacren <[email protected]>

The second argument name in the kernel-doc argument list for i40e_features_check() was slightly off. Fix it for the kernel doc.

Quoted 6 lines

---
v2: No changes.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch code changes correctly applied

#5 lore raw

PATCH v2 5/8 ixgbe: fix multiple kernel-doc errors

In reply to Jεan Sacren

From: Jean Sacren <[email protected]>

The commit dfaf891dd3e1 ("ixgbe: Refactor the RSS configuration code") introduced a few kernel-doc errors:

1) The function name is missing;
2) The format is wrong;
3) The short description is redundant.

Fix all the above for the correct execution of the kernel doc.

---
v2: No changes.

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -6
index 708957c75936..e60e969c1c78 100644
@@ -3308,8 +3308,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
 }
 
 /**
- * Return a number of entries in the RSS indirection table
- *
+ * ixgbe_rss_indir_tbl_entries - Return RSS indirection table entries
  * @adapter: device handle
  *
  *  - 82598/82599/X540:     128
@@ -3327,8 +3326,7 @@ u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
 }
 
 /**
- * Write the RETA table to HW
- *
+ * ixgbe_store_reta - Write the RETA table to HW
  * @adapter: device handle
  *
  * Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
@@ -3367,8 +3365,7 @@ void ixgbe_store_reta(struct ixgbe_adapter *adapter)
 }
 
 /**
- * Write the RETA table to HW (for x550 devices in SRIOV mode)
- *
+ * ixgbe_store_vfreta - Write the RETA table to HW (x550 devices in SRIOV mode)
  * @adapter: device handle
  *
  * Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
#6 lore raw

PATCH v2 6/8 i40e: declare rather than initialize int object

In reply to Jεan Sacren

From: Jean Sacren <[email protected]>

'err' would be overwritten immediately, so we should declare it only rather than initialize it to zero.

---
v2: No changes.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index 2d8c0cc23fcf..7551732a2b52 100644
@@ -10140,7 +10140,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	static u16 pfs_found;
 	u16 wol_nvm_bits;
 	u16 link_status;
-	int err = 0;
+	int err;
 	u32 len;
 	u32 i;
 
#7 lore raw

PATCH v2 6/8 i40e: declare rather than initialize int object

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jean Sacren
Sent: Saturday, September 19, 2015 4:09 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next-queue v2 6/8] i40e: declare rather than initialize int object

From: Jean Sacren <[email protected]>

'err' would be overwritten immediately, so we should declare it only rather than initialize it to zero.

Quoted 6 lines

---
v2: No changes.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Code changes present in tree

#8 lore raw

PATCH v2 7/8 e1000: fix kernel-doc argument being missing

In reply to Jεan Sacren

From: Jean Sacren <[email protected]>

Due to historical reason, 'phy_data' has never been included in the kernel doc. Fix it so that the requirement could be fulfilled.

---
v2: No changes.

 drivers/net/ethernet/intel/e1000/e1000_hw.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/e1000/e1000_hw.c +1 -0
index 59d1769d4816..dbae55e926e7 100644
@@ -2806,6 +2806,7 @@ static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw)
  * e1000_read_phy_reg - read a phy register
  * @hw: Struct containing variables accessed by shared code
  * @reg_addr: address of the PHY register to read
+ * @phy_data: pointer to the value on the PHY register
  *
  * Reads the value from a PHY register, if the value is on a specific non zero
  * page, sets the page first.
#9 lore raw

PATCH v2 8/8 e1000: get rid of duplicate exit path

In reply to Jεan Sacren

From: Jean Sacren <[email protected]>

By using goto statement, we can achieve sharing the same exit path so that code duplication could be minimized.

---
v2: No changes.

 drivers/net/ethernet/intel/e1000/e1000_hw.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_hw.c +3 -4
index dbae55e926e7..9c06456759e9 100644
@@ -2822,14 +2822,13 @@ s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 *phy_data)
 	    (reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
 		ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
 						 (u16) reg_addr);
-		if (ret_val) {
-			spin_unlock_irqrestore(&e1000_phy_lock, flags);
-			return ret_val;
-		}
+		if (ret_val)
+			goto out;
 	}
 
 	ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr,
 					phy_data);
+out:
 	spin_unlock_irqrestore(&e1000_phy_lock, flags);
 
 	return ret_val;