2018-05-11 08:13:51

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 00/30] staging: wilc1000: checkpatch fixes and code cleanup

This patch series contains modification to remove checkpatch related issues,
mainly related to 'line over 80 chars'.

Also code cleanup related change to follow as per linux coding style are
included in this patch series.

changes from v1:
- Dropped patch#5 and add a new patch #30 to address its review comments.
- Included changes for patch# 13, 15, 28 & 30 based on review comments
please refer patch# 12, 14, 27 & 29 in current updates series because
one patch is dropped in between.
- Corrected commit summary and description for patch#8 & #26 in updates series.

Ajay Singh (30):
staging: wilc1000: added complete() call for error scenario in
handle_key()
staging: wilc1000: remove 'ret' variable in handle_key()
staging: wilc1000: fix line over 80 chars in handle_key()
staging: wilc1000: fix line over 80 characters issue in
handle_connect()
staging: wilc1000: fix line over 80 chars issue in
host_int_handle_disconnect()
staging: wilc1000: fix line over 80 characters in
host_int_parse_join_bss_param()
staging: wilc1000: fix line over 80 chars in
host_int_parse_assoc_resp_info()
staging: wilc1000: replace kmalloc with kmemdup() in
handle_connect_timeout()
staging: wilc1000: fix line over 80 chars in linux_mon
staging: wilc1000: use sizeof(*wdev) to allocate memory in
wilc_wfi_cfg_alloc()
staging: wilc1000: use kmalloc(sizeof(*mgmt_tx)...) in mgmt_tx()
staging: wilc1000: rename clear_duringIP() to avoid camelCase issue
staging: wilc1000: fix line over 80 chars in add_network_to_shadow()
staging: wilc1000: use kmemdup instead of kmalloc in
add_network_to_shadow()
staging: wilc1000: fix line over 80 charas in
wilc_wfi_remain_on_channel_expired()
staging: wilc1000: fix line over 80 chars in
wilc_wfi_cfg_tx_vendor_spec()
staging: wilc1000: fix line over 80 chars in get_station()
staging: wilc1000: fix line over 80 chars in wilc_create_wiphy()
declaration
staging: wilc1000: fix line over 80 characters in add_key()
staging: wilc1000: fix line over 80 chars in scan()
staging: wilc1000: fix line over 80 chars issue in connect()
staging: wilc1000: rename u8security to avoid datatype in variable
name
staging: wilc1000: refactor del_station() to avoid parenthesis
misalignment
staging: wilc1000: fix line over 80 chars in wilc_sdio struct
staging: wilc1000: added #define for setting radiotap header
staging: wilc1000: remove 'flag' argument from wilc_mac_indicate()
staging: wilc1000: added comments for mutex and spinlock_t
staging: wilc1000: remove unused 'lock' varible in 'wilc_priv'
structure
staging: wilc1000: remove s8idxarray to avoid datatype in variable
name
staging: wilc1000: refactor host_int_parse_assoc_resp_info() to remove
unused code

drivers/staging/wilc1000/coreconfigurator.c | 51 +--
drivers/staging/wilc1000/coreconfigurator.h | 10 +-
drivers/staging/wilc1000/host_interface.c | 398 +++++++++++-----------
drivers/staging/wilc1000/host_interface.h | 2 +-
drivers/staging/wilc1000/linux_mon.c | 25 +-
drivers/staging/wilc1000/linux_wlan.c | 17 +-
drivers/staging/wilc1000/wilc_sdio.c | 3 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 190 ++++++-----
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 3 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 8 +-
drivers/staging/wilc1000/wilc_wlan.c | 7 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 3 -
12 files changed, 341 insertions(+), 376 deletions(-)

--
2.7.4


2018-05-11 08:15:36

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 30/30] staging: wilc1000: refactor host_int_parse_assoc_resp_info() to remove unused code

Remove 'connect_resp_info' structure as most of its elements are not used.

Modified wilc_parse_assoc_resp_info() to directly parse and fill value
in connect_info structure variable. Remove use of 'assoc_resp_len' variable.
get_assoc_resp_cap_info() & get_asoc_id() functions are remove as its
not used anymore.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 51 +++++------------------------
drivers/staging/wilc1000/coreconfigurator.h | 10 +-----
drivers/staging/wilc1000/host_interface.c | 20 ++---------
3 files changed, 11 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 9f9ca76..4481602 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -207,16 +207,6 @@ static inline u16 get_cap_info(u8 *data)
return cap_info;
}

-static inline u16 get_assoc_resp_cap_info(u8 *data)
-{
- u16 cap_info;
-
- cap_info = data[0];
- cap_info |= (data[1] << 8);
-
- return cap_info;
-}
-
static inline u16 get_asoc_status(u8 *data)
{
u16 asoc_status;
@@ -225,16 +215,6 @@ static inline u16 get_asoc_status(u8 *data)
return (asoc_status << 8) | data[2];
}

-static inline u16 get_asoc_id(u8 *data)
-{
- u16 asoc_id;
-
- asoc_id = data[4];
- asoc_id |= (data[5] << 8);
-
- return asoc_id;
-}
-
static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 tag_param_offset)
{
u16 index;
@@ -338,38 +318,23 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
}

s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
- struct connect_resp_info **ret_connect_resp_info)
+ struct connect_info *ret_conn_info)
{
- struct connect_resp_info *connect_resp_info = NULL;
- u16 assoc_resp_len = 0;
u8 *ies = NULL;
u16 ies_len = 0;

- connect_resp_info = kzalloc(sizeof(*connect_resp_info), GFP_KERNEL);
- if (!connect_resp_info)
- return -ENOMEM;
-
- assoc_resp_len = (u16)buffer_len;
-
- connect_resp_info->status = get_asoc_status(buffer);
- if (connect_resp_info->status == SUCCESSFUL_STATUSCODE) {
- connect_resp_info->capability = get_assoc_resp_cap_info(buffer);
- connect_resp_info->assoc_id = get_asoc_id(buffer);
-
+ ret_conn_info->status = get_asoc_status(buffer);
+ if (ret_conn_info->status == SUCCESSFUL_STATUSCODE) {
ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
- ies_len = assoc_resp_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
- AID_LEN);
+ ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
+ AID_LEN);

- connect_resp_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
- if (!connect_resp_info->ies) {
- kfree(connect_resp_info);
+ ret_conn_info->resp_ies = kmemdup(ies, ies_len, GFP_KERNEL);
+ if (!ret_conn_info->resp_ies)
return -ENOMEM;
- }

- connect_resp_info->ies_len = ies_len;
+ ret_conn_info->resp_ies_len = ies_len;
}

- *ret_connect_resp_info = connect_resp_info;
-
return 0;
}
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index a58f44e..55b5531 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -71,14 +71,6 @@ struct network_info {
u64 tsf_hi;
};

