aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/fw.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/fw.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/fw.c')
-rw-r--r--drivers/net/wireless/libertas/fw.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 08c914b62bae..56b272d62a86 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -126,18 +126,17 @@ done:
126 126
127static int wlan_allocate_adapter(wlan_private * priv) 127static int wlan_allocate_adapter(wlan_private * priv)
128{ 128{
129 u32 ulbufsize; 129 size_t bufsize;
130 wlan_adapter *adapter = priv->adapter; 130 wlan_adapter *adapter = priv->adapter;
131 131
132 struct bss_descriptor *ptempscantable;
133
134 /* Allocate buffer to store the BSSID list */ 132 /* Allocate buffer to store the BSSID list */
135 ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST; 133 bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
136 if (!(ptempscantable = kzalloc(ulbufsize, GFP_KERNEL))) { 134 adapter->networks = kzalloc(bufsize, GFP_KERNEL);
135 if (!adapter->networks) {
136 lbs_pr_err("Out of memory allocating beacons\n");
137 libertas_free_adapter(priv); 137 libertas_free_adapter(priv);
138 return -1; 138 return -ENOMEM;
139 } 139 }
140 adapter->scantable = ptempscantable;
141 140
142 /* Allocate the command buffers */ 141 /* Allocate the command buffers */
143 libertas_allocate_cmd_buffer(priv); 142 libertas_allocate_cmd_buffer(priv);
@@ -188,7 +187,14 @@ static void wlan_init_adapter(wlan_private * priv)
188 187
189 adapter->assoc_req = NULL; 188 adapter->assoc_req = NULL;
190 189
191 adapter->numinscantable = 0; 190 /* Initialize scan result lists */
191 INIT_LIST_HEAD(&adapter->network_free_list);
192 INIT_LIST_HEAD(&adapter->network_list);
193 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
194 list_add_tail(&adapter->networks[i].list,
195 &adapter->network_free_list);
196 }
197
192 adapter->pattemptedbssdesc = NULL; 198 adapter->pattemptedbssdesc = NULL;
193 mutex_init(&adapter->lock); 199 mutex_init(&adapter->lock);
194 200
@@ -291,11 +297,9 @@ void libertas_free_adapter(wlan_private * priv)
291 lbs_deb_fw("free command_timer\n"); 297 lbs_deb_fw("free command_timer\n");
292 del_timer(&adapter->command_timer); 298 del_timer(&adapter->command_timer);
293 299
294 lbs_deb_fw("free scantable\n"); 300 lbs_deb_fw("free scan results table\n");
295 if (adapter->scantable) { 301 kfree(adapter->networks);
296 kfree(adapter->scantable); 302 adapter->networks = NULL;
297 adapter->scantable = NULL;
298 }
299 303
300 /* Free the adapter object itself */ 304 /* Free the adapter object itself */
301 lbs_deb_fw("free adapter\n"); 305 lbs_deb_fw("free adapter\n");