All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style
@ 2018-07-18 22:44 Ajay Singh
  2018-07-18 22:44 ` [PATCH 01/23] staging: wilc1000: remove unused enum declaration Ajay Singh
                   ` (23 more replies)
  0 siblings, 24 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:44 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

This patch series contains modification to follow Linux coding style &
cleanup change to remove unused variables and enums.
Few patches also contain changes to remove unnecessary typecast.

Ajay Singh (23):
  staging: wilc1000: remove unused enum declaration
  staging: wilc1000: remove enum connect_status instead use
    ieee80211_statuscode
  staging: wilc1000: remove extra enum defined for data rates
  staging: wilc1000: remove extra enums defined for ieee80211_eid
  staging: wilc1000: rename goto to avoid leading '_' in label name
  staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase
  staging: wilc1000: rename enum SITESURVEY to use lowercase
  staging: wilc1000: rename enum AUTHTYPE to use lowercase
  staging: wilc1000: remove unused elements in 'wilc' struct
  staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct
  staging: wilc1000: removed unused element from wilc_cfg_frame struct
  staging: wilc1000: remove the mutliple #define used for same macro
  staging: wilc1000: use lowercase for 'IFC_UP' struct element name
  staging: wilc1000: remove unnecessary blank line between variable
    declaration
  staging: wilc1000: use single space before opening brances '{'
  staging: wilc1000: remove unnecessary type used for wid id
  staging: wilc1000: avoid forward declaration for handle_scan_done()
  staging: wilc1000: avoid host_int_get_assoc_res_info() forward
    declaration
  staging: wilc1000: avoid forward declaration of
    host_int_parse_join_bss_param()
  staging: wilc1000: avoid setting default value for variable at
    declaration
  staging: wilc1000: use 'int' inplace of 's32' date type
  staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops
    callbacks
  staging: wilc1000: move variable assignment along with its declaration

 drivers/staging/wilc1000/coreconfigurator.c       |  84 +--
 drivers/staging/wilc1000/coreconfigurator.h       |  20 -
 drivers/staging/wilc1000/host_interface.c         | 696 +++++++++++-----------
 drivers/staging/wilc1000/host_interface.h         |  20 +-
 drivers/staging/wilc1000/linux_mon.c              |   2 -
 drivers/staging/wilc1000/linux_wlan.c             | 122 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 307 +++-------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  16 +-
 drivers/staging/wilc1000/wilc_wlan.c              |  65 +-
 drivers/staging/wilc1000/wilc_wlan.h              |   3 -
 drivers/staging/wilc1000/wilc_wlan_if.h           |  56 +-
 11 files changed, 517 insertions(+), 874 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/23] staging: wilc1000: remove unused enum declaration
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
@ 2018-07-18 22:44 ` Ajay Singh
  2018-07-18 22:44 ` [PATCH 02/23] staging: wilc1000: remove enum connect_status instead use ieee80211_statuscode Ajay Singh
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:44 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to remove unused enums.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/coreconfigurator.c |  8 --------
 drivers/staging/wilc1000/host_interface.h   |  6 ------
 drivers/staging/wilc1000/wilc_wlan_if.h     | 26 --------------------------
 3 files changed, 40 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 4481602..0063895 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -4,14 +4,6 @@
 #define TAG_PARAM_OFFSET	(MAC_HDR_LEN + TIME_STAMP_LEN + \
 				 BEACON_INTERVAL_LEN + CAP_INFO_LEN)
 
-enum basic_frame_type {
-	FRAME_TYPE_CONTROL     = 0x04,
-	FRAME_TYPE_DATA        = 0x08,
-	FRAME_TYPE_MANAGEMENT  = 0x00,
-	FRAME_TYPE_RESERVED    = 0x0C,
-	FRAME_TYPE_FORCE_32BIT = 0xFFFFFFFF
-};
-
 enum sub_frame_type {
 	ASSOC_REQ             = 0x00,
 	ASSOC_RSP             = 0x10,
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 0ea22ab..3cd97dd 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -252,12 +252,6 @@ struct reg_frame {
 	u8 reg_id;
 };
 
-enum p2p_listen_state {
-	P2P_IDLE,
-	P2P_LISTEN,
-	P2P_GRP_FORMATION
-};
-
 struct wilc;
 struct host_if_drv {
 	struct user_scan_req usr_scan_req;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index e4a7bf5..85ac878 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -176,12 +176,6 @@ enum {
 };
 
 enum {
-	DONT_RESET		= 0,
-	DO_RESET		= 1,
-	NO_REQUEST		= 2,
-};
-
-enum {
 	REKEY_DISABLE		= 1,
 	REKEY_TIME_BASE,
 	REKEY_PKT_BASE,
@@ -195,17 +189,6 @@ enum {
 };
 
 enum {
-	PRI_HIGH_RSSI		= 0x00,
-	PRI_LOW_RSSI		= 0x04,
-	PRI_DETECT		= 0x08
-};
-
-enum {
-	CH_FILTER_OFF		= 0x00,
-	CH_FILTER_ON		= 0x10
-};
-
-enum {
 	AUTO_PROT		= 0,	/* Auto */
 	NO_PROT,			/* Do not use any protection */
 	ERP_PROT,			/* Protect all ERP frame exchanges */
@@ -244,15 +227,6 @@ enum {
 	MIMO_MODE		= 3,	/* power save disable */
 };
 
-enum {
-	DISABLE_SELF_CTS,
-	ENABLE_SELF_CTS,
-	DISABLE_TX_ABORT,
-	ENABLE_TX_ABORT,
-	HW_TRIGGER_ABORT,
-	SW_TRIGGER_ABORT,
-};
-
 enum wid_type {
 	WID_CHAR		= 0,
 	WID_SHORT		= 1,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/23] staging: wilc1000: remove enum connect_status instead use ieee80211_statuscode
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
  2018-07-18 22:44 ` [PATCH 01/23] staging: wilc1000: remove unused enum declaration Ajay Singh
@ 2018-07-18 22:44 ` Ajay Singh
  2018-07-18 22:44 ` [PATCH 03/23] staging: wilc1000: remove extra enum defined for data rates Ajay Singh
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:44 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to remove the use of enum 'connect_status' and instead use
predefined 'ieee80211_statuscode' for error code values.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/coreconfigurator.c       |  4 +++-
 drivers/staging/wilc1000/coreconfigurator.h       | 20 --------------------
 drivers/staging/wilc1000/host_interface.c         |  6 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  2 +-
 4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 0063895..a987953 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <linux/ieee80211.h>
+
 #include "coreconfigurator.h"
 
 #define TAG_PARAM_OFFSET	(MAC_HDR_LEN + TIME_STAMP_LEN + \
@@ -316,7 +318,7 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
 	u16 ies_len = 0;
 
 	ret_conn_info->status = get_asoc_status(buffer);
-	if (ret_conn_info->status == SUCCESSFUL_STATUSCODE) {
+	if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
 		ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
 		ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
 					AID_LEN);
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 55b5531..90d3d65 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -24,26 +24,6 @@
 #define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
 #define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))
 
-enum connect_status {
-	SUCCESSFUL_STATUSCODE    = 0,
-	UNSPEC_FAIL              = 1,
-	UNSUP_CAP                = 10,
-	REASOC_NO_ASOC           = 11,
-	FAIL_OTHER               = 12,
-	UNSUPT_ALG               = 13,
-	AUTH_SEQ_FAIL            = 14,
-	CHLNG_FAIL               = 15,
-	AUTH_TIMEOUT             = 16,
-	AP_FULL                  = 17,
-	UNSUP_RATE               = 18,
-	SHORT_PREAMBLE_UNSUP     = 19,
-	PBCC_UNSUP               = 20,
-	CHANNEL_AGIL_UNSUP       = 21,
-	SHORT_SLOT_UNSUP         = 25,
-	OFDM_DSSS_UNSUP          = 26,
-	CONNECT_STS_FORCE_16_BIT = 0xFFFF
-};
-
 struct rssi_history_buffer {
 	bool full;
 	u8 index;
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 918d06e..9b5bf3c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1336,7 +1336,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 	}
 
 	if (mac_status == MAC_STATUS_CONNECTED &&
-	    conn_info.status != SUCCESSFUL_STATUSCODE) {
+	    conn_info.status != WLAN_STATUS_SUCCESS) {
 		netdev_err(vif->ndev,
 			   "Received MAC status is MAC_STATUS_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
 		eth_zero_addr(wilc_connected_ssid);
@@ -1349,7 +1349,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 		memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
 		if (mac_status == MAC_STATUS_CONNECTED &&
-		    conn_info.status == SUCCESSFUL_STATUSCODE) {
+		    conn_info.status == WLAN_STATUS_SUCCESS) {
 			memcpy(hif_drv->assoc_bssid,
 			       hif_drv->usr_conn_req.bssid, ETH_ALEN);
 		}
@@ -1369,7 +1369,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 					  hif_drv->usr_conn_req.arg);
 
 	if (mac_status == MAC_STATUS_CONNECTED &&
-	    conn_info.status == SUCCESSFUL_STATUSCODE) {
+	    conn_info.status == WLAN_STATUS_SUCCESS) {
 		wilc_set_power_mgmt(vif, 0, 0);
 
 		hif_drv->hif_state = HOST_IF_CONNECTED;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e96163f..f90b9b6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -489,7 +489,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
 		connect_status = conn_info->status;
 
 		if (mac_status == MAC_STATUS_DISCONNECTED &&
-		    conn_info->status == SUCCESSFUL_STATUSCODE) {
+		    conn_info->status == WLAN_STATUS_SUCCESS) {
 			connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
 			wilc_wlan_set_bssid(priv->dev, null_bssid,
 					    STATION_MODE);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/23] staging: wilc1000: remove extra enum defined for data rates
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
  2018-07-18 22:44 ` [PATCH 01/23] staging: wilc1000: remove unused enum declaration Ajay Singh
  2018-07-18 22:44 ` [PATCH 02/23] staging: wilc1000: remove enum connect_status instead use ieee80211_statuscode Ajay Singh
@ 2018-07-18 22:44 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 04/23] staging: wilc1000: remove extra enums defined for ieee80211_eid Ajay Singh
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:44 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to remove extra enum defined to handle data rates.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_wlan.c   |  2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h | 16 ----------------
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 0019bb8..032afc2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -378,7 +378,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
 	if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = RATE_AUTO;
+	c_val[0] = AUTORATE;
 	if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
 		goto fail;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 85ac878..b23f86c 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -88,22 +88,6 @@ enum bss_types {
 };
 
 enum {
-	RATE_AUTO		= 0,
-	RATE_1MB		= 1,
-	RATE_2MB		= 2,
-	RATE_5MB		= 5,
-	RATE_6MB		= 6,
-	RATE_9MB		= 9,
-	RATE_11MB		= 11,
-	RATE_12MB		= 12,
-	RATE_18MB		= 18,
-	RATE_24MB		= 24,
-	RATE_26MB		= 36,
-	RATE_48MB		= 48,
-	RATE_54MB		= 54
-};
-
-enum {
 	B_ONLY_MODE		= 0,    /* 1, 2 M, otherwise 5, 11 M */
 	G_ONLY_MODE,			/* 6,12,24 otherwise 9,18,36,48,54 */
 	G_MIXED_11B_1_MODE,		/* 1,2,5.5,11 otherwise all on */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/23] staging: wilc1000: remove extra enums defined for ieee80211_eid
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (2 preceding siblings ...)
  2018-07-18 22:44 ` [PATCH 03/23] staging: wilc1000: remove extra enum defined for data rates Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name Ajay Singh
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to make use of existing enum 'ieee80211_eid' instead of
adding new enum in WILC for element ID's.

The below mapping is same to remove extra enum in WILC.

SUPP_RATES_IE   	-> WLAN_EID_SUPP_RATES
EXT_SUPP_RATES_IE	-> WLAN_EID_EXT_SUPP_RATES
HT_CAPABILITY_IE	-> WLAN_EID_HT_CAPABILITY
RSN_IE			-> WLAN_EID_RSN
WPA_IE			-> WLAN_EID_VENDOR_SPECIFIC
WMM_IE			-> WLAN_EID_VENDOR_SPECIFIC
P2P_IE			-> WLAN_EID_VENDOR_SPECIFIC

Also remove enum 'info_element_id' as its same as 'ieee80211_eid', below
the mapping of elements of enums which are used.

ITIM -> WLAN_EID_TIM
IDSPARMS -> WLAN_EID_DS_PARAMS

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/coreconfigurator.c | 47 ++---------------------------
 drivers/staging/wilc1000/host_interface.c   | 19 ++++++------
 drivers/staging/wilc1000/wilc_wlan_if.h     | 10 ------
 3 files changed, 12 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index a987953..5933e4d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -45,49 +45,6 @@ enum sub_frame_type {
 	FRAME_SUBTYPE_FORCE_32BIT  = 0xFFFFFFFF
 };
 
-enum info_element_id {
-	ISSID               = 0,   /* Service Set Identifier         */
-	ISUPRATES           = 1,   /* Supported Rates                */
-	IFHPARMS            = 2,   /* FH parameter set               */
-	IDSPARMS            = 3,   /* DS parameter set               */
-	ICFPARMS            = 4,   /* CF parameter set               */
-	ITIM                = 5,   /* Traffic Information Map        */
-	IIBPARMS            = 6,   /* IBSS parameter set             */
-	ICOUNTRY            = 7,   /* Country element                */
-	IEDCAPARAMS         = 12,  /* EDCA parameter set             */
-	ITSPEC              = 13,  /* Traffic Specification          */
-	ITCLAS              = 14,  /* Traffic Classification         */
-	ISCHED              = 15,  /* Schedule                       */
-	ICTEXT              = 16,  /* Challenge Text                 */
-	IPOWERCONSTRAINT    = 32,  /* Power Constraint               */
-	IPOWERCAPABILITY    = 33,  /* Power Capability               */
-	ITPCREQUEST         = 34,  /* TPC Request                    */
-	ITPCREPORT          = 35,  /* TPC Report                     */
-	ISUPCHANNEL         = 36,  /* Supported channel list         */
-	ICHSWANNOUNC        = 37,  /* Channel Switch Announcement    */
-	IMEASUREMENTREQUEST = 38,  /* Measurement request            */
-	IMEASUREMENTREPORT  = 39,  /* Measurement report             */
-	IQUIET              = 40,  /* Quiet element Info             */
-	IIBSSDFS            = 41,  /* IBSS DFS                       */
-	IERPINFO            = 42,  /* ERP Information                */
-	ITSDELAY            = 43,  /* TS Delay                       */
-	ITCLASPROCESS       = 44,  /* TCLAS Processing               */
-	IHTCAP              = 45,  /* HT Capabilities                */
-	IQOSCAP             = 46,  /* QoS Capability                 */
-	IRSNELEMENT         = 48,  /* RSN Information Element        */
-	IEXSUPRATES         = 50,  /* Extended Supported Rates       */
-	IEXCHSWANNOUNC      = 60,  /* Extended Ch Switch Announcement*/
-	IHTOPERATION        = 61,  /* HT Information                 */
-	ISECCHOFF           = 62,  /* Secondary Channel Offeset      */
-	I2040COEX           = 72,  /* 20/40 Coexistence IE           */
-	I2040INTOLCHREPORT  = 73,  /* 20/40 Intolerant channel report*/
-	IOBSSSCAN           = 74,  /* OBSS Scan parameters           */
-	IEXTCAP             = 127, /* Extended capability            */
-	IWMM                = 221, /* WMM parameters                 */
-	IWPAELEMENT         = 221, /* WPA Information Element        */
-	INFOELEM_ID_FORCE_32BIT  = 0xFFFFFFFF
-};
-
 static inline u16 get_beacon_period(u8 *data)
 {
 	u16 bcn_per;
@@ -216,7 +173,7 @@ static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 tag_param_offset)
 	index = tag_param_offset;
 
 	while (index < (rx_len - FCS_LEN)) {
-		if (msa[index] == ITIM)
+		if (msa[index] == WLAN_EID_TIM)
 			return &msa[index];
 		index += (IE_HDR_LEN + msa[index + 1]);
 	}
@@ -230,7 +187,7 @@ static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
 
 	index = TAG_PARAM_OFFSET;
 	while (index < (rx_len - FCS_LEN)) {
-		if (msa[index] == IDSPARMS)
+		if (msa[index] == WLAN_EID_DS_PARAMS)
 			return msa[index + 2];
 		index += msa[index + 1] + IE_HDR_LEN;
 	}
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 9b5bf3c..7309b7e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3861,7 +3861,7 @@ static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
 	u8 i, j;
 	u16 index = *out_index;
 
-	if (ies[index] == SUPP_RATES_IE) {
+	if (ies[index] == WLAN_EID_SUPP_RATES) {
 		*rates_no = ies[index + 1];
 		param->supp_rates[0] = *rates_no;
 		index += 2;
@@ -3870,7 +3870,7 @@ static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
 			param->supp_rates[i + 1] = ies[index + i];
 
 		index += *rates_no;
-	} else if (ies[index] == EXT_SUPP_RATES_IE) {
+	} else if (ies[index] == WLAN_EID_EXT_SUPP_RATES) {
 		ext_rates_no = ies[index + 1];
 		if (ext_rates_no > (MAX_RATES_SUPPORTED - *rates_no))
 			param->supp_rates[0] = MAX_RATES_SUPPORTED;
@@ -3881,10 +3881,10 @@ static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
 			param->supp_rates[*rates_no + i + 1] = ies[index + i];
 
 		index += ext_rates_no;
-	} else if (ies[index] == HT_CAPABILITY_IE) {
+	} else if (ies[index] == WLAN_EID_HT_CAPABILITY) {
 		param->ht_capable = true;
 		index += ies[index + 1] + 2;
-	} else if ((ies[index] == WMM_IE) &&
+	} else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
 		   (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
 		   (ies[index + 4] == 0xF2) && (ies[index + 5] == 0x02) &&
 		   ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
@@ -3894,7 +3894,7 @@ static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
 		if (ies[index + 8] & BIT(7))
 			param->uapsd_cap = true;
 		index += ies[index + 1] + 2;
-	} else if ((ies[index] == P2P_IE) &&
+	} else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
 		 (ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
 		 (ies[index + 4] == 0x9a) &&
 		 (ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
@@ -3923,13 +3923,14 @@ static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
 		memcpy(param->start_time, ies + p2p_cnt, 4);
 
 		index += ies[index + 1] + 2;
-	} else if ((ies[index] == RSN_IE) ||
-		 ((ies[index] == WPA_IE) && (ies[index + 2] == 0x00) &&
+	} else if ((ies[index] == WLAN_EID_RSN) ||
+		 ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+		  (ies[index + 2] == 0x00) &&
 		  (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
 		  (ies[index + 5] == 0x01))) {
 		u16 rsn_idx = index;
 
-		if (ies[rsn_idx] == RSN_IE) {
+		if (ies[rsn_idx] == WLAN_EID_RSN) {
 			param->mode_802_11i = 2;
 		} else {
 			if (param->mode_802_11i == 0)
@@ -3970,7 +3971,7 @@ static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
 		*auth_total_cnt += auth_cnt;
 		rsn_idx += offset;
 
-		if (ies[index] == RSN_IE) {
+		if (ies[index] == WLAN_EID_RSN) {
 			param->rsn_cap[0] = ies[rsn_idx];
 			param->rsn_cap[1] = ies[rsn_idx + 1];
 			rsn_idx += 2;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index b23f86c..af414d7 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -71,16 +71,6 @@ typedef void (*wilc_tx_complete_func_t)(void *, int);
 #define MAX_SSID_LEN            33
 #define MAX_RATES_SUPPORTED     12
 
-enum {
-	SUPP_RATES_IE		= 1,
-	EXT_SUPP_RATES_IE	= 50,
-	HT_CAPABILITY_IE	= 45,
-	RSN_IE			= 48,
-	WPA_IE			= 221,
-	WMM_IE			= 221,
-	P2P_IE			= 221,
-};
-
 enum bss_types {
 	INFRASTRUCTURE		= 0,
 	INDEPENDENT,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (3 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 04/23] staging: wilc1000: remove extra enums defined for ieee80211_eid Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-19  9:27   ` Dan Carpenter
  2018-07-18 22:45 ` [PATCH 06/23] staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase Ajay Singh
                   ` (18 subsequent siblings)
  23 siblings, 1 reply; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to avoid use of leading '_' in goto label name. Also used
proper string for lable names.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++++----
 drivers/staging/wilc1000/wilc_wlan.c              | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f90b9b6..73606c3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2196,11 +2196,11 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
 
 	wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
 	if (!wdev)
-		goto _fail_;
+		goto out;
 
 	wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv));
 	if (!wdev->wiphy)
-		goto _fail_mem_;
+		goto free_mem;
 
 	wilc_band_2ghz.ht_cap.ht_supported = 1;
 	wilc_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
@@ -2212,9 +2212,9 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
 
 	return wdev;
 
-_fail_mem_:
+free_mem:
 	kfree(wdev);
-_fail_:
+out:
 	return NULL;
 }
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 85af365..8e71c28 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 		if (wilc->rx_buffer)
 			buffer = &wilc->rx_buffer[offset];
 		else
-			goto _end_;
+			goto end;
 
 		wilc->hif_func->hif_clear_int_ext(wilc,
 					      DATA_INT_CLR | ENABLE_RX_VMM);
 		ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
 
-_end_:
+end:
 		if (ret) {
 			offset += size;
 			wilc->rx_buffer_offset = offset;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/23] staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (4 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 07/23] staging: wilc1000: rename enum SITESURVEY " Ajay Singh
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to rename enums in lowercase to follow linux coding style.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/host_interface.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 7309b7e..cc64b14 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -695,7 +695,7 @@ static void handle_cfg_param(struct work_struct *work)
 		i++;
 	}
 	if (param->flag & CURRENT_TX_RATE) {
-		enum CURRENT_TXRATE curr_tx_rate = param->curr_tx_rate;
+		enum current_tx_rate curr_tx_rate = param->curr_tx_rate;
 
 		if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 ||
 		    curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 ||
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 3cd97dd..64fc269 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -81,7 +81,7 @@ struct host_if_pmkid_attr {
 	struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
 };
 
-enum CURRENT_TXRATE {
+enum current_tx_rate {
 	AUTORATE	= 0,
 	MBPS_1		= 1,
 	MBPS_2		= 2,
@@ -118,7 +118,7 @@ struct cfg_param_attr {
 	u8 scan_source;
 	u16 active_scan_time;
 	u16 passive_scan_time;
-	enum CURRENT_TXRATE curr_tx_rate;
+	enum current_tx_rate curr_tx_rate;
 
 };
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/23] staging: wilc1000: rename enum SITESURVEY to use lowercase
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (5 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 06/23] staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 08/23] staging: wilc1000: rename enum AUTHTYPE " Ajay Singh
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to have enum in lowercase as per linux coding style.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/host_interface.h | 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index cc64b14..a5c0ac5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -635,7 +635,7 @@ static void handle_cfg_param(struct work_struct *work)
 		i++;
 	}
 	if (param->flag & SITE_SURVEY) {
-		enum SITESURVEY enabled = param->site_survey_enabled;
+		enum site_survey enabled = param->site_survey_enabled;
 
 		if (enabled < 3) {
 			wid_list[i].id = WID_SITE_SURVEY;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 64fc269..7f3e48c 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -113,7 +113,7 @@ struct cfg_param_attr {
 	u8 txop_prot_disabled;
 	u16 beacon_interval;
 	u16 dtim_period;
-	enum SITESURVEY site_survey_enabled;
+	enum site_survey site_survey_enabled;
 	u16 site_survey_scan_time;
 	u8 scan_source;
 	u16 active_scan_time;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index af414d7..b82e149 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -138,7 +138,7 @@ enum AUTHTYPE {
 	IEEE8021		= 5
 };
 
-enum SITESURVEY {
+enum site_survey {
 	SITE_SURVEY_1CH		= 0,
 	SITE_SURVEY_ALL_CH	= 1,
 	SITE_SURVEY_OFF		= 2
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/23] staging: wilc1000: rename enum AUTHTYPE to use lowercase
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (6 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 07/23] staging: wilc1000: rename enum SITESURVEY " Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 09/23] staging: wilc1000: remove unused elements in 'wilc' struct Ajay Singh
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to rename enum AUTHTYPE to lowercase.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c         | 8 ++++----
 drivers/staging/wilc1000/host_interface.h         | 6 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h           | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index a5c0ac5..0ffe205 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -26,7 +26,7 @@ struct host_if_wep_attr {
 	u8 key_len;
 	u8 index;
 	u8 mode;
-	enum AUTHTYPE auth_type;
+	enum authtype auth_type;
 };
 
 union host_if_key_attr {
@@ -62,7 +62,7 @@ struct connect_attr {
 	u8 security;
 	wilc_connect_result result;
 	void *arg;
-	enum AUTHTYPE auth_type;
+	enum authtype auth_type;
 	u8 ch;
 	void *params;
 };
@@ -2632,7 +2632,7 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
 }
 
 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
-			    u8 index, u8 mode, enum AUTHTYPE auth_type)
+			    u8 index, u8 mode, enum authtype auth_type)
 {
 	int result;
 	struct host_if_msg *msg;
@@ -2876,7 +2876,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
 		      size_t ssid_len, const u8 *ies, size_t ies_len,
 		      wilc_connect_result connect_result, void *user_arg,
-		      u8 security, enum AUTHTYPE auth_type,
+		      u8 security, enum authtype auth_type,
 		      u8 channel, void *join_params)
 {
 	int result = 0;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 7f3e48c..79166a5 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -207,7 +207,7 @@ struct user_conn_req {
 	u8 *bssid;
 	u8 *ssid;
 	u8 security;
-	enum AUTHTYPE auth_type;
+	enum authtype auth_type;
 	size_t ssid_len;
 	u8 *ies;
 	size_t ies_len;
@@ -298,7 +298,7 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
 int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
 			     u8 index);
 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
-			    u8 index, u8 mode, enum AUTHTYPE auth_type);
+			    u8 index, u8 mode, enum authtype auth_type);
 int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
 		 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
 		 u8 mode, u8 cipher_mode, u8 index);
@@ -314,7 +314,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
 		      size_t ssid_len, const u8 *ies, size_t ies_len,
 		      wilc_connect_result connect_result, void *user_arg,
-		      u8 security, enum AUTHTYPE auth_type,
+		      u8 security, enum authtype auth_type,
 		      u8 channel, void *join_params);
 int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 73606c3..8f1c595 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -678,7 +678,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 	u32 i;
 	u32 sel_bssi_idx = UINT_MAX;
 	u8 security = NO_ENCRYPT;
-	enum AUTHTYPE auth_type = ANY;
+	enum authtype auth_type = ANY;
 	u32 cipher_group;
 	struct wilc_priv *priv;
 	struct host_if_drv *wfi_drv;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index b82e149..73b57fb 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -131,7 +131,7 @@ enum {
 	WPA2_AES_TKIP		= 0x71,	/* Aes or Tkip */
 };
 
-enum AUTHTYPE {
+enum authtype {
 	OPEN_SYSTEM		= 1,
 	SHARED_KEY		= 2,
 	ANY			= 3,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/23] staging: wilc1000: remove unused elements in 'wilc' struct
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (7 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 08/23] staging: wilc1000: rename enum AUTHTYPE " Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 10/23] staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct Ajay Singh
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to remove unused elements from 'wilc' struct.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 ----
 drivers/staging/wilc1000/wilc_wlan.c          | 6 ------
 2 files changed, 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index fe18ae9..22f3486 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -157,12 +157,8 @@ struct wilc {
 
 	struct txq_entry_t txq_head;
 	int txq_entries;
-	int txq_exit;
 
 	struct rxq_entry_t rxq_head;
-	int rxq_exit;
-
-	unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
 
 	const struct firmware *firmware;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 8e71c28..c77e5c8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -527,7 +527,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 	wilc = vif->wilc;
 
 	txb = wilc->tx_buffer;
-	wilc->txq_exit = 0;
 
 	if (wilc->quit)
 		goto out;
@@ -713,7 +712,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 out:
 	mutex_unlock(&wilc->txq_add_to_head_cs);
 
-	wilc->txq_exit = 1;
 	*txq_count = wilc->txq_entries;
 	return ret;
 }
@@ -780,8 +778,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 	u8 *buffer;
 	struct rxq_entry_t *rqe;
 
-	wilc->rxq_exit = 0;
-
 	do {
 		if (wilc->quit) {
 			complete(&wilc->cfg_event);
@@ -797,8 +793,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
 		kfree(rqe);
 	} while (1);
-
-	wilc->rxq_exit = 1;
 }
 
 static void wilc_unknown_isr_ext(struct wilc *wilc)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/23] staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (8 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 09/23] staging: wilc1000: remove unused elements in 'wilc' struct Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 11/23] staging: wilc1000: removed unused element from wilc_cfg_frame struct Ajay Singh
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Remove unused elements from 'wilc_priv' structure.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ----
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     | 7 -------
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8f1c595..1a27e81 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2276,8 +2276,6 @@ int wilc_init_host_int(struct net_device *net)
 	}
 	op_ifcs++;
 
-	priv->auto_rate_adjusted = false;
-
 	priv->p2p_listen_state = false;
 
 	mutex_init(&priv->scan_req_lock);
@@ -2297,8 +2295,6 @@ int wilc_deinit_host_int(struct net_device *net)
 	priv = wdev_priv(net->ieee80211_ptr);
 	vif = netdev_priv(priv->dev);
 
-	priv->auto_rate_adjusted = false;
-
 	priv->p2p_listen_state = false;
 
 	op_ifcs--;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 22f3486..87f8cdc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -74,14 +74,10 @@ struct wilc_priv {
 
 	u8 associated_bss[ETH_ALEN];
 	struct sta_info assoc_stainfo;
-	struct net_device_stats stats;
-	u8 monitor_flag;
-	int status;
 	struct sk_buff *skb;
 	struct net_device *dev;
 	struct host_if_drv *hif_drv;
 	struct host_if_pmkid_attr pmkid_list;
-	struct wilc_wfi_stats netstats;
 	u8 wep_key[4][WLAN_KEY_LEN_WEP104];
 	u8 wep_key_len[4];
 	/* The real interface that the monitor is on */
@@ -91,9 +87,6 @@ struct wilc_priv {
 	u8 wilc_groupkey;
 	/* mutexes */
 	struct mutex scan_req_lock;
-	/*  */
-	bool auto_rate_adjusted;
-
 	bool p2p_listen_state;
 
 };
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/23] staging: wilc1000: removed unused element from wilc_cfg_frame struct
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (9 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 10/23] staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 12/23] staging: wilc1000: remove the mutliple #define used for same macro Ajay Singh
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup up patch to remove the unused structure elements in
'wilc_cfg_frame' struct.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_wlan.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index dbdebf0..f29d1ea 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -255,9 +255,6 @@ struct wilc_hif_func {
 #define MAX_CFG_FRAME_SIZE	1468
 
 struct wilc_cfg_frame {
-	u8 ether_header[14];
-	u8 ip_header[20];
-	u8 udp_header[8];
 	u8 wid_header[8];
 	u8 frame[MAX_CFG_FRAME_SIZE];
 };
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/23] staging: wilc1000: remove the mutliple #define used for same macro
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (10 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 11/23] staging: wilc1000: removed unused element from wilc_cfg_frame struct Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 13/23] staging: wilc1000: use lowercase for 'IFC_UP' struct element name Ajay Singh
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Moved the same #define in common header file instead of having their
declartion in different files.

Below macros are moved to header file:
TCP_ACK_FILTER_LINK_SPEED_THRESH
DEFAULT_LINK_SPEED
GET_PKT_OFFSET

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c         | 3 ---
 drivers/staging/wilc1000/linux_mon.c              | 1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 -----
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     | 5 +++++
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 0ffe205..8649225 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6,9 +6,6 @@
 
 #define FALSE_FRMWR_CHANNEL			100
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
-#define DEFAULT_LINK_SPEED			72
-
 #define REAL_JOIN_REQ				0
 
 struct host_if_wpa_attr {
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 1c7e6e1..bd09611 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -20,7 +20,6 @@ static u8 bssid[6];
 
 #define IEEE80211_RADIOTAP_F_TX_RTS	0x0004  /* used rts/cts handshake */
 #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))
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1a27e81..e561dce 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -77,11 +77,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
 	.flags = WIPHY_WOWLAN_ANY
 };
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
-#define DEFAULT_LINK_SPEED			72
-
-#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
-
 static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 87f8cdc..765681a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -21,6 +21,11 @@
 
 #define NUM_REG_FRAME				2
 
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
+#define DEFAULT_LINK_SPEED			72
+
+#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
+
 struct wilc_wfi_stats {
 	unsigned long rx_packets;
 	unsigned long tx_packets;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/23] staging: wilc1000: use lowercase for 'IFC_UP' struct element name
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (11 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 12/23] staging: wilc1000: remove the mutliple #define used for same macro Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 14/23] staging: wilc1000: remove unnecessary blank line between variable declaration Ajay Singh
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to use lowercase for structure element name to follow
linux coding style.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.h         | 2 +-
 drivers/staging/wilc1000/linux_wlan.c             | 4 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 79166a5..9a016c5 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -277,7 +277,7 @@ struct host_if_drv {
 	struct timer_list remain_on_ch_timer;
 	struct wilc_vif *remain_on_ch_timer_vif;
 
-	bool IFC_UP;
+	bool ifc_up;
 	int driver_handler_id;
 };
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 032afc2..84d3145 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -45,7 +45,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
 	switch (event) {
 	case NETDEV_UP:
 		if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
-			hif_drv->IFC_UP = 1;
+			hif_drv->ifc_up = 1;
 			wilc_optaining_ip = false;
 			del_timer(&wilc_during_ip_timer);
 		}
@@ -65,7 +65,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
 
 	case NETDEV_DOWN:
 		if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
-			hif_drv->IFC_UP = 0;
+			hif_drv->ifc_up = 0;
 			wilc_optaining_ip = false;
 		}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e561dce..ebe7adc2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -535,9 +535,9 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
 
 		if (!wfi_drv->p2p_connect)
 			wlan_channel = INVALID_CHANNEL;
-		if (wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
+		if (wfi_drv->ifc_up && dev == wl->vif[1]->ndev)
 			disconn_info->reason = 3;
-		else if (!wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
+		else if (!wfi_drv->ifc_up && dev == wl->vif[1]->ndev)
 			disconn_info->reason = 1;
 
 		cfg80211_disconnected(dev, disconn_info->reason,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/23] staging: wilc1000: remove unnecessary blank line between variable declaration
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (12 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 13/23] staging: wilc1000: use lowercase for 'IFC_UP' struct element name Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 15/23] staging: wilc1000: use single space before opening brances '{' Ajay Singh
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to remove the unnecessary blank line between variables
declaration inside the function.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_mon.c              | 1 -
 drivers/staging/wilc1000/linux_wlan.c             | 1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ----
 3 files changed, 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index bd09611..14405bf 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -147,7 +147,6 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 {
 	u32 rtap_len, ret = 0;
 	struct wilc_wfi_mon_priv  *mon_priv;
-
 	struct sk_buff *skb2;
 	struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 84d3145..8f77435 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -780,7 +780,6 @@ static int mac_init_fn(struct net_device *ndev)
 static int wilc_mac_open(struct net_device *ndev)
 {
 	struct wilc_vif *vif;
-
 	unsigned char mac_add[ETH_ALEN] = {0};
 	int ret = 0;
 	int i = 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ebe7adc2..43003d8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1250,7 +1250,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
 {
 	u32 i;
 	s32 ret = 0;
-
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 
 	for (i = 0; i < priv->pmkid_list.numpmkid; i++)	{
@@ -1315,7 +1314,6 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 ch_list_attr_idx,
 static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len)
 {
 	u32 index = 0;
-
 	u8 op_channel_attr_index = 0;
 	u8 channel_list_attr_index = 0;
 
@@ -1338,7 +1336,6 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch,
 					 u8 iftype)
 {
 	u32 index = 0;
-
 	u8 op_channel_attr_index = 0;
 	u8 channel_list_attr_index = 0;
 
@@ -2261,7 +2258,6 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
 int wilc_init_host_int(struct net_device *net)
 {
 	int ret = 0;
-
 	struct wilc_priv *priv;
 
 	priv = wdev_priv(net->ieee80211_ptr);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/23] staging: wilc1000: use single space before opening brances '{'
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (13 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 14/23] staging: wilc1000: remove unnecessary blank line between variable declaration Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 16/23] staging: wilc1000: remove unnecessary type used for wid id Ajay Singh
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to use single space instead of multiple space before the
'{'.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c         | 6 +++---
 drivers/staging/wilc1000/linux_wlan.c             | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c              | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 8649225..2f25175 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -799,7 +799,7 @@ static void handle_scan(struct work_struct *work)
 	    scan_info->ch_list_len > 0) {
 		int i;
 
-		for (i = 0; i < scan_info->ch_list_len; i++)	{
+		for (i = 0; i < scan_info->ch_list_len; i++) {
 			if (scan_info->ch_freq_list[i] > 0)
 				scan_info->ch_freq_list[i] -= 1;
 		}
@@ -3337,7 +3337,7 @@ int wilc_deinit(struct wilc_vif *vif)
 	int result = 0;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
-	if (!hif_drv)	{
+	if (!hif_drv) {
 		netdev_err(vif->ndev, "hif_drv = NULL\n");
 		return -EFAULT;
 	}
@@ -3404,7 +3404,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 		return;
 	hif_drv = vif->hif_drv;
 
-	if (!hif_drv || hif_drv == terminated_handle)	{
+	if (!hif_drv || hif_drv == terminated_handle) {
 		netdev_err(vif->ndev, "driver not init[%p]\n", hif_drv);
 		return;
 	}
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8f77435..5667a54 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -604,7 +604,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
 		return;
 	}
 
-	if (wl->initialized)	{
+	if (wl->initialized) {
 		netdev_info(dev, "Deinitializing wilc1000...\n");
 
 		if (!wl->dev_irq_num &&
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 43003d8..96aaf14 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -524,7 +524,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
 					conn_info->resp_ies,
 					conn_info->resp_ies_len, connect_status,
 					GFP_KERNEL);
-	} else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF)    {
+	} else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
 		wilc_optaining_ip = false;
 		p2p_local_random = 0x01;
 		p2p_recv_random = 0x00;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c77e5c8..cb8bfd2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -436,7 +436,7 @@ void chip_wakeup(struct wilc *wilc)
 				wilc_get_chipid(wilc, true);
 			} while (wilc_get_chipid(wilc, true) == 0);
 		} while (wilc_get_chipid(wilc, true) == 0);
-	} else if ((wilc->io_type & 0x1) == HIF_SDIO)	 {
+	} else if ((wilc->io_type & 0x1) == HIF_SDIO) {
 		wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
 		udelay(200);
 		wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/23] staging: wilc1000: remove unnecessary type used for wid id
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (14 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 15/23] staging: wilc1000: use single space before opening brances '{' Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 17/23] staging: wilc1000: avoid forward declaration for handle_scan_done() Ajay Singh
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to remove unnecessary typecast used while assigning the
WID ID.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 84 +++++++++++++++----------------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 2f25175..85ecba8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -264,7 +264,7 @@ static void handle_set_channel(struct work_struct *work)
 	int ret = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_CURRENT_CHANNEL;
+	wid.id = WID_CURRENT_CHANNEL;
 	wid.type = WID_CHAR;
 	wid.val = (char *)&hif_set_ch->set_ch;
 	wid.size = sizeof(char);
@@ -307,7 +307,7 @@ static void handle_set_wfi_drv_handler(struct work_struct *work)
 	currbyte++;
 	*currbyte = (hif_drv_handler->name | (hif_drv_handler->mode << 1));
 
-	wid.id = (u16)WID_SET_DRV_HANDLER;
+	wid.id = WID_SET_DRV_HANDLER;
 	wid.type = WID_STR;
 	wid.val = (s8 *)buffer;
 	wid.size = DRV_HANDLER_SIZE;
@@ -332,7 +332,7 @@ static void handle_set_operation_mode(struct work_struct *work)
 	int ret = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_SET_OPERATION_MODE;
+	wid.id = WID_SET_OPERATION_MODE;
 	wid.type = WID_INT;
 	wid.val = (s8 *)&hif_op_mode->mode;
 	wid.size = sizeof(u32);
@@ -363,7 +363,7 @@ static void handle_set_ip_address(struct work_struct *work)
 
 	memcpy(set_ip[idx], ip_addr, IP_ALEN);
 
-	wid.id = (u16)WID_IP_ADDRESS;
+	wid.id = WID_IP_ADDRESS;
 	wid.type = WID_STR;
 	wid.val = ip_addr;
 	wid.size = IP_ALEN;
@@ -386,7 +386,7 @@ static void handle_get_ip_address(struct work_struct *work)
 	int ret = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_IP_ADDRESS;
+	wid.id = WID_IP_ADDRESS;
 	wid.type = WID_STR;
 	wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
 	wid.size = IP_ALEN;
@@ -414,7 +414,7 @@ static void handle_get_mac_address(struct work_struct *work)
 	int ret = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_MAC_ADDR;
+	wid.id = WID_MAC_ADDR;
 	wid.type = WID_STR;
 	wid.val = get_mac_addr->mac_addr;
 	wid.size = ETH_ALEN;
@@ -757,7 +757,7 @@ static void handle_scan(struct work_struct *work)
 
 	hif_drv->usr_scan_req.rcvd_ch_cnt = 0;
 
-	wid_list[index].id = (u16)WID_SSID_PROBE_REQ;
+	wid_list[index].id = WID_SSID_PROBE_REQ;
 	wid_list[index].type = WID_STR;
 
 	for (i = 0; i < hidden_net->n_ssids; i++)
@@ -851,7 +851,7 @@ static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
 
 	if (evt == SCAN_EVENT_ABORTED) {
 		abort_running_scan = 1;
-		wid.id = (u16)WID_ABORT_RUNNING_SCAN;
+		wid.id = WID_ABORT_RUNNING_SCAN;
 		wid.type = WID_CHAR;
 		wid.val = (s8 *)&abort_running_scan;
 		wid.size = sizeof(char);
@@ -976,19 +976,19 @@ static void handle_connect(struct work_struct *work)
 	wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
 	wid_cnt++;
 
-	wid_list[wid_cnt].id = (u16)WID_11I_MODE;
+	wid_list[wid_cnt].id = WID_11I_MODE;
 	wid_list[wid_cnt].type = WID_CHAR;
 	wid_list[wid_cnt].size = sizeof(char);
 	wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
 	wid_cnt++;
 
-	wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
+	wid_list[wid_cnt].id = WID_AUTH_TYPE;
 	wid_list[wid_cnt].type = WID_CHAR;
 	wid_list[wid_cnt].size = sizeof(char);
 	wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
 	wid_cnt++;
 
-	wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
+	wid_list[wid_cnt].id = WID_JOIN_REQ_EXTENDED;
 	wid_list[wid_cnt].type = WID_STR;
 	wid_list[wid_cnt].size = 112;
 	wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);
@@ -1192,7 +1192,7 @@ static void handle_connect_timeout(struct work_struct *work)
 		netdev_err(vif->ndev, "Connect callback is NULL\n");
 	}
 
-	wid.id = (u16)WID_DISCONNECT;
+	wid.id = WID_DISCONNECT;
 	wid.type = WID_CHAR;
 	wid.val = (s8 *)&dummy_reason_code;
 	wid.size = sizeof(char);
@@ -1496,7 +1496,7 @@ static int wilc_pmksa_key_copy(struct wilc_vif *vif, struct key_attr *hif_key)
 		       hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
 	}
 
-	wid.id = (u16)WID_PMKID_INFO;
+	wid.id = WID_PMKID_INFO;
 	wid.type = WID_STR;
 	wid.val = (s8 *)key_buf;
 	wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
@@ -1524,7 +1524,7 @@ static void handle_key(struct work_struct *work)
 	case WEP:
 
 		if (hif_key->action & ADDKEY_AP) {
-			wid_list[0].id = (u16)WID_11I_MODE;
+			wid_list[0].id = WID_11I_MODE;
 			wid_list[0].type = WID_CHAR;
 			wid_list[0].size = sizeof(char);
 			wid_list[0].val = (s8 *)&hif_key->attr.wep.mode;
@@ -1547,7 +1547,7 @@ static void handle_key(struct work_struct *work)
 			memcpy(&key_buf[2], hif_key->attr.wep.key,
 			       hif_key->attr.wep.key_len);
 
-			wid_list[2].id = (u16)WID_WEP_KEY_VALUE;
+			wid_list[2].id = WID_WEP_KEY_VALUE;
 			wid_list[2].type = WID_STR;
 			wid_list[2].size = hif_key->attr.wep.key_len + 2;
 			wid_list[2].val = (s8 *)key_buf;
@@ -1568,7 +1568,7 @@ static void handle_key(struct work_struct *work)
 			memcpy(key_buf + 2, hif_key->attr.wep.key,
 			       hif_key->attr.wep.key_len);
 
-			wid.id = (u16)WID_ADD_WEP_KEY;
+			wid.id = WID_ADD_WEP_KEY;
 			wid.type = WID_STR;
 			wid.val = (s8 *)key_buf;
 			wid.size = hif_key->attr.wep.key_len + 2;
@@ -1578,7 +1578,7 @@ static void handle_key(struct work_struct *work)
 						      wilc_get_vif_idx(vif));
 			kfree(key_buf);
 		} else if (hif_key->action & REMOVEKEY) {
-			wid.id = (u16)WID_REMOVE_WEP_KEY;
+			wid.id = WID_REMOVE_WEP_KEY;
 			wid.type = WID_STR;
 
 			wid.val = (s8 *)&hif_key->attr.wep.index;
@@ -1588,7 +1588,7 @@ static void handle_key(struct work_struct *work)
 						      &wid, 1,
 						      wilc_get_vif_idx(vif));
 		} else if (hif_key->action & DEFAULTKEY) {
-			wid.id = (u16)WID_KEY_ID;
+			wid.id = WID_KEY_ID;
 			wid.type = WID_CHAR;
 			wid.val = (s8 *)&hif_key->attr.wep.index;
 			wid.size = sizeof(char);
@@ -1617,12 +1617,12 @@ static void handle_key(struct work_struct *work)
 			memcpy(key_buf + 16, hif_key->attr.wpa.key,
 			       hif_key->attr.wpa.key_len);
 
-			wid_list[0].id = (u16)WID_11I_MODE;
+			wid_list[0].id = WID_11I_MODE;
 			wid_list[0].type = WID_CHAR;
 			wid_list[0].size = sizeof(char);
 			wid_list[0].val = (s8 *)&hif_key->attr.wpa.mode;
 
-			wid_list[1].id = (u16)WID_ADD_RX_GTK;
+			wid_list[1].id = WID_ADD_RX_GTK;
 			wid_list[1].type = WID_STR;
 			wid_list[1].val = (s8 *)key_buf;
 			wid_list[1].size = RX_MIC_KEY_MSG_LEN;
@@ -1650,7 +1650,7 @@ static void handle_key(struct work_struct *work)
 			memcpy(key_buf + 16, hif_key->attr.wpa.key,
 			       hif_key->attr.wpa.key_len);
 
-			wid.id = (u16)WID_ADD_RX_GTK;
+			wid.id = WID_ADD_RX_GTK;
 			wid.type = WID_STR;
 			wid.val = (s8 *)key_buf;
 			wid.size = RX_MIC_KEY_MSG_LEN;
@@ -1679,12 +1679,12 @@ static void handle_key(struct work_struct *work)
 			memcpy(key_buf + 8, hif_key->attr.wpa.key,
 			       hif_key->attr.wpa.key_len);
 
-			wid_list[0].id = (u16)WID_11I_MODE;
+			wid_list[0].id = WID_11I_MODE;
 			wid_list[0].type = WID_CHAR;
 			wid_list[0].size = sizeof(char);
 			wid_list[0].val = (s8 *)&hif_key->attr.wpa.mode;
 
-			wid_list[1].id = (u16)WID_ADD_PTK;
+			wid_list[1].id = WID_ADD_PTK;
 			wid_list[1].type = WID_STR;
 			wid_list[1].val = (s8 *)key_buf;
 			wid_list[1].size = PTK_KEY_MSG_LEN + 1;
@@ -1705,7 +1705,7 @@ static void handle_key(struct work_struct *work)
 			memcpy(key_buf + 7, hif_key->attr.wpa.key,
 			       hif_key->attr.wpa.key_len);
 
-			wid.id = (u16)WID_ADD_PTK;
+			wid.id = WID_ADD_PTK;
 			wid.type = WID_STR;
 			wid.val = (s8 *)key_buf;
 			wid.size = PTK_KEY_MSG_LEN;
@@ -1745,7 +1745,7 @@ static void handle_disconnect(struct work_struct *work)
 	s32 result = 0;
 	u16 dummy_reason_code = 0;
 
-	wid.id = (u16)WID_DISCONNECT;
+	wid.id = WID_DISCONNECT;
 	wid.type = WID_CHAR;
 	wid.val = (s8 *)&dummy_reason_code;
 	wid.size = sizeof(char);
@@ -1823,7 +1823,7 @@ static void handle_get_rssi(struct work_struct *work)
 	s32 result = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_RSSI;
+	wid.id = WID_RSSI;
 	wid.type = WID_CHAR;
 	wid.val = msg->body.data;
 	wid.size = sizeof(char);
@@ -1903,7 +1903,7 @@ static void handle_get_inactive_time(struct work_struct *work)
 	s32 result = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME;
+	wid.id = WID_SET_STA_MAC_INACTIVE_TIME;
 	wid.type = WID_STR;
 	wid.size = ETH_ALEN;
 	wid.val = kmalloc(wid.size, GFP_KERNEL);
@@ -1921,7 +1921,7 @@ static void handle_get_inactive_time(struct work_struct *work)
 		goto out;
 	}
 
-	wid.id = (u16)WID_GET_INACTIVE_TIME;
+	wid.id = WID_GET_INACTIVE_TIME;
 	wid.type = WID_INT;
 	wid.val = (s8 *)&hif_sta_inactive->inactive_time;
 	wid.size = sizeof(u32);
@@ -1946,7 +1946,7 @@ static void handle_add_beacon(struct work_struct *work)
 	struct wid wid;
 	u8 *cur_byte;
 
-	wid.id = (u16)WID_ADD_BEACON;
+	wid.id = WID_ADD_BEACON;
 	wid.type = WID_BIN;
 	wid.size = param->head_len + param->tail_len + 16;
 	wid.val = kmalloc(wid.size, GFP_KERNEL);
@@ -2001,7 +2001,7 @@ static void handle_del_beacon(struct work_struct *work)
 	struct wid wid;
 	u8 del_beacon = 0;
 
-	wid.id = (u16)WID_DEL_BEACON;
+	wid.id = WID_DEL_BEACON;
 	wid.type = WID_CHAR;
 	wid.size = sizeof(char);
 	wid.val = &del_beacon;
@@ -2052,7 +2052,7 @@ static void handle_add_station(struct work_struct *work)
 	struct wid wid;
 	u8 *cur_byte;
 
-	wid.id = (u16)WID_ADD_STA;
+	wid.id = WID_ADD_STA;
 	wid.type = WID_BIN;
 	wid.size = WILC_ADD_STA_LENGTH + param->rates_len;
 
@@ -2085,7 +2085,7 @@ static void handle_del_all_sta(struct work_struct *work)
 	u8 i;
 	u8 zero_buff[6] = {0};
 
-	wid.id = (u16)WID_DEL_ALL_STA;
+	wid.id = WID_DEL_ALL_STA;
 	wid.type = WID_STR;
 	wid.size = (param->assoc_sta * ETH_ALEN) + 1;
 
@@ -2126,7 +2126,7 @@ static void handle_del_station(struct work_struct *work)
 	s32 result = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_REMOVE_STA;
+	wid.id = WID_REMOVE_STA;
 	wid.type = WID_BIN;
 	wid.size = ETH_ALEN;
 
@@ -2155,7 +2155,7 @@ static void handle_edit_station(struct work_struct *work)
 	struct wid wid;
 	u8 *cur_byte;
 
-	wid.id = (u16)WID_EDIT_STA;
+	wid.id = WID_EDIT_STA;
 	wid.type = WID_BIN;
 	wid.size = WILC_ADD_STA_LENGTH + param->rates_len;
 
@@ -2211,7 +2211,7 @@ static int handle_remain_on_chan(struct wilc_vif *vif,
 	}
 
 	remain_on_chan_flag = true;
-	wid.id = (u16)WID_REMAIN_ON_CHAN;
+	wid.id = WID_REMAIN_ON_CHAN;
 	wid.type = WID_STR;
 	wid.size = 2;
 	wid.val = kmalloc(wid.size, GFP_KERNEL);
@@ -2253,7 +2253,7 @@ static void handle_register_frame(struct work_struct *work)
 	struct wid wid;
 	u8 *cur_byte;
 
-	wid.id = (u16)WID_REGISTER_FRAME;
+	wid.id = WID_REGISTER_FRAME;
 	wid.type = WID_STR;
 	wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL);
 	if (!wid.val)
@@ -2289,7 +2289,7 @@ static void handle_listen_state_expired(struct work_struct *work)
 
 	if (p2p_listen_state) {
 		remain_on_chan_flag = false;
-		wid.id = (u16)WID_REMAIN_ON_CHAN;
+		wid.id = WID_REMAIN_ON_CHAN;
 		wid.type = WID_STR;
 		wid.size = 2;
 		wid.val = kmalloc(wid.size, GFP_KERNEL);
@@ -2353,7 +2353,7 @@ static void handle_power_management(struct work_struct *work)
 	struct wid wid;
 	s8 power_mode;
 
-	wid.id = (u16)WID_POWER_MANAGEMENT;
+	wid.id = WID_POWER_MANAGEMENT;
 
 	if (pm_param->enabled)
 		power_mode = MIN_FAST_PS;
@@ -2379,7 +2379,7 @@ static void handle_set_mcast_filter(struct work_struct *work)
 	struct wid wid;
 	u8 *cur_byte;
 
-	wid.id = (u16)WID_SETUP_MULTICAST_FILTER;
+	wid.id = WID_SETUP_MULTICAST_FILTER;
 	wid.type = WID_BIN;
 	wid.size = sizeof(struct set_multicast) + (hif_set_mc->cnt * ETH_ALEN);
 	wid.val = kmalloc(wid.size, GFP_KERNEL);
@@ -2419,7 +2419,7 @@ static void handle_set_tx_pwr(struct work_struct *work)
 	int ret;
 	struct wid wid;
 
-	wid.id = (u16)WID_TX_POWER;
+	wid.id = WID_TX_POWER;
 	wid.type = WID_CHAR;
 	wid.val = &tx_pwr;
 	wid.size = sizeof(char);
@@ -2440,7 +2440,7 @@ static void handle_get_tx_pwr(struct work_struct *work)
 	int ret = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_TX_POWER;
+	wid.id = WID_TX_POWER;
 	wid.type = WID_CHAR;
 	wid.val = (s8 *)tx_pwr;
 	wid.size = sizeof(char);
@@ -2988,7 +2988,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
 	s32 result = 0;
 	struct wid wid;
 
-	wid.id = (u16)WID_ASSOC_RES_INFO;
+	wid.id = WID_ASSOC_RES_INFO;
 	wid.type = WID_STR;
 	wid.val = assoc_resp_info;
 	wid.size = max_assoc_resp_info_len;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/23] staging: wilc1000: avoid forward declaration for handle_scan_done()
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (15 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 16/23] staging: wilc1000: remove unnecessary type used for wid id Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 18/23] staging: wilc1000: avoid host_int_get_assoc_res_info() forward declaration Ajay Singh
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Reorder the function position in host interface to avoid forward
declaration of handle_scan_done().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 77 +++++++++++++++----------------
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 85ecba8..eabe5c7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -199,7 +199,6 @@ static u32 clients_count;
 
 static void *host_int_parse_join_bss_param(struct network_info *info);
 static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt);
 
 /* 'msg' should be free by the caller for syc */
 static struct host_if_msg*
@@ -724,6 +723,44 @@ static void handle_cfg_param(struct work_struct *work)
 	kfree(msg);
 }
 
+static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
+{
+	s32 result = 0;
+	u8 abort_running_scan;
+	struct wid wid;
+	struct host_if_drv *hif_drv = vif->hif_drv;
+	struct user_scan_req *scan_req;
+
+	if (evt == SCAN_EVENT_ABORTED) {
+		abort_running_scan = 1;
+		wid.id = WID_ABORT_RUNNING_SCAN;
+		wid.type = WID_CHAR;
+		wid.val = (s8 *)&abort_running_scan;
+		wid.size = sizeof(char);
+
+		result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+					      wilc_get_vif_idx(vif));
+
+		if (result) {
+			netdev_err(vif->ndev, "Failed to set abort running\n");
+			result = -EFAULT;
+		}
+	}
+
+	if (!hif_drv) {
+		netdev_err(vif->ndev, "Driver handler is NULL\n");
+		return result;
+	}
+
+	scan_req = &hif_drv->usr_scan_req;
+	if (scan_req->scan_result) {
+		scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
+		scan_req->scan_result = NULL;
+	}
+
+	return result;
+}
+
 static void handle_scan(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -841,44 +878,6 @@ static void handle_scan(struct work_struct *work)
 	kfree(msg);
 }
 
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
-{
-	s32 result = 0;
-	u8 abort_running_scan;
-	struct wid wid;
-	struct host_if_drv *hif_drv = vif->hif_drv;
-	struct user_scan_req *scan_req;
-
-	if (evt == SCAN_EVENT_ABORTED) {
-		abort_running_scan = 1;
-		wid.id = WID_ABORT_RUNNING_SCAN;
-		wid.type = WID_CHAR;
-		wid.val = (s8 *)&abort_running_scan;
-		wid.size = sizeof(char);
-
-		result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
-					      wilc_get_vif_idx(vif));
-
-		if (result) {
-			netdev_err(vif->ndev, "Failed to set abort running\n");
-			result = -EFAULT;
-		}
-	}
-
-	if (!hif_drv) {
-		netdev_err(vif->ndev, "Driver handler is NULL\n");
-		return result;
-	}
-
-	scan_req = &hif_drv->usr_scan_req;
-	if (scan_req->scan_result) {
-		scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
-		scan_req->scan_result = NULL;
-	}
-
-	return result;
-}
-
 u8 wilc_connected_ssid[6] = {0};
 static void handle_connect(struct work_struct *work)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/23] staging: wilc1000: avoid host_int_get_assoc_res_info() forward declaration
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (16 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 17/23] staging: wilc1000: avoid forward declaration for handle_scan_done() Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 19/23] staging: wilc1000: avoid forward declaration of host_int_parse_join_bss_param() Ajay Singh
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Reorder the function position in host interface to avoid forward
declaration of host_int_get_assoc_res_info().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 47 ++++++++++++++-----------------
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index eabe5c7..f49e849 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1287,7 +1287,27 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work)
 static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
 				       u8 *assoc_resp_info,
 				       u32 max_assoc_resp_info_len,
-				       u32 *rcvd_assoc_resp_info_len);
+				       u32 *rcvd_assoc_resp_info_len)
+{
+	s32 result;
+	struct wid wid;
+
+	wid.id = WID_ASSOC_RES_INFO;
+	wid.type = WID_STR;
+	wid.val = assoc_resp_info;
+	wid.size = max_assoc_resp_info_len;
+
+	result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
+				      wilc_get_vif_idx(vif));
+	if (result) {
+		*rcvd_assoc_resp_info_len = 0;
+		netdev_err(vif->ndev, "Failed to send association response\n");
+		return -EINVAL;
+	}
+
+	*rcvd_assoc_resp_info_len = wid.size;
+	return result;
+}
 
 static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
 {
@@ -2979,31 +2999,6 @@ int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
 	return result;
 }
 
-static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
-				       u8 *assoc_resp_info,
-				       u32 max_assoc_resp_info_len,
-				       u32 *rcvd_assoc_resp_info_len)
-{
-	s32 result = 0;
-	struct wid wid;
-
-	wid.id = WID_ASSOC_RES_INFO;
-	wid.type = WID_STR;
-	wid.val = assoc_resp_info;
-	wid.size = max_assoc_resp_info_len;
-
-	result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
-				      wilc_get_vif_idx(vif));
-	if (result) {
-		*rcvd_assoc_resp_info_len = 0;
-		netdev_err(vif->ndev, "Failed to send association response\n");
-		return -EINVAL;
-	}
-
-	*rcvd_assoc_resp_info_len = wid.size;
-	return result;
-}
-
 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
 {
 	int result;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/23] staging: wilc1000: avoid forward declaration of host_int_parse_join_bss_param()
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (17 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 18/23] staging: wilc1000: avoid host_int_get_assoc_res_info() forward declaration Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 20/23] staging: wilc1000: avoid setting default value for variable at declaration Ajay Singh
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Reorder the functions position in host interface to avoid forward
declaration of host_int_parse_join_bss_param().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 333 +++++++++++++++---------------
 1 file changed, 166 insertions(+), 167 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index f49e849..895a126 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -197,7 +197,6 @@ static u8 set_ip[2][4];
 static u8 get_ip[2][4];
 static u32 clients_count;
 
-static void *host_int_parse_join_bss_param(struct network_info *info);
 static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
 
 /* 'msg' should be free by the caller for syc */
@@ -1216,6 +1215,172 @@ static void handle_connect_timeout(struct work_struct *work)
 	kfree(msg);
 }
 
+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,
+					 u8 *rates_no)
+{
+	u8 ext_rates_no;
+	u16 offset;
+	u8 pcipher_cnt;
+	u8 auth_cnt;
+	u8 i, j;
+	u16 index = *out_index;
+
+	if (ies[index] == WLAN_EID_SUPP_RATES) {
+		*rates_no = ies[index + 1];
+		param->supp_rates[0] = *rates_no;
+		index += 2;
+
+		for (i = 0; i < *rates_no; i++)
+			param->supp_rates[i + 1] = ies[index + i];
+
+		index += *rates_no;
+	} else if (ies[index] == WLAN_EID_EXT_SUPP_RATES) {
+		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] == WLAN_EID_HT_CAPABILITY) {
+		param->ht_capable = true;
+		index += ies[index + 1] + 2;
+	} else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+		   (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] == WLAN_EID_VENDOR_SPECIFIC) &&
+		 (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;
+		}
+
+		param->cnt = ies[index + 11];
+		p2p_cnt = index + 12;
+
+		memcpy(param->duration, ies + p2p_cnt, 4);
+		p2p_cnt += 4;
+
+		memcpy(param->interval, ies + p2p_cnt, 4);
+		p2p_cnt += 4;
+
+		memcpy(param->start_time, ies + p2p_cnt, 4);
+
+		index += ies[index + 1] + 2;
+	} else if ((ies[index] == WLAN_EID_RSN) ||
+		 ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+		  (ies[index + 2] == 0x00) &&
+		  (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
+		  (ies[index + 5] == 0x01))) {
+		u16 rsn_idx = index;
+
+		if (ies[rsn_idx] == WLAN_EID_RSN) {
+			param->mode_802_11i = 2;
+		} else {
+			if (param->mode_802_11i == 0)
+				param->mode_802_11i = 1;
+			rsn_idx += 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;
+
+		i = *pcipher_tc;
+		j = 0;
+		for (; i < (pcipher_cnt + *pcipher_tc) && i < 3; i++, j++) {
+			u8 *policy =  &param->rsn_pcip_policy[i];
+
+			*policy = ies[rsn_idx + ((j + 1) * 4) - 1];
+		}
+
+		*pcipher_tc += pcipher_cnt;
+		rsn_idx += offset;
+
+		offset = ies[rsn_idx] * 4;
+
+		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];
+
+			*policy = ies[rsn_idx + ((j + 1) * 4) - 1];
+		}
+
+		*auth_total_cnt += auth_cnt;
+		rsn_idx += offset;
+
+		if (ies[index] == WLAN_EID_RSN) {
+			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;
+	}
+
+	*out_index = index;
+}
+
+static void *host_int_parse_join_bss_param(struct network_info *info)
+{
+	struct join_bss_param *param;
+	u16 index = 0;
+	u8 rates_no = 0;
+	u8 pcipher_total_cnt = 0;
+	u8 auth_total_cnt = 0;
+
+	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,
+					     &rates_no);
+
+	return (void *)param;
+}
+
 static void handle_rcvd_ntwrk_info(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -3840,172 +4005,6 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
 	return result;
 }
 
-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,
-					 u8 *rates_no)
-{
-	u8 ext_rates_no;
-	u16 offset;
-	u8 pcipher_cnt;
-	u8 auth_cnt;
-	u8 i, j;
-	u16 index = *out_index;
-
-	if (ies[index] == WLAN_EID_SUPP_RATES) {
-		*rates_no = ies[index + 1];
-		param->supp_rates[0] = *rates_no;
-		index += 2;
-
-		for (i = 0; i < *rates_no; i++)
-			param->supp_rates[i + 1] = ies[index + i];
-
-		index += *rates_no;
-	} else if (ies[index] == WLAN_EID_EXT_SUPP_RATES) {
-		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] == WLAN_EID_HT_CAPABILITY) {
-		param->ht_capable = true;
-		index += ies[index + 1] + 2;
-	} else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
-		   (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] == WLAN_EID_VENDOR_SPECIFIC) &&
-		 (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;
-		}
-
-		param->cnt = ies[index + 11];
-		p2p_cnt = index + 12;
-
-		memcpy(param->duration, ies + p2p_cnt, 4);
-		p2p_cnt += 4;
-
-		memcpy(param->interval, ies + p2p_cnt, 4);
-		p2p_cnt += 4;
-
-		memcpy(param->start_time, ies + p2p_cnt, 4);
-
-		index += ies[index + 1] + 2;
-	} else if ((ies[index] == WLAN_EID_RSN) ||
-		 ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
-		  (ies[index + 2] == 0x00) &&
-		  (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
-		  (ies[index + 5] == 0x01))) {
-		u16 rsn_idx = index;
-
-		if (ies[rsn_idx] == WLAN_EID_RSN) {
-			param->mode_802_11i = 2;
-		} else {
-			if (param->mode_802_11i == 0)
-				param->mode_802_11i = 1;
-			rsn_idx += 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;
-
-		i = *pcipher_tc;
-		j = 0;
-		for (; i < (pcipher_cnt + *pcipher_tc) && i < 3; i++, j++) {
-			u8 *policy =  &param->rsn_pcip_policy[i];
-
-			*policy = ies[rsn_idx + ((j + 1) * 4) - 1];
-		}
-
-		*pcipher_tc += pcipher_cnt;
-		rsn_idx += offset;
-
-		offset = ies[rsn_idx] * 4;
-
-		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];
-
-			*policy = ies[rsn_idx + ((j + 1) * 4) - 1];
-		}
-
-		*auth_total_cnt += auth_cnt;
-		rsn_idx += offset;
-
-		if (ies[index] == WLAN_EID_RSN) {
-			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;
-	}
-
-	*out_index = index;
-}
-
-static void *host_int_parse_join_bss_param(struct network_info *info)
-{
-	struct join_bss_param *param = NULL;
-	u16 index = 0;
-	u8 rates_no = 0;
-	u8 pcipher_total_cnt = 0;
-	u8 auth_total_cnt = 0;
-
-	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,
-					     &rates_no);
-
-	return (void *)param;
-}
-
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
 	int result = 0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/23] staging: wilc1000: avoid setting default value for variable at declaration
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (18 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 19/23] staging: wilc1000: avoid forward declaration of host_int_parse_join_bss_param() Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 21/23] staging: wilc1000: use 'int' inplace of 's32' date type Ajay Singh
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to avoid setting default value for local variables and
also clubbed similar variables together.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/coreconfigurator.c       |  25 ++---
 drivers/staging/wilc1000/host_interface.c         | 122 +++++++++++-----------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  20 ++--
 3 files changed, 79 insertions(+), 88 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 5933e4d..e09f10d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -123,9 +123,7 @@ static inline void get_BSSID(u8 *data, u8 *bssid)
 
 static inline void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
 {
-	u8 len = 0;
-	u8 i   = 0;
-	u8 j   = 0;
+	u8 i, j, len;
 
 	len = data[TAG_PARAM_OFFSET + 1];
 	j   = TAG_PARAM_OFFSET + 2;
@@ -198,18 +196,11 @@ static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
 s32 wilc_parse_network_info(u8 *msg_buffer,
 			    struct network_info **ret_network_info)
 {
-	struct network_info *network_info = NULL;
-	u8 msg_type = 0;
-	u16 wid_len  = 0;
-	u8 *wid_val = NULL;
-	u8 *msa = NULL;
-	u16 rx_len = 0;
-	u8 *tim_elm = NULL;
-	u8 *ies = NULL;
-	u16 ies_len = 0;
-	u8 index = 0;
-	u32 tsf_lo;
-	u32 tsf_hi;
+	struct network_info *network_info;
+	u8 *wid_val, *msa, *tim_elm, *ies;
+	u32 tsf_lo, tsf_hi;
+	u16 wid_len, rx_len, ies_len;
+	u8 msg_type, index;
 
 	msg_type = msg_buffer[0];
 
@@ -271,8 +262,8 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
 			       struct connect_info *ret_conn_info)
 {
-	u8 *ies = NULL;
-	u16 ies_len = 0;
+	u8 *ies;
+	u16 ies_len;
 
 	ret_conn_info->status = get_asoc_status(buffer);
 	if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 895a126..d251a64 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -259,7 +259,7 @@ static void handle_set_channel(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct channel_attr *hif_set_ch = &msg->body.channel_info;
-	int ret = 0;
+	int ret;
 	struct wid wid;
 
 	wid.id = WID_CURRENT_CHANNEL;
@@ -280,10 +280,10 @@ static void handle_set_wfi_drv_handler(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct drv_handler *hif_drv_handler = &msg->body.drv;
-	int ret = 0;
+	int ret;
 	struct wid wid;
 	u8 *currbyte, *buffer;
-	struct host_if_drv *hif_drv = NULL;
+	struct host_if_drv *hif_drv;
 
 	if (!vif->hif_drv || !hif_drv_handler)
 		goto free_msg;
@@ -327,7 +327,7 @@ static void handle_set_operation_mode(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct op_mode *hif_op_mode = &msg->body.mode;
-	int ret = 0;
+	int ret;
 	struct wid wid;
 
 	wid.id = WID_SET_OPERATION_MODE;
@@ -352,7 +352,7 @@ static void handle_set_ip_address(struct work_struct *work)
 	struct wilc_vif *vif = msg->vif;
 	u8 *ip_addr = msg->body.ip_info.ip_addr;
 	u8 idx = msg->body.ip_info.idx;
-	int ret = 0;
+	int ret;
 	struct wid wid;
 	char firmware_ip_addr[4] = {0};
 
@@ -381,7 +381,7 @@ static void handle_get_ip_address(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	u8 idx = msg->body.ip_info.idx;
-	int ret = 0;
+	int ret;
 	struct wid wid;
 
 	wid.id = WID_IP_ADDRESS;
@@ -409,7 +409,7 @@ static void handle_get_mac_address(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct get_mac_addr *get_mac_addr = &msg->body.get_mac_info;
-	int ret = 0;
+	int ret;
 	struct wid wid;
 
 	wid.id = WID_MAC_ADDR;
@@ -431,7 +431,7 @@ static void handle_cfg_param(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct cfg_param_attr *param = &msg->body.cfg_info;
-	int ret = 0;
+	int ret;
 	struct wid wid_list[32];
 	struct host_if_drv *hif_drv = vif->hif_drv;
 	int i = 0;
@@ -1148,7 +1148,7 @@ static void handle_connect_timeout(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
-	s32 result = 0;
+	s32 result;
 	struct connect_info info;
 	struct wid wid;
 	u16 dummy_reason_code = 0;
@@ -1389,7 +1389,7 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work)
 	u32 i;
 	bool found;
 	struct network_info *info = NULL;
-	void *params = NULL;
+	void *params;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 	struct user_scan_req *scan_req = &hif_drv->usr_scan_req;
 
@@ -1608,7 +1608,7 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct rcvd_async_info *rcvd_info = &msg->body.async_info;
-	u8 msg_type = 0;
+	u8 msg_type;
 	u8 mac_status;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -1926,7 +1926,7 @@ static void handle_disconnect(struct work_struct *work)
 	struct disconnect_info disconn_info;
 	struct user_scan_req *scan_req;
 	struct user_conn_req *conn_req;
-	s32 result = 0;
+	s32 result;
 	u16 dummy_reason_code = 0;
 
 	wid.id = WID_DISCONNECT;
@@ -2004,7 +2004,7 @@ static void handle_get_rssi(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 
 	wid.id = WID_RSSI;
@@ -2026,7 +2026,7 @@ static void handle_get_statistics(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct wid wid_list[5];
-	u32 wid_cnt = 0, result = 0;
+	u32 wid_cnt = 0, result;
 	struct rf_info *stats = (struct rf_info *)msg->body.data;
 
 	wid_list[wid_cnt].id = WID_LINKSPEED;
@@ -2084,7 +2084,7 @@ static void handle_get_inactive_time(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct sta_inactive_t *hif_sta_inactive = &msg->body.mac_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 
 	wid.id = WID_SET_STA_MAC_INACTIVE_TIME;
@@ -2126,7 +2126,7 @@ static void handle_add_beacon(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct beacon_attr *param = &msg->body.beacon_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2181,7 +2181,7 @@ static void handle_del_beacon(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	u8 del_beacon = 0;
 
@@ -2232,7 +2232,7 @@ static void handle_add_station(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct add_sta_param *param = &msg->body.add_sta_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2263,7 +2263,7 @@ static void handle_del_all_sta(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct del_all_sta *param = &msg->body.del_all_sta_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	u8 *curr_byte;
 	u8 i;
@@ -2307,7 +2307,7 @@ static void handle_del_station(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct del_sta *param = &msg->body.del_sta_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 
 	wid.id = WID_REMOVE_STA;
@@ -2335,7 +2335,7 @@ static void handle_edit_station(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct add_sta_param *param = &msg->body.edit_sta_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2364,7 +2364,7 @@ static void handle_edit_station(struct work_struct *work)
 static int handle_remain_on_chan(struct wilc_vif *vif,
 				 struct remain_ch *hif_remain_ch)
 {
-	s32 result = 0;
+	s32 result;
 	u8 remain_on_chan_flag;
 	struct wid wid;
 	struct host_if_drv *hif_drv = vif->hif_drv;
@@ -2433,7 +2433,7 @@ static void handle_register_frame(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct reg_frame *hif_reg_frame = &msg->body.reg_frame;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2468,7 +2468,7 @@ static void handle_listen_state_expired(struct work_struct *work)
 	struct remain_ch *hif_remain_ch = &msg->body.remain_on_ch;
 	u8 remain_on_chan_flag;
 	struct wid wid;
-	s32 result = 0;
+	s32 result;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
 	if (p2p_listen_state) {
@@ -2510,7 +2510,7 @@ static void listen_timer_cb(struct timer_list *t)
 	struct host_if_drv *hif_drv = from_timer(hif_drv, t,
 						      remain_on_ch_timer);
 	struct wilc_vif *vif = hif_drv->remain_on_ch_timer_vif;
-	s32 result = 0;
+	s32 result;
 	struct host_if_msg *msg;
 
 	del_timer(&vif->hif_drv->remain_on_ch_timer);
@@ -2533,7 +2533,7 @@ static void handle_power_management(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct power_mgmt_param *pm_param = &msg->body.pwr_mgmt_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	s8 power_mode;
 
@@ -2559,7 +2559,7 @@ static void handle_set_mcast_filter(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct set_multicast *hif_set_mc = &msg->body.multicast_info;
-	s32 result = 0;
+	s32 result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2621,7 +2621,7 @@ static void handle_get_tx_pwr(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	u8 *tx_pwr = &msg->body.tx_power.tx_pwr;
-	int ret = 0;
+	int ret;
 	struct wid wid;
 
 	wid.id = WID_TX_POWER;
@@ -2713,7 +2713,7 @@ static void timer_connect_cb(struct timer_list *t)
 
 int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -2743,7 +2743,7 @@ int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
 
 int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -3005,7 +3005,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 int wilc_set_pmkid_info(struct wilc_vif *vif,
 			struct host_if_pmkid_attr *pmkid)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	int i;
 
@@ -3034,7 +3034,7 @@ int wilc_set_pmkid_info(struct wilc_vif *vif,
 
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_get_mac_address, true);
@@ -3060,7 +3060,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
 		      u8 security, enum authtype auth_type,
 		      u8 channel, void *join_params)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -3141,7 +3141,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
 
 int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -3187,7 +3187,7 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 			     u8 ifc_id)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, false);
@@ -3209,7 +3209,7 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg  = wilc_alloc_work(vif, handle_set_operation_mode, false);
@@ -3229,7 +3229,7 @@ int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode)
 s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
 			   u32 *out_val)
 {
-	s32 result = 0;
+	s32 result;
 	struct host_if_msg *msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -3258,7 +3258,7 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
 
 int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	if (!rssi_level) {
@@ -3293,7 +3293,7 @@ int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level)
 int
 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_get_statistics, is_sync);
@@ -3322,7 +3322,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 	      size_t ies_len, wilc_scan_result scan_result, void *user_arg,
 	      struct hidden_network *hidden_network)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct scan_attr *scan_info;
 	struct host_if_drv *hif_drv = vif->hif_drv;
@@ -3548,10 +3548,10 @@ int wilc_deinit(struct wilc_vif *vif)
 
 void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 {
-	s32 result = 0;
+	s32 result;
 	struct host_if_msg *msg;
 	int id;
-	struct host_if_drv *hif_drv = NULL;
+	struct host_if_drv *hif_drv;
 	struct wilc_vif *vif;
 
 	id = buffer[length - 4];
@@ -3589,10 +3589,10 @@ 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)
 {
-	s32 result = 0;
+	s32 result;
 	struct host_if_msg *msg;
 	int id;
-	struct host_if_drv *hif_drv = NULL;
+	struct host_if_drv *hif_drv;
 	struct wilc_vif *vif;
 
 	mutex_lock(&hif_deinit_lock);
@@ -3646,9 +3646,9 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 
 void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length)
 {
-	s32 result = 0;
+	s32 result;
 	int id;
-	struct host_if_drv *hif_drv = NULL;
+	struct host_if_drv *hif_drv;
 	struct wilc_vif *vif;
 
 	id = buffer[length - 4];
@@ -3684,7 +3684,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
 			   wilc_remain_on_chan_ready ready,
 			   void *user_arg)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_remain_on_chan_work, false);
@@ -3709,7 +3709,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
 
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -3737,7 +3737,7 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id)
 
 int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_register_frame, false);
@@ -3771,7 +3771,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
 		    u32 head_len, u8 *head, u32 tail_len, u8 *tail)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct beacon_attr *beacon_info;
 
@@ -3816,7 +3816,7 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
 
 int wilc_del_beacon(struct wilc_vif *vif)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_del_beacon, false);
@@ -3834,7 +3834,7 @@ int wilc_del_beacon(struct wilc_vif *vif)
 
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct add_sta_param *add_sta_info;
 
@@ -3865,7 +3865,7 @@ int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param)
 
 int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct del_sta *del_sta_info;
 
@@ -3890,7 +3890,7 @@ int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr)
 
 int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN])
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct del_all_sta *del_all_sta_info;
 	u8 zero_addr[ETH_ALEN] = {0};
@@ -3931,7 +3931,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN])
 int wilc_edit_station(struct wilc_vif *vif,
 		      struct add_sta_param *sta_param)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 	struct add_sta_param *add_sta_info;
 
@@ -3963,7 +3963,7 @@ int wilc_edit_station(struct wilc_vif *vif,
 
 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	if (wilc_wlan_get_num_conn_ifcs(vif->wilc) == 2 && enabled)
@@ -3987,7 +3987,7 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout)
 int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
 				u32 count)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_set_mcast_filter, false);
@@ -4007,7 +4007,7 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
 
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_set_ip_address, false);
@@ -4028,7 +4028,7 @@ int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 
 static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
-	int result = 0;
+	int result;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_get_ip_address, false);
@@ -4049,7 +4049,7 @@ static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 
 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 {
-	int ret = 0;
+	int ret;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_set_tx_pwr, false);
@@ -4069,7 +4069,7 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
 
 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
 {
-	int ret = 0;
+	int ret;
 	struct host_if_msg *msg;
 
 	msg = wilc_alloc_work(vif, handle_get_tx_pwr, true);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 96aaf14..e7e529f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -669,7 +669,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 static int connect(struct wiphy *wiphy, struct net_device *dev,
 		   struct cfg80211_connect_params *sme)
 {
-	s32 ret = 0;
+	s32 ret;
 	u32 i;
 	u32 sel_bssi_idx = UINT_MAX;
 	u8 security = NO_ENCRYPT;
@@ -677,7 +677,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 	u32 cipher_group;
 	struct wilc_priv *priv;
 	struct host_if_drv *wfi_drv;
-	struct network_info *nw_info = NULL;
+	struct network_info *nw_info;
 	struct wilc_vif *vif;
 
 	wilc_connecting = 1;
@@ -818,7 +818,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 static int disconnect(struct wiphy *wiphy, struct net_device *dev,
 		      u16 reason_code)
 {
-	s32 ret = 0;
+	s32 ret;
 	struct wilc_priv *priv;
 	struct host_if_drv *wfi_drv;
 	struct wilc_vif *vif;
@@ -1174,7 +1174,7 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev,
 
 static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
 {
-	s32 ret = 0;
+	s32 ret;
 	struct cfg_param_attr cfg_param_val;
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
@@ -1879,7 +1879,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
 		    struct cfg80211_ap_settings *settings)
 {
 	struct cfg80211_beacon_data *beacon = &settings->beacon;
-	s32 ret = 0;
+	s32 ret;
 	struct wilc *wl;
 	struct wilc_vif *vif;
 
@@ -1916,7 +1916,7 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
 
 static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
 {
-	s32 ret = 0;
+	s32 ret;
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
 	u8 null_bssid[ETH_ALEN] = {0};
@@ -2049,7 +2049,7 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
 {
 	struct wilc_vif *vif;
 	struct wilc_priv *priv;
-	struct net_device *new_ifc = NULL;
+	struct net_device *new_ifc;
 
 	priv = wiphy_priv(wiphy);
 	vif = netdev_priv(priv->wdev->netdev);
@@ -2215,7 +2215,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
 {
 	struct wilc_priv *priv;
 	struct wireless_dev *wdev;
-	s32 ret = 0;
+	s32 ret;
 
 	wdev = wilc_wfi_cfg_alloc();
 	if (!wdev) {
@@ -2257,7 +2257,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
 
 int wilc_init_host_int(struct net_device *net)
 {
-	int ret = 0;
+	int ret;
 	struct wilc_priv *priv;
 
 	priv = wdev_priv(net->ieee80211_ptr);
@@ -2279,7 +2279,7 @@ int wilc_init_host_int(struct net_device *net)
 
 int wilc_deinit_host_int(struct net_device *net)
 {
-	int ret = 0;
+	int ret;
 	struct wilc_vif *vif;
 	struct wilc_priv *priv;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/23] staging: wilc1000: use 'int' inplace of 's32' date type
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (19 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 20/23] staging: wilc1000: avoid setting default value for variable at declaration Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 22/23] staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops callbacks Ajay Singh
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to use 'int' instead of 's32' to have the same data type
based on its usage.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c         | 48 +++++++++++------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 28 ++++++-------
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index d251a64..fb063e5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -722,9 +722,9 @@ static void handle_cfg_param(struct work_struct *work)
 	kfree(msg);
 }
 
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
+static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
 {
-	s32 result = 0;
+	int result = 0;
 	u8 abort_running_scan;
 	struct wid wid;
 	struct host_if_drv *hif_drv = vif->hif_drv;
@@ -765,7 +765,7 @@ static void handle_scan(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct scan_attr *scan_info = &msg->body.scan_info;
-	s32 result = 0;
+	int result = 0;
 	struct wid wid_list[5];
 	u32 index = 0;
 	u32 i;
@@ -883,7 +883,7 @@ static void handle_connect(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct connect_attr *conn_attr = &msg->body.con_info;
-	s32 result = 0;
+	int result = 0;
 	struct wid wid_list[8];
 	u32 wid_cnt = 0, dummyval = 0;
 	u8 *cur_byte = NULL;
@@ -1148,7 +1148,7 @@ static void handle_connect_timeout(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
-	s32 result;
+	int result;
 	struct connect_info info;
 	struct wid wid;
 	u16 dummy_reason_code = 0;
@@ -1454,7 +1454,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
 				       u32 max_assoc_resp_info_len,
 				       u32 *rcvd_assoc_resp_info_len)
 {
-	s32 result;
+	int result;
 	struct wid wid;
 
 	wid.id = WID_ASSOC_RES_INFO;
@@ -1926,7 +1926,7 @@ static void handle_disconnect(struct work_struct *work)
 	struct disconnect_info disconn_info;
 	struct user_scan_req *scan_req;
 	struct user_conn_req *conn_req;
-	s32 result;
+	int result;
 	u16 dummy_reason_code = 0;
 
 	wid.id = WID_DISCONNECT;
@@ -2004,7 +2004,7 @@ static void handle_get_rssi(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
-	s32 result;
+	int result;
 	struct wid wid;
 
 	wid.id = WID_RSSI;
@@ -2084,7 +2084,7 @@ static void handle_get_inactive_time(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct sta_inactive_t *hif_sta_inactive = &msg->body.mac_info;
-	s32 result;
+	int result;
 	struct wid wid;
 
 	wid.id = WID_SET_STA_MAC_INACTIVE_TIME;
@@ -2126,7 +2126,7 @@ static void handle_add_beacon(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct beacon_attr *param = &msg->body.beacon_info;
-	s32 result;
+	int result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2181,7 +2181,7 @@ static void handle_del_beacon(struct work_struct *work)
 {
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
-	s32 result;
+	int result;
 	struct wid wid;
 	u8 del_beacon = 0;
 
@@ -2232,7 +2232,7 @@ static void handle_add_station(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct add_sta_param *param = &msg->body.add_sta_info;
-	s32 result;
+	int result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2263,7 +2263,7 @@ static void handle_del_all_sta(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct del_all_sta *param = &msg->body.del_all_sta_info;
-	s32 result;
+	int result;
 	struct wid wid;
 	u8 *curr_byte;
 	u8 i;
@@ -2307,7 +2307,7 @@ static void handle_del_station(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct del_sta *param = &msg->body.del_sta_info;
-	s32 result;
+	int result;
 	struct wid wid;
 
 	wid.id = WID_REMOVE_STA;
@@ -2335,7 +2335,7 @@ static void handle_edit_station(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct add_sta_param *param = &msg->body.edit_sta_info;
-	s32 result;
+	int result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2364,7 +2364,7 @@ static void handle_edit_station(struct work_struct *work)
 static int handle_remain_on_chan(struct wilc_vif *vif,
 				 struct remain_ch *hif_remain_ch)
 {
-	s32 result;
+	int result;
 	u8 remain_on_chan_flag;
 	struct wid wid;
 	struct host_if_drv *hif_drv = vif->hif_drv;
@@ -2433,7 +2433,7 @@ static void handle_register_frame(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct reg_frame *hif_reg_frame = &msg->body.reg_frame;
-	s32 result;
+	int result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -2468,7 +2468,7 @@ static void handle_listen_state_expired(struct work_struct *work)
 	struct remain_ch *hif_remain_ch = &msg->body.remain_on_ch;
 	u8 remain_on_chan_flag;
 	struct wid wid;
-	s32 result;
+	int result;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
 	if (p2p_listen_state) {
@@ -2510,7 +2510,7 @@ static void listen_timer_cb(struct timer_list *t)
 	struct host_if_drv *hif_drv = from_timer(hif_drv, t,
 						      remain_on_ch_timer);
 	struct wilc_vif *vif = hif_drv->remain_on_ch_timer_vif;
-	s32 result;
+	int result;
 	struct host_if_msg *msg;
 
 	del_timer(&vif->hif_drv->remain_on_ch_timer);
@@ -2533,7 +2533,7 @@ static void handle_power_management(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct power_mgmt_param *pm_param = &msg->body.pwr_mgmt_info;
-	s32 result;
+	int result;
 	struct wid wid;
 	s8 power_mode;
 
@@ -2559,7 +2559,7 @@ static void handle_set_mcast_filter(struct work_struct *work)
 	struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
 	struct wilc_vif *vif = msg->vif;
 	struct set_multicast *hif_set_mc = &msg->body.multicast_info;
-	s32 result;
+	int result;
 	struct wid wid;
 	u8 *cur_byte;
 
@@ -3548,7 +3548,7 @@ int wilc_deinit(struct wilc_vif *vif)
 
 void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 {
-	s32 result;
+	int result;
 	struct host_if_msg *msg;
 	int id;
 	struct host_if_drv *hif_drv;
@@ -3589,7 +3589,7 @@ 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)
 {
-	s32 result;
+	int result;
 	struct host_if_msg *msg;
 	int id;
 	struct host_if_drv *hif_drv;
@@ -3646,7 +3646,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 
 void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length)
 {
-	s32 result;
+	int result;
 	int id;
 	struct host_if_drv *hif_drv;
 	struct wilc_vif *vif;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e7e529f..ba6f9ed 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -615,7 +615,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 {
 	struct wilc_priv *priv;
 	u32 i;
-	s32 ret = 0;
+	int ret = 0;
 	u8 scan_ch_list[MAX_NUM_SCANNED_NETWORKS];
 	struct hidden_network hidden_ntwk;
 	struct wilc_vif *vif;
@@ -669,7 +669,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 static int connect(struct wiphy *wiphy, struct net_device *dev,
 		   struct cfg80211_connect_params *sme)
 {
-	s32 ret;
+	int ret;
 	u32 i;
 	u32 sel_bssi_idx = UINT_MAX;
 	u8 security = NO_ENCRYPT;
@@ -818,7 +818,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 static int disconnect(struct wiphy *wiphy, struct net_device *dev,
 		      u16 reason_code)
 {
-	s32 ret;
+	int ret;
 	struct wilc_priv *priv;
 	struct host_if_drv *wfi_drv;
 	struct wilc_vif *vif;
@@ -914,7 +914,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
 		   bool pairwise, const u8 *mac_addr, struct key_params *params)
 
 {
-	s32 ret = 0, keylen = params->key_len;
+	int ret = 0, keylen = params->key_len;
 	struct wilc_priv *priv;
 	const u8 *rx_mic = NULL;
 	const u8 *tx_mic = NULL;
@@ -1174,7 +1174,7 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev,
 
 static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
 {
-	s32 ret;
+	int ret;
 	struct cfg_param_attr cfg_param_val;
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
@@ -1213,7 +1213,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
 		     struct cfg80211_pmksa *pmksa)
 {
 	u32 i;
-	s32 ret = 0;
+	int ret = 0;
 	u8 flag = 0;
 	struct wilc_vif *vif;
 	struct wilc_priv *priv = wiphy_priv(wiphy);
@@ -1249,7 +1249,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
 		     struct cfg80211_pmksa *pmksa)
 {
 	u32 i;
-	s32 ret = 0;
+	int ret = 0;
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 
 	for (i = 0; i < priv->pmkid_list.numpmkid; i++)	{
@@ -1505,7 +1505,7 @@ static int remain_on_channel(struct wiphy *wiphy,
 			     struct ieee80211_channel *chan,
 			     unsigned int duration, u64 *cookie)
 {
-	s32 ret = 0;
+	int ret = 0;
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
 
@@ -1879,7 +1879,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
 		    struct cfg80211_ap_settings *settings)
 {
 	struct cfg80211_beacon_data *beacon = &settings->beacon;
-	s32 ret;
+	int ret;
 	struct wilc *wl;
 	struct wilc_vif *vif;
 
@@ -1916,7 +1916,7 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
 
 static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
 {
-	s32 ret;
+	int ret;
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
 	u8 null_bssid[ETH_ALEN] = {0};
@@ -1940,7 +1940,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
 static int add_station(struct wiphy *wiphy, struct net_device *dev,
 		       const u8 *mac, struct station_parameters *params)
 {
-	s32 ret = 0;
+	int ret = 0;
 	struct wilc_priv *priv;
 	struct add_sta_param sta_params = { {0} };
 	struct wilc_vif *vif;
@@ -1981,7 +1981,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
 		       struct station_del_parameters *params)
 {
 	const u8 *mac = params->mac;
-	s32 ret = 0;
+	int ret = 0;
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
 	struct sta_info *info;
@@ -2009,7 +2009,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
 static int change_station(struct wiphy *wiphy, struct net_device *dev,
 			  const u8 *mac, struct station_parameters *params)
 {
-	s32 ret = 0;
+	int ret = 0;
 	struct add_sta_param sta_params = { {0} };
 	struct wilc_vif *vif;
 
@@ -2215,7 +2215,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
 {
 	struct wilc_priv *priv;
 	struct wireless_dev *wdev;
-	s32 ret;
+	int ret;
 
 	wdev = wilc_wfi_cfg_alloc();
 	if (!wdev) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 22/23] staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops callbacks
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (20 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 21/23] staging: wilc1000: use 'int' inplace of 's32' date type Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-18 22:45 ` [PATCH 23/23] staging: wilc1000: move variable assignment along with its declaration Ajay Singh
  2018-07-19  8:36 ` [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Claudiu Beznea
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to remove the unnecessary 'NULL' check used in 'cfg80211_ops'
callback functions.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ba6f9ed..2d44333 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1781,9 +1781,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
 
-	if (!wiphy)
-		return -ENOENT;
-
 	priv = wiphy_priv(wiphy);
 	vif = netdev_priv(priv->dev);
 	if (!priv->hif_drv)
@@ -1921,9 +1918,6 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	struct wilc_vif *vif;
 	u8 null_bssid[ETH_ALEN] = {0};
 
-	if (!wiphy)
-		return -EFAULT;
-
 	priv = wiphy_priv(wiphy);
 	vif = netdev_priv(priv->dev);
 
@@ -1945,9 +1939,6 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
 	struct add_sta_param sta_params = { {0} };
 	struct wilc_vif *vif;
 
-	if (!wiphy)
-		return -EFAULT;
-
 	priv = wiphy_priv(wiphy);
 	vif = netdev_priv(dev);
 
@@ -1986,9 +1977,6 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
 	struct wilc_vif *vif;
 	struct sta_info *info;
 
-	if (!wiphy)
-		return -EFAULT;
-
 	priv = wiphy_priv(wiphy);
 	vif = netdev_priv(dev);
 
@@ -2013,9 +2001,6 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
 	struct add_sta_param sta_params = { {0} };
 	struct wilc_vif *vif;
 
-	if (!wiphy)
-		return -EFAULT;
-
 	vif = netdev_priv(dev);
 
 	if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 23/23] staging: wilc1000: move variable assignment along with its declaration
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (21 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 22/23] staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops callbacks Ajay Singh
@ 2018-07-18 22:45 ` Ajay Singh
  2018-07-19  8:36 ` [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Claudiu Beznea
  23 siblings, 0 replies; 32+ messages in thread
From: Ajay Singh @ 2018-07-18 22:45 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to club the variable assignment along with the variable
declaration especially for private data.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c         |   7 +-
 drivers/staging/wilc1000/linux_wlan.c             | 113 +++--------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 229 +++++++---------------
 drivers/staging/wilc1000/wilc_wlan.c              |  53 ++---
 4 files changed, 118 insertions(+), 284 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index fb063e5..c78b51a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3429,13 +3429,10 @@ static void get_periodic_rssi(struct timer_list *unused)
 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 {
 	struct host_if_drv *hif_drv;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 	int i;
 
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
 	hif_drv  = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
 	if (!hif_drv)
 		return -ENOMEM;
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 5667a54..2f4bf8e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -94,12 +94,9 @@ static int dev_state_ev_handler(struct notifier_block *this,
 
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
 	struct net_device *dev = user_data;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	if (wilc->close) {
 		netdev_err(dev, "Can't handle UH interrupt\n");
@@ -110,12 +107,9 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
 static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
 	struct net_device *dev = userdata;
-
-	vif = netdev_priv(userdata);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(userdata);
+	struct wilc *wilc = vif->wilc;
 
 	if (wilc->close) {
 		netdev_err(dev, "Can't handle BH interrupt\n");
@@ -130,11 +124,8 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
 static int init_irq(struct net_device *dev)
 {
 	int ret = 0;
-	struct wilc_vif *vif;
-	struct wilc *wl;
-
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
 
 	if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
 	    (gpio_direction_input(wl->gpio) == 0)) {
@@ -163,11 +154,8 @@ static int init_irq(struct net_device *dev)
 
 static void deinit_irq(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	/* Deinitialize IRQ */
 	if (wilc->dev_irq_num) {
@@ -238,12 +226,9 @@ static int linux_wlan_txq_task(void *vp)
 {
 	int ret;
 	u32 txq_count;
-	struct wilc_vif *vif;
-	struct wilc *wl;
 	struct net_device *dev = vp;
-
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
 
 	complete(&wl->txq_thread_started);
 	while (1) {
@@ -271,15 +256,12 @@ static int linux_wlan_txq_task(void *vp)
 
 static int wilc_wlan_get_firmware(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 	int chip_id, ret = 0;
 	const struct firmware *wilc_firmware;
 	char *firmware;
 
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
 	chip_id = wilc_get_chipid(wilc, false);
 
 	if (chip_id < 0x1003a0)
@@ -306,13 +288,10 @@ static int wilc_wlan_get_firmware(struct net_device *dev)
 
 static int linux_wlan_start_firmware(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 	int ret = 0;
 
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
 	ret = wilc_wlan_start(wilc);
 	if (ret < 0)
 		return ret;
@@ -326,13 +305,10 @@ static int linux_wlan_start_firmware(struct net_device *dev)
 
 static int wilc1000_firmware_download(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 	int ret = 0;
 
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
 	if (!wilc->firmware) {
 		netdev_err(dev, "Firmware buffer is NULL\n");
 		return -ENOBUFS;
@@ -560,11 +536,8 @@ static int linux_wlan_init_test_config(struct net_device *dev,
 
 static int wlan_deinit_locks(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	mutex_destroy(&wilc->hif_cs);
 	mutex_destroy(&wilc->rxq_cs);
@@ -575,11 +548,8 @@ static int wlan_deinit_locks(struct net_device *dev)
 
 static void wlan_deinitialize_threads(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wl;
-
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
 
 	wl->close = 1;
 
@@ -593,11 +563,8 @@ static void wlan_deinitialize_threads(struct net_device *dev)
 
 static void wilc_wlan_deinitialize(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wl;
-
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
 
 	if (!wl) {
 		netdev_err(dev, "wl is NULL\n");
@@ -632,11 +599,8 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
 
 static int wlan_init_locks(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wl;
-
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
 
 	mutex_init(&wl->hif_cs);
 	mutex_init(&wl->rxq_cs);
@@ -655,11 +619,8 @@ static int wlan_init_locks(struct net_device *dev)
 
 static int wlan_initialize_threads(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
 				       "K_TXQ_TASK");
@@ -779,14 +740,11 @@ static int mac_init_fn(struct net_device *ndev)
 
 static int wilc_mac_open(struct net_device *ndev)
 {
-	struct wilc_vif *vif;
+	struct wilc_vif *vif = netdev_priv(ndev);
+	struct wilc *wl = vif->wilc;
 	unsigned char mac_add[ETH_ALEN] = {0};
 	int ret = 0;
 	int i = 0;
-	struct wilc *wl;
-
-	vif = netdev_priv(ndev);
-	wl = vif->wilc;
 
 	if (!wl || !wl->dev) {
 		netdev_err(ndev, "device not ready\n");
@@ -850,11 +808,9 @@ static struct net_device_stats *mac_stats(struct net_device *dev)
 static void wilc_set_multicast_list(struct net_device *dev)
 {
 	struct netdev_hw_addr *ha;
-	struct wilc_vif *vif;
+	struct wilc_vif *vif = netdev_priv(dev);
 	int i = 0;
 
-	vif = netdev_priv(dev);
-
 	if (dev->flags & IFF_PROMISC)
 		return;
 
@@ -894,16 +850,13 @@ static void linux_wlan_tx_complete(void *priv, int status)
 
 netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
-	struct wilc_vif *vif;
+	struct wilc_vif *vif = netdev_priv(ndev);
+	struct wilc *wilc = vif->wilc;
 	struct tx_complete_data *tx_data = NULL;
 	int queue_count;
 	char *udp_buf;
 	struct iphdr *ih;
 	struct ethhdr *eth_h;
-	struct wilc *wilc;
-
-	vif = netdev_priv(ndev);
-	wilc = vif->wilc;
 
 	if (skb->dev != ndev) {
 		netdev_err(ndev, "Packet not destined to this device\n");
@@ -951,12 +904,10 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
 static int wilc_mac_close(struct net_device *ndev)
 {
 	struct wilc_priv *priv;
-	struct wilc_vif *vif;
+	struct wilc_vif *vif = netdev_priv(ndev);
 	struct host_if_drv *hif_drv;
 	struct wilc *wl;
 
-	vif = netdev_priv(ndev);
-
 	if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr ||
 	    !vif->ndev->ieee80211_ptr->wiphy)
 		return 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 2d44333..42c0128 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -463,21 +463,15 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
 			       struct disconnect_info *disconn_info,
 			       void *priv_data)
 {
-	struct wilc_priv *priv;
-	struct net_device *dev;
-	struct host_if_drv *wfi_drv;
+	struct wilc_priv *priv = priv_data;
+	struct net_device *dev = priv->dev;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
+	struct host_if_drv *wfi_drv = priv->hif_drv;
 	u8 null_bssid[ETH_ALEN] = {0};
-	struct wilc *wl;
-	struct wilc_vif *vif;
 
 	wilc_connecting = 0;
 
-	priv = priv_data;
-	dev = priv->dev;
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
-	wfi_drv = (struct host_if_drv *)priv->hif_drv;
-
 	if (conn_disconn_evt == CONN_DISCONN_EVENT_CONN_RESP) {
 		u16 connect_status;
 
@@ -550,12 +544,9 @@ static int set_channel(struct wiphy *wiphy,
 		       struct cfg80211_chan_def *chandef)
 {
 	u32 channelnum = 0;
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 	int result = 0;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
 
 	channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq);
 
@@ -613,15 +604,12 @@ wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request *request,
 
 static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 {
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 	u32 i;
 	int ret = 0;
 	u8 scan_ch_list[MAX_NUM_SCANNED_NETWORKS];
 	struct hidden_network hidden_ntwk;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
 
 	priv->scan_req = request;
 
@@ -669,21 +657,18 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 static int connect(struct wiphy *wiphy, struct net_device *dev,
 		   struct cfg80211_connect_params *sme)
 {
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
+	struct host_if_drv *wfi_drv = priv->hif_drv;
+	struct network_info *nw_info;
 	int ret;
 	u32 i;
 	u32 sel_bssi_idx = UINT_MAX;
 	u8 security = 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;
-	struct wilc_vif *vif;
 
 	wilc_connecting = 1;
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
-	wfi_drv = (struct host_if_drv *)priv->hif_drv;
 
 	if (!(strncmp(sme->ssid, "DIRECT-", 7)))
 		wfi_drv->p2p_connect = 1;
@@ -818,17 +803,14 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 static int disconnect(struct wiphy *wiphy, struct net_device *dev,
 		      u16 reason_code)
 {
-	int ret;
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
+	struct wilc *wilc = vif->wilc;
 	struct host_if_drv *wfi_drv;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
+	int ret;
 	u8 null_bssid[ETH_ALEN] = {0};
 
 	wilc_connecting = 0;
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
-	wilc = vif->wilc;
 
 	if (!wilc)
 		return -EIO;
@@ -915,15 +897,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
 
 {
 	int ret = 0, keylen = params->key_len;
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
 	const u8 *rx_mic = NULL;
 	const u8 *tx_mic = NULL;
 	u8 mode = NO_ENCRYPT;
 	u8 op_mode;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(netdev);
+	struct wilc_vif *vif = netdev_priv(netdev);
 
 	switch (params->cipher) {
 	case WLAN_CIPHER_SUITE_WEP40:
@@ -1028,13 +1007,9 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
 		   bool pairwise,
 		   const u8 *mac_addr)
 {
-	struct wilc_priv *priv;
-	struct wilc *wl;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(netdev);
-	wl = vif->wilc;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(netdev);
+	struct wilc *wl = vif->wilc;
 
 	if (netdev == wl->vif[0]->ndev) {
 		if (priv->wilc_gtk[key_index]) {
@@ -1071,11 +1046,9 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
 		   bool pairwise, const u8 *mac_addr, void *cookie,
 		   void (*callback)(void *cookie, struct key_params *))
 {
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
 	struct  key_params key_params;
 
-	priv = wiphy_priv(wiphy);
-
 	if (!pairwise) {
 		key_params.key = priv->wilc_gtk[key_index]->key;
 		key_params.cipher = priv->wilc_gtk[key_index]->cipher;
@@ -1098,11 +1071,8 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
 static int set_default_key(struct wiphy *wiphy, struct net_device *netdev,
 			   u8 key_index, bool unicast, bool multicast)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
 	wilc_set_wep_default_keyid(vif, key_index);
 
@@ -1112,15 +1082,12 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev,
 static int get_station(struct wiphy *wiphy, struct net_device *dev,
 		       const u8 *mac, struct station_info *sinfo)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(dev);
 	u32 i = 0;
 	u32 associatedsta = ~0;
 	u32 inactive_time = 0;
 
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(dev);
-
 	if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
 		for (i = 0; i < NUM_STA_ASSOCIATED; i++) {
 			if (!(memcmp(mac,
@@ -1176,11 +1143,8 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
 {
 	int ret;
 	struct cfg_param_attr cfg_param_val;
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
 	cfg_param_val.flag = 0;
 
@@ -1212,13 +1176,11 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
 static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
 		     struct cfg80211_pmksa *pmksa)
 {
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 	u32 i;
 	int ret = 0;
 	u8 flag = 0;
-	struct wilc_vif *vif;
-	struct wilc_priv *priv = wiphy_priv(wiphy);
-
-	vif = netdev_priv(priv->dev);
 
 	for (i = 0; i < priv->pmkid_list.numpmkid; i++)	{
 		if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,
@@ -1397,14 +1359,11 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff,
 
 void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size)
 {
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
+	struct host_if_drv *wfi_drv = priv->hif_drv;
 	u32 header, pkt_offset;
-	struct host_if_drv *wfi_drv;
 	s32 freq;
 
-	priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-	wfi_drv = (struct host_if_drv *)priv->hif_drv;
-
 	memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);
 
 	pkt_offset = GET_PKT_OFFSET(header);
@@ -1506,11 +1465,8 @@ static int remain_on_channel(struct wiphy *wiphy,
 			     unsigned int duration, u64 *cookie)
 {
 	int ret = 0;
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
 	if (wdev->iftype == NL80211_IFTYPE_AP) {
 		netdev_dbg(vif->ndev, "Required while in AP mode\n");
@@ -1535,11 +1491,8 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
 				    struct wireless_dev *wdev,
 				    u64 cookie)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
 	return wilc_listen_state_expired(vif,
 			priv->remain_on_ch_params.listen_session_id);
@@ -1605,16 +1558,12 @@ static int mgmt_tx(struct wiphy *wiphy,
 	size_t len = params->len;
 	const struct ieee80211_mgmt *mgmt;
 	struct p2p_mgmt_data *mgmt_tx;
-	struct wilc_priv *priv;
-	struct host_if_drv *wfi_drv;
-	struct wilc_vif *vif;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct host_if_drv *wfi_drv = priv->hif_drv;
+	struct wilc_vif *vif = netdev_priv(wdev->netdev);
 	u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(p2p_local_random);
 	int ret = 0;
 
-	vif = netdev_priv(wdev->netdev);
-	priv = wiphy_priv(wiphy);
-	wfi_drv = (struct host_if_drv *)priv->hif_drv;
-
 	*cookie = (unsigned long)buf;
 	priv->tx_cookie = *cookie;
 	mgmt = (const struct ieee80211_mgmt *)buf;
@@ -1694,11 +1643,9 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
 			       struct wireless_dev *wdev,
 			       u64 cookie)
 {
-	struct wilc_priv *priv;
-	struct host_if_drv *wfi_drv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct host_if_drv *wfi_drv = priv->hif_drv;
 
-	priv = wiphy_priv(wiphy);
-	wfi_drv = (struct host_if_drv *)priv->hif_drv;
 	wfi_drv->p2p_timeout = jiffies;
 
 	if (!priv->p2p_listen_state) {
@@ -1718,13 +1665,9 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 			      u16 frame_type, bool reg)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
-	struct wilc *wl;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->wdev->netdev);
-	wl = vif->wilc;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->wdev->netdev);
+	struct wilc *wl = vif->wilc;
 
 	if (!frame_type)
 		return;
@@ -1758,15 +1701,12 @@ static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
 static int dump_station(struct wiphy *wiphy, struct net_device *dev,
 			int idx, u8 *mac, struct station_info *sinfo)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
 	if (idx != 0)
 		return -ENOENT;
 
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
-
 	sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
 
 	wilc_get_rssi(vif, &sinfo->signal);
@@ -1778,11 +1718,9 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
 static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 			  bool enabled, int timeout)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
 	if (!priv->hif_drv)
 		return -EIO;
 
@@ -1796,13 +1734,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 			       enum nl80211_iftype type,
 			       struct vif_params *params)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
-	struct wilc *wl;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
 
-	vif = netdev_priv(dev);
-	priv = wiphy_priv(wiphy);
-	wl = vif->wilc;
 	p2p_local_random = 0x01;
 	p2p_recv_random = 0x00;
 	wilc_ie = false;
@@ -1875,13 +1810,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 static int start_ap(struct wiphy *wiphy, struct net_device *dev,
 		    struct cfg80211_ap_settings *settings)
 {
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wl = vif->wilc;
 	struct cfg80211_beacon_data *beacon = &settings->beacon;
 	int ret;
-	struct wilc *wl;
-	struct wilc_vif *vif;
-
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
 
 	ret = set_channel(wiphy, &settings->chandef);
 
@@ -1900,11 +1832,8 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
 static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
 			 struct cfg80211_beacon_data *beacon)
 {
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
 	return wilc_add_beacon(vif, 0, 0, beacon->head_len,
 				   (u8 *)beacon->head, beacon->tail_len,
@@ -1914,13 +1843,10 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
 static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
 {
 	int ret;
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 	u8 null_bssid[ETH_ALEN] = {0};
 
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->dev);
-
 	wilc_wlan_set_bssid(dev, null_bssid, AP_MODE);
 
 	ret = wilc_del_beacon(vif);
@@ -1935,12 +1861,9 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
 		       const u8 *mac, struct station_parameters *params)
 {
 	int ret = 0;
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
 	struct add_sta_param sta_params = { {0} };
-	struct wilc_vif *vif;
-
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(dev);
+	struct wilc_vif *vif = netdev_priv(dev);
 
 	if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
 		memcpy(sta_params.bssid, mac, ETH_ALEN);
@@ -1973,13 +1896,10 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
 {
 	const u8 *mac = params->mac;
 	int ret = 0;
-	struct wilc_priv *priv;
-	struct wilc_vif *vif;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(dev);
 	struct sta_info *info;
 
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(dev);
-
 	if (!(vif->iftype == AP_MODE || vif->iftype == GO_MODE))
 		return ret;
 
@@ -1999,9 +1919,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
 {
 	int ret = 0;
 	struct add_sta_param sta_params = { {0} };
-	struct wilc_vif *vif;
-
-	vif = netdev_priv(dev);
+	struct wilc_vif *vif = netdev_priv(dev);
 
 	if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
 		memcpy(sta_params.bssid, mac, ETH_ALEN);
@@ -2032,13 +1950,10 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
 					     enum nl80211_iftype type,
 					     struct vif_params *params)
 {
-	struct wilc_vif *vif;
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->wdev->netdev);
 	struct net_device *new_ifc;
 
-	priv = wiphy_priv(wiphy);
-	vif = netdev_priv(priv->wdev->netdev);
-
 	if (type == NL80211_IFTYPE_MONITOR) {
 		new_ifc = wilc_wfi_init_mon_interface(name, vif->ndev);
 		if (new_ifc) {
@@ -2109,9 +2024,7 @@ static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
 	int ret;
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 	struct wilc_vif *vif = netdev_priv(priv->dev);
-	struct wilc *wl;
-
-	wl = vif->wilc;
+	struct wilc *wl = vif->wilc;
 
 	/* If firmware is not started, return. */
 	if (!wl->initialized)
@@ -2243,9 +2156,8 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
 int wilc_init_host_int(struct net_device *net)
 {
 	int ret;
-	struct wilc_priv *priv;
+	struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr);
 
-	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_during_ip, 0);
@@ -2265,11 +2177,8 @@ int wilc_init_host_int(struct net_device *net)
 int wilc_deinit_host_int(struct net_device *net)
 {
 	int ret;
-	struct wilc_vif *vif;
-	struct wilc_priv *priv;
-
-	priv = wdev_priv(net->ieee80211_ptr);
-	vif = netdev_priv(priv->dev);
+	struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
 
 	priv->p2p_listen_state = false;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index cb8bfd2..ea2e77f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -31,11 +31,8 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev)
 {
 	struct txq_entry_t *tqe = NULL;
 	unsigned long flags;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
@@ -53,11 +50,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
 				      struct txq_entry_t *tqe)
 {
 	unsigned long flags;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
@@ -156,11 +150,8 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 	const struct ethhdr *eth_hdr_ptr = buffer;
 	int i;
 	unsigned long flags;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
@@ -202,15 +193,12 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 
 static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 {
-	struct wilc_vif *vif;
-	struct wilc *wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 	u32 i = 0;
 	u32 dropped = 0;
 	unsigned long flags;
 
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 	for (i = pending_base; i < (pending_base + pending_acks); i++) {
 		u32 session_index;
@@ -511,7 +499,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 	int i, entries = 0;
 	u32 sum;
 	u32 reg;
-	u8 *txb;
 	u32 offset = 0;
 	int vmm_sz = 0;
 	struct txq_entry_t *tqe;
@@ -519,14 +506,10 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 	int counter;
 	int timeout;
 	u32 vmm_table[WILC_VMM_TBL_SIZE];
-	struct wilc_vif *vif;
-	struct wilc *wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 	const struct wilc_hif_func *func;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
-	txb = wilc->tx_buffer;
+	u8 *txb = wilc->tx_buffer;
 
 	if (wilc->quit)
 		goto out;
@@ -1081,11 +1064,8 @@ void wilc_wlan_cleanup(struct net_device *dev)
 	struct rxq_entry_t *rqe;
 	u32 reg = 0;
 	int ret;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	wilc->quit = 1;
 	do {
@@ -1281,11 +1261,8 @@ static u32 init_chip(struct net_device *dev)
 {
 	u32 chipid;
 	u32 reg, ret = 0;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
+	struct wilc_vif *vif = netdev_priv(dev);
+	struct wilc *wilc = vif->wilc;
 
 	acquire_bus(wilc, ACQUIRE_ONLY);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style
  2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
                   ` (22 preceding siblings ...)
  2018-07-18 22:45 ` [PATCH 23/23] staging: wilc1000: move variable assignment along with its declaration Ajay Singh
@ 2018-07-19  8:36 ` Claudiu Beznea
  23 siblings, 0 replies; 32+ messages in thread
From: Claudiu Beznea @ 2018-07-19  8:36 UTC (permalink / raw)
  To: Ajay Singh, linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	adham.abozaeid

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


On 19.07.2018 01:44, Ajay Singh wrote:
> This patch series contains modification to follow Linux coding style &
> cleanup change to remove unused variables and enums.
> Few patches also contain changes to remove unnecessary typecast.
> 
> Ajay Singh (23):
>   staging: wilc1000: remove unused enum declaration
>   staging: wilc1000: remove enum connect_status instead use
>     ieee80211_statuscode
>   staging: wilc1000: remove extra enum defined for data rates
>   staging: wilc1000: remove extra enums defined for ieee80211_eid
>   staging: wilc1000: rename goto to avoid leading '_' in label name
>   staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase
>   staging: wilc1000: rename enum SITESURVEY to use lowercase
>   staging: wilc1000: rename enum AUTHTYPE to use lowercase
>   staging: wilc1000: remove unused elements in 'wilc' struct
>   staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct
>   staging: wilc1000: removed unused element from wilc_cfg_frame struct
>   staging: wilc1000: remove the mutliple #define used for same macro
>   staging: wilc1000: use lowercase for 'IFC_UP' struct element name
>   staging: wilc1000: remove unnecessary blank line between variable
>     declaration
>   staging: wilc1000: use single space before opening brances '{'
>   staging: wilc1000: remove unnecessary type used for wid id
>   staging: wilc1000: avoid forward declaration for handle_scan_done()
>   staging: wilc1000: avoid host_int_get_assoc_res_info() forward
>     declaration
>   staging: wilc1000: avoid forward declaration of
>     host_int_parse_join_bss_param()
>   staging: wilc1000: avoid setting default value for variable at
>     declaration
>   staging: wilc1000: use 'int' inplace of 's32' date type
>   staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops
>     callbacks
>   staging: wilc1000: move variable assignment along with its declaration
> 
>  drivers/staging/wilc1000/coreconfigurator.c       |  84 +--
>  drivers/staging/wilc1000/coreconfigurator.h       |  20 -
>  drivers/staging/wilc1000/host_interface.c         | 696 +++++++++++-----------
>  drivers/staging/wilc1000/host_interface.h         |  20 +-
>  drivers/staging/wilc1000/linux_mon.c              |   2 -
>  drivers/staging/wilc1000/linux_wlan.c             | 122 ++--
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 307 +++-------
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  16 +-
>  drivers/staging/wilc1000/wilc_wlan.c              |  65 +-
>  drivers/staging/wilc1000/wilc_wlan.h              |   3 -
>  drivers/staging/wilc1000/wilc_wlan_if.h           |  56 +-
>  11 files changed, 517 insertions(+), 874 deletions(-)
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-07-18 22:45 ` [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name Ajay Singh
@ 2018-07-19  9:27   ` Dan Carpenter
  2018-07-19 23:05     ` Ajay Singh
  0 siblings, 1 reply; 32+ messages in thread
From: Dan Carpenter @ 2018-07-19  9:27 UTC (permalink / raw)
  To: Ajay Singh
  Cc: linux-wireless, devel, venkateswara.kaja, gregkh, ganesh.krishna,
	adham.abozaeid, aditya.shankar

On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> index 85af365..8e71c28 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
>  		if (wilc->rx_buffer)
>  			buffer = &wilc->rx_buffer[offset];
>  		else
> -			goto _end_;
> +			goto end;

This isn't related to your patch but this goto doesn't appear to make
any sort of sense.  I have no idea what was intended.

>  
>  		wilc->hif_func->hif_clear_int_ext(wilc,
>  					      DATA_INT_CLR | ENABLE_RX_VMM);
>  		ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
>  
> -_end_:
> +end:
>  		if (ret) {
>  			offset += size;
>  			wilc->rx_buffer_offset = offset;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-07-19  9:27   ` Dan Carpenter
@ 2018-07-19 23:05     ` Ajay Singh
  2018-07-30  8:41       ` Dan Carpenter
  0 siblings, 1 reply; 32+ messages in thread
From: Ajay Singh @ 2018-07-19 23:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, venkateswara.kaja, gregkh, linux-wireless, ganesh.krishna,
	adham.abozaeid, aditya.shankar

Hi Dan,

On Thu, 19 Jul 2018 12:27:44 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:
> > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > b/drivers/staging/wilc1000/wilc_wlan.c index 85af365..8e71c28 100644
> > --- a/drivers/staging/wilc1000/wilc_wlan.c
> > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > @@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct
> > wilc *wilc, u32 int_status) if (wilc->rx_buffer)
> >  			buffer = &wilc->rx_buffer[offset];
> >  		else
> > -			goto _end_;
> > +			goto end;  
> 
> This isn't related to your patch but this goto doesn't appear to make
> any sort of sense.  I have no idea what was intended.
> 

Thanks for pointing it out. I will include these changes in separate
patchset.

Yes, the position of goto label can be moved just before
wilc_wlan_handle_rxq(wilc), as 'ret' will always be '0' when goto
statement is executed.

Actually earlier there were few more goto statement in this function
and single label 'end' was used to handle for different cases. But in
previous cleanup patches those cases were removed.
Now this function can be further refactor by either moving
goto label before wilc_wlan_handle_rxq(wilc) or avoid goto use by
adding the rx_buffer validation along with size check.

i.e 

end:
    wilc_wlan_handle_rxq(wilc)


OR

	if (size > 0 && wilc->rx_buffer) {

	....
	}
    	wilc_wlan_handle_rxq(wilc)

	

> >  
> >  		wilc->hif_func->hif_clear_int_ext(wilc,
> >  					      DATA_INT_CLR |
> > ENABLE_RX_VMM); ret = wilc->hif_func->hif_block_rx_ext(wilc, 0,
> > buffer, size); 
> > -_end_:
> > +end:
> >  		if (ret) {
> >  			offset += size;
> >  			wilc->rx_buffer_offset = offset;  
> 
> regards,
> dan carpenter
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-07-19 23:05     ` Ajay Singh
@ 2018-07-30  8:41       ` Dan Carpenter
  2018-07-30 10:10         ` Ajay Singh
  0 siblings, 1 reply; 32+ messages in thread
From: Dan Carpenter @ 2018-07-30  8:41 UTC (permalink / raw)
  To: Ajay Singh
  Cc: devel, venkateswara.kaja, gregkh, linux-wireless, ganesh.krishna,
	adham.abozaeid, aditya.shankar

On Fri, Jul 20, 2018 at 04:35:24AM +0530, Ajay Singh wrote:
> Hi Dan,
> 
> On Thu, 19 Jul 2018 12:27:44 +0300
> Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> > On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:
> > > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > > b/drivers/staging/wilc1000/wilc_wlan.c index 85af365..8e71c28 100644
> > > --- a/drivers/staging/wilc1000/wilc_wlan.c
> > > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > > @@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct
> > > wilc *wilc, u32 int_status) if (wilc->rx_buffer)
> > >  			buffer = &wilc->rx_buffer[offset];
> > >  		else
> > > -			goto _end_;
> > > +			goto end;  
> > 
> > This isn't related to your patch but this goto doesn't appear to make
> > any sort of sense.  I have no idea what was intended.
> > 
> 
> Thanks for pointing it out. I will include these changes in separate
> patchset.
> 
> Yes, the position of goto label can be moved just before
> wilc_wlan_handle_rxq(wilc), as 'ret' will always be '0' when goto
> statement is executed.
> 
> Actually earlier there were few more goto statement in this function
> and single label 'end' was used to handle for different cases. But in
> previous cleanup patches those cases were removed.
> Now this function can be further refactor by either moving
> goto label before wilc_wlan_handle_rxq(wilc) or avoid goto use by
> adding the rx_buffer validation along with size check.
> 
> i.e 
> 
> end:
>     wilc_wlan_handle_rxq(wilc)
> 
> 
> OR
> 
> 	if (size > 0 && wilc->rx_buffer) {
> 
> 	....
> 	}
>     	wilc_wlan_handle_rxq(wilc)
> 

Actually looking at it now, you could probably just remove the if
statement.  Hopefully wilc->rx_buffer is non-NULL at this point? Is
there really any need to call wilc_wlan_handle_rxq() when we haven't
called wilc_wlan_rxq_add()?

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-07-30  8:41       ` Dan Carpenter
@ 2018-07-30 10:10         ` Ajay Singh
  2018-07-30 11:32           ` Dan Carpenter
  0 siblings, 1 reply; 32+ messages in thread
From: Ajay Singh @ 2018-07-30 10:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, venkateswara.kaja, gregkh, linux-wireless, ganesh.krishna,
	adham.abozaeid, aditya.shankar

Hi Dan,

On Mon, 30 Jul 2018 11:41:13 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Fri, Jul 20, 2018 at 04:35:24AM +0530, Ajay Singh wrote:
> > Hi Dan,
> > 
> > On Thu, 19 Jul 2018 12:27:44 +0300
> > Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >   
> > > On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:  
> > > > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > > > b/drivers/staging/wilc1000/wilc_wlan.c index 85af365..8e71c28
> > > > 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c
> > > > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > > > @@ -850,13 +850,13 @@ static void
> > > > wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) if
> > > > (wilc->rx_buffer) buffer = &wilc->rx_buffer[offset];
> > > >  		else
> > > > -			goto _end_;
> > > > +			goto end;    
> > > 
> > > This isn't related to your patch but this goto doesn't appear to
> > > make any sort of sense.  I have no idea what was intended.
> > >   
> > 
> > Thanks for pointing it out. I will include these changes in separate
> > patchset.
> > 
> > Yes, the position of goto label can be moved just before
> > wilc_wlan_handle_rxq(wilc), as 'ret' will always be '0' when goto
> > statement is executed.
> > 
> > Actually earlier there were few more goto statement in this function
> > and single label 'end' was used to handle for different cases. But
> > in previous cleanup patches those cases were removed.
> > Now this function can be further refactor by either moving
> > goto label before wilc_wlan_handle_rxq(wilc) or avoid goto use by
> > adding the rx_buffer validation along with size check.
> > 
> > i.e 
> > 
> > end:
> >     wilc_wlan_handle_rxq(wilc)
> > 
> > 
> > OR
> > 
> > 	if (size > 0 && wilc->rx_buffer) {
> > 
> > 	....
> > 	}
> >     	wilc_wlan_handle_rxq(wilc)
> >   
> 
> Actually looking at it now, you could probably just remove the if
> statement.  Hopefully wilc->rx_buffer is non-NULL at this point? Is
> there really any need to call wilc_wlan_handle_rxq() when we haven't
> called wilc_wlan_rxq_add()?
> 

Yes, wilc->rx_buffer would be non NULL value as its only one time
allocated buffer. wilc_wlan_handle_rxq() was called without
wilc_wlan_rxq_add() just as a fail safe to ensure there are no pending
packets in the queue.

Regards,
Ajay

> regards,
> dan carpenter
> 
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-07-30 10:10         ` Ajay Singh
@ 2018-07-30 11:32           ` Dan Carpenter
  2018-08-01  5:16             ` Ajay Singh
  0 siblings, 1 reply; 32+ messages in thread
From: Dan Carpenter @ 2018-07-30 11:32 UTC (permalink / raw)
  To: Ajay Singh
  Cc: devel, venkateswara.kaja, gregkh, linux-wireless, ganesh.krishna,
	adham.abozaeid, aditya.shankar

On Mon, Jul 30, 2018 at 03:40:24PM +0530, Ajay Singh wrote:
> Hi Dan,
> 
> On Mon, 30 Jul 2018 11:41:13 +0300
> Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> > On Fri, Jul 20, 2018 at 04:35:24AM +0530, Ajay Singh wrote:
> > > Hi Dan,
> > > 
> > > On Thu, 19 Jul 2018 12:27:44 +0300
> > > Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > >   
> > > > On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:  
> > > > > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > > > > b/drivers/staging/wilc1000/wilc_wlan.c index 85af365..8e71c28
> > > > > 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c
> > > > > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > > > > @@ -850,13 +850,13 @@ static void
> > > > > wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) if
> > > > > (wilc->rx_buffer) buffer = &wilc->rx_buffer[offset];
> > > > >  		else
> > > > > -			goto _end_;
> > > > > +			goto end;    
> > > > 
> > > > This isn't related to your patch but this goto doesn't appear to
> > > > make any sort of sense.  I have no idea what was intended.
> > > >   
> > > 
> > > Thanks for pointing it out. I will include these changes in separate
> > > patchset.
> > > 
> > > Yes, the position of goto label can be moved just before
> > > wilc_wlan_handle_rxq(wilc), as 'ret' will always be '0' when goto
> > > statement is executed.
> > > 
> > > Actually earlier there were few more goto statement in this function
> > > and single label 'end' was used to handle for different cases. But
> > > in previous cleanup patches those cases were removed.
> > > Now this function can be further refactor by either moving
> > > goto label before wilc_wlan_handle_rxq(wilc) or avoid goto use by
> > > adding the rx_buffer validation along with size check.
> > > 
> > > i.e 
> > > 
> > > end:
> > >     wilc_wlan_handle_rxq(wilc)
> > > 
> > > 
> > > OR
> > > 
> > > 	if (size > 0 && wilc->rx_buffer) {
> > > 
> > > 	....
> > > 	}
> > >     	wilc_wlan_handle_rxq(wilc)
> > >   
> > 
> > Actually looking at it now, you could probably just remove the if
> > statement.  Hopefully wilc->rx_buffer is non-NULL at this point? Is
> > there really any need to call wilc_wlan_handle_rxq() when we haven't
> > called wilc_wlan_rxq_add()?
> > 
> 
> Yes, wilc->rx_buffer would be non NULL value as its only one time
> allocated buffer. wilc_wlan_handle_rxq() was called without
> wilc_wlan_rxq_add() just as a fail safe to ensure there are no pending
> packets in the queue.

The only thing is wilc->quit can be set.  Otherwise if ->rx_buffer is
NULL it would just result in a NULL dereference.  (We are deep into
hypotheticals here because we're discussing impossible code).

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-07-30 11:32           ` Dan Carpenter
@ 2018-08-01  5:16             ` Ajay Singh
  2018-08-01  8:11               ` Dan Carpenter
  0 siblings, 1 reply; 32+ messages in thread
From: Ajay Singh @ 2018-08-01  5:16 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, venkateswara.kaja, gregkh, linux-wireless, ganesh.krishna,
	adham.abozaeid, aditya.shankar

Hi Dan,

On Mon, 30 Jul 2018 14:32:31 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Mon, Jul 30, 2018 at 03:40:24PM +0530, Ajay Singh wrote:
> > Hi Dan,
> > 
> > On Mon, 30 Jul 2018 11:41:13 +0300
> > Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >   
> > > On Fri, Jul 20, 2018 at 04:35:24AM +0530, Ajay Singh wrote:  
> > > > Hi Dan,
> > > > 
> > > > On Thu, 19 Jul 2018 12:27:44 +0300
> > > > Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > > >     
> > > > > On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh
> > > > > wrote:    
> > > > > > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > > > > > b/drivers/staging/wilc1000/wilc_wlan.c index
> > > > > > 85af365..8e71c28 100644 ---
> > > > > > a/drivers/staging/wilc1000/wilc_wlan.c +++
> > > > > > b/drivers/staging/wilc1000/wilc_wlan.c @@ -850,13 +850,13
> > > > > > @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc,
> > > > > > u32 int_status) if (wilc->rx_buffer) buffer =
> > > > > > &wilc->rx_buffer[offset]; else
> > > > > > -			goto _end_;
> > > > > > +			goto end;      
> > > > > 
> > > > > This isn't related to your patch but this goto doesn't appear
> > > > > to make any sort of sense.  I have no idea what was intended.
> > > > >     
> > > > 
> > > > Thanks for pointing it out. I will include these changes in
> > > > separate patchset.
> > > > 
> > > > Yes, the position of goto label can be moved just before
> > > > wilc_wlan_handle_rxq(wilc), as 'ret' will always be '0' when
> > > > goto statement is executed.
> > > > 
> > > > Actually earlier there were few more goto statement in this
> > > > function and single label 'end' was used to handle for
> > > > different cases. But in previous cleanup patches those cases
> > > > were removed. Now this function can be further refactor by
> > > > either moving goto label before wilc_wlan_handle_rxq(wilc) or
> > > > avoid goto use by adding the rx_buffer validation along with
> > > > size check.
> > > > 
> > > > i.e 
> > > > 
> > > > end:
> > > >     wilc_wlan_handle_rxq(wilc)
> > > > 
> > > > 
> > > > OR
> > > > 
> > > > 	if (size > 0 && wilc->rx_buffer) {
> > > > 
> > > > 	....
> > > > 	}
> > > >     	wilc_wlan_handle_rxq(wilc)
> > > >     
> > > 
> > > Actually looking at it now, you could probably just remove the if
> > > statement.  Hopefully wilc->rx_buffer is non-NULL at this point?
> > > Is there really any need to call wilc_wlan_handle_rxq() when we
> > > haven't called wilc_wlan_rxq_add()?
> > >   
> > 
> > Yes, wilc->rx_buffer would be non NULL value as its only one time
> > allocated buffer. wilc_wlan_handle_rxq() was called without
> > wilc_wlan_rxq_add() just as a fail safe to ensure there are no
> > pending packets in the queue.  
> 
> The only thing is wilc->quit can be set.  Otherwise if ->rx_buffer is
> NULL it would just result in a NULL dereference.  (We are deep into
> hypotheticals here because we're discussing impossible code).
> 

I have prepared a patch based on the feedback. The patch is submitted
in https://patchwork.kernel.org/patch/10551703/.

Regards,
Ajay

> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name
  2018-08-01  5:16             ` Ajay Singh
@ 2018-08-01  8:11               ` Dan Carpenter
  0 siblings, 0 replies; 32+ messages in thread
From: Dan Carpenter @ 2018-08-01  8:11 UTC (permalink / raw)
  To: Ajay Singh
  Cc: devel, venkateswara.kaja, gregkh, linux-wireless, ganesh.krishna,
	adham.abozaeid, aditya.shankar

Fantastic.  Thanks!

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2018-08-01  9:55 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18 22:44 [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Ajay Singh
2018-07-18 22:44 ` [PATCH 01/23] staging: wilc1000: remove unused enum declaration Ajay Singh
2018-07-18 22:44 ` [PATCH 02/23] staging: wilc1000: remove enum connect_status instead use ieee80211_statuscode Ajay Singh
2018-07-18 22:44 ` [PATCH 03/23] staging: wilc1000: remove extra enum defined for data rates Ajay Singh
2018-07-18 22:45 ` [PATCH 04/23] staging: wilc1000: remove extra enums defined for ieee80211_eid Ajay Singh
2018-07-18 22:45 ` [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name Ajay Singh
2018-07-19  9:27   ` Dan Carpenter
2018-07-19 23:05     ` Ajay Singh
2018-07-30  8:41       ` Dan Carpenter
2018-07-30 10:10         ` Ajay Singh
2018-07-30 11:32           ` Dan Carpenter
2018-08-01  5:16             ` Ajay Singh
2018-08-01  8:11               ` Dan Carpenter
2018-07-18 22:45 ` [PATCH 06/23] staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase Ajay Singh
2018-07-18 22:45 ` [PATCH 07/23] staging: wilc1000: rename enum SITESURVEY " Ajay Singh
2018-07-18 22:45 ` [PATCH 08/23] staging: wilc1000: rename enum AUTHTYPE " Ajay Singh
2018-07-18 22:45 ` [PATCH 09/23] staging: wilc1000: remove unused elements in 'wilc' struct Ajay Singh
2018-07-18 22:45 ` [PATCH 10/23] staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct Ajay Singh
2018-07-18 22:45 ` [PATCH 11/23] staging: wilc1000: removed unused element from wilc_cfg_frame struct Ajay Singh
2018-07-18 22:45 ` [PATCH 12/23] staging: wilc1000: remove the mutliple #define used for same macro Ajay Singh
2018-07-18 22:45 ` [PATCH 13/23] staging: wilc1000: use lowercase for 'IFC_UP' struct element name Ajay Singh
2018-07-18 22:45 ` [PATCH 14/23] staging: wilc1000: remove unnecessary blank line between variable declaration Ajay Singh
2018-07-18 22:45 ` [PATCH 15/23] staging: wilc1000: use single space before opening brances '{' Ajay Singh
2018-07-18 22:45 ` [PATCH 16/23] staging: wilc1000: remove unnecessary type used for wid id Ajay Singh
2018-07-18 22:45 ` [PATCH 17/23] staging: wilc1000: avoid forward declaration for handle_scan_done() Ajay Singh
2018-07-18 22:45 ` [PATCH 18/23] staging: wilc1000: avoid host_int_get_assoc_res_info() forward declaration Ajay Singh
2018-07-18 22:45 ` [PATCH 19/23] staging: wilc1000: avoid forward declaration of host_int_parse_join_bss_param() Ajay Singh
2018-07-18 22:45 ` [PATCH 20/23] staging: wilc1000: avoid setting default value for variable at declaration Ajay Singh
2018-07-18 22:45 ` [PATCH 21/23] staging: wilc1000: use 'int' inplace of 's32' date type Ajay Singh
2018-07-18 22:45 ` [PATCH 22/23] staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops callbacks Ajay Singh
2018-07-18 22:45 ` [PATCH 23/23] staging: wilc1000: move variable assignment along with its declaration Ajay Singh
2018-07-19  8:36 ` [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style Claudiu Beznea

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.