Commit 491775a5 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: use sdata pointer for scan interface

Since we now use sdata pointers most of the time, using a netdev
pointer here is somewhat artificial, use an sdata pointer instead.
Replace a netdev-prefix in a few messages by a wiphy-prefix.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 60f8b39c
...@@ -636,7 +636,7 @@ struct ieee80211_local { ...@@ -636,7 +636,7 @@ struct ieee80211_local {
enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
unsigned long last_scan_completed; unsigned long last_scan_completed;
struct delayed_work scan_work; struct delayed_work scan_work;
struct net_device *scan_dev; struct ieee80211_sub_if_data *scan_sdata;
struct ieee80211_channel *oper_channel, *scan_channel; struct ieee80211_channel *oper_channel, *scan_channel;
u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
size_t scan_ssid_len; size_t scan_ssid_len;
......
...@@ -551,7 +551,7 @@ static int ieee80211_stop(struct net_device *dev) ...@@ -551,7 +551,7 @@ static int ieee80211_stop(struct net_device *dev)
synchronize_rcu(); synchronize_rcu();
skb_queue_purge(&sdata->u.sta.skb_queue); skb_queue_purge(&sdata->u.sta.skb_queue);
if (local->scan_dev == sdata->dev) { if (local->scan_sdata == sdata) {
if (!local->ops->hw_scan) { if (!local->ops->hw_scan) {
local->sta_sw_scanning = 0; local->sta_sw_scanning = 0;
cancel_delayed_work(&local->scan_work); cancel_delayed_work(&local->scan_work);
......
...@@ -3507,19 +3507,18 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) ...@@ -3507,19 +3507,18 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
void ieee80211_scan_completed(struct ieee80211_hw *hw) void ieee80211_scan_completed(struct ieee80211_hw *hw)
{ {
struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_local *local = hw_to_local(hw);
struct net_device *dev = local->scan_dev;
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
union iwreq_data wrqu; union iwreq_data wrqu;
local->last_scan_completed = jiffies; local->last_scan_completed = jiffies;
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));
wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL); wireless_send_event(local->scan_sdata->dev, SIOCGIWSCAN, &wrqu, NULL);
if (local->sta_hw_scanning) { if (local->sta_hw_scanning) {
local->sta_hw_scanning = 0; local->sta_hw_scanning = 0;
if (ieee80211_hw_config(local)) if (ieee80211_hw_config(local))
printk(KERN_DEBUG "%s: failed to restore operational " printk(KERN_DEBUG "%s: failed to restore operational "
"channel after scan\n", dev->name); "channel after scan\n", wiphy_name(local->hw.wiphy));
/* Restart STA timer for HW scan case */ /* Restart STA timer for HW scan case */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(sdata, &local->interfaces, list) list_for_each_entry_rcu(sdata, &local->interfaces, list)
...@@ -3532,7 +3531,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) ...@@ -3532,7 +3531,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
local->sta_sw_scanning = 0; local->sta_sw_scanning = 0;
if (ieee80211_hw_config(local)) if (ieee80211_hw_config(local))
printk(KERN_DEBUG "%s: failed to restore operational " printk(KERN_DEBUG "%s: failed to restore operational "
"channel after scan\n", dev->name); "channel after scan\n", wiphy_name(local->hw.wiphy));
netif_tx_lock_bh(local->mdev); netif_tx_lock_bh(local->mdev);
...@@ -3562,8 +3561,8 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) ...@@ -3562,8 +3561,8 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
} }
rcu_read_unlock(); rcu_read_unlock();
done: done:
sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata = local->scan_sdata;
if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
struct ieee80211_if_sta *ifsta = &sdata->u.sta; struct ieee80211_if_sta *ifsta = &sdata->u.sta;
if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
...@@ -3578,8 +3577,7 @@ void ieee80211_sta_scan_work(struct work_struct *work) ...@@ -3578,8 +3577,7 @@ void ieee80211_sta_scan_work(struct work_struct *work)
{ {
struct ieee80211_local *local = struct ieee80211_local *local =
container_of(work, struct ieee80211_local, scan_work.work); container_of(work, struct ieee80211_local, scan_work.work);
struct net_device *dev = local->scan_dev; struct ieee80211_sub_if_data *sdata = local->scan_sdata;
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
int skip; int skip;
...@@ -3627,7 +3625,7 @@ void ieee80211_sta_scan_work(struct work_struct *work) ...@@ -3627,7 +3625,7 @@ void ieee80211_sta_scan_work(struct work_struct *work)
local->scan_channel = chan; local->scan_channel = chan;
if (ieee80211_hw_config(local)) { if (ieee80211_hw_config(local)) {
printk(KERN_DEBUG "%s: failed to set freq to " printk(KERN_DEBUG "%s: failed to set freq to "
"%d MHz for scan\n", dev->name, "%d MHz for scan\n", wiphy_name(local->hw.wiphy),
chan->center_freq); chan->center_freq);
skip = 1; skip = 1;
} }
...@@ -3697,7 +3695,7 @@ static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, ...@@ -3697,7 +3695,7 @@ static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata,
*/ */
if (local->sta_sw_scanning || local->sta_hw_scanning) { if (local->sta_sw_scanning || local->sta_hw_scanning) {
if (local->scan_dev == scan_sdata->dev) if (local->scan_sdata == scan_sdata)
return 0; return 0;
return -EBUSY; return -EBUSY;
} }
...@@ -3707,7 +3705,7 @@ static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, ...@@ -3707,7 +3705,7 @@ static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata,
ssid, ssid_len); ssid, ssid_len);
if (!rc) { if (!rc) {
local->sta_hw_scanning = 1; local->sta_hw_scanning = 1;
local->scan_dev = scan_sdata->dev; local->scan_sdata = scan_sdata;
} }
return rc; return rc;
} }
...@@ -3734,7 +3732,7 @@ static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, ...@@ -3734,7 +3732,7 @@ static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata,
local->scan_state = SCAN_SET_CHANNEL; local->scan_state = SCAN_SET_CHANNEL;
local->scan_channel_idx = 0; local->scan_channel_idx = 0;
local->scan_band = IEEE80211_BAND_2GHZ; local->scan_band = IEEE80211_BAND_2GHZ;
local->scan_dev = scan_sdata->dev; local->scan_sdata = scan_sdata;
netif_addr_lock_bh(local->mdev); netif_addr_lock_bh(local->mdev);
local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; local->filter_flags |= FIF_BCN_PRBRESP_PROMISC;
...@@ -3762,7 +3760,7 @@ int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ...@@ -3762,7 +3760,7 @@ int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t
return ieee80211_sta_start_scan(sdata, ssid, ssid_len); return ieee80211_sta_start_scan(sdata, ssid, ssid_len);
if (local->sta_sw_scanning || local->sta_hw_scanning) { if (local->sta_sw_scanning || local->sta_hw_scanning) {
if (local->scan_dev == sdata->dev) if (local->scan_sdata == sdata)
return 0; return 0;
return -EBUSY; return -EBUSY;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment