Skip to contentSkip to conversation

staging: wilc1000: remove CoreConfiguratorDeInit

PATCH New Chaehyun Lim 1 participant 9 messages Sep 22, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 staging: wilc1000: remove CoreConfiguratorDeInit

This patch removes CoreConfiguratorDeInit function, which is not doing anything else except printing a PRINT_D message and returning a s32Error. It is also removed the codes that is calling this function.

---
 drivers/staging/wilc1000/coreconfigurator.c | 20 --------------------
 drivers/staging/wilc1000/coreconfigurator.h |  2 --
 drivers/staging/wilc1000/host_interface.c   |  2 --
 3 files changed, 24 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -20
index e563c9b..9676044 100644
@@ -700,26 +700,6 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 }
 #endif
 
-/**
- *  @brief              Deinitializes the Core Configurator
- *  @details
- *  @return     Error code indicating success/failure
- *  @note
- *  @author	mabubakr
- *  @date		1 Mar 2012
- *  @version	1.0
- */
-
-s32 CoreConfiguratorDeInit(void)
-{
-	s32 s32Error = 0;
-
-	PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
-
-
-	return s32Error;
-}
-
 /*Using the global handle of the driver*/
 extern wilc_wlan_oup_t *gpstrWlanOps;
 /**
drivers/staging/wilc1000/coreconfigurator.h +0 -2
index 88a697b..a255e45 100644
@@ -156,8 +156,6 @@ typedef struct wid_site_survey_reslts {
 } wid_site_survey_reslts_s;
 #endif
 
-s32 CoreConfiguratorDeInit(void);
-
 s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
 		  u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
drivers/staging/wilc1000/host_interface.c +0 -2
index db93940..86dbe46 100644
@@ -6525,8 +6525,6 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv)
 
 		pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL;
 	}
-	/*deinit configurator and simulator*/
-	CoreConfiguratorDeInit();
 
 	pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
 
Signature · 1 line
2.5.1
#1 lore raw

PATCH 2/9 staging: wilc1000: rename SendConfigPkt

This patch replaces SendConfigPkt with send_config_pkt to aovid camelcase.

---
 drivers/staging/wilc1000/coreconfigurator.c |   4 +-
 drivers/staging/wilc1000/coreconfigurator.h |   4 +-
 drivers/staging/wilc1000/host_interface.c   | 204 ++++++++++++++--------------
 3 files changed, 106 insertions(+), 106 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +2 -2
index 9676044..3813767 100644
@@ -717,8 +717,8 @@ extern wilc_wlan_oup_t *gpstrWlanOps;
  *  @date		1 Mar 2012
  *  @version	1.0
  */
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
-			  u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
+s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
+		    u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
 {
 	s32 counter = 0, ret = 0;
 
drivers/staging/wilc1000/coreconfigurator.h +2 -2
index a255e45..7227c0f 100644
@@ -156,8 +156,8 @@ typedef struct wid_site_survey_reslts {
 } wid_site_survey_reslts_s;
 #endif
 
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
-		  u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
+s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
+		    u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
 
drivers/staging/wilc1000/host_interface.c +102 -102

510 lines not on this page · raw message

Signature · 1 line
2.5.1
#2 lore raw

PATCH 3/9 staging: wilc1000: replace kmalloc with kzalloc

In reply to Chaehyun Lim

This patch replaces kmalloc with kzalloc because it is initialized by 0 immediately after allcating memory.

---
 drivers/staging/wilc1000/coreconfigurator.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +2 -6
index 3813767..d8b8c3d 100644
@@ -439,12 +439,10 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 		u32 u32Tsf_Lo;
 		u32 u32Tsf_Hi;
 
-		pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+		pstrNetworkInfo = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
 		if (!pstrNetworkInfo)
 			return -ENOMEM;
 
-		memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo));
-
 		pstrNetworkInfo->s8rssi = pu8WidVal[0];
 
 		/* Assign a pointer to msa "Mac Header Start Address" */