-struct connect_resp_info {
- u16 capability;
- u16 status;
- u16 assoc_id;
- u8 *ies;
- u16 ies_len;
-};
-
struct connect_info {
u8 bssid[6];
u8 *req_ies;
@@ -97,7 +89,7 @@ struct disconnect_info {
s32 wilc_parse_network_info(u8 *msg_buffer,
struct network_info **ret_network_info);
s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
- struct connect_resp_info **ret_connect_resp_info);
+ struct connect_info *ret_conn_info);
void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length);
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4274efb..a2f82c8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1297,7 +1297,6 @@ static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
u8 mac_status)
{
- struct connect_resp_info *connect_resp_info = NULL;
struct connect_info conn_info;
struct host_if_drv *hif_drv = vif->hif_drv;

@@ -1317,26 +1316,11 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,

err = wilc_parse_assoc_resp_info(rcv_assoc_resp,
assoc_resp_info_len,
- &connect_resp_info);
- if (err) {
+ &conn_info);
+ if (err)
netdev_err(vif->ndev,
"wilc_parse_assoc_resp_info() returned error %d\n",
err);
- } else {
- conn_info.status = connect_resp_info->status;
-
- if (conn_info.status == SUCCESSFUL_STATUSCODE &&
- connect_resp_info->ies) {
- conn_info.resp_ies = kmemdup(connect_resp_info->ies,
- connect_resp_info->ies_len,
- GFP_KERNEL);
- if (conn_info.resp_ies)
- conn_info.resp_ies_len = connect_resp_info->ies_len;
- }
-
- kfree(connect_resp_info->ies);
- kfree(connect_resp_info);
- }
}
}

--
2.7.4

2018-05-11 08:15:18

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 25/30] staging: wilc1000: added #define for setting radiotap header

Added new macro to resolve below checkpatch issues in linux_mon.

"Lines should not end with a '('"

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/linux_mon.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index c372e0f..1c7e6e1 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -22,6 +22,9 @@ static u8 bssid[6];
#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive*/
#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)

+#define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) | \
+ (1 << IEEE80211_RADIOTAP_TX_FLAGS))
+
void wilc_wfi_monitor_rx(u8 *buff, u32 size)
{
u32 header, pkt_offset;
@@ -59,9 +62,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)

cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));

- cb_hdr->hdr.it_present = cpu_to_le32(
- (1 << IEEE80211_RADIOTAP_RATE) |
- (1 << IEEE80211_RADIOTAP_TX_FLAGS));
+ cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);

cb_hdr->rate = 5; /* txrate->bitrate / 5; */

@@ -177,9 +178,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,

cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));

- cb_hdr->hdr.it_present = cpu_to_le32(
- (1 << IEEE80211_RADIOTAP_RATE) |
- (1 << IEEE80211_RADIOTAP_TX_FLAGS));
+ cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);

cb_hdr->rate = 5; /* txrate->bitrate / 5; */
cb_hdr->tx_flags = 0x0004;
--
2.7.4

2018-05-11 08:13:54

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 01/30] staging: wilc1000: added complete() call for error scenario in handle_key()

During memory allocation failure in handle_key() the complete() was not
called for comp_test_key_block event. So now added the code to call
complete() for event during error scenario.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index b5f3829..652f51c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1513,8 +1513,10 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)

key_buf = kmalloc(hif_key->attr.wep.key_len + 2,
GFP_KERNEL);
- if (!key_buf)
- return -ENOMEM;
+ if (!key_buf) {
+ result = -ENOMEM;
+ goto out_wep;
+ }

key_buf[0] = hif_key->attr.wep.index;
key_buf[1] = hif_key->attr.wep.key_len;
@@ -1535,8 +1537,10 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
kfree(key_buf);
} else if (hif_key->action & ADDKEY) {
key_buf = kmalloc(hif_key->attr.wep.key_len + 2, GFP_KERNEL);
- if (!key_buf)
- return -ENOMEM;
+ if (!key_buf) {
+ result = -ENOMEM;
+ goto out_wep;
+ }
key_buf[0] = hif_key->attr.wep.index;
memcpy(key_buf + 1, &hif_key->attr.wep.key_len, 1);
memcpy(key_buf + 2, hif_key->attr.wep.key,
@@ -1573,6 +1577,7 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
&wid, 1,
wilc_get_vif_idx(vif));
}
+out_wep:
complete(&hif_drv->comp_test_key_block);
break;

@@ -1607,7 +1612,6 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
wilc_get_vif_idx(vif));

kfree(key_buf);
- complete(&hif_drv->comp_test_key_block);
} else if (hif_key->action & ADDKEY) {
key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
@@ -1636,9 +1640,9 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
wilc_get_vif_idx(vif));

kfree(key_buf);
- complete(&hif_drv->comp_test_key_block);
}
out_wpa_rx_gtk:
+ complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
kfree(hif_key->attr.wpa.seq);
if (ret)
@@ -1674,7 +1678,6 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
wid_list, 2,
wilc_get_vif_idx(vif));
kfree(key_buf);
- complete(&hif_drv->comp_test_key_block);
} else if (hif_key->action & ADDKEY) {
key_buf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
@@ -1696,10 +1699,10 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
&wid, 1,
wilc_get_vif_idx(vif));
kfree(key_buf);
- complete(&hif_drv->comp_test_key_block);
}

out_wpa_ptk:
+ complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
if (ret)
return ret;
--
2.7.4

2018-05-11 08:14:05

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 04/30] staging: wilc1000: fix line over 80 characters issue in handle_connect()

Fix line over 80 character issue found by checkpatch.pl script by
aligning the input argument in function call.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index bf5efb0..84eff27 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1117,10 +1117,8 @@ static s32 handle_connect(struct wilc_vif *vif,
}

conn_attr->result(CONN_DISCONN_EVENT_CONN_RESP,
- &conn_info,
- MAC_STATUS_DISCONNECTED,
- NULL,
- conn_attr->arg);
+ &conn_info, MAC_STATUS_DISCONNECTED,
+ NULL, conn_attr->arg);
hif_drv->hif_state = HOST_IF_IDLE;
kfree(conn_info.req_ies);
conn_info.req_ies = NULL;
--
2.7.4

2018-05-11 08:14:11

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 06/30] staging: wilc1000: fix line over 80 characters in host_int_parse_join_bss_param()

Split host_int_parse_join_bss_param() to avoid the line over 80
character issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 247 ++++++++++++++++--------------
1 file changed, 131 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index b8dcca6..02e7da5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3827,150 +3827,165 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
return result;
}

