linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: remove redundant flag check
@ 2013-12-23 11:07 fred.chou.nd
  2014-01-06 15:19 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: fred.chou.nd @ 2013-12-23 11:07 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Fred Chou

From: Fred Chou <fred.chou.nd@gmail.com>

It's not necessary to check a flag setting and then
set it anyway. The outer condition check is redundant
in the code below. Remove the outer if.

Signed-off-by: Fred Chou  <fred.chou.nd@gmail.com>
---
 net/mac80211/tx.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 2f0e176..52bb276 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1157,13 +1157,11 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
 		info->flags |= IEEE80211_TX_CTL_NO_ACK;
 	} else
 		tx->flags |= IEEE80211_TX_UNICAST;
-
-	if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) {
-		if (!(tx->flags & IEEE80211_TX_UNICAST) ||
-		    skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
-		    info->flags & IEEE80211_TX_CTL_AMPDU)
-			info->flags |= IEEE80211_TX_CTL_DONTFRAG;
-	}
+
+	if (!(tx->flags & IEEE80211_TX_UNICAST) ||
+	    skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
+	    info->flags & IEEE80211_TX_CTL_AMPDU)
+		info->flags |= IEEE80211_TX_CTL_DONTFRAG;
 
 	if (!tx->sta)
 		info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
-- 
1.7.9.5


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

* Re: [PATCH] mac80211: remove redundant flag check
  2013-12-23 11:07 [PATCH] mac80211: remove redundant flag check fred.chou.nd
@ 2014-01-06 15:19 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2014-01-06 15:19 UTC (permalink / raw)
  To: fred.chou.nd; +Cc: linux-wireless

On Mon, 2013-12-23 at 19:07 +0800, fred.chou.nd@gmail.com wrote:
> From: Fred Chou <fred.chou.nd@gmail.com>
> 
> It's not necessary to check a flag setting and then
> set it anyway. The outer condition check is redundant
> in the code below. Remove the outer if.

It may be redundant in theory, but I think it makes the code easier to
read, and it avoids all the other checks and the flags write. I don't
think I want to apply this.

johannes


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

end of thread, other threads:[~2014-01-06 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23 11:07 [PATCH] mac80211: remove redundant flag check fred.chou.nd
2014-01-06 15:19 ` Johannes Berg

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