[PATCH] libertas: push WEXT scan requests to a work queue

Push WEXT scan requests to a workqueue and have each partial scan queue
the next part, then only report results when the complete scan has finished.
Full scans don't go through the work queue.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 9a46339..bcd8450 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1269,9 +1269,10 @@
 		goto done;
 	}
 
-	priv->assoc_thread =
-		create_singlethread_workqueue("libertas_assoc");
+	priv->work_thread = create_singlethread_workqueue("libertas_worker");
 	INIT_DELAYED_WORK(&priv->assoc_work, libertas_association_worker);
+	INIT_DELAYED_WORK(&priv->scan_work, libertas_scan_worker);
+
 	INIT_WORK(&priv->sync_channel, libertas_sync_channel);
 
 	/*
@@ -1305,7 +1306,7 @@
 err_init_fw:
 	priv->hw_unregister_dev(priv);
 err_registerdev:
-	destroy_workqueue(priv->assoc_thread);
+	destroy_workqueue(priv->work_thread);
 	/* Stop the thread servicing the interrupts */
 	wake_up_interruptible(&priv->waitq);
 	kthread_stop(priv->main_thread);
@@ -1426,8 +1427,9 @@
 
 	unregister_netdev(dev);
 
+	cancel_delayed_work(&priv->scan_work);
 	cancel_delayed_work(&priv->assoc_work);
-	destroy_workqueue(priv->assoc_thread);
+	destroy_workqueue(priv->work_thread);
 
 	if (adapter->psmode == WLAN802_11POWERMODEMAX_PSP) {
 		adapter->psmode = WLAN802_11POWERMODECAM;