-static void *host_int_parse_join_bss_param(struct network_info *info)
+static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
+ u16 *out_index, u8 *pcipher_tc,
+ u8 *auth_total_cnt, u32 tsf_lo)
{
- struct join_bss_param *param = NULL;
- u8 *ies;
- u16 ies_len;
- u16 index = 0;
u8 rates_no = 0;
u8 ext_rates_no;
u16 offset;
u8 pcipher_cnt;
u8 auth_cnt;
- u8 pcipher_total_cnt = 0;
- u8 auth_total_cnt = 0;
u8 i, j;
+ u16 index = *out_index;

- ies = info->ies;
- ies_len = info->ies_len;
+ if (ies[index] == SUPP_RATES_IE) {
+ rates_no = ies[index + 1];
+ param->supp_rates[0] = rates_no;
+ index += 2;

- param = kzalloc(sizeof(*param), GFP_KERNEL);
- if (!param)
- return NULL;
+ for (i = 0; i < rates_no; i++)
+ param->supp_rates[i + 1] = ies[index + i];

- param->dtim_period = info->dtim_period;
- param->beacon_period = info->beacon_period;
- param->cap_info = info->cap_info;
- memcpy(param->bssid, info->bssid, 6);
- memcpy((u8 *)param->ssid, info->ssid, info->ssid_len + 1);
- param->ssid_len = info->ssid_len;
- memset(param->rsn_pcip_policy, 0xFF, 3);
- memset(param->rsn_auth_policy, 0xFF, 3);
+ index += rates_no;
+ } else if (ies[index] == EXT_SUPP_RATES_IE) {
+ ext_rates_no = ies[index + 1];
+ if (ext_rates_no > (MAX_RATES_SUPPORTED - rates_no))
+ param->supp_rates[0] = MAX_RATES_SUPPORTED;
+ else
+ param->supp_rates[0] += ext_rates_no;
+ index += 2;
+ for (i = 0; i < (param->supp_rates[0] - rates_no); i++)
+ param->supp_rates[rates_no + i + 1] = ies[index + i];
+
+ index += ext_rates_no;
+ } else if (ies[index] == HT_CAPABILITY_IE) {
+ param->ht_capable = true;
+ index += ies[index + 1] + 2;
+ } else if ((ies[index] == WMM_IE) &&
+ (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
+ (ies[index + 4] == 0xF2) && (ies[index + 5] == 0x02) &&
+ ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
+ (ies[index + 7] == 0x01)) {
+ param->wmm_cap = true;
+
+ if (ies[index + 8] & BIT(7))
+ param->uapsd_cap = true;
+ index += ies[index + 1] + 2;
+ } else if ((ies[index] == P2P_IE) &&
+ (ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
+ (ies[index + 4] == 0x9a) &&
+ (ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
+ u16 p2p_cnt;
+
+ param->tsf = tsf_lo;
+ param->noa_enabled = 1;
+ param->idx = ies[index + 9];
+
+ if (ies[index + 10] & BIT(7)) {
+ param->opp_enabled = 1;
+ param->ct_window = ies[index + 10];
+ } else {
+ param->opp_enabled = 0;
+ }

- while (index < ies_len) {
- if (ies[index] == SUPP_RATES_IE) {
- rates_no = ies[index + 1];
- param->supp_rates[0] = rates_no;
- index += 2;
+ param->cnt = ies[index + 11];
+ p2p_cnt = index + 12;

- for (i = 0; i < rates_no; i++)
- param->supp_rates[i + 1] = ies[index + i];
+ memcpy(param->duration, ies + p2p_cnt, 4);
+ p2p_cnt += 4;

- index += rates_no;
- } else if (ies[index] == EXT_SUPP_RATES_IE) {
- ext_rates_no = ies[index + 1];
- if (ext_rates_no > (MAX_RATES_SUPPORTED - rates_no))
- param->supp_rates[0] = MAX_RATES_SUPPORTED;
- else
- param->supp_rates[0] += ext_rates_no;
- index += 2;
- for (i = 0; i < (param->supp_rates[0] - rates_no); i++)
- param->supp_rates[rates_no + i + 1] = ies[index + i];
-
- index += ext_rates_no;
- } else if (ies[index] == HT_CAPABILITY_IE) {
- param->ht_capable = true;
- index += ies[index + 1] + 2;
- } else if ((ies[index] == WMM_IE) &&
- (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
- (ies[index + 4] == 0xF2) &&
- (ies[index + 5] == 0x02) &&
- ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
- (ies[index + 7] == 0x01)) {
- param->wmm_cap = true;
-
- if (ies[index + 8] & BIT(7))
- param->uapsd_cap = true;
- index += ies[index + 1] + 2;
- } else if ((ies[index] == P2P_IE) &&
- (ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
- (ies[index + 4] == 0x9a) &&
- (ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
- u16 p2p_cnt;
-
- param->tsf = info->tsf_lo;
- param->noa_enabled = 1;
- param->idx = ies[index + 9];
-
- if (ies[index + 10] & BIT(7)) {
- param->opp_enabled = 1;
- param->ct_window = ies[index + 10];
- } else {
- param->opp_enabled = 0;
- }
+ memcpy(param->interval, ies + p2p_cnt, 4);
+ p2p_cnt += 4;

- param->cnt = ies[index + 11];
- p2p_cnt = index + 12;
+ memcpy(param->start_time, ies + p2p_cnt, 4);

- memcpy(param->duration, ies + p2p_cnt, 4);
- p2p_cnt += 4;
+ index += ies[index + 1] + 2;
+ } else if ((ies[index] == RSN_IE) ||
+ ((ies[index] == WPA_IE) && (ies[index + 2] == 0x00) &&
+ (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
+ (ies[index + 5] == 0x01))) {
+ u16 rsn_idx = index;

- memcpy(param->interval, ies + p2p_cnt, 4);
- p2p_cnt += 4;
+ if (ies[rsn_idx] == RSN_IE) {
+ param->mode_802_11i = 2;
+ } else {
+ if (param->mode_802_11i == 0)
+ param->mode_802_11i = 1;
+ rsn_idx += 4;
+ }

- memcpy(param->start_time, ies + p2p_cnt, 4);
+ rsn_idx += 7;
+ param->rsn_grp_policy = ies[rsn_idx];
+ rsn_idx++;
+ offset = ies[rsn_idx] * 4;
+ pcipher_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
+ rsn_idx += 2;

- index += ies[index + 1] + 2;
- } else if ((ies[index] == RSN_IE) ||
- ((ies[index] == WPA_IE) && (ies[index + 2] == 0x00) &&
- (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
- (ies[index + 5] == 0x01))) {
- u16 rsn_idx = index;
+ i = *pcipher_tc;
+ j = 0;
+ for (; i < (pcipher_cnt + *pcipher_tc) && i < 3; i++, j++) {
+ u8 *policy = &param->rsn_pcip_policy[i];

- if (ies[rsn_idx] == RSN_IE) {
- param->mode_802_11i = 2;
- } else {
- if (param->mode_802_11i == 0)
- param->mode_802_11i = 1;
- rsn_idx += 4;
- }
+ *policy = ies[rsn_idx + ((j + 1) * 4) - 1];
+ }

- rsn_idx += 7;
- param->rsn_grp_policy = ies[rsn_idx];
- rsn_idx++;
- offset = ies[rsn_idx] * 4;
- pcipher_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
- rsn_idx += 2;
+ *pcipher_tc += pcipher_cnt;
+ rsn_idx += offset;

- for (i = pcipher_total_cnt, j = 0; i < pcipher_cnt + pcipher_total_cnt && i < 3; i++, j++)
- param->rsn_pcip_policy[i] = ies[rsn_idx + ((j + 1) * 4) - 1];
+ offset = ies[rsn_idx] * 4;

- pcipher_total_cnt += pcipher_cnt;
- rsn_idx += offset;
+ auth_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
+ rsn_idx += 2;
+ i = *auth_total_cnt;
+ j = 0;
+ for (; i < (*auth_total_cnt + auth_cnt); i++, j++) {
+ u8 *policy = &param->rsn_auth_policy[i];

- offset = ies[rsn_idx] * 4;
+ *policy = ies[rsn_idx + ((j + 1) * 4) - 1];
+ }
+
+ auth_total_cnt += auth_cnt;
+ rsn_idx += offset;

- auth_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
+ if (ies[index] == RSN_IE) {
+ param->rsn_cap[0] = ies[rsn_idx];
+ param->rsn_cap[1] = ies[rsn_idx + 1];
rsn_idx += 2;
+ }
+ param->rsn_found = true;
+ index += ies[index + 1] + 2;
+ } else {
+ index += ies[index + 1] + 2;
+ }

- for (i = auth_total_cnt, j = 0; i < auth_total_cnt + auth_cnt; i++, j++)
- param->rsn_auth_policy[i] = ies[rsn_idx + ((j + 1) * 4) - 1];
+ *out_index = index;
+}

- auth_total_cnt += auth_cnt;
- rsn_idx += offset;
+static void *host_int_parse_join_bss_param(struct network_info *info)
+{
+ struct join_bss_param *param = NULL;
+ u16 index = 0;
+ u8 pcipher_total_cnt = 0;
+ u8 auth_total_cnt = 0;

- if (ies[index] == RSN_IE) {
- param->rsn_cap[0] = ies[rsn_idx];
- param->rsn_cap[1] = ies[rsn_idx + 1];
- rsn_idx += 2;
- }
- param->rsn_found = true;
- index += ies[index + 1] + 2;
- } else {
- index += ies[index + 1] + 2;
- }
- }
+ param = kzalloc(sizeof(*param), GFP_KERNEL);
+ if (!param)
+ return NULL;
+
+ param->dtim_period = info->dtim_period;
+ param->beacon_period = info->beacon_period;
+ param->cap_info = info->cap_info;
+ memcpy(param->bssid, info->bssid, 6);
+ memcpy((u8 *)param->ssid, info->ssid, info->ssid_len + 1);
+ param->ssid_len = info->ssid_len;
+ memset(param->rsn_pcip_policy, 0xFF, 3);
+ memset(param->rsn_auth_policy, 0xFF, 3);
+
+ while (index < info->ies_len)
+ host_int_fill_join_bss_param(param, info->ies, &index,
+ &pcipher_total_cnt,
+ &auth_total_cnt, info->tsf_lo);

return (void *)param;
}
--
2.7.4

2018-05-11 08:14:40

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 14/30] staging: wilc1000: use kmemdup instead of kmalloc in add_network_to_shadow()

Use kmemdup instead of kmalloc & memcpy in add_network_to_shadow(). Also
added code to set 'ies_len' to zero in case of memory allocation
failure.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c730323..32bdefb 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -327,12 +327,15 @@ static void add_network_to_shadow(struct network_info *nw_info,
shadow_nw_info->beacon_period = nw_info->beacon_period;
shadow_nw_info->dtim_period = nw_info->dtim_period;
shadow_nw_info->ch = nw_info->ch;
- shadow_nw_info->ies_len = nw_info->ies_len;
shadow_nw_info->tsf_hi = nw_info->tsf_hi;
if (ap_found != -1)
kfree(shadow_nw_info->ies);
- shadow_nw_info->ies = kmalloc(nw_info->ies_len, GFP_KERNEL);
- memcpy(shadow_nw_info->ies, nw_info->ies, nw_info->ies_len);
+ shadow_nw_info->ies = kmemdup(nw_info->ies, nw_info->ies_len,
+ GFP_KERNEL);
+ if (shadow_nw_info->ies)
+ shadow_nw_info->ies_len = nw_info->ies_len;
+ else
+ shadow_nw_info->ies_len = 0;
shadow_nw_info->time_scan = jiffies;
shadow_nw_info->time_scan_cached = jiffies;
shadow_nw_info->found = 1;
--
2.7.4

2018-05-11 08:15:28

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 28/30] staging: wilc1000: remove unused 'lock' varible in 'wilc_priv' structure

Cleanup patch to remove the unused variable from 'wilc_priv' structure.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 78f3312..f2b07e8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -78,7 +78,6 @@ struct wilc_priv {
u8 monitor_flag;
int status;
struct sk_buff *skb;
- spinlock_t lock;
struct net_device *dev;
struct host_if_drv *hif_drv;
struct host_if_pmkid_attr pmkid_list;
--
2.7.4

2018-05-11 08:15:12

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 23/30] staging: wilc1000: refactor del_station() to avoid parenthesis misalignment

Refactor the code to fix open parenthesis alignment issue reported by
checkpatch.pl script in del_station().

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 399dc1e3..e248702 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1992,6 +1992,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
s32 ret = 0;
struct wilc_priv *priv;
struct wilc_vif *vif;
+ struct sta_info *info;

if (!wiphy)
return -EFAULT;
@@ -1999,16 +2000,17 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);

- if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
- if (!mac)
- ret = wilc_del_allstation(vif,
- priv->assoc_stainfo.sta_associated_bss);
+ if (!(vif->iftype == AP_MODE || vif->iftype == GO_MODE))
+ return ret;

- ret = wilc_del_station(vif, mac);
+ info = &priv->assoc_stainfo;

- if (ret)
- netdev_err(dev, "Host delete station fail\n");
- }
+ if (!mac)
+ ret = wilc_del_allstation(vif, info->sta_associated_bss);
+
+ ret = wilc_del_station(vif, mac);
+ if (ret)
+ netdev_err(dev, "Host delete station fail\n");
return ret;
}

--
2.7.4

2018-05-11 08:14:19

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 08/30] staging: wilc1000: replace kmalloc with kmemdup() in handle_connect_timeout()

Instead of kmalloc and memcpy use kmemdup in handle_connect_timeout().
Also return -ENOMEM incase of failure to allocate the memory.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 039b49b..89f4afd 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1166,10 +1166,11 @@ static s32 handle_connect_timeout(struct wilc_vif *vif)

if (hif_drv->usr_conn_req.ies) {
info.req_ies_len = hif_drv->usr_conn_req.ies_len;
- info.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
- memcpy(info.req_ies,
- hif_drv->usr_conn_req.ies,
- hif_drv->usr_conn_req.ies_len);
+ info.req_ies = kmemdup(hif_drv->usr_conn_req.ies,
+ hif_drv->usr_conn_req.ies_len,
+ GFP_KERNEL);
+ if (!info.req_ies)
+ return -ENOMEM;
}

hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
--
2.7.4

2018-05-11 08:14:55

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 18/30] staging: wilc1000: fix line over 80 chars in wilc_create_wiphy() declaration

Fix line over 80 characters issue found by checkpatch.pl script in
function declaration.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index c1a2421..a69103b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -3,7 +3,8 @@
#define NM_WFI_CFGOPERATIONS
#include "wilc_wfi_netdevice.h"

-struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net,
+ struct device *dev);
void wilc_free_wiphy(struct net_device *net);
int wilc_deinit_host_int(struct net_device *net);
int wilc_init_host_int(struct net_device *net);
--
2.7.4

2018-05-11 08:14:50

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 10/30] staging: wilc1000: use sizeof(*wdev) to allocate memory in wilc_wfi_cfg_alloc()

Fix below reported checkpatch issues in wilc_wfi_cfg_alloc().
kzalloc(sizeof(*wdev)...) over kzalloc(sizeof(struct wireless_dev)

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e0015ca..65ba6ed 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2184,7 +2184,7 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
{
struct wireless_dev *wdev;

- wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
+ wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
if (!wdev)
goto _fail_;

--
2.7.4

2018-05-11 08:14:52

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 16/30] staging: wilc1000: fix line over 80 chars in wilc_wfi_cfg_tx_vendor_spec()

Fix line over 80 characters issues reported by checkpatch.pl script in
wilc_wfi_cfg_tx_vendor_spec() by using temporary variable. Simplified
'if else' condition with 'if'.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 93511de..7994736 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1570,14 +1570,14 @@ static void wilc_wfi_cfg_tx_vendor_spec(struct p2p_mgmt_data *mgmt_tx,
for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) {
if (buf[i] == P2PELEM_ATTR_ID &&
!memcmp(p2p_oui, &buf[i + 2], 4)) {
+ bool oper_ch = false;
+ u8 *tx_buff = &mgmt_tx->buff[i + 6];
+
if (subtype == P2P_INV_REQ || subtype == P2P_INV_RSP)
- wilc_wfi_cfg_parse_tx_action(&mgmt_tx->buff[i + 6],
- len - (i + 6),
- true, iftype);
- else
- wilc_wfi_cfg_parse_tx_action(&mgmt_tx->buff[i + 6],
- len - (i + 6),
- false, iftype);
+ oper_ch = true;
+
+ wilc_wfi_cfg_parse_tx_action(tx_buff, len - (i + 6),
+ oper_ch, iftype);

break;
}
--
2.7.4

2018-05-11 08:15:08

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 22/30] staging: wilc1000: rename u8security to avoid datatype in variable name

Cleanup patch to avoid use of datatype in variable name to follow as
per linux coding style.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 70947a8..399dc1e3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -677,7 +677,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
s32 ret = 0;
u32 i;
u32 sel_bssi_idx = UINT_MAX;
- u8 u8security = NO_ENCRYPT;
+ u8 security = NO_ENCRYPT;
enum AUTHTYPE auth_type = ANY;
u32 cipher_group;
struct wilc_priv *priv;
@@ -730,7 +730,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
cipher_group = sme->crypto.cipher_group;
if (cipher_group != NO_ENCRYPT) {
if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
- u8security = ENCRYPT_ENABLED | WEP;
+ security = ENCRYPT_ENABLED | WEP;

priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
@@ -740,7 +740,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
sme->key_idx);
} else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
- u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
+ security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
@@ -751,14 +751,14 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
- u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
+ security = ENCRYPT_ENABLED | WPA2 | TKIP;
else
- u8security = ENCRYPT_ENABLED | WPA2 | AES;
+ security = ENCRYPT_ENABLED | WPA2 | AES;
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) {
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
- u8security = ENCRYPT_ENABLED | WPA | TKIP;
+ security = ENCRYPT_ENABLED | WPA | TKIP;
else
- u8security = ENCRYPT_ENABLED | WPA | AES;
+ security = ENCRYPT_ENABLED | WPA | AES;
} else {
ret = -ENOTSUPP;
netdev_err(dev, "Not supported cipher\n");
@@ -773,9 +773,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
u32 ciphers_pairwise = sme->crypto.ciphers_pairwise[i];

if (ciphers_pairwise == WLAN_CIPHER_SUITE_TKIP)
- u8security = u8security | TKIP;
+ security = security | TKIP;
else
- u8security = u8security | AES;
+ security = security | AES;
}
}