@@ -559,12 +557,10 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
 	u8 *pu8IEs = NULL;
 	u16 u16IEsLen = 0;
 
-	pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+	pstrConnectRespInfo = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
 	if (!pstrConnectRespInfo)
 		return -ENOMEM;
 
-	memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo));
-
 	/* u16AssocRespLen = pu8Buffer[0]; */
 	u16AssocRespLen = (u16)u32BufferLen;
 
Signature · 1 line
2.5.1
#3 lore raw

PATCH 4/9 staging: wilc1000: replace kmalloc/memcpy with kmemdup

In reply to Chaehyun Lim

This patch replaces kmalloc followed by memset and memcpy with kmemdup.

---
 drivers/staging/wilc1000/coreconfigurator.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +3 -9
index d8b8c3d..875b769 100644
@@ -488,13 +488,10 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 		u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
 		if (u16IEsLen > 0) {
-			pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, GFP_KERNEL);
+			pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
+							  GFP_KERNEL);
 			if (!pstrNetworkInfo->pu8IEs)
 				return -ENOMEM;
-
-			memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen);
-
-			memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
 		}
 		pstrNetworkInfo->u16IEsLen = u16IEsLen;
 
@@ -578,13 +575,10 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
 		pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
 		u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN);
 
-		pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, GFP_KERNEL);
+		pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, GFP_KERNEL);
 		if (!pstrConnectRespInfo->pu8RespIEs)
 			return -ENOMEM;
 
-		memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen);
-
-		memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
 		pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
 	}
 
Signature · 1 line
2.5.1
#4 lore raw

PATCH 5/9 staging: wilc1000: replace kmalloc_array/memset with kcalloc

In reply to Chaehyun Lim

This patch replaces kmalloc_array followed by memset with kcalloc.

---
 drivers/staging/wilc1000/coreconfigurator.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +2 -4
index 875b769..8b56b92 100644
@@ -644,13 +644,11 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
 		}
 	}
 
-	pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
-				sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
+	pstrSurveyResults = kcalloc(u32SurveyResultsCount,
+				    sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
 	if (!pstrSurveyResults)
 		return -ENOMEM;
 
-	memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s));
-
 	u32SurveyResultsCount = 0;
 
 	for (i = 0; i < u32RcvdSurveyResultsNum; i++) {
Signature · 1 line
2.5.1
#5 lore raw

PATCH 6/9 staging: wilc1000: remove useless comment

In reply to Chaehyun Lim

This patch removes useless comment in coreconfigurator.c

---
 drivers/staging/wilc1000/coreconfigurator.c | 38 -----------------------------
 drivers/staging/wilc1000/coreconfigurator.h | 29 ++++++----------------
 2 files changed, 8 insertions(+), 59 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -38
index 8b56b92..47a37fa 100644
@@ -9,26 +9,11 @@
  */
 
 
-/*****************************************************************************/
-/* File Includes                                                             */
-/*****************************************************************************/
 #include "coreconfigurator.h"
 #include <linux/errno.h>
-/*****************************************************************************/
-/* Constants                                                                 */
-/*****************************************************************************/
 #define TAG_PARAM_OFFSET	(MAC_HDR_LEN + TIME_STAMP_LEN + \
 							BEACON_INTERVAL_LEN + CAP_INFO_LEN)
 
-/*****************************************************************************/
-/* Function Macros                                                           */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Type Definitions                                                          */
-/*****************************************************************************/
-
 /* Basic Frame Type Codes (2-bit) */
 typedef enum {
 	FRAME_TYPE_CONTROL     = 0x04,
@@ -130,25 +115,6 @@ typedef struct {
 	bool bRespRequired;
 } tstrConfigPktInfo;
 
-
-
-/*****************************************************************************/
-/* Extern Variable Declarations                                              */
-/*****************************************************************************/
-
-/*****************************************************************************/
-/* Global Variables                                                          */
-/*****************************************************************************/
-/*****************************************************************************/
-/* Static Function Declarations                                              */
-/*****************************************************************************/
-
-
-
-/*****************************************************************************/
-/* Functions                                                                 */
-/*****************************************************************************/
-
 /* This function extracts the beacon period field from the beacon or probe   */
 /* response frame.                                                           */
 static inline u16 get_beacon_period(u8 *data)
@@ -688,7 +654,6 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 }
 #endif
 
