80b919ee24c6a69ab8f8e7d05463fbba56ea4306
[openwrt/staging/hauke.git] / package / kernel / mac80211 / patches / 316-ath9k-Add-a-function-to-check-for-an-active-GO.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:21 +0530
3 Subject: [PATCH] ath9k: Add a function to check for an active GO
4
5 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
6 ---
7
8 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
9 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
10 @@ -469,6 +469,7 @@ void ath_chanctx_set_next(struct ath_sof
11 void ath_offchannel_next(struct ath_softc *sc);
12 void ath_scan_complete(struct ath_softc *sc, bool abort);
13 void ath_roc_complete(struct ath_softc *sc, bool abort);
14 +struct ath_chanctx* ath_is_go_chanctx_present(struct ath_softc *sc);
15
16 #else
17
18 --- a/drivers/net/wireless/ath/ath9k/channel.c
19 +++ b/drivers/net/wireless/ath/ath9k/channel.c
20 @@ -146,6 +146,36 @@ void ath_chanctx_set_channel(struct ath_
21
22 #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
23
24 +/*************/
25 +/* Utilities */
26 +/*************/
27 +
28 +struct ath_chanctx* ath_is_go_chanctx_present(struct ath_softc *sc)
29 +{
30 + struct ath_chanctx *ctx;
31 + struct ath_vif *avp;
32 + struct ieee80211_vif *vif;
33 +
34 + spin_lock_bh(&sc->chan_lock);
35 +
36 + ath_for_each_chanctx(sc, ctx) {
37 + if (!ctx->active)
38 + continue;
39 +
40 + list_for_each_entry(avp, &ctx->vifs, list) {
41 + vif = avp->vif;
42 +
43 + if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_P2P_GO) {
44 + spin_unlock_bh(&sc->chan_lock);
45 + return ctx;
46 + }
47 + }
48 + }
49 +
50 + spin_unlock_bh(&sc->chan_lock);
51 + return NULL;
52 +}
53 +
54 /**********************************************************/
55 /* Functions to handle the channel context state machine. */
56 /**********************************************************/