@@ -807,7 +807,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
ret = wilc_set_join_req(vif, nw_info->bssid, sme->ssid,
sme->ssid_len, sme->ie, sme->ie_len,
cfg_connect_result, (void *)priv,
- u8security, auth_type,
+ security, auth_type,
nw_info->ch,
nw_info->join_params);
if (ret != 0) {
--
2.7.4

2018-05-11 08:14:58

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 19/30] staging: wilc1000: fix line over 80 characters in add_key()

Fix line over 80 character issue found by checkpatch.pl script in
add_key().

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 9684d34..b67a170 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -908,8 +908,7 @@ static int wilc_wfi_cfg_copy_wpa_info(struct wilc_wfi_key *key_info,
}

static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
- bool pairwise,
- const u8 *mac_addr, struct key_params *params)
+ bool pairwise, const u8 *mac_addr, struct key_params *params)

{
s32 ret = 0, keylen = params->key_len;
@@ -955,6 +954,8 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP ||
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
+ struct wilc_wfi_key *key;
+
ret = wilc_wfi_cfg_allocate_wpa_entry(priv, key_index);
if (ret)
return -ENOMEM;
@@ -974,21 +975,19 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

priv->wilc_groupkey = mode;

- ret = wilc_wfi_cfg_copy_wpa_info(priv->wilc_gtk[key_index],
- params);
- if (ret)
- return -ENOMEM;
+ key = priv->wilc_gtk[key_index];
} else {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
mode = ENCRYPT_ENABLED | WPA | TKIP;
else
mode = priv->wilc_groupkey | AES;

- ret = wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index],
- params);
- if (ret)
- return -ENOMEM;
+ key = priv->wilc_ptk[key_index];
}
+ ret = wilc_wfi_cfg_copy_wpa_info(key, params);
+ if (ret)
+ return -ENOMEM;
+
op_mode = AP_MODE;
} else {
if (params->key_len > 16 &&
--
2.7.4

2018-05-11 08:14:30

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 11/30] staging: wilc1000: use kmalloc(sizeof(*mgmt_tx)...) in mgmt_tx()

Fix below checkpatch issue found in mgmt_tx()

Prefer kmalloc(sizeof(*mgmt_tx)...) over kmalloc(sizeof(struct
p2p_mgmt_data)...)

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 65ba6ed..1408ebd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1622,7 +1622,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (!ieee80211_is_mgmt(mgmt->frame_control))
goto out;

- mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
+ mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_KERNEL);
if (!mgmt_tx) {
ret = -ENOMEM;
goto out;
--
2.7.4

2018-05-11 08:14:08

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 05/30] staging: wilc1000: fix line over 80 chars issue in host_int_handle_disconnect()

Fix line over 80 char issue in host_int_handle_disconnect() by using
temp variable to hold the 'wilc_connect_result' function pointer.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 84eff27..b8dcca6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1396,6 +1396,7 @@ static inline void host_int_handle_disconnect(struct wilc_vif *vif)
{
struct disconnect_info disconn_info;
struct host_if_drv *hif_drv = vif->hif_drv;
+ wilc_connect_result conn_result = hif_drv->usr_conn_req.conn_result;

memset(&disconn_info, 0, sizeof(struct disconnect_info));

@@ -1408,13 +1409,12 @@ static inline void host_int_handle_disconnect(struct wilc_vif *vif)
disconn_info.ie = NULL;
disconn_info.ie_len = 0;

- if (hif_drv->usr_conn_req.conn_result) {
+ if (conn_result) {
wilc_optaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);

- hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
- NULL, 0, &disconn_info,
- hif_drv->usr_conn_req.arg);
+ conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, 0,
+ &disconn_info, hif_drv->usr_conn_req.arg);
} else {
netdev_err(vif->ndev, "Connect result NULL\n");
}
--
2.7.4

2018-05-11 08:14:50

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 13/30] staging: wilc1000: fix line over 80 chars in add_network_to_shadow()

