aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/libertas/wext.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-25 16:15:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:41 -0400
commitfcdb53dbc743f288bf72e485fefb3a967b733686 (patch)
treeceafcff8076af2da654214e3b72caa7b15164a28 /drivers/net/wireless/libertas/wext.c
parent90e8eafc93ed159846bb7126af8502f2a8570a11 (diff)
[PATCH] libertas: make scan result handling more flexible
- use a linked list for scan results - age scan results - pass bss_descriptors around instead of indexes into the scan table - lock access to the scan results - stop returning EAGAIN from SIOCGIWSCAN handler Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r--drivers/net/wireless/libertas/wext.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 4f0ae8026b0..4759aa2bba5 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -189,6 +189,8 @@ static int setcurrentchannel(wlan_private * priv, int channel)
static int changeadhocchannel(wlan_private * priv, int channel)
{
int ret = 0;
+ struct WLAN_802_11_SSID curadhocssid;
+ struct bss_descriptor * join_bss = NULL;
wlan_adapter *adapter = priv->adapter;
adapter->adhocchannel = channel;
@@ -214,43 +216,38 @@ static int changeadhocchannel(wlan_private * priv, int channel)
goto out;
}
- if (adapter->connect_status == libertas_connected) {
- int i;
- struct WLAN_802_11_SSID curadhocssid;
-
- lbs_deb_wext("channel changed while in IBSS\n");
+ if (adapter->connect_status != libertas_connected)
+ goto out;
- /* Copy the current ssid */
- memcpy(&curadhocssid, &adapter->curbssparams.ssid,
- sizeof(struct WLAN_802_11_SSID));
+ lbs_deb_wext("channel changed while in IBSS\n");
- /* Exit Adhoc mode */
- lbs_deb_wext("in changeadhocchannel(): sending Adhoc stop\n");
- ret = libertas_stop_adhoc_network(priv);
+ /* Copy the current ssid */
+ memcpy(&curadhocssid, &adapter->curbssparams.ssid,
+ sizeof(struct WLAN_802_11_SSID));
- if (ret)
- goto out;
+ /* Exit Adhoc mode */
+ lbs_deb_wext("in changeadhocchannel(): sending Adhoc stop\n");
+ ret = libertas_stop_adhoc_network(priv);
+ if (ret)
+ goto out;
- /* Scan for the network, do not save previous results. Stale
- * scan data will cause us to join a non-existant adhoc network
- */
- libertas_send_specific_SSID_scan(priv, &curadhocssid, 0);
+ /* Scan for the network, do not save previous results. Stale
+ * scan data will cause us to join a non-existant adhoc network
+ */
+ libertas_send_specific_SSID_scan(priv, &curadhocssid, 0);
- // find out the BSSID that matches the current SSID
- i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
- IW_MODE_ADHOC);
+ /* find out the BSSID that matches the current SSID */
+ join_bss = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
+ IW_MODE_ADHOC);
- if (i >= 0) {
- lbs_deb_wext("SSID found at %d in list,"
- "so join\n", i);
- libertas_join_adhoc_network(priv, &adapter->scantable[i]);
- } else {
- // else send START command
- lbs_deb_wext("SSID not found in list, "
- "creating AdHoc with SSID '%s'\n",
- curadhocssid.ssid);
- libertas_start_adhoc_network(priv, &curadhocssid);
- } // end of else (START command)
+ if (join_bss) {
+ lbs_deb_wext("SSID found in list, so join\n");
+ libertas_join_adhoc_network(priv, join_bss);
+ } else {
+ lbs_deb_wext("SSID not found in list, "
+ "creating AdHoc with SSID '%s'\n",
+ curadhocssid.ssid);
+ libertas_start_adhoc_network(priv, &curadhocssid);
}
out: