]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath6kl: Support channel set request for startscan command
authorEdward Lu <elu@qca.qualcomm.com>
Tue, 30 Aug 2011 18:58:00 +0000 (21:58 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Wed, 31 Aug 2011 07:13:01 +0000 (10:13 +0300)
Signed-off-by: Edward Lu <elu@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath6kl/wmi.c

index 56a60c7f53c143ff26287e5968b1b5db5f9313a1..78b178892ede509f2f0bffcb739cf7d8b78352cc 100644 (file)
@@ -748,6 +748,8 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
                                struct cfg80211_scan_request *request)
 {
        struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev);
+       s8 n_channels = 0;
+       u16 *channels = NULL;
        int ret = 0;
 
        if (!ath6kl_cfg80211_ready(ar))
@@ -786,14 +788,32 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
                }
        }
 
+       if (request->n_channels > 0) {
+               u8 i;
+
+               n_channels = min(127U, request->n_channels);
+
+               channels = kzalloc(n_channels * sizeof(u16), GFP_KERNEL);
+               if (channels == NULL) {
+                       ath6kl_warn("failed to set scan channels, "
+                                   "scan all channels");
+                       n_channels = 0;
+               }
+
+               for (i = 0; i < n_channels; i++)
+                       channels[i] = request->channels[i]->center_freq;
+       }
+
        if (ath6kl_wmi_startscan_cmd(ar->wmi, WMI_LONG_SCAN, 0,
-                                    false, 0, 0, 0, NULL) != 0) {
+                                    false, 0, 0, n_channels, channels) != 0) {
                ath6kl_err("wmi_startscan_cmd failed\n");
                ret = -EIO;
        }
 
        ar->scan_req = request;
 
+       kfree(channels);
+
        return ret;
 }
 
index 2d80bdb2d912b2f7c054221884cbe445aefde37d..bbe3e8d214c86567e23db15cdb506347e003f296 100644 (file)
@@ -1709,7 +1709,7 @@ int ath6kl_wmi_startscan_cmd(struct wmi *wmi, enum wmi_scan_type scan_type,
        struct sk_buff *skb;
        struct wmi_start_scan_cmd *sc;
        s8 size;
-       int ret;
+       int i, ret;
 
        size = sizeof(struct wmi_start_scan_cmd);
 
@@ -1734,8 +1734,8 @@ int ath6kl_wmi_startscan_cmd(struct wmi *wmi, enum wmi_scan_type scan_type,
        sc->force_scan_intvl = cpu_to_le32(force_scan_interval);
        sc->num_ch = num_chan;
 
-       if (num_chan)
-               memcpy(sc->ch_list, ch_list, num_chan * sizeof(u16));
+       for (i = 0; i < num_chan; i++)
+               sc->ch_list[i] = cpu_to_le16(ch_list[i]);
 
        ret = ath6kl_wmi_cmd_send(wmi, skb, WMI_START_SCAN_CMDID,
                                  NO_SYNC_WMIFLAG);