wl12xx: add stop_scan command
authorEliad Peller <eliad@wizery.com>
Mon, 27 Jun 2011 10:06:44 +0000 (13:06 +0300)
committerLuciano Coelho <coelho@ti.com>
Tue, 5 Jul 2011 18:50:39 +0000 (21:50 +0300)
define wl1271_scan_stop() to cancel an ongoing hw scan.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/scan.c
drivers/net/wireless/wl12xx/scan.h

index 5e5c66dd06d592e29ec2d16386a8d402533d789d..edfe01c321cadd1f4cafd3bafa595043c5a3e5c9 100644 (file)
@@ -321,6 +321,33 @@ int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
        return 0;
 }
 
+int wl1271_scan_stop(struct wl1271 *wl)
+{
+       struct wl1271_cmd_header *cmd = NULL;
+       int ret = 0;
+
+       if (WARN_ON(wl->scan.state == WL1271_SCAN_STATE_IDLE))
+               return -EINVAL;
+
+       wl1271_debug(DEBUG_CMD, "cmd scan stop");
+
+       cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+       if (!cmd) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       ret = wl1271_cmd_send(wl, CMD_STOP_SCAN, cmd,
+                             sizeof(*cmd), 0);
+       if (ret < 0) {
+               wl1271_error("cmd stop_scan failed");
+               goto out;
+       }
+out:
+       kfree(cmd);
+       return ret;
+}
+
 static int
 wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
                                    struct cfg80211_sched_scan_request *req,
index ca81de20ebef838018511195624b0b61eb23912c..d882e4da71b705e87a0b47af18969239ac1f87f7 100644 (file)
@@ -28,6 +28,7 @@
 
 int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
                struct cfg80211_scan_request *req);
+int wl1271_scan_stop(struct wl1271 *wl);
 int wl1271_scan_build_probe_req(struct wl1271 *wl,
                                const u8 *ssid, size_t ssid_len,
                                const u8 *ie, size_t ie_len, u8 band);