linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: wireless: iwlwifi: remove minor dead code
@ 2013-11-10 19:06 Michal Nazarewicz
  2013-11-10 19:15 ` Sergei Shtylyov
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Nazarewicz @ 2013-11-10 19:06 UTC (permalink / raw)
  To: Johannes Berg, Emmanuel Grumbach, John W. Linville
  Cc: Intel Linux Wireless, linux-wireless, netdev, linux-kernel,
	Michal Nazarewicz

From: Michal Nazarewicz <mina86@mina86.com>

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

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 drivers/net/wireless/iwlwifi/pcie/rx.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index 3f237b4..c32122a 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -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
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] net: wireless: iwlwifi: remove minor dead code
  2013-11-10 19:06 [PATCH] net: wireless: iwlwifi: remove minor dead code Michal Nazarewicz
@ 2013-11-10 19:15 ` Sergei Shtylyov
  2013-11-10 20:17   ` [PATCHv2] " Michal Nazarewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2013-11-10 19:15 UTC (permalink / raw)
  To: Michal Nazarewicz, Johannes Berg, Emmanuel Grumbach, John W. Linville
  Cc: Intel Linux Wireless, linux-wireless, netdev, linux-kernel,
	Michal Nazarewicz

Hello.

On 10-11-2013 23:06, Michal Nazarewicz wrote:

> From: Michal Nazarewicz <mina86@mina86.com>

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

> Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
> ---
>   drivers/net/wireless/iwlwifi/pcie/rx.c | 23 ++++++++---------------
>   1 file changed, 8 insertions(+), 15 deletions(-)

> diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
> index 3f237b4..c32122a 100644
> --- a/drivers/net/wireless/iwlwifi/pcie/rx.c
> +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
[...]
> @@ -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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv2] net: wireless: iwlwifi: remove minor dead code
  2013-11-10 19:15 ` Sergei Shtylyov
@ 2013-11-10 20:17   ` Michal Nazarewicz
  2013-11-11 13:41     ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Nazarewicz @ 2013-11-10 20:17 UTC (permalink / raw)
  To: Sergei Shtylyov, Johannes Berg, Emmanuel Grumbach, John W. Linville
  Cc: Intel Linux Wireless, linux-wireless, netdev, linux-kernel


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(-)

On Sun, Nov 10 2013, Sergei Shtylyov wrote:
> 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.

diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index 3f237b4..7d0fdc0 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -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
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv2] net: wireless: iwlwifi: remove minor dead code
  2013-11-10 20:17   ` [PATCHv2] " Michal Nazarewicz
@ 2013-11-11 13:41     ` Johannes Berg
  2013-11-11 13:42       ` Johannes Berg
  2013-11-12  0:01       ` [PATCHv2.1] " Michal Nazarewicz
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Berg @ 2013-11-11 13:41 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Sergei Shtylyov, Emmanuel Grumbach, John W. Linville,
	Intel Linux Wireless, linux-wireless, netdev, linux-kernel

On Sun, 2013-11-10 at 21:17 +0100, Michal Nazarewicz wrote:
> 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


> @@ -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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv2] net: wireless: iwlwifi: remove minor dead code
  2013-11-11 13:41     ` Johannes Berg
@ 2013-11-11 13:42       ` Johannes Berg
  2013-11-12  0:01       ` [PATCHv2.1] " Michal Nazarewicz
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2013-11-11 13:42 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Sergei Shtylyov, Emmanuel Grumbach, John W. Linville,
	Intel Linux Wireless, linux-wireless, netdev, linux-kernel

On Mon, 2013-11-11 at 14:41 +0100, Johannes Berg wrote:
> > @@ -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?

Err, sorry, not paying attention.

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv2.1] net: wireless: iwlwifi: remove minor dead code
  2013-11-11 13:41     ` Johannes Berg
  2013-11-11 13:42       ` Johannes Berg
@ 2013-11-12  0:01       ` Michal Nazarewicz
  2013-11-12  5:24         ` Emmanuel Grumbach
  1 sibling, 1 reply; 7+ messages in thread
From: Michal Nazarewicz @ 2013-11-12  0:01 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Sergei Shtylyov, Emmanuel Grumbach, John W. Linville,
	Intel Linux Wireless, linux-wireless, netdev, linux-kernel

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

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 drivers/net/wireless/iwlwifi/pcie/rx.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

On Mon, Nov 11 2013, Johannes Berg wrote:
> no signed-off-by

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

diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index 3f237b4..7d0fdc0 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -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
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv2.1] net: wireless: iwlwifi: remove minor dead code
  2013-11-12  0:01       ` [PATCHv2.1] " Michal Nazarewicz
@ 2013-11-12  5:24         ` Emmanuel Grumbach
  0 siblings, 0 replies; 7+ messages in thread
From: Emmanuel Grumbach @ 2013-11-12  5:24 UTC (permalink / raw)
  To: Michal Nazarewicz, Johannes Berg
  Cc: Sergei Shtylyov, Emmanuel Grumbach, John W. Linville,
	Intel Linux Wireless, linux-wireless, netdev, linux-kernel



On 11/12/2013 02:01 AM, Michal Nazarewicz wrote:
> inta is checked to be zero in a IRQ_NONE branch so afterwards it
> cannot be zero as it is never modified.
> 
> Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
> ---
>  drivers/net/wireless/iwlwifi/pcie/rx.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 
> On Mon, Nov 11 2013, Johannes Berg wrote:
>> 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!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-12  5:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10 19:06 [PATCH] net: wireless: iwlwifi: remove minor dead code Michal Nazarewicz
2013-11-10 19:15 ` Sergei Shtylyov
2013-11-10 20:17   ` [PATCHv2] " Michal Nazarewicz
2013-11-11 13:41     ` Johannes Berg
2013-11-11 13:42       ` Johannes Berg
2013-11-12  0:01       ` [PATCHv2.1] " Michal Nazarewicz
2013-11-12  5:24         ` Emmanuel Grumbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).