diff mbox

[v8,2/5] mac80211: align ieee80211_ibss_csa_beacon() with ieee80211_csa_beacon()

Message ID 1386257143-29840-3-git-send-email-luciano.coelho@intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Luca Coelho Dec. 5, 2013, 3:25 p.m. UTC
The return value of ieee80211_ibss_csa_beacon is not aligned with the
return value of ieee80211_csa_beacon().  For consistency and to be
able to use both functions with similar code, change
ieee80211_ibss_csa_beacon() not to send the bss changed notification
itself, but return what has changed so the caller can send the
notification instead.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
---
 net/mac80211/ibss.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Jones Desougi Dec. 7, 2013, 4:44 p.m. UTC | #1
On 05/12/13 16:25, Luciano Coelho wrote:
> The return value of ieee80211_ibss_csa_beacon is not aligned with the
> return value of ieee80211_csa_beacon().  For consistency and to be
> able to use both functions with similar code, change
> ieee80211_ibss_csa_beacon() not to send the bss changed notification
> itself, but return what has changed so the caller can send the
> notification instead.
> 
> Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
> ---
>  net/mac80211/ibss.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
> index 3514aab..23e035f 100644
> --- a/net/mac80211/ibss.c
> +++ b/net/mac80211/ibss.c
> @@ -522,7 +522,7 @@ int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
>  	if (csa_settings)
>  		ieee80211_send_action_csa(sdata, csa_settings);
>  
> -	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
> +	return BSS_CHANGED_BEACON;
>   out:
>  	return ret;
>  }
> @@ -559,11 +559,17 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
>  
>  	/* generate the beacon */
>  	err = ieee80211_ibss_csa_beacon(sdata, NULL);
> -	sdata_unlock(sdata);
>  	if (err < 0)
> -		return err;
> +		goto out;
>  
> -	return 0;
> +	if (err) {
> +		ieee80211_bss_info_change_notify(sdata, err);
> +		err = 0;
> +	}
> +out:
> +	sdata_unlock(sdata);

Why not simplify to something like this?
	/* generate the beacon */
	err = ieee80211_ibss_csa_beacon(sdata, NULL);
	if (err > 0) {
		ieee80211_bss_info_change_notify(sdata, err);
		err = 0;
	}
	sdata_unlock(sdata);

> +
> +	return err;
>  }
>  
>  void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata)
> 

--
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/ibss.c b/net/mac80211/ibss.c
index 3514aab..23e035f 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -522,7 +522,7 @@  int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
 	if (csa_settings)
 		ieee80211_send_action_csa(sdata, csa_settings);
 
-	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
+	return BSS_CHANGED_BEACON;
  out:
 	return ret;
 }
@@ -559,11 +559,17 @@  int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
 
 	/* generate the beacon */
 	err = ieee80211_ibss_csa_beacon(sdata, NULL);
-	sdata_unlock(sdata);
 	if (err < 0)
-		return err;
+		goto out;
 
-	return 0;
+	if (err) {
+		ieee80211_bss_info_change_notify(sdata, err);
+		err = 0;
+	}
+out:
+	sdata_unlock(sdata);
+
+	return err;
 }
 
 void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata)