All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions
@ 2018-04-25 17:18 Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE Ajay Singh
                   ` (21 more replies)
  0 siblings, 22 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 fixes to remove the unused code. It also has patches
to reorganize the function and simplify the function logic.

Ajay Singh (21):
  staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE
  staging: wilc1000: align the #define in wilc_spi file
  staging: wilc1000: remove unnecessary assingment from 'if' conditions
  staging: wilc1000: remove 'cmd' variable in wilc_spi functions
  staging: wicl1000: removed the unsed variables in
    wilc_parse_network_info()
  staging: wilc1000: remove inner {} in wilc_parse_network_info()
  staging: wilc1000: simplified if conditions in spi_data_write()
  staging: wilc1000: remove unused variable scan_while_connected
  staging: wilc1000: remove unsed typedef wilc_debug_func
  staging: wilc1000: remove used #define HIF_SDIO_GPIO_IRQ
  staging: wilc1000: remove unused #define related to MAC status
  staging: wilc1000: rename mac status macros and moved related #define
    together
  staging: wilc1000: rename WILC_WFI_stats to avoid uppercase
  staging: wilc1000: rename num_reg_frame macro to have uppercase in
    macro name
  staging: wilc1000: rename wlan init and deinit function prefixed with
    wil1000
  staging: wilc1000: remove unused elements in 'wilc_priv' struct
  staging: wilc1000: remove unused enum 'stats_flags'
  staging: wilc1000: rename P2P_LISTEN_STATE variable to use lowercase
  staging: wilc1000: remove inner block '{}' in handle_remain_on_chan()
  staging: wilc1000: change function to static in linux_wlan
  staging: wilc1000: reorder functions to avoid forward declaration in
    linux_wlan

 drivers/staging/wilc1000/coreconfigurator.c       |  84 +++++++--------
 drivers/staging/wilc1000/host_interface.c         |  64 ++++--------
 drivers/staging/wilc1000/linux_wlan.c             | 122 ++++++++++------------
 drivers/staging/wilc1000/wilc_sdio.c              |  12 +--
 drivers/staging/wilc1000/wilc_spi.c               |  70 ++++++-------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |   2 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  23 +---
 drivers/staging/wilc1000/wilc_wlan.h              |   7 --
 drivers/staging/wilc1000/wilc_wlan_if.h           |  11 +-
 9 files changed, 158 insertions(+), 237 deletions(-)

-- 
2.7.4

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

* [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-26  7:40   ` Greg KH
  2018-04-25 17:18 ` [PATCH v2 02/21] staging: wilc1000: align the #define in wilc_spi file Ajay Singh
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Replace the function call for crc7_byte() with macro CRC7_BYTE.
crc7_byte() was called in close while(), so replaced it with macro to
avoid extra functional call depth.

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

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 2cb9f4e..3bb8fec 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -75,15 +75,12 @@ static const u8 crc7_syndrome_table[256] = {
 	0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79
 };
 
-static u8 crc7_byte(u8 crc, u8 data)
-{
-	return crc7_syndrome_table[(crc << 1) ^ data];
-}
+#define CRC7_BYTE(crc, data) crc7_syndrome_table[(crc << 1) ^ data]
 
 static u8 crc7(u8 crc, const u8 *buffer, u32 len)
 {
 	while (len--)
-		crc = crc7_byte(crc, *buffer++);
+		crc = CRC7_BYTE(crc, *buffer++);
 	return crc;
 }
 
-- 
2.7.4

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

* [PATCH v2 02/21] staging: wilc1000: align the #define in wilc_spi file
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 03/21] staging: wilc1000: remove unnecessary assingment from 'if' conditions Ajay Singh
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to align the #define used in wilc_spi.c file by adding the
tabs.

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

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 3bb8fec..600005c 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -92,29 +92,29 @@ static u8 crc7(u8 crc, const u8 *buffer, u32 len)
 
 #define CMD_DMA_WRITE				0xc1
 #define CMD_DMA_READ				0xc2
-#define CMD_INTERNAL_WRITE		0xc3
-#define CMD_INTERNAL_READ		0xc4
+#define CMD_INTERNAL_WRITE			0xc3
+#define CMD_INTERNAL_READ			0xc4
 #define CMD_TERMINATE				0xc5
-#define CMD_REPEAT					0xc6
-#define CMD_DMA_EXT_WRITE		0xc7
-#define CMD_DMA_EXT_READ		0xc8
+#define CMD_REPEAT				0xc6
+#define CMD_DMA_EXT_WRITE			0xc7
+#define CMD_DMA_EXT_READ			0xc8
 #define CMD_SINGLE_WRITE			0xc9
-#define CMD_SINGLE_READ			0xca
-#define CMD_RESET						0xcf
+#define CMD_SINGLE_READ				0xca
+#define CMD_RESET				0xcf
 
-#define N_OK								1
-#define N_FAIL								0
-#define N_RESET							-1
-#define N_RETRY							-2
+#define N_OK					1
+#define N_FAIL					0
+#define N_RESET					-1
+#define N_RETRY					-2
 
 #define DATA_PKT_SZ_256				256
-#define DATA_PKT_SZ_512			512
+#define DATA_PKT_SZ_512				512
 #define DATA_PKT_SZ_1K				1024
 #define DATA_PKT_SZ_4K				(4 * 1024)
 #define DATA_PKT_SZ_8K				(8 * 1024)
-#define DATA_PKT_SZ					DATA_PKT_SZ_8K
+#define DATA_PKT_SZ				DATA_PKT_SZ_8K
 
-#define USE_SPI_DMA     0
+#define USE_SPI_DMA				0
 
 static int wilc_bus_probe(struct spi_device *spi)
 {
-- 
2.7.4

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

* [PATCH v2 03/21] staging: wilc1000: remove unnecessary assingment from 'if' conditions
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 02/21] staging: wilc1000: align the #define in wilc_spi file Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 04/21] staging: wilc1000: remove 'cmd' variable in wilc_spi functions Ajay Singh
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 use of '==' check used in if
conditions.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_sdio.c | 12 ++++++------
 drivers/staging/wilc1000/wilc_spi.c  |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 087ad42..54121c3 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -885,13 +885,13 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val)
 			reg = 0;
 		}
 		/* select VMM table 0 */
-		if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
+		if (val & SEL_VMM_TBL0)
 			reg |= BIT(5);
 		/* select VMM table 1 */
-		if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1)
+		if (val & SEL_VMM_TBL1)
 			reg |= BIT(6);
 		/* enable VMM */
-		if ((val & EN_VMM) == EN_VMM)
+		if (val & EN_VMM)
 			reg |= BIT(7);
 		if (reg) {
 			struct sdio_cmd52 cmd;
@@ -961,13 +961,13 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val)
 
 	vmm_ctl = 0;
 	/* select VMM table 0 */
-	if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
+	if (val & SEL_VMM_TBL0)
 		vmm_ctl |= BIT(0);
 	/* select VMM table 1 */
-	if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1)
+	if (val & SEL_VMM_TBL1)
 		vmm_ctl |= BIT(1);
 	/* enable VMM */
-	if ((val & EN_VMM) == EN_VMM)
+	if (val & EN_VMM)
 		vmm_ctl |= BIT(2);
 
 	if (vmm_ctl) {
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 600005c..c980d3b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1023,10 +1023,10 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
 
 	tbl_ctl = 0;
 	/* select VMM table 0 */
-	if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
+	if (val & SEL_VMM_TBL0)
 		tbl_ctl |= BIT(0);
 	/* select VMM table 1 */
-	if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1)
+	if (val & SEL_VMM_TBL1)
 		tbl_ctl |= BIT(1);
 
 	ret = wilc_spi_write_reg(wilc, WILC_VMM_TBL_CTL, tbl_ctl);
@@ -1035,7 +1035,7 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
 		return ret;
 	}
 
-	if ((val & EN_VMM) == EN_VMM) {
+	if (val & EN_VMM) {
 		/*
 		 * enable vmm transfer.
 		 */
-- 
2.7.4

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

* [PATCH v2 04/21] staging: wilc1000: remove 'cmd' variable in wilc_spi functions
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (2 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 03/21] staging: wilc1000: remove unnecessary assingment from 'if' conditions Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 05/21] staging: wicl1000: removed the unsed variables in wilc_parse_network_info() Ajay Singh
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 'cmd' variable in wilc_spi.c. Instead of
using cmd now passing the command directly.

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

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index c980d3b..ac8df38b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -742,7 +742,6 @@ static int wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
 	struct spi_device *spi = to_spi_device(wilc->dev);
 	int result;
-	u8 cmd = CMD_DMA_EXT_WRITE;
 
 	/*
 	 * has to be greated than 4
@@ -750,7 +749,7 @@ static int wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 	if (size <= 4)
 		return 0;
 
-	result = spi_cmd_complete(wilc, cmd, addr, NULL, size, 0);
+	result = spi_cmd_complete(wilc, CMD_DMA_EXT_WRITE, addr, NULL, size, 0);
 	if (result != N_OK) {
 		dev_err(&spi->dev,
 			"Failed cmd, write block (%08x)...\n", addr);
@@ -795,13 +794,12 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data)
 static int wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
 	struct spi_device *spi = to_spi_device(wilc->dev);
-	u8 cmd = CMD_DMA_EXT_READ;
 	int result;
 
 	if (size <= 4)
 		return 0;
 
-	result = spi_cmd_complete(wilc, cmd, addr, buf, size, 0);
+	result = spi_cmd_complete(wilc, CMD_DMA_EXT_READ, addr, buf, size, 0);
 	if (result != N_OK) {
 		dev_err(&spi->dev, "Failed cmd, read block (%08x)...\n", addr);
 		return 0;
-- 
2.7.4

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

* [PATCH v2 05/21] staging: wicl1000: removed the unsed variables in wilc_parse_network_info()
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (3 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 04/21] staging: wilc1000: remove 'cmd' variable in wilc_spi functions Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 06/21] staging: wilc1000: remove inner {} " Ajay Singh
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 unused variables in
wilc_parse_network_info(). The value is assinged to these local
variables but assinged value is not used in that function.

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

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index db66b1c..5bc9d78 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -272,10 +272,6 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
 {
 	struct network_info *network_info = NULL;
 	u8 msg_type = 0;
-	u8 msg_id = 0;
-	u16 msg_len = 0;
-
-	u16 wid_id = (u16)WID_NIL;
 	u16 wid_len  = 0;
 	u8 *wid_val = NULL;
 
@@ -284,9 +280,6 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
 	if ('N' != msg_type)
 		return -EFAULT;
 
-	msg_id = msg_buffer[1];
-	msg_len = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
-	wid_id = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
 	wid_len = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
 	wid_val = &msg_buffer[8];
 
-- 
2.7.4

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

* [PATCH v2 06/21] staging: wilc1000: remove inner {} in wilc_parse_network_info()
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (4 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 05/21] staging: wicl1000: removed the unsed variables in wilc_parse_network_info() Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 07/21] staging: wilc1000: simplified if conditions in spi_data_write() Ajay Singh
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 {/**/} block in
wilc_parse_network_info().

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

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 5bc9d78..43b0b21 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -274,6 +274,14 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
 	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;
 
 	msg_type = msg_buffer[0];
 
@@ -283,60 +291,49 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
 	wid_len = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
 	wid_val = &msg_buffer[8];
 
-	{
-		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;
-
-		network_info = kzalloc(sizeof(*network_info), GFP_KERNEL);
-		if (!network_info)
-			return -ENOMEM;
+	network_info = kzalloc(sizeof(*network_info), GFP_KERNEL);
+	if (!network_info)
+		return -ENOMEM;
 
-		network_info->rssi = wid_val[0];
+	network_info->rssi = wid_val[0];
 
-		msa = &wid_val[1];
+	msa = &wid_val[1];
 
-		rx_len = wid_len - 1;
-		network_info->cap_info = get_cap_info(msa);
-		network_info->tsf_lo = get_beacon_timestamp_lo(msa);
+	rx_len = wid_len - 1;
+	network_info->cap_info = get_cap_info(msa);
+	network_info->tsf_lo = get_beacon_timestamp_lo(msa);
 
-		tsf_lo = get_beacon_timestamp_lo(msa);
-		tsf_hi = get_beacon_timestamp_hi(msa);
+	tsf_lo = get_beacon_timestamp_lo(msa);
+	tsf_hi = get_beacon_timestamp_hi(msa);
 
-		network_info->tsf_hi = tsf_lo | ((u64)tsf_hi << 32);
+	network_info->tsf_hi = tsf_lo | ((u64)tsf_hi << 32);
 
-		get_ssid(msa, network_info->ssid, &network_info->ssid_len);
-		get_BSSID(msa, network_info->bssid);
+	get_ssid(msa, network_info->ssid, &network_info->ssid_len);
+	get_BSSID(msa, network_info->bssid);
 
-		network_info->ch = get_current_channel_802_11n(msa, rx_len
-							       + FCS_LEN);
+	network_info->ch = get_current_channel_802_11n(msa, rx_len
+						       + FCS_LEN);
 
-		index = MAC_HDR_LEN + TIME_STAMP_LEN;
+	index = MAC_HDR_LEN + TIME_STAMP_LEN;
 
-		network_info->beacon_period = get_beacon_period(msa + index);
+	network_info->beacon_period = get_beacon_period(msa + index);
 
-		index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
+	index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
 
-		tim_elm = get_tim_elm(msa, rx_len + FCS_LEN, index);
-		if (tim_elm)
-			network_info->dtim_period = tim_elm[3];
-		ies = &msa[TAG_PARAM_OFFSET];
-		ies_len = rx_len - TAG_PARAM_OFFSET;
+	tim_elm = get_tim_elm(msa, rx_len + FCS_LEN, index);
+	if (tim_elm)
+		network_info->dtim_period = tim_elm[3];
+	ies = &msa[TAG_PARAM_OFFSET];
+	ies_len = rx_len - TAG_PARAM_OFFSET;
 
-		if (ies_len > 0) {
-			network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
-			if (!network_info->ies) {
-				kfree(network_info);
-				return -ENOMEM;
-			}
+	if (ies_len > 0) {
+		network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
+		if (!network_info->ies) {
+			kfree(network_info);
+			return -ENOMEM;
 		}
-		network_info->ies_len = ies_len;
 	}
+	network_info->ies_len = ies_len;
 
 	*ret_network_info = network_info;
 
-- 
2.7.4

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

* [PATCH v2 07/21] staging: wilc1000: simplified if conditions in spi_data_write()
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (5 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 06/21] staging: wilc1000: remove inner {} " Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 08/21] staging: wilc1000: remove unused variable scan_while_connected Ajay Singh
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to simplify the if conditions logic in spi_data_write().

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

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index ac8df38b..2aaa5fd 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -614,28 +614,23 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
 	 */
 	ix = 0;
 	do {
-		if (sz <= DATA_PKT_SZ)
+		if (sz <= DATA_PKT_SZ) {
 			nbytes = sz;
-		else
+			order = 0x3;
+		} else {
 			nbytes = DATA_PKT_SZ;
+			if (ix == 0)
+				order = 0x1;
+			else
+				order = 0x02;
+		}
 
 		/*
 		 * Write command
 		 */
 		cmd = 0xf0;
-		if (ix == 0) {
-			if (sz <= DATA_PKT_SZ)
-
-				order = 0x3;
-			else
-				order = 0x1;
-		} else {
-			if (sz <= DATA_PKT_SZ)
-				order = 0x3;
-			else
-				order = 0x2;
-		}
 		cmd |= order;
+
 		if (wilc_spi_tx(wilc, &cmd, 1)) {
 			dev_err(&spi->dev,
 				"Failed data block cmd write, bus error...\n");
-- 
2.7.4

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

* [PATCH v2 08/21] staging: wilc1000: remove unused variable scan_while_connected
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (6 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 07/21] staging: wilc1000: simplified if conditions in spi_data_write() Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 09/21] staging: wilc1000: remove unsed typedef wilc_debug_func Ajay Singh
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 unused variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 12414f4..1b282b0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -242,8 +242,6 @@ u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 
 static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
 
-static bool scan_while_connected;
-
 static s8 rssi;
 static u8 set_ip[2][4];
 static u8 get_ip[2][4];
@@ -839,11 +837,6 @@ static s32 handle_scan(struct wilc_vif *vif, struct scan_attr *scan_info)
 	wid_list[index].val = (s8 *)&scan_info->src;
 	index++;
 
-	if (hif_drv->hif_state == HOST_IF_CONNECTED)
-		scan_while_connected = true;
-	else if (hif_drv->hif_state == HOST_IF_IDLE)
-		scan_while_connected = false;
-
 	result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
 				      index,
 				      wilc_get_vif_idx(vif));
@@ -1182,8 +1175,6 @@ static s32 handle_connect_timeout(struct wilc_vif *vif)
 
 	hif_drv->hif_state = HOST_IF_IDLE;
 
-	scan_while_connected = false;
-
 	memset(&info, 0, sizeof(struct connect_info));
 
 	if (hif_drv->usr_conn_req.conn_result) {
@@ -1410,7 +1401,6 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 			  jiffies + msecs_to_jiffies(10000));
 	} else {
 		hif_drv->hif_state = HOST_IF_IDLE;
-		scan_while_connected = false;
 	}
 
 	kfree(conn_info.resp_ies);
@@ -1452,7 +1442,6 @@ static inline void host_int_handle_disconnect(struct wilc_vif *vif)
 
 	host_int_free_user_conn_req(hif_drv);
 	hif_drv->hif_state = HOST_IF_IDLE;
-	scan_while_connected = false;
 }
 
 static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
@@ -1830,8 +1819,6 @@ static void handle_disconnect(struct wilc_vif *vif)
 		netdev_err(vif->ndev, "conn_result = NULL\n");
 	}
 
-	scan_while_connected = false;
-
 	hif_drv->hif_state = HOST_IF_IDLE;
 
 	eth_zero_addr(hif_drv->assoc_bssid);
@@ -3339,8 +3326,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 	vif = netdev_priv(dev);
 	wilc = vif->wilc;
 
-	scan_while_connected = false;
-
 	init_completion(&hif_wait_response);
 
 	hif_drv  = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
@@ -3436,8 +3421,6 @@ int wilc_deinit(struct wilc_vif *vif)
 
 	hif_drv->hif_state = HOST_IF_IDLE;
 
-	scan_while_connected = false;
-
 	memset(&msg, 0, sizeof(struct host_if_msg));
 
 	if (clients_count == 1)	{
-- 
2.7.4

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

* [PATCH v2 09/21] staging: wilc1000: remove unsed typedef wilc_debug_func
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (7 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 08/21] staging: wilc1000: remove unused variable scan_while_connected Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 10/21] staging: wilc1000: remove used #define HIF_SDIO_GPIO_IRQ Ajay Singh
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 unused typedef and also removed the
unecessary comment about that typedef.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 671e499..a5b9c68 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -202,13 +202,6 @@
 
 /********************************************
  *
- *      Debug Type
- *
- ********************************************/
-typedef void (*wilc_debug_func)(u32, char *, ...);
-
-/********************************************
- *
  *      Tx/Rx Queue Structure
  *
  ********************************************/
-- 
2.7.4

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

* [PATCH v2 10/21] staging: wilc1000: remove used #define HIF_SDIO_GPIO_IRQ
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (8 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 09/21] staging: wilc1000: remove unsed typedef wilc_debug_func Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 11/21] staging: wilc1000: remove unused #define related to MAC status Ajay Singh
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 #define.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index eb8d819..e8a56f4 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -21,7 +21,6 @@
 
 #define HIF_SDIO		(0)
 #define HIF_SPI			BIT(0)
-#define HIF_SDIO_GPIO_IRQ	BIT(2)
 
 /********************************************
  *
-- 
2.7.4

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

* [PATCH v2 11/21] staging: wilc1000: remove unused #define related to MAC status
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (9 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 10/21] staging: wilc1000: remove used #define HIF_SDIO_GPIO_IRQ Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 12/21] staging: wilc1000: rename mac status macros and moved related #define together Ajay Singh
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Remove below #define which are not used in code:

WILC_MAC_STATUS_READY
WILC_MAC_STATUS_CONNECT

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index e8a56f4..1982348 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -49,8 +49,6 @@ struct sdio_cmd53 {
 
 #define WILC_MAC_INDICATE_STATUS	0x1
 #define WILC_MAC_STATUS_INIT		-1
-#define WILC_MAC_STATUS_READY		0
-#define WILC_MAC_STATUS_CONNECT		1
 
 #define WILC_MAC_INDICATE_SCAN		0x2
 
-- 
2.7.4

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

* [PATCH v2 12/21] staging: wilc1000: rename mac status macros and moved related #define together
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (10 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 11/21] staging: wilc1000: remove unused #define related to MAC status Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 13/21] staging: wilc1000: rename WILC_WFI_stats to avoid uppercase Ajay Singh
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Rename the mac status macro to follow the same naming style. Also move
them to keep together.

Renamed like below

>From ------------------------> To

WILC_MAC_STATUS_INIT -> MAC_STATUS_INIT
MAC_CONNECTED --------> MAC_STATUS_CONNECTED
MAC_DISCONNECTED -----> MAC_STATUS_DISCONNECTED

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 1b282b0..758dc44 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1135,7 +1135,7 @@ static s32 handle_connect(struct wilc_vif *vif,
 
 			conn_attr->result(CONN_DISCONN_EVENT_CONN_RESP,
 							       &conn_info,
-							       MAC_DISCONNECTED,
+							       MAC_STATUS_DISCONNECTED,
 							       NULL,
 							       conn_attr->arg);
 			hif_drv->hif_state = HOST_IF_IDLE;
@@ -1193,7 +1193,7 @@ static s32 handle_connect_timeout(struct wilc_vif *vif)
 
 		hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
 						  &info,
-						  MAC_DISCONNECTED,
+						  MAC_STATUS_DISCONNECTED,
 						  NULL,
 						  hif_drv->usr_conn_req.arg);
 
@@ -1321,7 +1321,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 
 	memset(&conn_info, 0, sizeof(struct connect_info));
 
-	if (mac_status == MAC_CONNECTED) {
+	if (mac_status == MAC_STATUS_CONNECTED) {
 		u32 rcvd_assoc_resp_info_len;
 
 		memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
@@ -1357,20 +1357,20 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 		}
 	}
 
-	if (mac_status == MAC_CONNECTED &&
+	if (mac_status == MAC_STATUS_CONNECTED &&
 	    conn_info.status != SUCCESSFUL_STATUSCODE) {
 		netdev_err(vif->ndev,
-			   "Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
+			   "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);
-	} else if (mac_status == MAC_DISCONNECTED)    {
-		netdev_err(vif->ndev, "Received MAC status is MAC_DISCONNECTED\n");
+	} else if (mac_status == MAC_STATUS_DISCONNECTED)    {
+		netdev_err(vif->ndev, "Received MAC status is MAC_STATUS_DISCONNECTED\n");
 		eth_zero_addr(wilc_connected_ssid);
 	}
 
 	if (hif_drv->usr_conn_req.bssid) {
 		memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
-		if (mac_status == MAC_CONNECTED &&
+		if (mac_status == MAC_STATUS_CONNECTED &&
 		    conn_info.status == SUCCESSFUL_STATUSCODE) {
 			memcpy(hif_drv->assoc_bssid,
 			       hif_drv->usr_conn_req.bssid, ETH_ALEN);
@@ -1390,7 +1390,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 					  &conn_info, mac_status, NULL,
 					  hif_drv->usr_conn_req.arg);
 
-	if (mac_status == MAC_CONNECTED &&
+	if (mac_status == MAC_STATUS_CONNECTED &&
 	    conn_info.status == SUCCESSFUL_STATUSCODE) {
 		wilc_set_power_mgmt(vif, 0, 0);
 
@@ -1498,10 +1498,10 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
 		mac_status_additional_info = rcvd_info->buffer[9];
 		if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
 			host_int_parse_assoc_resp_info(vif, mac_status);
-		} else if ((mac_status == MAC_DISCONNECTED) &&
+		} else if ((mac_status == MAC_STATUS_DISCONNECTED) &&
 			   (hif_drv->hif_state == HOST_IF_CONNECTED)) {
 			host_int_handle_disconnect(vif);
-		} else if ((mac_status == MAC_DISCONNECTED) &&
+		} else if ((mac_status == MAC_STATUS_DISCONNECTED) &&
 			   (hif_drv->usr_scan_req.scan_result)) {
 			del_timer(&hif_drv->scan_timer);
 			if (hif_drv->usr_scan_req.scan_result)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 85b290a..f09d6a8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -226,7 +226,7 @@ void wilc_mac_indicate(struct wilc *wilc, int flag)
 	if (flag == WILC_MAC_INDICATE_STATUS) {
 		wilc_wlan_cfg_get_val(WID_STATUS,
 				      (unsigned char *)&status, 4);
-		if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
+		if (wilc->mac_status == MAC_STATUS_INIT) {
 			wilc->mac_status = status;
 			complete(&wilc->sync_event);
 		} else {
@@ -725,7 +725,7 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
 	struct wilc *wl = vif->wilc;
 
 	if (!wl->initialized) {
-		wl->mac_status = WILC_MAC_STATUS_INIT;
+		wl->mac_status = MAC_STATUS_INIT;
 		wl->close = 0;
 
 		wlan_init_locks(dev);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 9e87b91..3ca0c97 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_DISCONNECTED &&
+		if (mac_status == MAC_STATUS_DISCONNECTED &&
 		    conn_info->status == SUCCESSFUL_STATUSCODE) {
 			connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
 			wilc_wlan_set_bssid(priv->dev, null_bssid,
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 1982348..aa0731e 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -48,10 +48,12 @@ struct sdio_cmd53 {
 };
 
 #define WILC_MAC_INDICATE_STATUS	0x1
-#define WILC_MAC_STATUS_INIT		-1
-
 #define WILC_MAC_INDICATE_SCAN		0x2
 
+#define MAC_STATUS_INIT			-1
+#define MAC_STATUS_CONNECTED		1
+#define MAC_STATUS_DISCONNECTED		0
+
 struct tx_complete_data {
 	int size;
 	void *buff;
@@ -117,8 +119,6 @@ enum {
 	G_AUTO_PREAMBLE		= 2,	/* Auto Preamble Selection */
 };
 
-#define MAC_CONNECTED		1
-#define MAC_DISCONNECTED	0
 enum {
 	PASSIVE_SCAN		= 0,
 	ACTIVE_SCAN		= 1,
-- 
2.7.4

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

* [PATCH v2 13/21] staging: wilc1000: rename WILC_WFI_stats to avoid uppercase
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (11 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 12/21] staging: wilc1000: rename mac status macros and moved related #define together Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 14/21] staging: wilc1000: rename num_reg_frame macro to have uppercase in macro name Ajay Singh
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 struct name as per linux coding style.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 07167637..35bc4df 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -50,7 +50,7 @@ enum stats_flags {
 	WILC_WFI_TX_PKT = BIT(1),
 };
 
-struct WILC_WFI_stats {
+struct wilc_wfi_stats {
 	unsigned long rx_packets;
 	unsigned long tx_packets;
 	unsigned long rx_bytes;
@@ -119,7 +119,7 @@ struct wilc_priv {
 	struct napi_struct napi;
 	struct host_if_drv *hif_drv;
 	struct host_if_pmkid_attr pmkid_list;
-	struct WILC_WFI_stats netstats;
+	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 */
-- 
2.7.4

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

* [PATCH v2 14/21] staging: wilc1000: rename num_reg_frame macro to have uppercase in macro name
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (12 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 13/21] staging: wilc1000: rename WILC_WFI_stats to avoid uppercase Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 15/21] staging: wilc1000: rename wlan init and deinit function prefixed with wil1000 Ajay Singh
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Cleanup patch to follow name as per linux coding style.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 35bc4df..4bc1899 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -65,7 +65,7 @@ struct wilc_wfi_stats {
  * packets in and out, so there is place for a packet
  */
 
-#define num_reg_frame 2
+#define NUM_REG_FRAME 2
 
 struct wilc_wfi_key {
 	u8 *key;
@@ -146,7 +146,7 @@ struct wilc_vif {
 	u8 iftype;
 	int monitor_flag;
 	int mac_opened;
-	struct frame_reg frame_reg[num_reg_frame];
+	struct frame_reg frame_reg[NUM_REG_FRAME];
 	struct net_device_stats netstats;
 	struct wilc *wilc;
 	u8 src_addr[ETH_ALEN];
-- 
2.7.4

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

* [PATCH v2 15/21] staging: wilc1000: rename wlan init and deinit function prefixed with wil1000
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (13 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 14/21] staging: wilc1000: rename num_reg_frame macro to have uppercase in macro name Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 16/21] staging: wilc1000: remove unused elements in 'wilc_priv' struct Ajay Singh
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Rename wilc1000_wlan_init() & wilc1000_wlan_deinit() function to avoid
unecessary 'wilc1000' prefix in function to be inline with other
function naming convension.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index f09d6a8..b6a8165 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -604,7 +604,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
 	return -1;
 }
 
-void wilc1000_wlan_deinit(struct net_device *dev)
+void wilc_wlan_deinitialize(struct net_device *dev)
 {
 	struct wilc_vif *vif;
 	struct wilc *wl;
@@ -719,7 +719,7 @@ static void wlan_deinitialize_threads(struct net_device *dev)
 	}
 }
 
-int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
+int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
 {
 	int ret = 0;
 	struct wilc *wl = vif->wilc;
@@ -846,7 +846,7 @@ static int wilc_mac_open(struct net_device *ndev)
 	if (ret < 0)
 		return ret;
 
-	ret = wilc1000_wlan_init(ndev, vif);
+	ret = wilc_wlan_initialize(ndev, vif);
 	if (ret < 0) {
 		wilc_deinit_host_int(ndev);
 		return ret;
@@ -869,7 +869,7 @@ static int wilc_mac_open(struct net_device *ndev)
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		netdev_err(ndev, "Wrong MAC address\n");
 		wilc_deinit_host_int(ndev);
-		wilc1000_wlan_deinit(ndev);
+		wilc_wlan_deinitialize(ndev);
 		return -EINVAL;
 	}
 
@@ -1038,7 +1038,7 @@ static int wilc_mac_close(struct net_device *ndev)
 	if (wl->open_ifcs == 0) {
 		netdev_dbg(ndev, "Deinitializing wilc1000\n");
 		wl->close = 1;
-		wilc1000_wlan_deinit(ndev);
+		wilc_wlan_deinitialize(ndev);
 		WILC_WFI_deinit_mon_interface();
 	}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 4bc1899..0a91468 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -218,14 +218,14 @@ struct WILC_WFI_mon_priv {
 	struct net_device *real_ndev;
 };
 
-int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif);
+int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif);
 
 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void wilc_mac_indicate(struct wilc *wilc, int flag);
 void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 		     int gpio, const struct wilc_hif_func *ops);
-void wilc1000_wlan_deinit(struct net_device *dev);
+void wilc_wlan_deinitialize(struct net_device *dev);
 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
 int wilc_wlan_get_firmware(struct net_device *dev);
 int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
-- 
2.7.4

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

* [PATCH v2 16/21] staging: wilc1000: remove unused elements in 'wilc_priv' struct
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (14 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 15/21] staging: wilc1000: rename wlan init and deinit function prefixed with wil1000 Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 17/21] staging: wilc1000: remove unused enum 'stats_flags' Ajay Singh
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 element from 'wilc_priv' structure.

Below elements are removed in 'wilc_priv' structure:

struct WILC_WFI_packet *ppool;
struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
int rx_int_enabled;
int tx_packetlen;
u8 *tx_packetdata;
struct napi_struct napi;

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 0a91468..e6489fa 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -108,15 +108,9 @@ struct wilc_priv {
 	struct net_device_stats stats;
 	u8 monitor_flag;
 	int status;
-	struct WILC_WFI_packet *ppool;
-	struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
-	int rx_int_enabled;
-	int tx_packetlen;
-	u8 *tx_packetdata;
 	struct sk_buff *skb;
 	spinlock_t lock;
 	struct net_device *dev;
-	struct napi_struct napi;
 	struct host_if_drv *hif_drv;
 	struct host_if_pmkid_attr pmkid_list;
 	struct wilc_wfi_stats netstats;
-- 
2.7.4

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

* [PATCH v2 17/21] staging: wilc1000: remove unused enum 'stats_flags'
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (15 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 16/21] staging: wilc1000: remove unused elements in 'wilc_priv' struct Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 18/21] staging: wilc1000: rename P2P_LISTEN_STATE variable to use lowercase Ajay Singh
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 unused enum.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index e6489fa..5f4dbff 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -45,11 +45,6 @@
 #define FLOW_CONTROL_LOWER_THRESHOLD	128
 #define FLOW_CONTROL_UPPER_THRESHOLD	256
 
-enum stats_flags {
-	WILC_WFI_RX_PKT = BIT(0),
-	WILC_WFI_TX_PKT = BIT(1),
-};
-
 struct wilc_wfi_stats {
 	unsigned long rx_packets;
 	unsigned long tx_packets;
-- 
2.7.4

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

* [PATCH v2 18/21] staging: wilc1000: rename P2P_LISTEN_STATE variable to use lowercase
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (16 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 17/21] staging: wilc1000: remove unused enum 'stats_flags' Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 19/21] staging: wilc1000: remove inner block '{}' in handle_remain_on_chan() Ajay Singh
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Rename P2P_LISTEN_STATE variable to avoid using uppercase for variable
name to follow linux coding style.

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 758dc44..6eafb98 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -229,7 +229,7 @@ struct join_bss_param {
 
 static struct host_if_drv *terminated_handle;
 bool wilc_optaining_ip;
-static u8 P2P_LISTEN_STATE;
+static u8 p2p_listen_state;
 static struct workqueue_struct *hif_workqueue;
 static struct completion hif_thread_comp;
 static struct completion hif_driver_comp;
@@ -2245,7 +2245,7 @@ static int handle_remain_on_chan(struct wilc_vif *vif,
 
 error:
 	{
-		P2P_LISTEN_STATE = 1;
+		p2p_listen_state = 1;
 		hif_drv->remain_on_ch_timer_vif = vif;
 		mod_timer(&hif_drv->remain_on_ch_timer,
 			  jiffies +
@@ -2301,7 +2301,7 @@ static u32 handle_listen_state_expired(struct wilc_vif *vif,
 	s32 result = 0;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
-	if (P2P_LISTEN_STATE) {
+	if (p2p_listen_state) {
 		remain_on_chan_flag = false;
 		wid.id = (u16)WID_REMAIN_ON_CHAN;
 		wid.type = WID_STR;
@@ -2326,7 +2326,7 @@ static u32 handle_listen_state_expired(struct wilc_vif *vif,
 			hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg,
 						      hif_remain_ch->id);
 		}
-		P2P_LISTEN_STATE = 0;
+		p2p_listen_state = 0;
 	} else {
 		netdev_dbg(vif->ndev, "Not in listen state\n");
 		result = -EFAULT;
-- 
2.7.4

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

* [PATCH v2 19/21] staging: wilc1000: remove inner block '{}' in handle_remain_on_chan()
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (17 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 18/21] staging: wilc1000: rename P2P_LISTEN_STATE variable to use lowercase Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 20/21] staging: wilc1000: change function to static in linux_wlan Ajay Singh
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 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 inner block {\* *\} in
handle_remain_on_chan().

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 6eafb98..2f3e20d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2244,19 +2244,16 @@ static int handle_remain_on_chan(struct wilc_vif *vif,
 		netdev_err(vif->ndev, "Failed to set remain on channel\n");
 
 error:
-	{
-		p2p_listen_state = 1;
-		hif_drv->remain_on_ch_timer_vif = vif;
-		mod_timer(&hif_drv->remain_on_ch_timer,
-			  jiffies +
-			  msecs_to_jiffies(hif_remain_ch->duration));
+	p2p_listen_state = 1;
+	hif_drv->remain_on_ch_timer_vif = vif;
+	mod_timer(&hif_drv->remain_on_ch_timer,
+		  jiffies + msecs_to_jiffies(hif_remain_ch->duration));
 
-		if (hif_drv->remain_on_ch.ready)
-			hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg);
+	if (hif_drv->remain_on_ch.ready)
+		hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg);
 
-		if (hif_drv->remain_on_ch_pending)
-			hif_drv->remain_on_ch_pending = 0;
-	}
+	if (hif_drv->remain_on_ch_pending)
+		hif_drv->remain_on_ch_pending = 0;
 
 	return result;
 }
-- 
2.7.4

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

* [PATCH v2 20/21] staging: wilc1000: change function to static in linux_wlan
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (18 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 19/21] staging: wilc1000: remove inner block '{}' in handle_remain_on_chan() Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-25 17:18 ` [PATCH v2 21/21] staging: wilc1000: reorder functions to avoid forward declaration " Ajay Singh
  2018-04-26  6:16 ` [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Defined function as static which are used only in single file. And also removed
their declaration from header file.
Below function are changed to static
wilc_wlan_initialize()
wilc_wlan_deinitialize()
wilc_wlan_get_firmware()

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b6a8165..1643166 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -315,7 +315,7 @@ static int linux_wlan_txq_task(void *vp)
 	return 0;
 }
 
-int wilc_wlan_get_firmware(struct net_device *dev)
+static int wilc_wlan_get_firmware(struct net_device *dev)
 {
 	struct wilc_vif *vif;
 	struct wilc *wilc;
@@ -604,7 +604,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
 	return -1;
 }
 
-void wilc_wlan_deinitialize(struct net_device *dev)
+static void wilc_wlan_deinitialize(struct net_device *dev)
 {
 	struct wilc_vif *vif;
 	struct wilc *wl;
@@ -719,7 +719,7 @@ static void wlan_deinitialize_threads(struct net_device *dev)
 	}
 }
 
-int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
+static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
 {
 	int ret = 0;
 	struct wilc *wl = vif->wilc;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 5f4dbff..ab94d78f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -207,16 +207,12 @@ struct WILC_WFI_mon_priv {
 	struct net_device *real_ndev;
 };
 
-int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif);
-
 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void wilc_mac_indicate(struct wilc *wilc, int flag);
 void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 		     int gpio, const struct wilc_hif_func *ops);
-void wilc_wlan_deinitialize(struct net_device *dev);
 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-int wilc_wlan_get_firmware(struct net_device *dev);
 int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
 
 #endif
-- 
2.7.4

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

* [PATCH v2 21/21] staging: wilc1000: reorder functions to avoid forward declaration in linux_wlan
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (19 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 20/21] staging: wilc1000: change function to static in linux_wlan Ajay Singh
@ 2018-04-25 17:18 ` Ajay Singh
  2018-04-26  6:16 ` [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-25 17:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: devel, gregkh, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid, Ajay Singh

Reorder the functions in linux_wlan.c file to avoid having explicit
declaration of static functions. Forward declaration is avoided
with the help of reordering the function.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 1643166..35e30c5 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -24,35 +24,8 @@
 #include <linux/mutex.h>
 #include <linux/completion.h>
 
-static int dev_state_ev_handler(struct notifier_block *this,
-				unsigned long event, void *ptr);
-
-static struct notifier_block g_dev_notifier = {
-	.notifier_call = dev_state_ev_handler
-};
-
-static int wlan_deinit_locks(struct net_device *dev);
-static void wlan_deinitialize_threads(struct net_device *dev);
-
-static void linux_wlan_tx_complete(void *priv, int status);
-static int  mac_init_fn(struct net_device *ndev);
-static struct net_device_stats *mac_stats(struct net_device *dev);
-static int wilc_mac_open(struct net_device *ndev);
-static int wilc_mac_close(struct net_device *ndev);
-static void wilc_set_multicast_list(struct net_device *dev);
-
 bool wilc_enable_ps = true;
 
-static const struct net_device_ops wilc_netdev_ops = {
-	.ndo_init = mac_init_fn,
-	.ndo_open = wilc_mac_open,
-	.ndo_stop = wilc_mac_close,
-	.ndo_start_xmit = wilc_mac_xmit,
-	.ndo_get_stats = mac_stats,
-	.ndo_set_rx_mode  = wilc_set_multicast_list,
-
-};
-
 static int dev_state_ev_handler(struct notifier_block *this,
 				unsigned long event, void *ptr)
 {
@@ -604,6 +577,39 @@ static int linux_wlan_init_test_config(struct net_device *dev,
 	return -1;
 }
 
+static int wlan_deinit_locks(struct net_device *dev)
+{
+	struct wilc_vif *vif;
+	struct wilc *wilc;
+
+	vif = netdev_priv(dev);
+	wilc = vif->wilc;
+
+	mutex_destroy(&wilc->hif_cs);
+	mutex_destroy(&wilc->rxq_cs);
+	mutex_destroy(&wilc->txq_add_to_head_cs);
+
+	return 0;
+}
+
+static void wlan_deinitialize_threads(struct net_device *dev)
+{
+	struct wilc_vif *vif;
+	struct wilc *wl;
+
+	vif = netdev_priv(dev);
+	wl = vif->wilc;
+
+	wl->close = 1;
+
+	complete(&wl->txq_event);
+
+	if (wl->txq_thread) {
+		kthread_stop(wl->txq_thread);
+		wl->txq_thread = NULL;
+	}
+}
+
 static void wilc_wlan_deinitialize(struct net_device *dev)
 {
 	struct wilc_vif *vif;
@@ -666,21 +672,6 @@ static int wlan_init_locks(struct net_device *dev)
 	return 0;
 }
 
-static int wlan_deinit_locks(struct net_device *dev)
-{
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
-	mutex_destroy(&wilc->hif_cs);
-	mutex_destroy(&wilc->rxq_cs);
-	mutex_destroy(&wilc->txq_add_to_head_cs);
-
-	return 0;
-}
-
 static int wlan_initialize_threads(struct net_device *dev)
 {
 	struct wilc_vif *vif;
@@ -701,24 +692,6 @@ static int wlan_initialize_threads(struct net_device *dev)
 	return 0;
 }
 
-static void wlan_deinitialize_threads(struct net_device *dev)
-{
-	struct wilc_vif *vif;
-	struct wilc *wl;
-
-	vif = netdev_priv(dev);
-	wl = vif->wilc;
-
-	wl->close = 1;
-
-	complete(&wl->txq_event);
-
-	if (wl->txq_thread) {
-		kthread_stop(wl->txq_thread);
-		wl->txq_thread = NULL;
-	}
-}
-
 static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
 {
 	int ret = 0;
@@ -1106,6 +1079,10 @@ void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
 		wilc_wfi_p2p_rx(wilc->vif[1]->ndev, buff, size);
 }
 
+static struct notifier_block g_dev_notifier = {
+	.notifier_call = dev_state_ev_handler
+};
+
 void wilc_netdev_cleanup(struct wilc *wilc)
 {
 	int i;
@@ -1135,6 +1112,15 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
 
+static const struct net_device_ops wilc_netdev_ops = {
+	.ndo_init = mac_init_fn,
+	.ndo_open = wilc_mac_open,
+	.ndo_stop = wilc_mac_close,
+	.ndo_start_xmit = wilc_mac_xmit,
+	.ndo_get_stats = mac_stats,
+	.ndo_set_rx_mode  = wilc_set_multicast_list,
+};
+
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 		     int gpio, const struct wilc_hif_func *ops)
 {
-- 
2.7.4

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

* Re: [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions
  2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
                   ` (20 preceding siblings ...)
  2018-04-25 17:18 ` [PATCH v2 21/21] staging: wilc1000: reorder functions to avoid forward declaration " Ajay Singh
@ 2018-04-26  6:16 ` Ajay Singh
  21 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-26  6:16 UTC (permalink / raw)
  To: linux-wireless, gregkh
  Cc: devel, ganesh.krishna, venkateswara.kaja, aditya.shankar,
	claudiu.beznea, adham.abozaeid

Hi Greg,

This series is actually V1 and not V2. Sorry, it's mistake from my
side. 
If you want me to resend this series, please let me know.

 
 On Wed, 25 Apr 2018 22:48:05 +0530
Ajay Singh <ajay.kathat@microchip.com> wrote:

> This patch series contains fixes to remove the unused code. It also
> has patches to reorganize the function and simplify the function
> logic.
> 
> Ajay Singh (21):
>   staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE
>   staging: wilc1000: align the #define in wilc_spi file
>   staging: wilc1000: remove unnecessary assingment from 'if'
> conditions staging: wilc1000: remove 'cmd' variable in wilc_spi
> functions staging: wicl1000: removed the unsed variables in
>     wilc_parse_network_info()
>   staging: wilc1000: remove inner {} in wilc_parse_network_info()
>   staging: wilc1000: simplified if conditions in spi_data_write()
>   staging: wilc1000: remove unused variable scan_while_connected
>   staging: wilc1000: remove unsed typedef wilc_debug_func
>   staging: wilc1000: remove used #define HIF_SDIO_GPIO_IRQ
>   staging: wilc1000: remove unused #define related to MAC status
>   staging: wilc1000: rename mac status macros and moved related
> #define together
>   staging: wilc1000: rename WILC_WFI_stats to avoid uppercase
>   staging: wilc1000: rename num_reg_frame macro to have uppercase in
>     macro name
>   staging: wilc1000: rename wlan init and deinit function prefixed
> with wil1000
>   staging: wilc1000: remove unused elements in 'wilc_priv' struct
>   staging: wilc1000: remove unused enum 'stats_flags'
>   staging: wilc1000: rename P2P_LISTEN_STATE variable to use
> lowercase staging: wilc1000: remove inner block '{}' in
> handle_remain_on_chan() staging: wilc1000: change function to
> static in linux_wlan staging: wilc1000: reorder functions to avoid
> forward declaration in linux_wlan
> 
>  drivers/staging/wilc1000/coreconfigurator.c       |  84
> +++++++-------- drivers/staging/wilc1000/host_interface.c
> |  64 ++++--------
> drivers/staging/wilc1000/linux_wlan.c             | 122
> ++++++++++------------
> drivers/staging/wilc1000/wilc_sdio.c              |  12 +--
> drivers/staging/wilc1000/wilc_spi.c               |  70
> ++++++------- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |
> 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  23 +---
> drivers/staging/wilc1000/wilc_wlan.h              |   7 --
> drivers/staging/wilc1000/wilc_wlan_if.h           |  11 +- 9 files
> changed, 158 insertions(+), 237 deletions(-)
> 



