aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/scan.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-12-23 07:15:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-12-28 16:54:59 -0500
commit0c1ad2cac1cb54db38fd4cc1822965071ee83f6e (patch)
treed5af632483584b7579ad8b24ba870f9b18e1aaa7 /net/mac80211/scan.c
parent8e664fb3fd2b04e3ac5fad7f046000ba54e0e275 (diff)
mac80211: proper bss private data handling
cfg80211 offers private data for each BSS struct, which mac80211 uses. However, mac80211 uses internal and external (cfg80211) BSS pointers interchangeably and has a hack to put the cfg80211 bss struct into the private struct. Remove this hack, properly converting between the pointers wherever necessary. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r--net/mac80211/scan.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index fb89e4c0fbfd..2a2d7f6005af 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -29,16 +29,19 @@ struct ieee80211_bss *
29ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, 29ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
30 u8 *ssid, u8 ssid_len) 30 u8 *ssid, u8 ssid_len)
31{ 31{
32 return (void *)cfg80211_get_bss(local->hw.wiphy, 32 struct cfg80211_bss *cbss;
33 ieee80211_get_channel(local->hw.wiphy, 33
34 freq), 34 cbss = cfg80211_get_bss(local->hw.wiphy,
35 bssid, ssid, ssid_len, 35 ieee80211_get_channel(local->hw.wiphy, freq),
36 0, 0); 36 bssid, ssid, ssid_len, 0, 0);
37 if (!cbss)
38 return NULL;
39 return (void *)cbss->priv;
37} 40}
38 41
39static void ieee80211_rx_bss_free(struct cfg80211_bss *cbss) 42static void ieee80211_rx_bss_free(struct cfg80211_bss *cbss)
40{ 43{
41 struct ieee80211_bss *bss = (void *)cbss; 44 struct ieee80211_bss *bss = (void *)cbss->priv;
42 45
43 kfree(bss_mesh_id(bss)); 46 kfree(bss_mesh_id(bss));
44 kfree(bss_mesh_cfg(bss)); 47 kfree(bss_mesh_cfg(bss));
@@ -47,7 +50,9 @@ static void ieee80211_rx_bss_free(struct cfg80211_bss *cbss)
47void ieee80211_rx_bss_put(struct ieee80211_local *local, 50void ieee80211_rx_bss_put(struct ieee80211_local *local,
48 struct ieee80211_bss *bss) 51 struct ieee80211_bss *bss)
49{ 52{
50 cfg80211_put_bss((struct cfg80211_bss *)bss); 53 if (!bss)
54 return;
55 cfg80211_put_bss(container_of((void *)bss, struct cfg80211_bss, priv));
51} 56}
52 57
53struct ieee80211_bss * 58struct ieee80211_bss *
@@ -59,6 +64,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
59 struct ieee80211_channel *channel, 64 struct ieee80211_channel *channel,
60 bool beacon) 65 bool beacon)
61{ 66{
67 struct cfg80211_bss *cbss;
62 struct ieee80211_bss *bss; 68 struct ieee80211_bss *bss;
63 int clen; 69 int clen;
64 s32 signal = 0; 70 s32 signal = 0;
@@ -68,13 +74,14 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
68 else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) 74 else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
69 signal = (rx_status->signal * 100) / local->hw.max_signal; 75 signal = (rx_status->signal * 100) / local->hw.max_signal;
70 76
71 bss = (void *)cfg80211_inform_bss_frame(local->hw.wiphy, channel, 77 cbss = cfg80211_inform_bss_frame(local->hw.wiphy, channel,
72 mgmt, len, signal, GFP_ATOMIC); 78 mgmt, len, signal, GFP_ATOMIC);
73 79
74 if (!bss) 80 if (!cbss)
75 return NULL; 81 return NULL;
76 82
77 bss->cbss.free_priv = ieee80211_rx_bss_free; 83 cbss->free_priv = ieee80211_rx_bss_free;
84 bss = (void *)cbss->priv;
78 85
79 /* save the ERP value so that it is available at association time */ 86 /* save the ERP value so that it is available at association time */
80 if (elems->erp_info && elems->erp_info_len >= 1) { 87 if (elems->erp_info && elems->erp_info_len >= 1) {