diff mbox

[1/4] mac80211: refactor recalculate channel context functions (1)

Message ID 8966cabb0cf4c83da8fd37e4a5ec1df8727e9dbe.1394158459.git.gamerh2o@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Gang ZHAO March 7, 2014, 2:17 a.m. UTC
Function ieee80211_change_chanctx() updates struct
ieee80211_chanctx_conf's def and min_def members, in a somewhat mixed
way. Since there are other members can be updated, this function's
name is a bit inaccurate.

Rename ieee80211_change_chanctx() to ieee80211_recalc_chanctx_def()
and only update def member in this function. Add a wrapper function
_ieee80211_recalc_chanctx_chantype() to do ieee80211_change_chanctx()'s
work.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 net/mac80211/chan.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

Comments

Johannes Berg March 11, 2014, 1:21 p.m. UTC | #1
On Fri, 2014-03-07 at 10:17 +0800, Zhao, Gang wrote:
> Function ieee80211_change_chanctx() updates struct
> ieee80211_chanctx_conf's def and min_def members, in a somewhat mixed
> way. Since there are other members can be updated, this function's
> name is a bit inaccurate.
> 
> Rename ieee80211_change_chanctx() to ieee80211_recalc_chanctx_def()
> and only update def member in this function. Add a wrapper function
> _ieee80211_recalc_chanctx_chantype() to do ieee80211_change_chanctx()'s
> work.

I think this is reasonable, but as discussed in the other thread I'll
drop this until the CSA code settles down.

johannes

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

Patch

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 42c6592..49fa37e 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -143,9 +143,10 @@  void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
 	drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_MIN_WIDTH);
 }
 
-static void ieee80211_change_chanctx(struct ieee80211_local *local,
-				     struct ieee80211_chanctx *ctx,
-				     const struct cfg80211_chan_def *chandef)
+static void
+ieee80211_recalc_chanctx_def(struct ieee80211_local *local,
+			     struct ieee80211_chanctx *ctx,
+			     const struct cfg80211_chan_def *chandef)
 {
 	if (cfg80211_chandef_identical(&ctx->conf.def, chandef))
 		return;
@@ -154,7 +155,6 @@  static void ieee80211_change_chanctx(struct ieee80211_local *local,
 
 	ctx->conf.def = *chandef;
 	drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_WIDTH);
-	ieee80211_recalc_chanctx_min_def(local, ctx);
 
 	if (!local->use_chanctx) {
 		local->_oper_chandef = *chandef;
@@ -162,6 +162,15 @@  static void ieee80211_change_chanctx(struct ieee80211_local *local,
 	}
 }
 
+static void
+_ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
+				   struct ieee80211_chanctx *ctx,
+				   const struct cfg80211_chan_def *chandef)
+{
+	ieee80211_recalc_chanctx_def(local, ctx, chandef);
+	ieee80211_recalc_chanctx_min_def(local, ctx);
+}
+
 static struct ieee80211_chanctx *
 ieee80211_find_chanctx(struct ieee80211_local *local,
 		       const struct cfg80211_chan_def *chandef,
@@ -184,7 +193,7 @@  ieee80211_find_chanctx(struct ieee80211_local *local,
 		if (!compat)
 			continue;
 
-		ieee80211_change_chanctx(local, ctx, compat);
+		_ieee80211_recalc_chanctx_chantype(local, ctx, compat);
 
 		return ctx;
 	}
@@ -350,7 +359,7 @@  static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
 	if (WARN_ON_ONCE(!compat))
 		return;
 
-	ieee80211_change_chanctx(local, ctx, compat);
+	_ieee80211_recalc_chanctx_chantype(local, ctx, compat);
 }
 
 static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local,