Regards,
Ajay

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

* Re: [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE
  2018-04-25 17:18 ` [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE Ajay Singh
@ 2018-04-26  7:40   ` Greg KH
  2018-04-26  7:54     ` Ajay Singh
  0 siblings, 1 reply; 25+ messages in thread
From: Greg KH @ 2018-04-26  7:40 UTC (permalink / raw)
  To: Ajay Singh
  Cc: linux-wireless, devel, venkateswara.kaja, ganesh.krishna,
	adham.abozaeid, aditya.shankar

On Wed, Apr 25, 2018 at 10:48:06PM +0530, Ajay Singh wrote:
> Replace the function call for crc7_byte() with macro CRC7_BYTE.
> crc7_byte() was called in close while(), so replaced it with macro to
> avoid extra functional call depth.
> 
> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> ---
>  drivers/staging/wilc1000/wilc_spi.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
> index 2cb9f4e..3bb8fec 100644
> --- a/drivers/staging/wilc1000/wilc_spi.c
> +++ b/drivers/staging/wilc1000/wilc_spi.c
> @@ -75,15 +75,12 @@ static const u8 crc7_syndrome_table[256] = {
>  	0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79
>  };
>  
> -static u8 crc7_byte(u8 crc, u8 data)
> -{
> -	return crc7_syndrome_table[(crc << 1) ^ data];
> -}
> +#define CRC7_BYTE(crc, data) crc7_syndrome_table[(crc << 1) ^ data]

Ick, no.  That's not needed at all, a function is always much better.

And a good compiler will just inline this, are you _sure_ you are
actually changing anything here?

But most importantly, why not just use the build-in crc7 functionality
that the kernel already provides?  Don't have a duplicate version here.

That would be a much better cleanup, right?

thanks,

greg k-h

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

* Re: [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE
  2018-04-26  7:40   ` Greg KH
@ 2018-04-26  7:54     ` Ajay Singh
  0 siblings, 0 replies; 25+ messages in thread
From: Ajay Singh @ 2018-04-26  7:54 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-wireless, devel, venkateswara.kaja, ganesh.krishna,
	adham.abozaeid, aditya.shankar

Hi Greg,

On Thu, 26 Apr 2018 09:40:20 +0200
Greg KH <gregkh@linuxfoundation.org> wrote:

> On Wed, Apr 25, 2018 at 10:48:06PM +0530, Ajay Singh wrote:
> > Replace the function call for crc7_byte() with macro CRC7_BYTE.
> > crc7_byte() was called in close while(), so replaced it with
> > macro to avoid extra functional call depth.
> > 
> > Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> > ---
> >  drivers/staging/wilc1000/wilc_spi.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/staging/wilc1000/wilc_spi.c
> > b/drivers/staging/wilc1000/wilc_spi.c index 2cb9f4e..3bb8fec
> > 100644 --- a/drivers/staging/wilc1000/wilc_spi.c
> > +++ b/drivers/staging/wilc1000/wilc_spi.c
> > @@ -75,15 +75,12 @@ static const u8 crc7_syndrome_table[256] = {
> >  	0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79
> >  };
> >  
> > -static u8 crc7_byte(u8 crc, u8 data)
> > -{
> > -	return crc7_syndrome_table[(crc << 1) ^ data];
> > -}
> > +#define CRC7_BYTE(crc, data) crc7_syndrome_table[(crc << 1) ^
> > data]  
> 
> Ick, no.  That's not needed at all, a function is always much
> better.
> 
> And a good compiler will just inline this, are you _sure_ you are
> actually changing anything here?

As you mentioned, we can leave as it is for good compiler to
handle.

> 
> But most importantly, why not just use the build-in crc7
> functionality that the kernel already provides?  Don't have a
> duplicate version here.
> 
> That would be a much better cleanup, right?
> 

Thank you for your suggestion.

Yes, I agree its better to use the existing crc7 functionality.

It seems the same crc7() functions was available in kernel version
before v3.16-rc1 (in /lib/crc7.c) but later it got changed to
crc7_be() with a different crc lookup table. So i think it can not be
changed directly now.

I will check more on this and see how can we can make use of
modified version of crc7, by also considering the receiver end
changes.

> thanks,
> 
> greg k-h



Regards,
Ajay

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

end of thread, other threads:[~2018-04-26  8:56 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
2018-04-25 17:18 ` [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE Ajay Singh
2018-04-26  7:40   ` Greg KH
2018-04-26  7:54     ` Ajay Singh
2018-04-25 17:18 ` [PATCH v2 02/21] staging: wilc1000: align the #define in wilc_spi file Ajay Singh
2018-04-25 17:18 ` [PATCH v2 03/21] staging: wilc1000: remove unnecessary assingment from 'if' conditions Ajay Singh
2018-04-25 17:18 ` [PATCH v2 04/21] staging: wilc1000: remove 'cmd' variable in wilc_spi functions Ajay Singh
2018-04-25 17:18 ` [PATCH v2 05/21] staging: wicl1000: removed the unsed variables in wilc_parse_network_info() Ajay Singh
2018-04-25 17:18 ` [PATCH v2 06/21] staging: wilc1000: remove inner {} " Ajay Singh
2018-04-25 17:18 ` [PATCH v2 07/21] staging: wilc1000: simplified if conditions in spi_data_write() Ajay Singh
2018-04-25 17:18 ` [PATCH v2 08/21] staging: wilc1000: remove unused variable scan_while_connected Ajay Singh
2018-04-25 17:18 ` [PATCH v2 09/21] staging: wilc1000: remove unsed typedef wilc_debug_func Ajay Singh
2018-04-25 17:18 ` [PATCH v2 10/21] staging: wilc1000: remove used #define HIF_SDIO_GPIO_IRQ Ajay Singh
2018-04-25 17:18 ` [PATCH v2 11/21] staging: wilc1000: remove unused #define related to MAC status Ajay Singh
2018-04-25 17:18 ` [PATCH v2 12/21] staging: wilc1000: rename mac status macros and moved related #define together Ajay Singh
2018-04-25 17:18 ` [PATCH v2 13/21] staging: wilc1000: rename WILC_WFI_stats to avoid uppercase Ajay Singh
2018-04-25 17:18 ` [PATCH v2 14/21] staging: wilc1000: rename num_reg_frame macro to have uppercase in macro name Ajay Singh
2018-04-25 17:18 ` [PATCH v2 15/21] staging: wilc1000: rename wlan init and deinit function prefixed with wil1000 Ajay Singh
2018-04-25 17:18 ` [PATCH v2 16/21] staging: wilc1000: remove unused elements in 'wilc_priv' struct Ajay Singh
2018-04-25 17:18 ` [PATCH v2 17/21] staging: wilc1000: remove unused enum 'stats_flags' Ajay Singh
2018-04-25 17:18 ` [PATCH v2 18/21] staging: wilc1000: rename P2P_LISTEN_STATE variable to use lowercase Ajay Singh
2018-04-25 17:18 ` [PATCH v2 19/21] staging: wilc1000: remove inner block '{}' in handle_remain_on_chan() Ajay Singh
2018-04-25 17:18 ` [PATCH v2 20/21] staging: wilc1000: change function to static in linux_wlan Ajay Singh
2018-04-25 17:18 ` [PATCH v2 21/21] staging: wilc1000: reorder functions to avoid forward declaration " Ajay Singh
2018-04-26  6:16 ` [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh

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.