aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-11-16 06:00:37 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-18 17:09:14 -0500
commit3b53fde8ac40c4321389def14d7f4a9e14092fd3 (patch)
tree705a81684a9326764c53fa7a9a85e337f87cb15e /net
parentcb53a150caa3068ce366b75dd354718145f5e893 (diff)
mac80211: let sta_info_get_by_idx get sta by sdata
Instead of filtering by device, directly look up by sdata. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c4
-rw-r--r--net/mac80211/sta_info.c7
-rw-r--r--net/mac80211/sta_info.h4
3 files changed, 8 insertions, 7 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7f18c8fa188..7d591816ed1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -398,13 +398,13 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
398static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, 398static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
399 int idx, u8 *mac, struct station_info *sinfo) 399 int idx, u8 *mac, struct station_info *sinfo)
400{ 400{
401 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 401 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
402 struct sta_info *sta; 402 struct sta_info *sta;
403 int ret = -ENOENT; 403 int ret = -ENOENT;
404 404
405 rcu_read_lock(); 405 rcu_read_lock();
406 406
407 sta = sta_info_get_by_idx(local, idx, dev); 407 sta = sta_info_get_by_idx(sdata, idx);
408 if (sta) { 408 if (sta) {
409 ret = 0; 409 ret = 0;
410 memcpy(mac, sta->sta.addr, ETH_ALEN); 410 memcpy(mac, sta->sta.addr, ETH_ALEN);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 396a94806de..aa017a56afc 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -116,14 +116,15 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr)
116 return sta; 116 return sta;
117} 117}
118 118
119struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, 119struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
120 struct net_device *dev) 120 int idx)
121{ 121{
122 struct ieee80211_local *local = sdata->local;
122 struct sta_info *sta; 123 struct sta_info *sta;
123 int i = 0; 124 int i = 0;
124 125
125 list_for_each_entry_rcu(sta, &local->sta_list, list) { 126 list_for_each_entry_rcu(sta, &local->sta_list, list) {
126 if (dev && dev != sta->sdata->dev) 127 if (sdata != sta->sdata)
127 continue; 128 continue;
128 if (i < idx) { 129 if (i < idx) {
129 ++i; 130 ++i;
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 4673454176e..4c84c2205e8 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -409,8 +409,8 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr);
409/* 409/*
410 * Get STA info by index, BROKEN! 410 * Get STA info by index, BROKEN!
411 */ 411 */
412struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, 412struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
413 struct net_device *dev); 413 int idx);
414/* 414/*
415 * Create a new STA info, caller owns returned structure 415 * Create a new STA info, caller owns returned structure
416 * until sta_info_insert(). 416 * until sta_info_insert().