-/*Using the global handle of the driver*/
 extern wilc_wlan_oup_t *gpstrWlanOps;
 /**
  *  @brief              sends certain Configuration Packet based on the input WIDs pstrWIDs
@@ -735,9 +700,6 @@ s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
 				break;
 			}
 		}
-		/**
-		 *      get the value
-		 **/
 		counter = 0;
 		for (counter = 0; counter < u32WIDsCount; counter++) {
 			pstrWIDs[counter].s32ValueSize = gpstrWlanOps->wlan_cfg_get_value(
drivers/staging/wilc1000/coreconfigurator.h +8 -21
index 7227c0f..e2b7b09 100644
@@ -12,10 +12,7 @@
 #define CORECONFIGURATOR_H
 
 #include "wilc_wlan_if.h"
-/*****************************************************************************/
-/* Constants                                                                 */
-/*****************************************************************************/
-/* Number of WID Options Supported */
+
 #define NUM_BASIC_SWITCHES      45
 #define NUM_FHSS_SWITCHES       0
 
@@ -24,12 +21,12 @@
 #ifdef MAC_802_11N
 #define NUM_11N_BASIC_SWITCHES  25
 #define NUM_11N_HUT_SWITCHES    47
-#else /* MAC_802_11N */
+#else
 #define NUM_11N_BASIC_SWITCHES  0
 #define NUM_11N_HUT_SWITCHES    0
-#endif /* MAC_802_11N */
+#endif
 
-#define MAC_HDR_LEN             24          /* No Address4 - non-ESS         */
+#define MAC_HDR_LEN             24
 #define MAX_SSID_LEN            33
 #define FCS_LEN                 4
 #define TIME_STAMP_LEN          8
@@ -39,9 +36,7 @@
 #define AID_LEN                 2
 #define IE_HDR_LEN              2
 
-/* Operating Mode: SET */
 #define SET_CFG              0
-/* Operating Mode: GET */
 #define GET_CFG              1
 
 #define MAX_STRING_LEN               256
@@ -52,16 +47,9 @@
 #define MAC_CONNECTED                1
 #define MAC_DISCONNECTED             0
 
-/*****************************************************************************/
-/* Function Macros                                                           */
-/*****************************************************************************/
 #define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
 #define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))
 
-/*****************************************************************************/
-/* Type Definitions                                                                                                                       */
-/*****************************************************************************/
-/* Status Codes for Authentication and Association Frames */
 typedef enum {
 	SUCCESSFUL_STATUSCODE    = 0,
 	UNSPEC_FAIL              = 1,
@@ -95,7 +83,7 @@ typedef struct {
 	u8 u8Index;
 	s8 as8RSSI[NUM_RSSI];
 } tstrRSSI;
-/* This structure is used to support parsing of the received 'N' message */
+
 typedef struct {
 	s8 s8rssi;
 	u16 u16CapInfo;
@@ -105,21 +93,20 @@ typedef struct {
 	u16 u16BeaconPeriod;
 	u8 u8DtimPeriod;
 	u8 u8channel;
-	unsigned long u32TimeRcvdInScanCached; /* of type unsigned long to be accepted by the linux kernel macro time_after() */
+	unsigned long u32TimeRcvdInScanCached;
 	unsigned long u32TimeRcvdInScan;
 	bool bNewNetwork;
 #ifdef AGING_ALG
 	u8 u8Found;
 #endif
-	u32 u32Tsf; /* time-stamp [Low only 32 bit] */
+	u32 u32Tsf;
 	u8 *pu8IEs;
 	u16 u16IEsLen;
 	void *pJoinParams;
 	tstrRSSI strRssi;
-	u64 u64Tsf; /* time-stamp [Low and High 64 bit] */
+	u64 u64Tsf;
 } tstrNetworkInfo;
 
-/* This structure is used to support parsing of the received Association Response frame */
 typedef struct {
 	u16 u16capability;
 	u16 u16ConnectStatus;
Signature · 1 line
2.5.1
#6 lore raw

PATCH 7/9 staging: wilc1000: remove extern declaration

In reply to Chaehyun Lim

This patch removes extern declaration of *gpstrWlanOps in coreconfigurator.c file. It is defined extern declaration in wilc_wlan_if.h file and then is included in coreconfigurator.c file.

---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/staging/wilc1000/coreconfigurator.c +1 -1
index 47a37fa..bdf775a 100644
@@ -10,6 +10,7 @@
 
 
 #include "coreconfigurator.h"
+#include "wilc_wlan_if.h"
 #include <linux/errno.h>
 #define TAG_PARAM_OFFSET	(MAC_HDR_LEN + TIME_STAMP_LEN + \
 							BEACON_INTERVAL_LEN + CAP_INFO_LEN)
@@ -654,7 +655,6 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 }
 #endif
 
-extern wilc_wlan_oup_t *gpstrWlanOps;
 /**
  *  @brief              sends certain Configuration Packet based on the input WIDs pstrWIDs
  *  using driver config layer
drivers/staging/wilc1000/wilc_wlan_if.h +1 -0
index 5f68b6a..668f1b8 100644
@@ -912,6 +912,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup);
 void wilc_bus_set_max_speed(void);
 void wilc_bus_set_default_speed(void);
 u32 wilc_get_chipid(u8 update);
+extern wilc_wlan_oup_t *gpstrWlanOps;
 
 
 #endif
Signature · 1 line
2.5.1
#7 lore raw

PATCH 8/9 staging: wilc1000: rename ParseNetworkInfo

In reply to Chaehyun Lim

This patch replaces ParseNetworkInfo with parse_network_info to avoid camelcase.

---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 drivers/staging/wilc1000/coreconfigurator.h | 2 +-
 drivers/staging/wilc1000/host_interface.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +1 -1
index bdf775a..3c71b9f 100644
@@ -360,7 +360,7 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  *  @date			1 Mar 2012
  *  @version		1.0
  */
-s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
+s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
 	s32 s32Error = 0;
 	tstrNetworkInfo *pstrNetworkInfo = NULL;
drivers/staging/wilc1000/coreconfigurator.h +1 -1
index e2b7b09..c2bd6fc 100644
@@ -145,7 +145,7 @@ typedef struct wid_site_survey_reslts {
 
 s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
 		    u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
-s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
+s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
 
 s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
drivers/staging/wilc1000/host_interface.c +1 -1
index c4ef274..e7fc648 100644
@@ -2269,7 +2269,7 @@ static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler,
 	/*if there is a an ongoing scan request*/
 	if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
 		PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n");
-		ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo);
+		parse_network_info(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo);
 		if ((pstrNetworkInfo == NULL)
 		    || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) {
 			PRINT_ER("driver is null\n");
Signature · 1 line
2.5.1
#8 lore raw

PATCH 9/9 staging: wilc1000: parse_network_info: remove s32Error

In reply to Chaehyun Lim

s32Error is defined, but not used anywhere in this function. Then just delete it and return 0 at the end of this function.

---
 drivers/staging/wilc1000/coreconfigurator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +1 -2
index 3c71b9f..68e3c7f 100644
@@ -362,7 +362,6 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  */
 s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
-	s32 s32Error = 0;
 	tstrNetworkInfo *pstrNetworkInfo = NULL;
 	u8 u8MsgType = 0;
 	u8 u8MsgID = 0;
@@ -466,7 +465,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 	*ppstrNetworkInfo = pstrNetworkInfo;
 
-	return s32Error;
+	return 0;
 }
 
 /**
Signature · 1 line
2.5.1