Fix line over 80 characters issue reported by checkpatch in
add_network_to_shadow() by using temporary variable.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 52 +++++++++++------------
1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 9afba4d..c730323 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -300,6 +300,7 @@ static void add_network_to_shadow(struct network_info *nw_info,
int ap_found = is_network_in_shadow(nw_info, user_void);
u32 ap_index = 0;
u8 rssi_index = 0;
+ struct network_info *shadow_nw_info;

if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW)
return;
@@ -310,37 +311,34 @@ static void add_network_to_shadow(struct network_info *nw_info,
} else {
ap_index = ap_found;
}
- rssi_index = last_scanned_shadow[ap_index].rssi_history.index;
- last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++] = nw_info->rssi;
+ shadow_nw_info = &last_scanned_shadow[ap_index];
+ rssi_index = shadow_nw_info->rssi_history.index;
+ shadow_nw_info->rssi_history.samples[rssi_index++] = nw_info->rssi;
if (rssi_index == NUM_RSSI) {
rssi_index = 0;
- last_scanned_shadow[ap_index].rssi_history.full = true;
- }
- last_scanned_shadow[ap_index].rssi_history.index = rssi_index;
- last_scanned_shadow[ap_index].rssi = nw_info->rssi;
- last_scanned_shadow[ap_index].cap_info = nw_info->cap_info;
- last_scanned_shadow[ap_index].ssid_len = nw_info->ssid_len;
- memcpy(last_scanned_shadow[ap_index].ssid,
- nw_info->ssid, nw_info->ssid_len);
- memcpy(last_scanned_shadow[ap_index].bssid,
- nw_info->bssid, ETH_ALEN);
- last_scanned_shadow[ap_index].beacon_period = nw_info->beacon_period;
- last_scanned_shadow[ap_index].dtim_period = nw_info->dtim_period;
- last_scanned_shadow[ap_index].ch = nw_info->ch;
- last_scanned_shadow[ap_index].ies_len = nw_info->ies_len;
- last_scanned_shadow[ap_index].tsf_hi = nw_info->tsf_hi;
+ shadow_nw_info->rssi_history.full = true;
+ }
+ shadow_nw_info->rssi_history.index = rssi_index;
+ shadow_nw_info->rssi = nw_info->rssi;
+ shadow_nw_info->cap_info = nw_info->cap_info;
+ shadow_nw_info->ssid_len = nw_info->ssid_len;
+ memcpy(shadow_nw_info->ssid, nw_info->ssid, nw_info->ssid_len);
+ memcpy(shadow_nw_info->bssid, nw_info->bssid, ETH_ALEN);
+ shadow_nw_info->beacon_period = nw_info->beacon_period;
+ shadow_nw_info->dtim_period = nw_info->dtim_period;
+ shadow_nw_info->ch = nw_info->ch;
+ shadow_nw_info->ies_len = nw_info->ies_len;
+ shadow_nw_info->tsf_hi = nw_info->tsf_hi;
if (ap_found != -1)
- kfree(last_scanned_shadow[ap_index].ies);
- last_scanned_shadow[ap_index].ies = kmalloc(nw_info->ies_len,
- GFP_KERNEL);
- memcpy(last_scanned_shadow[ap_index].ies,
- nw_info->ies, nw_info->ies_len);
- last_scanned_shadow[ap_index].time_scan = jiffies;
- last_scanned_shadow[ap_index].time_scan_cached = jiffies;
- last_scanned_shadow[ap_index].found = 1;
+ kfree(shadow_nw_info->ies);
+ shadow_nw_info->ies = kmalloc(nw_info->ies_len, GFP_KERNEL);
+ memcpy(shadow_nw_info->ies, nw_info->ies, nw_info->ies_len);
+ shadow_nw_info->time_scan = jiffies;
+ shadow_nw_info->time_scan_cached = jiffies;
+ shadow_nw_info->found = 1;
if (ap_found != -1)
- kfree(last_scanned_shadow[ap_index].join_params);
- last_scanned_shadow[ap_index].join_params = join_params;
+ kfree(shadow_nw_info->join_params);
+ shadow_nw_info->join_params = join_params;
}

static void cfg_scan_result(enum scan_event scan_event,
--
2.7.4

2018-05-11 08:13:58

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 02/30] staging: wilc1000: remove 'ret' variable in handle_key()

Remove the use of unnecessary 'ret' variable and use existing 'result'
variable to hold the status. Also changed type of 'result' from s32 to
int to confirm with the function return type.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 652f51c..13c5ae2 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1488,13 +1488,12 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,

static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
{
- s32 result = 0;
+ int result = 0;
struct wid wid;
struct wid wid_list[5];
u8 i;
u8 *key_buf;
s8 s8idxarray[1];
- s8 ret = 0;
struct host_if_drv *hif_drv = vif->hif_drv;

switch (hif_key->type) {
@@ -1585,7 +1584,7 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
if (hif_key->action & ADDKEY_AP) {
key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
- ret = -ENOMEM;
+ result = -ENOMEM;
goto out_wpa_rx_gtk;
}

@@ -1615,7 +1614,7 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
} else if (hif_key->action & ADDKEY) {
key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
- ret = -ENOMEM;
+ result = -ENOMEM;
goto out_wpa_rx_gtk;
}

@@ -1645,16 +1644,13 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
kfree(hif_key->attr.wpa.seq);
- if (ret)
- return ret;
-
break;

case WPA_PTK:
if (hif_key->action & ADDKEY_AP) {
key_buf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL);
if (!key_buf) {
- ret = -ENOMEM;
+ result = -ENOMEM;
goto out_wpa_ptk;
}

@@ -1681,7 +1677,7 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
} else if (hif_key->action & ADDKEY) {
key_buf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
- ret = -ENOMEM;
+ result = -ENOMEM;
goto out_wpa_ptk;
}

@@ -1704,9 +1700,6 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
out_wpa_ptk:
complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
- if (ret)
- return ret;
-
break;

case PMKSA:
--
2.7.4

2018-05-11 08:14:52

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 17/30] staging: wilc1000: fix line over 80 chars in get_station()

Fix line over 80 characters issue in get_station().

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 7994736..9684d34 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1121,7 +1121,9 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,

if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
for (i = 0; i < NUM_STA_ASSOCIATED; i++) {
- if (!(memcmp(mac, priv->assoc_stainfo.sta_associated_bss[i], ETH_ALEN))) {
+ if (!(memcmp(mac,
+ priv->assoc_stainfo.sta_associated_bss[i],
+ ETH_ALEN))) {
associatedsta = i;
break;
}
--
2.7.4

2018-05-11 08:14:22

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 09/30] staging: wilc1000: fix line over 80 chars in linux_mon

Fix line over 80 char issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/linux_mon.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 2f4b3f5..c372e0f 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -46,18 +46,18 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
if (pkt_offset & IS_MANAGMEMENT_CALLBACK) {
/* hostapd callback mgmt frame */

- skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_cb_hdr));
+ skb = dev_alloc_skb(size + sizeof(*cb_hdr));
if (!skb)
return;

skb_put_data(skb, buff, size);

cb_hdr = skb_push(skb, sizeof(*cb_hdr));
- memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr));
+ memset(cb_hdr, 0, sizeof(*cb_hdr));

cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */

- cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
+ cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));

cb_hdr->hdr.it_present = cpu_to_le32(
(1 << IEEE80211_RADIOTAP_RATE) |
@@ -73,7 +73,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
}

} else {
- skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_hdr));
+ skb = dev_alloc_skb(size + sizeof(*hdr));

if (!skb)
return;
@@ -82,7 +82,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
hdr = skb_push(skb, sizeof(*hdr));
memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr));
hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
- hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_hdr));
+ hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr));
hdr->hdr.it_present = cpu_to_le32
(1 << IEEE80211_RADIOTAP_RATE); /* | */
hdr->rate = 5; /* txrate->bitrate / 5; */
@@ -164,7 +164,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
skb_pull(skb, rtap_len);

if (skb->data[0] == 0xc0 && is_broadcast_ether_addr(&skb->data[4])) {
- skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr));
+ skb2 = dev_alloc_skb(skb->len + sizeof(*cb_hdr));
if (!skb2)
return -ENOMEM;

@@ -175,7 +175,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,

cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */

- cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
+ cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));

cb_hdr->hdr.it_present = cpu_to_le32(
(1 << IEEE80211_RADIOTAP_RATE) |
--
2.7.4

2018-05-11 08:14:01

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 03/30] staging: wilc1000: fix line over 80 chars in handle_key()

