Skip to contentSkip to conversation

net: wireless: iwlwifi: remove minor dead code

PATCH In review Michal Nazarewicz 5 participants 7 messages Nov 10, 2013 – Nov 12, 2013

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

PATCH 1/1 net: wireless: iwlwifi: remove minor dead code

From: Michal Nazarewicz <[email protected]>

inta is checked to be zero in a IRQ_NONE branch so afterwards it cannot be zero as it is never modified.

---
 drivers/net/wireless/iwlwifi/pcie/rx.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/net/wireless/iwlwifi/pcie/rx.c +8 -15
index 3f237b4..c32122a 100644
@@ -1121,7 +1121,6 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	struct iwl_trans *trans = data;
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	u32 inta, inta_mask;
-	irqreturn_t ret = IRQ_NONE;
 
 	lockdep_assert_held(&trans_pcie->irq_lock);
 
@@ -1150,7 +1149,13 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	 * or due to sporadic interrupts thrown from our NIC. */
 	if (!inta) {
 		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
-		goto none;
+		/* re-enable interrupts here since we don't have anything to
+		 * service.  only Re-enable if disabled by irq and no
+		 * schedules tasklet. */
+		if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
+		    !trans_pcie->inta)
+			iwl_enable_interrupts(trans);
+		return IRQ_NONE;
 	}
 
 	if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
@@ -1168,19 +1173,7 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 
 	trans_pcie->inta |= inta;
 	/* the thread will service interrupts and re-enable them */
-	if (likely(inta))
-		return IRQ_WAKE_THREAD;
-
-	ret = IRQ_HANDLED;
-
-none:
-	/* re-enable interrupts here since we don't have anything to service. */
-	/* only Re-enable if disabled by irq  and no schedules tasklet. */
-	if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
-	    !trans_pcie->inta)
-		iwl_enable_interrupts(trans);
-
-	return ret;
+	return IRQ_WAKE_THREAD;
 }
 
 /* interrupt handler using ict table, with this interrupt driver will
Signature · 1 line
1.8.3.2
#1 lore raw

Hello.

Quoted 14 lines · Michal Nazarewicz

From: Michal Nazarewicz <[email protected]>

inta is checked to be zero in a IRQ_NONE branch so afterwards it cannot be zero as it is never modified.

---
  drivers/net/wireless/iwlwifi/pcie/rx.c | 23 ++++++++---------------
  1 file changed, 8 insertions(+), 15 deletions(-)
drivers/net/wireless/iwlwifi/pcie/rx.c +0 -0
index 3f237b4..c32122a 100644

[...]

drivers/net/wireless/iwlwifi/pcie/rx.c static irqreturn_t iwl_pcie_isr(int irq, void *data) · line 1154

Quoted 8 lines
drivers/net/wireless/iwlwifi/pcie/rx.c +3 -1
@@ -1150,7 +1149,13 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
  	 * or due to sporadic interrupts thrown from our NIC. */
  	if (!inta) {
  		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
-		goto none;
+		/* re-enable interrupts here since we don't have anything to
+		 * service.  only Re-enable if disabled by irq and no
+		 * schedules tasklet. */

The preferred way of formatting the multi-line comments in the networking
code is this:

/* bla
* bla
*/

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH v2 1/1 net: wireless: iwlwifi: remove minor dead code

inta is checked to be zero in a IRQ_NONE branch so afterwards it cannot be zero as it is never modified.

---
 drivers/net/wireless/iwlwifi/pcie/rx.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
Quoted 6 lines · Sergei Shtylyov

The preferred way of formatting the multi-line comments in the networking code is this:

/* bla
* bla
*/

Works for me. I used /* bla \n * bla */ because this is what the rest of this function was using.

drivers/net/wireless/iwlwifi/pcie/rx.c +9 -15
index 3f237b4..7d0fdc0 100644
@@ -1121,7 +1121,6 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	struct iwl_trans *trans = data;
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	u32 inta, inta_mask;
-	irqreturn_t ret = IRQ_NONE;
 
 	lockdep_assert_held(&trans_pcie->irq_lock);
 
@@ -1150,7 +1149,14 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	 * or due to sporadic interrupts thrown from our NIC. */
 	if (!inta) {
 		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
-		goto none;
+		/* re-enable interrupts here since we don't have anything to
+		 * service.  only Re-enable if disabled by irq and no
+		 * schedules tasklet.
+		 */
+		if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
+		    !trans_pcie->inta)
+			iwl_enable_interrupts(trans);
+		return IRQ_NONE;
 	}
 
 	if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
@@ -1168,19 +1174,7 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 
 	trans_pcie->inta |= inta;
 	/* the thread will service interrupts and re-enable them */
