staging: wilc1000: rename hidden_network related data structure
authorAjay Singh <ajay.kathat@microchip.com>
Thu, 17 Jan 2019 13:21:30 +0000 (13:21 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jan 2019 09:39:15 +0000 (10:39 +0100)
Rename hidden_network related data structure to have more appropriate
names, as it's used to keep search network SSID details.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c
drivers/staging/wilc1000/host_interface.h
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c

index 46fd448ddde76f9a187598495df8a8003d526046..6c2be4339ce2faeae9d201432a61f0378e8aea43 100644 (file)
@@ -234,7 +234,7 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
 int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
              u8 *ch_freq_list, u8 ch_list_len, const u8 *ies,
              size_t ies_len, wilc_scan_result scan_result, void *user_arg,
-             struct hidden_network *hidden_net)
+             struct wilc_probe_ssid *search)
 {
        int result = 0;
        struct wid wid_list[5];
@@ -242,7 +242,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
        u32 i;
        u8 *buffer;
        u8 valuesize = 0;
-       u8 *hdn_ntwk_wid_val = NULL;
+       u8 *search_ssid_vals = NULL;
        struct host_if_drv *hif_drv = vif->hif_drv;
 
        if (hif_drv->hif_state >= HOST_IF_SCANNING &&
@@ -260,26 +260,24 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 
        hif_drv->usr_scan_req.ch_cnt = 0;
 
-       if (hidden_net) {
-               wid_list[index].id = WID_SSID_PROBE_REQ;
-               wid_list[index].type = WID_STR;
-
-               for (i = 0; i < hidden_net->n_ssids; i++)
-                       valuesize += ((hidden_net->net_info[i].ssid_len) + 1);
-               hdn_ntwk_wid_val = kmalloc(valuesize + 1, GFP_KERNEL);
-               wid_list[index].val = hdn_ntwk_wid_val;
-               if (wid_list[index].val) {
+       if (search) {
+               for (i = 0; i < search->n_ssids; i++)
+                       valuesize += ((search->ssid_info[i].ssid_len) + 1);
+               search_ssid_vals = kmalloc(valuesize + 1, GFP_KERNEL);
+               if (search_ssid_vals) {
+                       wid_list[index].id = WID_SSID_PROBE_REQ;
+                       wid_list[index].type = WID_STR;
+                       wid_list[index].val = search_ssid_vals;
                        buffer = wid_list[index].val;
 
-                       *buffer++ = hidden_net->n_ssids;
+                       *buffer++ = search->n_ssids;
 
-                       for (i = 0; i < hidden_net->n_ssids; i++) {
-                               *buffer++ = hidden_net->net_info[i].ssid_len;
-                               memcpy(buffer, hidden_net->net_info[i].ssid,
-                                      hidden_net->net_info[i].ssid_len);
-                               buffer += hidden_net->net_info[i].ssid_len;
+                       for (i = 0; i < search->n_ssids; i++) {
+                               *buffer++ = search->ssid_info[i].ssid_len;
+                               memcpy(buffer, search->ssid_info[i].ssid,
+                                      search->ssid_info[i].ssid_len);
+                               buffer += search->ssid_info[i].ssid_len;
                        }
-
                        wid_list[index].size = (s32)(valuesize + 1);
                        index++;
                }
@@ -332,9 +330,9 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
                  jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
 
 error:
-       if (hidden_net) {
-               kfree(hidden_net->net_info);
-               kfree(hdn_ntwk_wid_val);
+       if (search) {
+               kfree(search->ssid_info);
+               kfree(search_ssid_vals);
        }
 
        return result;
index 659e8ccb653b33f7eb4a6fa04abffe28844e2819..e702404854f29fafd6e4c60388833b73da8f8750 100644 (file)
@@ -131,14 +131,15 @@ typedef void (*wilc_connect_result)(enum conn_event,
 typedef void (*wilc_remain_on_chan_expired)(void *, u32);
 typedef void (*wilc_remain_on_chan_ready)(void *);
 
-struct hidden_net_info {
-       u8  *ssid;
+struct wilc_probe_ssid_info {
        u8 ssid_len;
+       u8 *ssid;
 };
 
-struct hidden_network {
-       struct hidden_net_info *net_info;
+struct wilc_probe_ssid {
+       struct wilc_probe_ssid_info *ssid_info;
        u8 n_ssids;
+       u32 size;
 };
 
 struct user_scan_req {
@@ -238,7 +239,7 @@ int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
 int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
              u8 *ch_freq_list, u8 ch_list_len, const u8 *ies,
              size_t ies_len, wilc_scan_result scan_result, void *user_arg,
-             struct hidden_network *hidden_network);
+             struct wilc_probe_ssid *search);
 int wilc_hif_set_cfg(struct wilc_vif *vif,
                     struct cfg_param_attr *cfg_param);
 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
index 5070cad277385c586103bde8454bc457fc259271..1762c609962ceae7f566f2182e6146ae4f7ad7a5 100644 (file)
@@ -221,22 +221,23 @@ static int set_channel(struct wiphy *wiphy,
 
 static inline int
 wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request *request,
-                            struct hidden_network *ntwk)
+                            struct wilc_probe_ssid *search)
 {
        int i;
        int slot_id = 0;
 
-       ntwk->net_info = kcalloc(request->n_ssids, sizeof(*ntwk->net_info),
-                                GFP_KERNEL);
-       if (!ntwk->net_info)
+       search->ssid_info = kcalloc(request->n_ssids,
+                                   sizeof(*search->ssid_info), GFP_KERNEL);
+       if (!search->ssid_info)
                goto out;
 
-       ntwk->n_ssids = request->n_ssids;
+       search->n_ssids = request->n_ssids;
 
        for (i = 0; i < request->n_ssids; i++) {
                if (request->ssids[i].ssid_len > 0) {
-                       struct hidden_net_info *info = &ntwk->net_info[slot_id];
+                       struct wilc_probe_ssid_info *info;
 
+                       info = &search->ssid_info[slot_id];
                        info->ssid = kmemdup(request->ssids[i].ssid,
                                             request->ssids[i].ssid_len,
                                             GFP_KERNEL);
@@ -246,7 +247,7 @@ wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request *request,
                        info->ssid_len = request->ssids[i].ssid_len;
                        slot_id++;
                } else {
-                       ntwk->n_ssids -= 1;
+                       search->n_ssids -= 1;
                }
        }
        return 0;
@@ -254,9 +255,9 @@ wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request *request,
 out_free:
 
        for (i = 0; i < slot_id; i++)
-               kfree(ntwk->net_info[i].ssid);
+               kfree(search->ssid_info[i].ssid);
 
-       kfree(ntwk->net_info);
+       kfree(search->ssid_info);
 out:
 
        return -ENOMEM;
@@ -269,7 +270,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
        u32 i;
        int ret = 0;
        u8 scan_ch_list[MAX_NUM_SCANNED_NETWORKS];
-       struct hidden_network hidden_ntwk;
+       struct wilc_probe_ssid probe_ssid;
 
        priv->scan_req = request;
 
@@ -283,7 +284,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 
                if (request->n_ssids >= 1) {
                        if (wilc_wfi_cfg_alloc_fill_ssid(request,
-                                                        &hidden_ntwk)) {
+                                                        &probe_ssid)) {
                                ret = -ENOMEM;
                                goto out;
                        }
@@ -293,7 +294,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
                                        request->n_channels,
                                        (const u8 *)request->ie,
                                        request->ie_len, cfg_scan_result,
-                                       (void *)priv, &hidden_ntwk);
+                                       (void *)priv, &probe_ssid);
                } else {
                        ret = wilc_scan(vif, WILC_FW_USER_SCAN,
                                        WILC_FW_ACTIVE_SCAN, scan_ch_list,