Fix checkpatch reported issue of line over 80 char in handle_key().
Introduced new functions by spliting existing function to address the
checkpatch issue.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 59 +++++++++++++++++++------------
1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 13c5ae2..bf5efb0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1486,12 +1486,45 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
return result;
}

+static int wilc_pmksa_key_copy(struct wilc_vif *vif, struct key_attr *hif_key)
+{
+ int i;
+ int ret;
+ struct wid wid;
+ u8 *key_buf;
+
+ key_buf = kmalloc((hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1,
+ GFP_KERNEL);
+ if (!key_buf)
+ return -ENOMEM;
+
+ key_buf[0] = hif_key->attr.pmkid.numpmkid;
+
+ for (i = 0; i < hif_key->attr.pmkid.numpmkid; i++) {
+ memcpy(key_buf + ((PMKSA_KEY_LEN * i) + 1),
+ hif_key->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN);
+ memcpy(key_buf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1),
+ hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
+ }
+
+ wid.id = (u16)WID_PMKID_INFO;
+ wid.type = WID_STR;
+ wid.val = (s8 *)key_buf;
+ wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
+
+ ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+
+ kfree(key_buf);
+
+ return ret;
+}
+
static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
{
int result = 0;
struct wid wid;
struct wid wid_list[5];
- u8 i;
u8 *key_buf;
s8 s8idxarray[1];
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -1535,7 +1568,8 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
wilc_get_vif_idx(vif));
kfree(key_buf);
} else if (hif_key->action & ADDKEY) {
- key_buf = kmalloc(hif_key->attr.wep.key_len + 2, GFP_KERNEL);
+ key_buf = kmalloc(hif_key->attr.wep.key_len + 2,
+ GFP_KERNEL);
if (!key_buf) {
result = -ENOMEM;
goto out_wep;
@@ -1703,26 +1737,7 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
break;

case PMKSA:
- key_buf = kmalloc((hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL);
- if (!key_buf)
- return -ENOMEM;
-
- key_buf[0] = hif_key->attr.pmkid.numpmkid;
-
- for (i = 0; i < hif_key->attr.pmkid.numpmkid; i++) {
- memcpy(key_buf + ((PMKSA_KEY_LEN * i) + 1), hif_key->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN);
- memcpy(key_buf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
- }
-
- wid.id = (u16)WID_PMKID_INFO;
- wid.type = WID_STR;
- wid.val = (s8 *)key_buf;
- wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-
- kfree(key_buf);
+ result = wilc_pmksa_key_copy(vif, hif_key);
break;
}

--
2.7.4

2018-05-11 08:15:01

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 20/30] staging: wilc1000: fix line over 80 chars in scan()

Fix line over 80 characters issues found by checkpatch.pl script with
the help of local variable.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b67a170..e64e944 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -636,8 +636,11 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)

priv->cfg_scanning = true;
if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) {
- for (i = 0; i < request->n_channels; i++)
- scan_ch_list[i] = (u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq);
+ for (i = 0; i < request->n_channels; i++) {
+ u16 freq = request->channels[i]->center_freq;
+
+ scan_ch_list[i] = ieee80211_frequency_to_channel(freq);
+ }

if (request->n_ssids >= 1) {
if (wilc_wfi_cfg_alloc_fill_ssid(request,
--
2.7.4

2018-05-11 08:14:50

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 12/30] staging: wilc1000: rename clear_duringIP() to avoid camelCase issue

Rename clear_duringIP() function to avoid camelCase issue reported by
checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1408ebd..9afba4d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -269,7 +269,7 @@ static void remove_network_from_shadow(struct timer_list *unused)
mod_timer(&aging_timer, jiffies + msecs_to_jiffies(AGING_TIME));
}

-static void clear_duringIP(struct timer_list *unused)
+static void clear_during_ip(struct timer_list *unused)
{
wilc_optaining_ip = false;
}
@@ -2262,7 +2262,7 @@ int wilc_init_host_int(struct net_device *net)
priv = wdev_priv(net->ieee80211_ptr);
if (op_ifcs == 0) {
timer_setup(&aging_timer, remove_network_from_shadow, 0);
- timer_setup(&wilc_during_ip_timer, clear_duringIP, 0);
+ timer_setup(&wilc_during_ip_timer, clear_during_ip, 0);
}
op_ifcs++;

--
2.7.4

2018-05-11 08:15:05

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 21/30] staging: wilc1000: fix line over 80 chars issue in connect()

Fix line over 80 characters in connect() by using temporary variables.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 29 +++++++++++++----------
1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e64e944..70947a8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -679,7 +679,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
u32 sel_bssi_idx = UINT_MAX;
u8 u8security = NO_ENCRYPT;
enum AUTHTYPE auth_type = ANY;
-
+ u32 cipher_group;
struct wilc_priv *priv;
struct host_if_drv *wfi_drv;
struct network_info *nw_info = NULL;
@@ -727,32 +727,35 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
memset(priv->wep_key, 0, sizeof(priv->wep_key));
memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));

- if (sme->crypto.cipher_group != NO_ENCRYPT) {
- if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) {
+ cipher_group = sme->crypto.cipher_group;
+ if (cipher_group != NO_ENCRYPT) {
+ if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
u8security = ENCRYPT_ENABLED | WEP;

priv->wep_key_len[sme->key_idx] = sme->key_len;
- memcpy(priv->wep_key[sme->key_idx], sme->key, sme->key_len);
+ memcpy(priv->wep_key[sme->key_idx], sme->key,
+ sme->key_len);

wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
sme->key_idx);
- } else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) {
+ } else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

priv->wep_key_len[sme->key_idx] = sme->key_len;
- memcpy(priv->wep_key[sme->key_idx], sme->key, sme->key_len);
+ memcpy(priv->wep_key[sme->key_idx], sme->key,
+ sme->key_len);

wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
sme->key_idx);
- } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
- if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP)
+ } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
+ if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
else
u8security = ENCRYPT_ENABLED | WPA2 | AES;
- } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) {
- if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP)
+ } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) {
+ if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
u8security = ENCRYPT_ENABLED | WPA | TKIP;
else
u8security = ENCRYPT_ENABLED | WPA | AES;
@@ -767,14 +770,16 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) ||
(sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) {
for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) {
- if (sme->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP)
+ u32 ciphers_pairwise = sme->crypto.ciphers_pairwise[i];
+
+ if (ciphers_pairwise == WLAN_CIPHER_SUITE_TKIP)
u8security = u8security | TKIP;
else
u8security = u8security | AES;
}
}

