Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291283
b: refs/heads/master
c: 9fd6f21
h: refs/heads/master
i:
  291281: d130b41
  291279: 4ccacb4
v: v3
  • Loading branch information
Eliad Peller authored and Luciano Coelho committed Mar 5, 2012
1 parent f9b0f1a commit efde036
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 98 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2d6cf2b51fa3492c479c6d1f86496e120b51e1d8
refs/heads/master: 9fd6f21ba295810e36299981411f62719364d9e9
117 changes: 22 additions & 95 deletions trunk/drivers/net/wireless/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,15 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
static void wl1271_op_stop(struct ieee80211_hw *hw);
static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif);

static DEFINE_MUTEX(wl_list_mutex);
static LIST_HEAD(wl_list);

static int wl1271_check_operstate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
unsigned char operstate)
static int wl12xx_set_authorized(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
{
int ret;

if (operstate != IF_OPER_UP)
if (WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS))
return -EINVAL;

if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
return 0;

if (test_and_set_bit(WLVIF_FLAG_STA_STATE_SENT, &wlvif->flags))
Expand All @@ -415,76 +415,6 @@ static int wl1271_check_operstate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
wl1271_info("Association completed.");
return 0;
}
static int wl1271_dev_notify(struct notifier_block *me, unsigned long what,
void *arg)
{
struct net_device *dev = arg;
struct wireless_dev *wdev;
struct wiphy *wiphy;
struct ieee80211_hw *hw;
struct wl1271 *wl;
struct wl1271 *wl_temp;
struct wl12xx_vif *wlvif;
int ret = 0;

/* Check that this notification is for us. */
if (what != NETDEV_CHANGE)
return NOTIFY_DONE;

wdev = dev->ieee80211_ptr;
if (wdev == NULL)
return NOTIFY_DONE;

wiphy = wdev->wiphy;
if (wiphy == NULL)
return NOTIFY_DONE;

hw = wiphy_priv(wiphy);
if (hw == NULL)
return NOTIFY_DONE;

wl_temp = hw->priv;
mutex_lock(&wl_list_mutex);
list_for_each_entry(wl, &wl_list, list) {
if (wl == wl_temp)
break;
}
mutex_unlock(&wl_list_mutex);
if (wl != wl_temp)
return NOTIFY_DONE;

mutex_lock(&wl->mutex);

if (wl->state == WL1271_STATE_OFF)
goto out;

if (dev->operstate != IF_OPER_UP)
goto out;
/*
* The correct behavior should be just getting the appropriate wlvif
* from the given dev, but currently we don't have a mac80211
* interface for it.
*/
wl12xx_for_each_wlvif_sta(wl, wlvif) {
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);

if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
continue;

ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out;

wl1271_check_operstate(wl, wlvif,
ieee80211_get_operstate(vif));

wl1271_ps_elp_sleep(wl);
}
out:
mutex_unlock(&wl->mutex);

return NOTIFY_OK;
}

static int wl1271_reg_notify(struct wiphy *wiphy,
struct regulatory_request *request)
Expand Down Expand Up @@ -1626,10 +1556,6 @@ static struct sk_buff *wl12xx_alloc_dummy_packet(struct wl1271 *wl)
}


static struct notifier_block wl1271_dev_notifier = {
.notifier_call = wl1271_dev_notify,
};

#ifdef CONFIG_PM
static int wl1271_configure_suspend_sta(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
Expand Down Expand Up @@ -1856,10 +1782,6 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
wl->state = WL1271_STATE_OFF;
mutex_unlock(&wl->mutex);

mutex_lock(&wl_list_mutex);
list_del(&wl->list);
mutex_unlock(&wl_list_mutex);

wl1271_flush_deferred_work(wl);
cancel_delayed_work_sync(&wl->scan_complete_work);
cancel_work_sync(&wl->netstack_work);
Expand Down Expand Up @@ -2270,11 +2192,6 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
out_unlock:
mutex_unlock(&wl->mutex);

mutex_lock(&wl_list_mutex);
if (!ret)
list_add(&wl->list, &wl_list);
mutex_unlock(&wl_list_mutex);

return ret;
}

Expand Down Expand Up @@ -3967,8 +3884,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (ret < 0)
goto out;

wl1271_check_operstate(wl, wlvif,
ieee80211_get_operstate(vif));
if (test_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags))
wl12xx_set_authorized(wl, wlvif);
}
/*
* stop device role if started (we might already be in
Expand Down Expand Up @@ -4321,6 +4238,20 @@ static int wl12xx_update_sta_state(struct wl1271 *wl,
return ret;
}

/* Authorize station */
if (is_sta &&
new_state == IEEE80211_STA_AUTHORIZED) {
set_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags);
return wl12xx_set_authorized(wl, wlvif);
}

if (is_sta &&
old_state == IEEE80211_STA_AUTHORIZED &&
new_state == IEEE80211_STA_ASSOC) {
clear_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags);
return 0;
}

return 0;
}

Expand Down Expand Up @@ -5144,8 +5075,6 @@ static int wl1271_register_hw(struct wl1271 *wl)

wl1271_debugfs_init(wl);

register_netdevice_notifier(&wl1271_dev_notifier);

wl1271_notice("loaded");

out:
Expand All @@ -5157,7 +5086,6 @@ static void wl1271_unregister_hw(struct wl1271 *wl)
if (wl->plt)
wl1271_plt_stop(wl);

unregister_netdevice_notifier(&wl1271_dev_notifier);
ieee80211_unregister_hw(wl->hw);
wl->mac80211_registered = false;

Expand Down Expand Up @@ -5278,7 +5206,6 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
wl = hw->priv;
memset(wl, 0, sizeof(*wl));

INIT_LIST_HEAD(&wl->list);
INIT_LIST_HEAD(&wl->wlvif_list);

wl->hw = hw;
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/net/wireless/wl12xx/wl12xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ enum wl12xx_flags {
enum wl12xx_vif_flags {
WLVIF_FLAG_INITIALIZED,
WLVIF_FLAG_STA_ASSOCIATED,
WLVIF_FLAG_STA_AUTHORIZED,
WLVIF_FLAG_IBSS_JOINED,
WLVIF_FLAG_AP_STARTED,
WLVIF_FLAG_IN_PS,
Expand Down Expand Up @@ -452,8 +453,6 @@ struct wl1271 {

bool enable_11a;

struct list_head list;

/* Most recently reported noise in dBm */
s8 noise;

Expand Down

0 comments on commit efde036

Please sign in to comment.