-	if (likely(inta))
-		return IRQ_WAKE_THREAD;
-
-	ret = IRQ_HANDLED;
-
-none:
-	/* re-enable interrupts here since we don't have anything to service. */
-	/* only Re-enable if disabled by irq  and no schedules tasklet. */
-	if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
-	    !trans_pcie->inta)
-		iwl_enable_interrupts(trans);
-
-	return ret;
+	return IRQ_WAKE_THREAD;
 }
 
 /* interrupt handler using ict table, with this interrupt driver will
Signature · 1 line
1.8.3.2
maintainer
#3 lore raw
Quoted 2 lines · Michal Nazarewicz

inta is checked to be zero in a IRQ_NONE branch so afterwards it cannot be zero as it is never modified.

no signed-off-by

drivers/net/wireless/iwlwifi/pcie/rx.c static irqreturn_t iwl_pcie_isr(int irq, void *data) · line 1159

Quoted 13 lines
drivers/net/wireless/iwlwifi/pcie/rx.c +8 -1
@@ -1150,7 +1149,14 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	 * or due to sporadic interrupts thrown from our NIC. */
 	if (!inta) {
 		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
-		goto none;
+		/* re-enable interrupts here since we don't have anything to
+		 * service.  only Re-enable if disabled by irq and no
+		 * schedules tasklet.
+		 */
+		if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
+		    !trans_pcie->inta)
+			iwl_enable_interrupts(trans);
+		return IRQ_NONE;

I don't really think duplicating this is really an improvement?

johannes

maintainer
#4 lore raw
Quoted 7 lines · Johannes Berg
Quoted 7 lines
drivers/net/wireless/iwlwifi/pcie/rx.c +2 -1
@@ -1150,7 +1149,14 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	 * or due to sporadic interrupts thrown from our NIC. */
 	if (!inta) {
 		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
-		goto none;
+		/* re-enable interrupts here since we don't have anything to
+		 * service.  only Re-enable if disabled by irq and no
Quoted 8 lines

drivers/net/wireless/iwlwifi/pcie/rx.c static irqreturn_t iwl_pcie_isr(int irq, void *data) · line 1159

Quoted 6 lines
drivers/net/wireless/iwlwifi/pcie/rx.c +6 -0
+		 * schedules tasklet.
+		 */
+		if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
+		    !trans_pcie->inta)
+			iwl_enable_interrupts(trans);
+		return IRQ_NONE;

I don't really think duplicating this is really an improvement?

Err, sorry, not paying attention.

johannes

#5 lore raw
In reply to Johannes Berg

inta is checked to be zero in a IRQ_NONE branch so afterwards it cannot be zero as it is never modified.

---
 drivers/net/wireless/iwlwifi/pcie/rx.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
Quoted 1 line · Johannes Berg

no signed-off-by

Sorry, fixed. Interestingly, I did not forget about it in my first patch.

drivers/net/wireless/iwlwifi/pcie/rx.c +9 -15
index 3f237b4..7d0fdc0 100644
@@ -1121,7 +1121,6 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	struct iwl_trans *trans = data;
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	u32 inta, inta_mask;
-	irqreturn_t ret = IRQ_NONE;
 
 	lockdep_assert_held(&trans_pcie->irq_lock);
 
@@ -1150,7 +1149,14 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 	 * or due to sporadic interrupts thrown from our NIC. */
 	if (!inta) {
 		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
-		goto none;
+		/* re-enable interrupts here since we don't have anything to
+		 * service.  only Re-enable if disabled by irq and no
+		 * schedules tasklet.
+		 */
+		if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
+		    !trans_pcie->inta)
+			iwl_enable_interrupts(trans);
+		return IRQ_NONE;
 	}
 
 	if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
@@ -1168,19 +1174,7 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
 
 	trans_pcie->inta |= inta;
 	/* the thread will service interrupts and re-enable them */
-	if (likely(inta))
-		return IRQ_WAKE_THREAD;
-
-	ret = IRQ_HANDLED;
-
-none:
-	/* re-enable interrupts here since we don't have anything to service. */
-	/* only Re-enable if disabled by irq  and no schedules tasklet. */
-	if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
-	    !trans_pcie->inta)
-		iwl_enable_interrupts(trans);
-
-	return ret;
+	return IRQ_WAKE_THREAD;
 }
 
 /* interrupt handler using ict table, with this interrupt driver will
Signature · 1 line
1.8.3.2
#6 lore raw
Quoted 4 lines · Michal Nazarewicz

inta is checked to be zero in a IRQ_NONE branch so afterwards it cannot be zero as it is never modified.

Quoted 9 lines
---
 drivers/net/wireless/iwlwifi/pcie/rx.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
Quoted 1 line · Johannes Berg

no signed-off-by

Sorry, fixed. Interestingly, I did not forget about it in my first patch.

no worries - I picked it up in our internal tree.
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html