- switch (sme->auth_type) {
+ switch (sme->auth_type) {
case NL80211_AUTHTYPE_OPEN_SYSTEM:
auth_type = OPEN_SYSTEM;
break;
--
2.7.4

2018-05-11 08:15:32

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 29/30] staging: wilc1000: remove s8idxarray to avoid datatype in variable name

Cleanup patch to have variable names as per linux coding style.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 89f4afd..4274efb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1526,7 +1526,6 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
struct wid wid;
struct wid wid_list[5];
u8 *key_buf;
- s8 s8idxarray[1];
struct host_if_drv *hif_drv = vif->hif_drv;

switch (hif_key->type) {
@@ -1593,8 +1592,7 @@ static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
wid.id = (u16)WID_REMOVE_WEP_KEY;
wid.type = WID_STR;

- s8idxarray[0] = (s8)hif_key->attr.wep.index;
- wid.val = s8idxarray;
+ wid.val = (s8 *)&hif_key->attr.wep.index;
wid.size = 1;

result = wilc_send_config_pkt(vif, SET_CFG,
--
2.7.4

2018-05-11 08:14:51

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 15/30] staging: wilc1000: fix line over 80 charas in wilc_wfi_remain_on_channel_expired()

Refactor wilc_wfi_remain_on_channel_expired() to avoid line over 80
character issue reported by checkpatch.pl script. Also assigned value in the
variable at the time of declaration.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 32bdefb..93511de 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1487,18 +1487,16 @@ static void wilc_wfi_remain_on_channel_ready(void *priv_data)

static void wilc_wfi_remain_on_channel_expired(void *data, u32 session_id)
{
- struct wilc_priv *priv;
+ struct wilc_priv *priv = data;
+ struct wilc_wfi_p2p_listen_params *params = &priv->remain_on_ch_params;

- priv = data;
+ if (session_id != params->listen_session_id)
+ return;

- if (session_id == priv->remain_on_ch_params.listen_session_id) {
- priv->p2p_listen_state = false;
+ priv->p2p_listen_state = false;

- cfg80211_remain_on_channel_expired(priv->wdev,
- priv->remain_on_ch_params.listen_cookie,
- priv->remain_on_ch_params.listen_ch,
- GFP_KERNEL);
- }
+ cfg80211_remain_on_channel_expired(priv->wdev, params->listen_cookie,
+ params->listen_ch, GFP_KERNEL);
}

static int remain_on_channel(struct wiphy *wiphy,
--
2.7.4

2018-05-11 08:14:15

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 07/30] staging: wilc1000: fix line over 80 chars in host_int_parse_assoc_resp_info()

Fix line over 80 characters issue in host_int_parse_assoc_resp_info() by
using shorter name for the local variable.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 02e7da5..039b49b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1303,18 +1303,19 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
memset(&conn_info, 0, sizeof(struct connect_info));

if (mac_status == MAC_STATUS_CONNECTED) {
- u32 rcvd_assoc_resp_info_len;
+ u32 assoc_resp_info_len;

memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);

host_int_get_assoc_res_info(vif, rcv_assoc_resp,
MAX_ASSOC_RESP_FRAME_SIZE,
- &rcvd_assoc_resp_info_len);
+ &assoc_resp_info_len);

- if (rcvd_assoc_resp_info_len != 0) {
+ if (assoc_resp_info_len != 0) {
s32 err = 0;

- err = wilc_parse_assoc_resp_info(rcv_assoc_resp, rcvd_assoc_resp_info_len,
+ err = wilc_parse_assoc_resp_info(rcv_assoc_resp,
+ assoc_resp_info_len,
&connect_resp_info);
if (err) {
netdev_err(vif->ndev,
--
2.7.4

2018-05-11 08:15:15

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 24/30] staging: wilc1000: fix line over 80 chars in wilc_sdio struct

Fix line over 80 chars issue found by checkpatch.pl script by placing
the comment message above the macro preprocessor.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_sdio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 211be73..4ab43f9 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -26,7 +26,8 @@ struct wilc_sdio {
bool irq_gpio;
u32 block_size;
int nint;
-#define MAX_NUN_INT_THRPT_ENH2 (5) /* Max num interrupts allowed in registers 0xf7, 0xf8 */
+/* Max num interrupts allowed in registers 0xf7, 0xf8 */
+#define MAX_NUN_INT_THRPT_ENH2 (5)
int has_thrpt_enh3;
};

--
2.7.4

2018-05-11 08:15:25

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 27/30] staging: wilc1000: added comments for mutex and spinlock_t

Added comments for mutex and spinlock_t to avoid checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.h | 2 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 08b3ba7..068b587 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -271,7 +271,7 @@ struct host_if_drv {

u8 assoc_bssid[ETH_ALEN];
struct cfg_param_attr cfg_values;
-
+ /*lock to protect concurrent setting of cfg params*/
struct mutex cfg_values_lock;
struct completion comp_test_key_block;
struct completion comp_test_disconn_block;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 607dae0..78f3312 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -131,10 +131,11 @@ struct wilc {
u8 vif_num;
struct wilc_vif *vif[NUM_CONCURRENT_IFC];
u8 open_ifcs;
-
+ /*protect head of transmit queue*/
struct mutex txq_add_to_head_cs;
+ /*protect txq_entry_t transmit queue*/
spinlock_t txq_spinlock;
-
+ /*protect rxq_entry_t receiver queue*/
struct mutex rxq_cs;
struct mutex hif_cs;

--
2.7.4

2018-05-11 08:15:22

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 26/30] staging: wilc1000: remove 'flag' argument from wilc_mac_indicate()

Remove 'flag' function parameter in wilc_mac_indicate() as only one
condition was handled using that parameter. Also removed unnecessary
call to wilc_mac_indicate() as no operation was performed in that
function call.
After above changes below macros are not required anymore.
WILC_MAC_INDICATE_STATUS 0x1
WILC_MAC_INDICATE_SCAN 0x2

This changes also helped in resolving the line over 80 chars issue
found by checkatpch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 17 +++++++----------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 7 +------
drivers/staging/wilc1000/wilc_wlan_if.h | 3 ---
4 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7b883c0..02e6b13 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -176,19 +176,16 @@ static void deinit_irq(struct net_device *dev)
}
}

-void wilc_mac_indicate(struct wilc *wilc, int flag)
+void wilc_mac_indicate(struct wilc *wilc)
{
int status;

- if (flag == WILC_MAC_INDICATE_STATUS) {
- wilc_wlan_cfg_get_val(WID_STATUS,
- (unsigned char *)&status, 4);
- if (wilc->mac_status == MAC_STATUS_INIT) {
- wilc->mac_status = status;
- complete(&wilc->sync_event);
- } else {
- wilc->mac_status = status;
- }
+ wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
+ if (wilc->mac_status == MAC_STATUS_INIT) {
+ wilc->mac_status = status;
+ complete(&wilc->sync_event);
+ } else {
+ wilc->mac_status = status;
}
}

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 8849924..607dae0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -182,7 +182,7 @@ struct wilc_wfi_mon_priv {
};

void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
-void wilc_mac_indicate(struct wilc *wilc, int flag);
+void wilc_mac_indicate(struct wilc *wilc);
void wilc_netdev_cleanup(struct wilc *wilc);
int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
int gpio, const struct wilc_hif_func *ops);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 7147e0c..d4ebbf6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -816,12 +816,7 @@ static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 *buffer, int size)
if (wilc->cfg_seq_no == rsp.seq_no)
complete(&wilc->cfg_event);
} else if (rsp.type == WILC_CFG_RSP_STATUS) {
- wilc_mac_indicate(wilc,
- WILC_MAC_INDICATE_STATUS);
-
- } else if (rsp.type == WILC_CFG_RSP_SCAN) {
- wilc_mac_indicate(wilc,
- WILC_MAC_INDICATE_SCAN);
+ wilc_mac_indicate(wilc);
}
}
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index aa0731e..e4a7bf5 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -47,9 +47,6 @@ struct sdio_cmd53 {
u32 block_size;
};

-#define WILC_MAC_INDICATE_STATUS 0x1
-#define WILC_MAC_INDICATE_SCAN 0x2
-
#define MAC_STATUS_INIT -1
#define MAC_STATUS_CONNECTED 1
#define MAC_STATUS_DISCONNECTED 0
--
2.7.4