2018-04-18 11:40:24

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 00/22] staging: wilc1000: cleanup patches to follow linux coding style

This patch series is based on top of
"[PATCH 00/11] staging: wilc1000: fix for checkpatch and handled
malloc memory properly" and its not applied yet.[1]

In this series contains fixes to avoid the checkpatch reported issue.
Also remove the multiple #define for same macros and changes to
follow linux coding style.

[1] https://www.mail-archive.com/[email protected]/msg43998.html

Ajay Singh (22):
staging: wilc1000: rename WILC_WFI_wep_key & WILC_WFI_wep_key_len
staging: wilc1000: rename variable using datatype in their name in
add_key()
staging: wilc1000: split add_key() to avoid line over 80 chars
staging: wilc1000: remove inner block {} and resetting of mode
variable
staging: wilc1000: refactor add_key() to avoid duplicated code
staging: wilc1000: handle error condition in add_key() and remove
auth_type variable
staging: wilc1000: use sizeof(variable) for memory allocated to store
key info
staging: wilc1000: fix line over 80 chars in change_station()
staging: wilc1000: rename WID_LOGTerminal_Switch to avoid camelCase
staging: wilc1000: added identifiers name in function definations
staging: wilc1000: remove unused macros in wilc module
staging: wilc1000: remove multiple define used for MAX_SSID_LEN
staging: wilc1000: remove multiple define for mac connect and
disconnect
staging: wilc1000: remove the use of goto label in spi_cmd_complete()
staging: wilc1000: remove the use of goto label in
wilc_spi_read_size()
staging: wilc1000: remove the use of goto label in wilc_spi_read_int()
staging: wilc1000: remove goto label '_done_' in
handle_listen_state_expired()
staging: wilc1000: remove the use of goto label in wilc_init()
staging: wilc1000: rename goto label '_fail_' linux naming convension
staging: wilc1000: rename goto labels starting with '_' in
wilc1000_wlan_init()
staging: wilc1000: remove the use of goto label in
wilc_spi_clear_int_ext()
staging: wilc1000: rename pu32InactiveTime to avoid camelCase issue

drivers/staging/wilc1000/coreconfigurator.h | 17 --
drivers/staging/wilc1000/host_interface.c | 25 +--
drivers/staging/wilc1000/host_interface.h | 3 +-
drivers/staging/wilc1000/linux_wlan.c | 118 +++++-----
drivers/staging/wilc1000/wilc_sdio.c | 84 ++++----
drivers/staging/wilc1000/wilc_spi.c | 21 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 250 +++++++++++-----------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 8 +-
drivers/staging/wilc1000/wilc_wlan.c | 16 +-
drivers/staging/wilc1000/wilc_wlan.h | 26 +--
drivers/staging/wilc1000/wilc_wlan_if.h | 4 +-
11 files changed, 268 insertions(+), 304 deletions(-)

--
2.7.4


2018-04-18 11:40:52

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 13/22] staging: wilc1000: remove multiple define for mac connect and disconnect

Cleanup patch to have commonly used macro in common header file to avoid
same defination in mulitple file. Removed MAC_CONNECTED &
MAC_DISCONNECTED macro from coreconfigurator.h header.

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

diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 1666b7a..6e61f3d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -31,9 +31,6 @@
#define MAX_STRING_LEN 256
#define MAX_ASSOC_RESP_FRAME_SIZE MAX_STRING_LEN

-#define MAC_CONNECTED 1
-#define MAC_DISCONNECTED 0
-
#define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
#define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))

--
2.7.4

2018-04-18 11:41:08

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 20/22] staging: wilc1000: rename goto labels starting with '_' in wilc1000_wlan_init()

Rename goto labels starting with '_' in wilc1000_wlan_init() to follow
linux coding style.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8f97c62..26edbb6 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -735,42 +735,42 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
ret = wilc_wlan_init(dev);
if (ret < 0) {
ret = -EIO;
- goto _fail_locks_;
+ goto fail_locks;
}

if (wl->gpio >= 0 && init_irq(dev)) {
ret = -EIO;
- goto _fail_locks_;
+ goto fail_locks;
}

ret = wlan_initialize_threads(dev);
if (ret < 0) {
ret = -EIO;
- goto _fail_wilc_wlan_;
+ goto fail_wilc_wlan;
}

if (!wl->dev_irq_num &&
wl->hif_func->enable_interrupt &&
wl->hif_func->enable_interrupt(wl)) {
ret = -EIO;
- goto _fail_irq_init_;
+ goto fail_irq_init;
}

if (wilc_wlan_get_firmware(dev)) {
ret = -EIO;
- goto _fail_irq_enable_;
+ goto fail_irq_enable;
}

ret = wilc1000_firmware_download(dev);
if (ret < 0) {
ret = -EIO;
- goto _fail_irq_enable_;
+ goto fail_irq_enable;
}

ret = linux_wlan_start_firmware(dev);
if (ret < 0) {
ret = -EIO;
- goto _fail_irq_enable_;
+ goto fail_irq_enable;
}

if (wilc_wlan_cfg_get(vif, 1, WID_FIRMWARE_VERSION, 1, 0)) {
@@ -788,27 +788,27 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
if (ret < 0) {
netdev_err(dev, "Failed to configure firmware\n");
ret = -EIO;
- goto _fail_fw_start_;
+ goto fail_fw_start;
}

wl->initialized = true;
return 0;

-_fail_fw_start_:
+fail_fw_start:
wilc_wlan_stop(wl);

-_fail_irq_enable_:
+fail_irq_enable:
if (!wl->dev_irq_num &&
wl->hif_func->disable_interrupt)
wl->hif_func->disable_interrupt(wl);
-_fail_irq_init_:
+fail_irq_init:
if (wl->dev_irq_num)
deinit_irq(dev);

wlan_deinitialize_threads(dev);
-_fail_wilc_wlan_:
+fail_wilc_wlan:
wilc_wlan_cleanup(dev);
-_fail_locks_:
+fail_locks:
wlan_deinit_locks(dev);
netdev_err(dev, "WLAN initialization FAILED\n");
} else {
--
2.7.4

2018-04-18 11:41:06

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 19/22] staging: wilc1000: rename goto label '_fail_' linux naming convension

Rename '_fail_' goto label to have name as per linux coding style.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 92 +++++++++++++++++------------------
drivers/staging/wilc1000/wilc_sdio.c | 84 ++++++++++++++++----------------
drivers/staging/wilc1000/wilc_wlan.c | 16 +++---
3 files changed, 96 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 2236967..8f97c62 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -338,16 +338,16 @@ int wilc_wlan_get_firmware(struct net_device *dev)
netdev_info(dev, "loading firmware %s\n", firmware);

if (!(&vif->ndev->dev))
- goto _fail_;
+ goto fail;

if (request_firmware(&wilc_firmware, firmware, wilc->dev) != 0) {
netdev_err(dev, "%s - firmware not available\n", firmware);
ret = -1;
- goto _fail_;
+ goto fail;
}
wilc->firmware = wilc_firmware;

-_fail_:
+fail:

return ret;
}
@@ -416,193 +416,193 @@ static int linux_wlan_init_test_config(struct net_device *dev,
*(int *)c_val = 1;

if (!wilc_wlan_cfg_set(vif, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 0;
if (!wilc_wlan_cfg_set(vif, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = INFRASTRUCTURE;
if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = RATE_AUTO;
if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = G_MIXED_11B_2_MODE;
if (!wilc_wlan_cfg_set(vif, 0, WID_11G_OPERATING_MODE, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = 1;
if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = G_SHORT_PREAMBLE;
if (!wilc_wlan_cfg_set(vif, 0, WID_PREAMBLE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = AUTO_PROT;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = ACTIVE_SCAN;
if (!wilc_wlan_cfg_set(vif, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = SITE_SURVEY_OFF;
if (!wilc_wlan_cfg_set(vif, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

*((int *)c_val) = 0xffff;
if (!wilc_wlan_cfg_set(vif, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
- goto _fail_;
+ goto fail;

*((int *)c_val) = 2346;
if (!wilc_wlan_cfg_set(vif, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 0;
if (!wilc_wlan_cfg_set(vif, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 1;
if (!wilc_wlan_cfg_set(vif, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = NO_POWERSAVE;
if (!wilc_wlan_cfg_set(vif, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
if (!wilc_wlan_cfg_set(vif, 0, WID_11I_MODE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = OPEN_SYSTEM;
if (!wilc_wlan_cfg_set(vif, 0, WID_AUTH_TYPE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

strcpy(c_val, "123456790abcdef1234567890");
if (!wilc_wlan_cfg_set(vif, 0, WID_WEP_KEY_VALUE, c_val,
(strlen(c_val) + 1), 0, 0))
- goto _fail_;
+ goto fail;

strcpy(c_val, "12345678");
if (!wilc_wlan_cfg_set(vif, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0,
0))
- goto _fail_;
+ goto fail;

strcpy(c_val, "password");
if (!wilc_wlan_cfg_set(vif, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1),
0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 192;
c_val[1] = 168;
c_val[2] = 1;
c_val[3] = 112;
if (!wilc_wlan_cfg_set(vif, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 3;
if (!wilc_wlan_cfg_set(vif, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 3;
if (!wilc_wlan_cfg_set(vif, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = NORMAL_ACK;
if (!wilc_wlan_cfg_set(vif, 0, WID_ACK_POLICY, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 0;
if (!wilc_wlan_cfg_set(vif, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1,
0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 48;
if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = 28;
if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

*((int *)c_val) = 100;
if (!wilc_wlan_cfg_set(vif, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = REKEY_DISABLE;
if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_POLICY, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

*((int *)c_val) = 84600;
if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
- goto _fail_;
+ goto fail;

*((int *)c_val) = 500;
if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = 1;
if (!wilc_wlan_cfg_set(vif, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = G_SELF_CTS_PROT;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 1;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ENABLE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = HT_MIXED_MODE;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OPERATING_MODE, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = 1;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = DETECT_PROTECT_REPORT;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1,
0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = RTS_CTS_NONHT_PROT;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 0;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = MIMO_MODE;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
- goto _fail_;
+ goto fail;

c_val[0] = 7;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0,
0))
- goto _fail_;
+ goto fail;

c_val[0] = 1;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1,
1, 1))
- goto _fail_;
+ goto fail;

return 0;

-_fail_:
+fail:
return -1;
}

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index a088999..087ad42 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -274,7 +274,7 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10c data...\n");
- goto _fail_;
+ goto fail;
}

cmd.address = 0x10d;
@@ -282,7 +282,7 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10d data...\n");
- goto _fail_;
+ goto fail;
}

cmd.address = 0x10e;
@@ -290,11 +290,11 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10e data...\n");
- goto _fail_;
+ goto fail;
}

return 1;
-_fail_:
+fail:
return 0;
}

@@ -312,7 +312,7 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10 data...\n");
- goto _fail_;
+ goto fail;
}

cmd.address = 0x11;
@@ -320,11 +320,11 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x11 data...\n");
- goto _fail_;
+ goto fail;
}

return 1;
-_fail_:
+fail:
return 0;
}

@@ -348,18 +348,18 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x110 data...\n");
- goto _fail_;
+ goto fail;
}
cmd.address = 0x111;
cmd.data = (u8)(block_size >> 8);
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x111 data...\n");
- goto _fail_;
+ goto fail;
}

return 1;
-_fail_:
+fail:
return 0;
}

@@ -387,7 +387,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
if (ret) {
dev_err(&func->dev,
"Failed cmd 52, read reg (%08x) ...\n", addr);
- goto _fail_;
+ goto fail;
}
} else {
struct sdio_cmd53 cmd;
@@ -396,7 +396,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
* set the AHB address
**/
if (!sdio_set_func0_csa_address(wilc, addr))
- goto _fail_;
+ goto fail;

cmd.read_write = 1;
cmd.function = 0;
@@ -410,13 +410,13 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
if (ret) {
dev_err(&func->dev,
"Failed cmd53, write reg (%08x)...\n", addr);
- goto _fail_;
+ goto fail;
}
}

return 1;

-_fail_:
+fail:

return 0;
}
@@ -470,13 +470,13 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
cmd.block_size = block_size;
if (addr > 0) {
if (!sdio_set_func0_csa_address(wilc, addr))
- goto _fail_;
+ goto fail;
}
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
"Failed cmd53 [%x], block send...\n", addr);
- goto _fail_;
+ goto fail;
}
if (addr > 0)
addr += nblk * block_size;
@@ -493,19 +493,19 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)

if (addr > 0) {
if (!sdio_set_func0_csa_address(wilc, addr))
- goto _fail_;
+ goto fail;
}
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
"Failed cmd53 [%x], bytes send...\n", addr);
- goto _fail_;
+ goto fail;
}
}

return 1;

-_fail_:
+fail:

return 0;
}
@@ -526,14 +526,14 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
if (ret) {
dev_err(&func->dev,
"Failed cmd 52, read reg (%08x) ...\n", addr);
- goto _fail_;
+ goto fail;
}
*data = cmd.data;
} else {
struct sdio_cmd53 cmd;

if (!sdio_set_func0_csa_address(wilc, addr))
- goto _fail_;
+ goto fail;

cmd.read_write = 0;
cmd.function = 0;
@@ -548,7 +548,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
if (ret) {
dev_err(&func->dev,
"Failed cmd53, read reg (%08x)...\n", addr);
- goto _fail_;
+ goto fail;
}
}

@@ -556,7 +556,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)

return 1;

-_fail_:
+fail:

return 0;
}
@@ -610,13 +610,13 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
cmd.block_size = block_size;
if (addr > 0) {
if (!sdio_set_func0_csa_address(wilc, addr))
- goto _fail_;
+ goto fail;
}
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
"Failed cmd53 [%x], block read...\n", addr);
- goto _fail_;
+ goto fail;
}
if (addr > 0)
addr += nblk * block_size;
@@ -633,19 +633,19 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)

if (addr > 0) {
if (!sdio_set_func0_csa_address(wilc, addr))
- goto _fail_;
+ goto fail;
}
ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev,
"Failed cmd53 [%x], bytes read...\n", addr);
- goto _fail_;
+ goto fail;
}
}

return 1;

-_fail_:
+fail:

return 0;
}
@@ -684,7 +684,7 @@ static int sdio_init(struct wilc *wilc, bool resume)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Fail cmd 52, enable csa...\n");
- goto _fail_;
+ goto fail;
}

/**
@@ -692,7 +692,7 @@ static int sdio_init(struct wilc *wilc, bool resume)
**/
if (!sdio_set_func0_block_size(wilc, WILC_SDIO_BLOCK_SIZE)) {
dev_err(&func->dev, "Fail cmd 52, set func 0 block size...\n");
- goto _fail_;
+ goto fail;
}
g_sdio.block_size = WILC_SDIO_BLOCK_SIZE;

@@ -708,7 +708,7 @@ static int sdio_init(struct wilc *wilc, bool resume)
if (ret) {
dev_err(&func->dev,
"Fail cmd 52, set IOE register...\n");
- goto _fail_;
+ goto fail;
}

/**
@@ -725,7 +725,7 @@ static int sdio_init(struct wilc *wilc, bool resume)
if (ret) {
dev_err(&func->dev,
"Fail cmd 52, get IOR register...\n");
- goto _fail_;
+ goto fail;
}
if (cmd.data == 0x2)
break;
@@ -733,7 +733,7 @@ static int sdio_init(struct wilc *wilc, bool resume)

if (loop <= 0) {
dev_err(&func->dev, "Fail func 1 is not ready...\n");
- goto _fail_;
+ goto fail;
}

/**
@@ -741,7 +741,7 @@ static int sdio_init(struct wilc *wilc, bool resume)
**/
if (!sdio_set_func1_block_size(wilc, WILC_SDIO_BLOCK_SIZE)) {
dev_err(&func->dev, "Fail set func 1 block size...\n");
- goto _fail_;
+ goto fail;
}

/**
@@ -755,7 +755,7 @@ static int sdio_init(struct wilc *wilc, bool resume)
ret = wilc_sdio_cmd52(wilc, &cmd);
if (ret) {
dev_err(&func->dev, "Fail cmd 52, set IEN register...\n");
- goto _fail_;
+ goto fail;
}

/**
@@ -764,7 +764,7 @@ static int sdio_init(struct wilc *wilc, bool resume)
if (!resume) {
if (!sdio_read_reg(wilc, 0x1000, &chipid)) {
dev_err(&func->dev, "Fail cmd read chip id...\n");
- goto _fail_;
+ goto fail;
}
dev_err(&func->dev, "chipid (%08x)\n", chipid);
if ((chipid & 0xfff) > 0x2a0)
@@ -777,7 +777,7 @@ static int sdio_init(struct wilc *wilc, bool resume)

return 1;

-_fail_:
+fail:

return 0;
}
@@ -907,7 +907,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val)
dev_err(&func->dev,
"Failed cmd52, set 0xf8 data (%d) ...\n",
__LINE__);
- goto _fail_;
+ goto fail;
}
}
return 1;
@@ -940,7 +940,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val)
dev_err(&func->dev,
"Failed cmd52, set 0xf8 data (%d) ...\n",
__LINE__);
- goto _fail_;
+ goto fail;
}
}
if (!ret)
@@ -948,7 +948,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val)
flags >>= 1;
}
if (!ret)
- goto _fail_;
+ goto fail;
for (i = g_sdio.nint; i < MAX_NUM_INT; i++) {
if (flags & 1)
dev_err(&func->dev,
@@ -983,11 +983,11 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val)
dev_err(&func->dev,
"Failed cmd52, set 0xf6 data (%d) ...\n",
__LINE__);
- goto _fail_;
+ goto fail;
}
}
return 1;
-_fail_:
+fail:
return 0;
}

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index bcbb923..43cf9b8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -996,11 +996,11 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,

if (!ret) {
ret = -EIO;
- goto _fail_;
+ goto fail;
}
} while (offset < buffer_size);

-_fail_:
+fail:

kfree(dma_buffer);

@@ -1421,12 +1421,12 @@ int wilc_wlan_init(struct net_device *dev)

if (!wilc->hif_func->hif_init(wilc, false)) {
ret = -EIO;
- goto _fail_;
+ goto fail;
}

if (!wilc_wlan_cfg_init()) {
ret = -ENOBUFS;
- goto _fail_;
+ goto fail;
}

if (!wilc->tx_buffer)
@@ -1434,7 +1434,7 @@ int wilc_wlan_init(struct net_device *dev)

if (!wilc->tx_buffer) {
ret = -ENOBUFS;
- goto _fail_;
+ goto fail;
}

if (!wilc->rx_buffer)
@@ -1442,17 +1442,17 @@ int wilc_wlan_init(struct net_device *dev)

if (!wilc->rx_buffer) {
ret = -ENOBUFS;
- goto _fail_;
+ goto fail;
}

if (!init_chip(dev)) {
ret = -EIO;
- goto _fail_;
+ goto fail;
}

return 1;

-_fail_:
+fail:

kfree(wilc->rx_buffer);
wilc->rx_buffer = NULL;
--
2.7.4

2018-04-18 11:40:44

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 09/22] staging: wilc1000: rename WID_LOGTerminal_Switch to avoid camelCase

Fix 'Avoid camelCase' issue found by checkpatch.pl script.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index e186509..f129d81 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -741,7 +741,7 @@ enum {

WID_DEL_BEACON = 0x00CA,

- WID_LOGTerminal_Switch = 0x00CD,
+ WID_LOG_TERMINAL_SWITCH = 0x00CD,
WID_TX_POWER = 0x00CE,
/* EMAC Short WID list */
/* RTS Threshold */
--
2.7.4

2018-04-18 11:40:59

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 16/22] staging: wilc1000: remove the use of goto label in wilc_spi_read_int()

In wilc_spi_read_int() remove the use of goto label '_fail_'. Changes
are done to avoid the use of '_' in label name.

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

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 57e4f11..1db2814 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -946,7 +946,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
if (!ret) {
dev_err(&spi->dev,
"Failed read WILC_VMM_TO_HOST_SIZE ...\n");
- goto _fail_;
+ return ret;
}
tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK;

@@ -976,7 +976,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)

*int_status = tmp;

-_fail_:
return ret;
}

--
2.7.4

2018-04-18 11:40:33

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 04/22] staging: wilc1000: remove inner block {} and resetting of mode variable

Cleanup fixes to remove the uncessary inner block { /* */ } and setting
of 'mode' variable.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0c7bf2b..ac4cd58 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1009,31 +1009,28 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
break;
}

- {
- mode = 0;
- if (!pairwise) {
- if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
- rx_mic = params->key + 24;
- tx_mic = params->key + 16;
- keylen = params->key_len - 16;
- }
-
- wilc_add_rx_gtk(vif, params->key, keylen,
- key_index, params->seq_len,
- params->seq, rx_mic,
- tx_mic, STATION_MODE,
- mode);
- } else {
- if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
- rx_mic = params->key + 24;
- tx_mic = params->key + 16;
- keylen = params->key_len - 16;
- }
+ if (!pairwise) {
+ if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
+ rx_mic = params->key + 24;
+ tx_mic = params->key + 16;
+ keylen = params->key_len - 16;
+ }

- wilc_add_ptk(vif, params->key, keylen,
- mac_addr, rx_mic, tx_mic,
- STATION_MODE, mode, key_index);
+ wilc_add_rx_gtk(vif, params->key, keylen,
+ key_index, params->seq_len,
+ params->seq, rx_mic,
+ tx_mic, STATION_MODE,
+ mode);
+ } else {
+ if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
+ rx_mic = params->key + 24;
+ tx_mic = params->key + 16;
+ keylen = params->key_len - 16;
}
+
+ wilc_add_ptk(vif, params->key, keylen,
+ mac_addr, rx_mic, tx_mic,
+ STATION_MODE, mode, key_index);
}
break;

--
2.7.4

2018-04-18 11:41:01

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 17/22] staging: wilc1000: remove goto label '_done_' in handle_listen_state_expired()

Remove the use of goto label '_done_' in handle_listen_state_expired().
Changes are done to avoid the use of '_' in label name.

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 1117705..65caa6d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2332,7 +2332,7 @@ static u32 handle_listen_state_expired(struct wilc_vif *vif,
kfree(wid.val);
if (result != 0) {
netdev_err(vif->ndev, "Failed to set remain channel\n");
- goto _done_;
+ return result;
}

if (hif_drv->remain_on_ch.expired) {
@@ -2345,7 +2345,6 @@ static u32 handle_listen_state_expired(struct wilc_vif *vif,
result = -EFAULT;
}

-_done_:
return result;
}

--
2.7.4

2018-04-18 11:40:28

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 02/22] staging: wilc1000: rename variable using datatype in their name in add_key()

Cleanup changes to use variable name as per linux coding style.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bdc6c85..57e7bf6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -869,9 +869,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
struct wilc_priv *priv;
const u8 *rx_mic = NULL;
const u8 *tx_mic = NULL;
- u8 u8mode = NO_ENCRYPT;
- u8 u8gmode = NO_ENCRYPT;
- u8 u8pmode = NO_ENCRYPT;
+ u8 mode = NO_ENCRYPT;
+ u8 gmode = NO_ENCRYPT;
+ u8 pmode = NO_ENCRYPT;
enum AUTHTYPE auth_type = ANY;
struct wilc *wl;
struct wilc_vif *vif;
@@ -890,13 +890,13 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
auth_type = OPEN_SYSTEM;

if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
- u8mode = ENCRYPT_ENABLED | WEP;
+ mode = ENCRYPT_ENABLED | WEP;
else
- u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
+ mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

wilc_add_wep_key_bss_ap(vif, params->key,
params->key_len, key_index,
- u8mode, auth_type);
+ mode, auth_type);
break;
}
if (memcmp(params->key, priv->wep_key[key_index], params->key_len)) {
@@ -925,11 +925,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

if (!pairwise) {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
- u8gmode = ENCRYPT_ENABLED | WPA | TKIP;
+ gmode = ENCRYPT_ENABLED | WPA | TKIP;
else
- u8gmode = ENCRYPT_ENABLED | WPA2 | AES;
+ gmode = ENCRYPT_ENABLED | WPA2 | AES;

- priv->wilc_groupkey = u8gmode;
+ priv->wilc_groupkey = gmode;

if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
tx_mic = params->key + 24;
@@ -954,13 +954,13 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
wilc_add_rx_gtk(vif, params->key, keylen,
key_index, params->seq_len,
params->seq, rx_mic,
- tx_mic, AP_MODE, u8gmode);
+ tx_mic, AP_MODE, gmode);

} else {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
- u8pmode = ENCRYPT_ENABLED | WPA | TKIP;
+ pmode = ENCRYPT_ENABLED | WPA | TKIP;
else
- u8pmode = priv->wilc_groupkey | AES;
+ pmode = priv->wilc_groupkey | AES;

if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
tx_mic = params->key + 24;
@@ -984,13 +984,13 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

wilc_add_ptk(vif, params->key, keylen,
mac_addr, rx_mic, tx_mic,
- AP_MODE, u8pmode, key_index);
+ AP_MODE, pmode, key_index);
}
break;
}

{
- u8mode = 0;
+ mode = 0;
if (!pairwise) {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
rx_mic = params->key + 24;
@@ -1002,7 +1002,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
key_index, params->seq_len,
params->seq, rx_mic,
tx_mic, STATION_MODE,
- u8mode);
+ mode);
} else {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
rx_mic = params->key + 24;
@@ -1012,7 +1012,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

wilc_add_ptk(vif, params->key, keylen,
mac_addr, rx_mic, tx_mic,
- STATION_MODE, u8mode, key_index);
+ STATION_MODE, mode, key_index);
}
}
break;
--
2.7.4

2018-04-18 11:40:57

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 15/22] staging: wilc1000: remove the use of goto label in wilc_spi_read_size()

In wilc_spi_read_size() remove the use of goto label '_fail_'. Changes
are done to avoid the use of '_' in label name.

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

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 3e3c774..57e4f11 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -917,13 +917,12 @@ static int wilc_spi_read_size(struct wilc *wilc, u32 *size)
if (!ret) {
dev_err(&spi->dev,
"Failed read WILC_VMM_TO_HOST_SIZE ...\n");
- goto _fail_;
+ return ret;
}
tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK;
*size = tmp;
}

-_fail_:
return ret;
}

--
2.7.4

2018-04-18 11:40:39

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 07/22] staging: wilc1000: use sizeof(variable) for memory allocated to store key info

Changes to fix below checkpatch reported issues.

CHECK: Prefer kmalloc(sizeof(*priv->wilc_gtk[idx])...) over
kmalloc(sizeof(struct wilc_wfi_key)...)

CHECK: Prefer kmalloc(sizeof(*priv->wilc_ptk[idx])...) over
kmalloc(sizeof(struct wilc_wfi_key)...)

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 821d4f1..0d3f85d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -871,15 +871,15 @@ static inline void wilc_wfi_cfg_copy_wep_info(struct wilc_priv *priv,
static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx)
{
if (!priv->wilc_gtk[idx]) {
- priv->wilc_gtk[idx] = kzalloc(sizeof(struct wilc_wfi_key),
- GFP_KERNEL);
+ priv->wilc_gtk[idx] = kzalloc(sizeof(*priv->wilc_gtk[idx]),
+ GFP_KERNEL);
if (!priv->wilc_gtk[idx])
return -ENOMEM;
}

if (!priv->wilc_ptk[idx]) {
- priv->wilc_ptk[idx] = kzalloc(sizeof(struct wilc_wfi_key),
- GFP_KERNEL);
+ priv->wilc_ptk[idx] = kzalloc(sizeof(*priv->wilc_ptk[idx]),
+ GFP_KERNEL);
if (!priv->wilc_ptk[idx])
return -ENOMEM;
}
--
2.7.4

2018-04-23 14:01:46

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH 00/22] staging: wilc1000: cleanup patches to follow linux coding style

On Mon, 23 Apr 2018 15:45:38 +0200
Greg KH <[email protected]> wrote:

> On Wed, Apr 18, 2018 at 05:09:02PM +0530, Ajay Singh wrote:
> > This patch series is based on top of
> > "[PATCH 00/11] staging: wilc1000: fix for checkpatch and handled
> > malloc memory properly" and its not applied yet.[1]
>
> I don't have that patch set in my queue.
>
> So please resend all outstanding patches, my queue of patches for
> this driver is now empty.

Hi Greg,

Is it okay to resend all the outstanding patch series by clubbing
them in a single patch series?

>
> thanks,
>
> greg k-h



Regards,
Ajay

2018-04-18 11:41:10

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 21/22] staging: wilc1000: remove the use of goto label in wilc_spi_clear_int_ext()

Remove goto label '_fail_' used in wilc_spi_clear_int_ext(), to avoid
the label name starting with '_'.

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

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 1db2814..2cb9f4e 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1013,7 +1013,7 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
dev_err(&spi->dev,
"Failed wilc_spi_write_reg, set reg %x ...\n",
0x10c8 + i * 4);
- goto _fail_;
+ return ret;
}
for (i = g_spi.nint; i < MAX_NUM_INT; i++) {
if (flags & 1)
@@ -1035,7 +1035,7 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
ret = wilc_spi_write_reg(wilc, WILC_VMM_TBL_CTL, tbl_ctl);
if (!ret) {
dev_err(&spi->dev, "fail write reg vmm_tbl_ctl...\n");
- goto _fail_;
+ return ret;
}

if ((val & EN_VMM) == EN_VMM) {
@@ -1045,10 +1045,10 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
ret = wilc_spi_write_reg(wilc, WILC_VMM_CORE_CTL, 1);
if (!ret) {
dev_err(&spi->dev, "fail write reg vmm_core_ctl...\n");
- goto _fail_;
+ return ret;
}
}
-_fail_:
+
return ret;
}

--
2.7.4

2018-04-23 14:44:50

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH 00/22] staging: wilc1000: cleanup patches to follow linux coding style

Hi Ajay,

You can add:
Reviewed-by: Claudiu Beznea <[email protected]>

On 23.04.2018 16:01, Ajay Singh wrote:
> On Mon, 23 Apr 2018 15:45:38 +0200
> Greg KH <[email protected]> wrote:
>
>> On Wed, Apr 18, 2018 at 05:09:02PM +0530, Ajay Singh wrote:
>>> This patch series is based on top of
>>> "[PATCH 00/11] staging: wilc1000: fix for checkpatch and handled
>>> malloc memory properly" and its not applied yet.[1]
>>
>> I don't have that patch set in my queue.
>>
>> So please resend all outstanding patches, my queue of patches for
>> this driver is now empty.
>
> Hi Greg,
>
> Is it okay to resend all the outstanding patch series by clubbing
> them in a single patch series?
>
>>
>> thanks,
>>
>> greg k-h
>
>
>
> Regards,
> Ajay
>
>

2018-04-18 11:41:12

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 22/22] staging: wilc1000: rename pu32InactiveTime to avoid camelCase issue

Avoid camelCase issues found by checkpatch.pl script.

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

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 035c537..7a26f34 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -314,7 +314,7 @@ 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);
s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
- u32 *pu32InactiveTime);
+ u32 *out_val);
int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
u8 index, u32 key_rsc_len, const u8 *key_rsc,
const u8 *rx_mic, const u8 *tx_mic, u8 mode,
--
2.7.4

2018-04-23 13:45:50

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 00/22] staging: wilc1000: cleanup patches to follow linux coding style

On Wed, Apr 18, 2018 at 05:09:02PM +0530, Ajay Singh wrote:
> This patch series is based on top of
> "[PATCH 00/11] staging: wilc1000: fix for checkpatch and handled
> malloc memory properly" and its not applied yet.[1]

I don't have that patch set in my queue.

So please resend all outstanding patches, my queue of patches for this
driver is now empty.

thanks,

greg k-h

2018-04-18 11:40:46

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 10/22] staging: wilc1000: added identifiers name in function definations

Fix identifier names required for functions definition issues reported
by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.h | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 4abbfa7..20e4659 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -222,7 +222,7 @@ struct txq_entry_t {
int buffer_size;
void *priv;
int status;
- void (*tx_complete_func)(void *, int);
+ void (*tx_complete_func)(void *priv, int status);
};

struct rxq_entry_t {
@@ -238,18 +238,18 @@ struct rxq_entry_t {
********************************************/
struct wilc;
struct wilc_hif_func {
- int (*hif_init)(struct wilc *, bool resume);
- int (*hif_deinit)(struct wilc *);
- int (*hif_read_reg)(struct wilc *, u32, u32 *);
- int (*hif_write_reg)(struct wilc *, u32, u32);
- int (*hif_block_rx)(struct wilc *, u32, u8 *, u32);
- int (*hif_block_tx)(struct wilc *, u32, u8 *, u32);
- int (*hif_read_int)(struct wilc *, u32 *);
- int (*hif_clear_int_ext)(struct wilc *, u32);
- int (*hif_read_size)(struct wilc *, u32 *);
- int (*hif_block_tx_ext)(struct wilc *, u32, u8 *, u32);
- int (*hif_block_rx_ext)(struct wilc *, u32, u8 *, u32);
- int (*hif_sync_ext)(struct wilc *, int);
+ int (*hif_init)(struct wilc *wilc, bool resume);
+ int (*hif_deinit)(struct wilc *wilc);
+ int (*hif_read_reg)(struct wilc *wilc, u32 addr, u32 *data);
+ int (*hif_write_reg)(struct wilc *wilc, u32 addr, u32 data);
+ int (*hif_block_rx)(struct wilc *wilc, u32 addr, u8 *buf, u32 size);
+ int (*hif_block_tx)(struct wilc *wilc, u32 addr, u8 *buf, u32 size);
+ int (*hif_read_int)(struct wilc *wilc, u32 *int_status);
+ int (*hif_clear_int_ext)(struct wilc *wilc, u32 val);
+ int (*hif_read_size)(struct wilc *wilc, u32 *size);
+ int (*hif_block_tx_ext)(struct wilc *wilc, u32 addr, u8 *buf, u32 size);
+ int (*hif_block_rx_ext)(struct wilc *wilc, u32 addr, u8 *buf, u32 size);
+ int (*hif_sync_ext)(struct wilc *wilc, int nint);
int (*enable_interrupt)(struct wilc *nic);
void (*disable_interrupt)(struct wilc *nic);
};
--
2.7.4

2018-04-18 11:41:03

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 18/22] staging: wilc1000: remove the use of goto label in wilc_init()

Added direct return in wilc_init() instead of goto label. Changes
are done to avoid the use of '_' in label name.

Signed-off-by: Ajay Singh <[email protected]>
---
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 65caa6d..12414f4 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3331,7 +3331,6 @@ static void get_periodic_rssi(struct timer_list *unused)

int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
{
- int result = 0;
struct host_if_drv *hif_drv;
struct wilc_vif *vif;
struct wilc *wilc;
@@ -3345,10 +3344,9 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
init_completion(&hif_wait_response);

hif_drv = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
- if (!hif_drv) {
- result = -ENOMEM;
- goto _fail_;
- }
+ if (!hif_drv)
+ return -ENOMEM;
+
*hif_drv_handler = hif_drv;
for (i = 0; i < wilc->vif_num; i++)
if (dev == wilc->vif[i]->ndev) {
@@ -3359,7 +3357,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)

wilc_optaining_ip = false;

- if (clients_count == 0) {
+ if (clients_count == 0) {
init_completion(&hif_thread_comp);
init_completion(&hif_driver_comp);
mutex_init(&hif_deinit_lock);
@@ -3370,12 +3368,12 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
init_completion(&hif_drv->comp_get_rssi);
init_completion(&hif_drv->comp_inactive_time);

- if (clients_count == 0) {
+ if (clients_count == 0) {
hif_workqueue = create_singlethread_workqueue("WILC_wq");
if (!hif_workqueue) {
netdev_err(vif->ndev, "Failed to create workqueue\n");
- result = -ENOMEM;
- goto _fail_;
+ kfree(hif_drv);
+ return -ENOMEM;
}

periodic_rssi_vif = vif;
@@ -3403,8 +3401,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)

clients_count++;

-_fail_:
- return result;
+ return 0;
}

int wilc_deinit(struct wilc_vif *vif)
--
2.7.4

2018-04-18 11:40:48

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 11/22] staging: wilc1000: remove unused macros in wilc module

Cleanup patch to remove the macros which are defined by not used.
Below mentioned macros are removed:
SCAN_DONE
SCAN_EVENT_DONE_ABORTED
WILC_WFI_RX_INTR
WILC_WFI_TX_INTR
WILC_WFI_TIMEOUT
WILC_WFI_DWELL_PASSIVE
WILC_WFI_DWELL_ACTIVE
MAX_SURVEY_RESULT_FRAG_SIZE
SURVEY_RESULT_LENGTH
NUM_BASIC_SWITCHES
NUM_FHSS_SWITCHES
NUM_11N_BASIC_SWITCHES
NUM_11N_HUT_SWITCHES
BA_SESSION_DEFAULT_BUFFER_SIZE
BA_SESSION_DEFAULT_TIMEOUT
BLOCK_ACK_REQ_SIZE

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.h | 13 -------------
drivers/staging/wilc1000/host_interface.c | 3 ---
drivers/staging/wilc1000/host_interface.h | 1 -
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 ---
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 ----
drivers/staging/wilc1000/wilc_wlan_if.h | 2 --
6 files changed, 26 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 3f5da8c..5436fd3 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -14,19 +14,8 @@

#include "wilc_wlan_if.h"

-#define NUM_BASIC_SWITCHES 45
-#define NUM_FHSS_SWITCHES 0
-
#define NUM_RSSI 5

-#ifdef MAC_802_11N
-#define NUM_11N_BASIC_SWITCHES 25
-#define NUM_11N_HUT_SWITCHES 47
-#else
-#define NUM_11N_BASIC_SWITCHES 0
-#define NUM_11N_HUT_SWITCHES 0
-#endif
-
#define MAC_HDR_LEN 24
#define MAX_SSID_LEN 33
#define FCS_LEN 4
@@ -41,8 +30,6 @@
#define GET_CFG 1

#define MAX_STRING_LEN 256
-#define MAX_SURVEY_RESULT_FRAG_SIZE MAX_STRING_LEN
-#define SURVEY_RESULT_LENGTH 44
#define MAX_ASSOC_RESP_FRAME_SIZE MAX_STRING_LEN

#define MAC_CONNECTED 1
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 6b5300c..1117705 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -53,9 +53,6 @@
#define HOST_IF_SCAN_TIMEOUT 4000
#define HOST_IF_CONNECT_TIMEOUT 9500

-#define BA_SESSION_DEFAULT_BUFFER_SIZE 16
-#define BA_SESSION_DEFAULT_TIMEOUT 1000
-#define BLOCK_ACK_REQ_SIZE 0x14
#define FALSE_FRMWR_CHANNEL 100

#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 4b60b18..035c537 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -49,7 +49,6 @@
#define PMKID_LEN 16
#define WILC_MAX_NUM_PMKIDS 16
#define WILC_ADD_STA_LENGTH 40
-#define SCAN_EVENT_DONE_ABORTED
#define NUM_CONCURRENT_IFC 2
#define DRV_HANDLER_SIZE 5
#define DRV_HANDLER_MASK 0x000000FF
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bddfbcb..9cd6be5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -79,9 +79,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
.flags = WIPHY_WOWLAN_ANY
};

-#define WILC_WFI_DWELL_PASSIVE 100
-#define WILC_WFI_DWELL_ACTIVE 40
-
#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
#define DEFAULT_LINK_SPEED 72

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index bd0c98a..07167637 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -9,10 +9,6 @@
#ifndef WILC_WFI_NETDEVICE
#define WILC_WFI_NETDEVICE

-#define WILC_WFI_RX_INTR 0x0001
-#define WILC_WFI_TX_INTR 0x0002
-
-#define WILC_WFI_TIMEOUT 5
#define WILC_MAX_NUM_PMKIDS 16
#define PMKID_LEN 16
#define PMKID_FOUND 1
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index f129d81..eb8d819 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -122,8 +122,6 @@ enum {

#define MAC_CONNECTED 1
#define MAC_DISCONNECTED 0
-
-#define SCAN_DONE TRUE
enum {
PASSIVE_SCAN = 0,
ACTIVE_SCAN = 1,
--
2.7.4

2018-04-18 11:40:54

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 14/22] staging: wilc1000: remove the use of goto label in spi_cmd_complete()

In spi_cmd_complete() remove the use of goto label '_error_'. Changes
were done to avoid the use of '_' in label name.

Signed-off-by: Ajay Singh <[email protected]>
---
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 6b392c9..3e3c774 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -527,8 +527,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev,
"Failed block read, bus err\n");
- result = N_FAIL;
- goto _error_;
+ return N_FAIL;
}

/*
@@ -537,8 +536,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
- result = N_FAIL;
- goto _error_;
+ return N_FAIL;
}

ix += nbytes;
@@ -604,7 +602,6 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
sz -= nbytes;
}
}
-_error_:
return result;
}

--
2.7.4

2018-04-18 11:40:30

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 03/22] staging: wilc1000: split add_key() to avoid line over 80 chars

Cleanup changes to fix 'line over 80 chars' issue found by checkpatch.pl
script by spliting the function. Also make use of kzalloc() instead of
kmalloc().

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 57e7bf6..0c7bf2b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -860,6 +860,58 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
return ret;
}

+static inline void wilc_wfi_cfg_copy_wep_info(struct wilc_priv *priv,
+ u8 key_index,
+ struct key_params *params)
+{
+ priv->wep_key_len[key_index] = params->key_len;
+ memcpy(priv->wep_key[key_index], params->key, params->key_len);
+}
+
+static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx)
+{
+ if (!priv->wilc_gtk[idx]) {
+ priv->wilc_gtk[idx] = kzalloc(sizeof(struct wilc_wfi_key),
+ GFP_KERNEL);
+ if (!priv->wilc_gtk[idx])
+ return -ENOMEM;
+ }
+
+ if (!priv->wilc_ptk[idx]) {
+ priv->wilc_ptk[idx] = kzalloc(sizeof(struct wilc_wfi_key),
+ GFP_KERNEL);
+ if (!priv->wilc_ptk[idx])
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
+static int wilc_wfi_cfg_copy_wpa_info(struct wilc_wfi_key *key_info,
+ struct key_params *params)
+{
+ kfree(key_info->key);
+
+ key_info->key = kmemdup(params->key, params->key_len, GFP_KERNEL);
+ if (!key_info->key)
+ return -ENOMEM;
+
+ kfree(key_info->seq);
+
+ if (params->seq_len > 0) {
+ key_info->seq = kmemdup(params->seq, params->seq_len,
+ GFP_KERNEL);
+ if (!key_info->seq)
+ return -ENOMEM;
+ }
+
+ key_info->cipher = params->cipher;
+ key_info->key_len = params->key_len;
+ key_info->seq_len = params->seq_len;
+
+ return 0;
+}
+
static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
bool pairwise,
const u8 *mac_addr, struct key_params *params)
@@ -880,12 +932,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
vif = netdev_priv(netdev);
wl = vif->wilc;

- switch (params->cipher) {
+ switch (params->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
- priv->wep_key_len[key_index] = params->key_len;
- memcpy(priv->wep_key[key_index], params->key, params->key_len);
+ wilc_wfi_cfg_copy_wep_info(priv, key_index, params);

auth_type = OPEN_SYSTEM;

@@ -899,9 +950,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
mode, auth_type);
break;
}
- if (memcmp(params->key, priv->wep_key[key_index], params->key_len)) {
- priv->wep_key_len[key_index] = params->key_len;
- memcpy(priv->wep_key[key_index], params->key, params->key_len);
+ if (memcmp(params->key, priv->wep_key[key_index],
+ params->key_len)) {
+ wilc_wfi_cfg_copy_wep_info(priv, key_index, params);

wilc_add_wep_key_bss_sta(vif, params->key,
params->key_len, key_index);
@@ -911,17 +962,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
- if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
- if (!priv->wilc_gtk[key_index]) {
- priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
- priv->wilc_gtk[key_index]->key = NULL;
- priv->wilc_gtk[key_index]->seq = NULL;
- }
- if (!priv->wilc_ptk[key_index]) {
- priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
- priv->wilc_ptk[key_index]->key = NULL;
- priv->wilc_ptk[key_index]->seq = NULL;
- }
+ if (priv->wdev->iftype == NL80211_IFTYPE_AP ||
+ priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
+ wilc_wfi_cfg_allocate_wpa_entry(priv, key_index);

if (!pairwise) {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
@@ -936,20 +979,8 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
rx_mic = params->key + 16;
keylen = params->key_len - 16;
}
- kfree(priv->wilc_gtk[key_index]->key);
-
- priv->wilc_gtk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL);
- memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len);
- kfree(priv->wilc_gtk[key_index]->seq);
-
- if (params->seq_len > 0) {
- priv->wilc_gtk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);
- memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len);
- }
-
- priv->wilc_gtk[key_index]->cipher = params->cipher;
- priv->wilc_gtk[key_index]->key_len = params->key_len;
- priv->wilc_gtk[key_index]->seq_len = params->seq_len;
+ wilc_wfi_cfg_copy_wpa_info(priv->wilc_gtk[key_index],
+ params);

wilc_add_rx_gtk(vif, params->key, keylen,
key_index, params->seq_len,
@@ -968,19 +999,8 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
keylen = params->key_len - 16;
}

- kfree(priv->wilc_ptk[key_index]->key);
- priv->wilc_ptk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL);
- memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len);
-
- kfree(priv->wilc_ptk[key_index]->seq);
- if (params->seq_len > 0) {
- priv->wilc_ptk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);
- memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len);
- }
-
- priv->wilc_ptk[key_index]->cipher = params->cipher;
- priv->wilc_ptk[key_index]->key_len = params->key_len;
- priv->wilc_ptk[key_index]->seq_len = params->seq_len;
+ wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index],
+ params);

wilc_add_ptk(vif, params->key, keylen,
mac_addr, rx_mic, tx_mic,
--
2.7.4

2018-04-18 11:40:37

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 06/22] staging: wilc1000: handle error condition in add_key() and remove auth_type variable

Added the code to return correct error code in add_key() and also removed
'auth_type' variable. Now passing diretly to function instead of using
the 'auth_type' variable.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 329899f..821d4f1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -923,7 +923,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
const u8 *tx_mic = NULL;
u8 mode = NO_ENCRYPT;
u8 op_mode;
- enum AUTHTYPE auth_type = ANY;
struct wilc *wl;
struct wilc_vif *vif;

@@ -937,24 +936,24 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);

- auth_type = OPEN_SYSTEM;
-
if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
mode = ENCRYPT_ENABLED | WEP;
else
mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

- wilc_add_wep_key_bss_ap(vif, params->key,
- params->key_len, key_index,
- mode, auth_type);
+ ret = wilc_add_wep_key_bss_ap(vif, params->key,
+ params->key_len,
+ key_index, mode,
+ OPEN_SYSTEM);
break;
}
if (memcmp(params->key, priv->wep_key[key_index],
params->key_len)) {
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);

- wilc_add_wep_key_bss_sta(vif, params->key,
- params->key_len, key_index);
+ ret = wilc_add_wep_key_bss_sta(vif, params->key,
+ params->key_len,
+ key_index);
}

break;
@@ -963,7 +962,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP ||
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
- wilc_wfi_cfg_allocate_wpa_entry(priv, key_index);
+ ret = wilc_wfi_cfg_allocate_wpa_entry(priv, key_index);
+ if (ret)
+ return -ENOMEM;

if (params->key_len > 16 &&
params->cipher == WLAN_CIPHER_SUITE_TKIP) {
@@ -980,16 +981,20 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

priv->wilc_groupkey = mode;

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

- wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index],
- params);
+ ret = wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index],
+ params);
+ if (ret)
+ return -ENOMEM;
}
op_mode = AP_MODE;
} else {
@@ -1003,17 +1008,16 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
op_mode = STATION_MODE;
}

- if (!pairwise) {
- wilc_add_rx_gtk(vif, params->key, keylen,
- key_index, params->seq_len,
- params->seq, rx_mic,
- tx_mic, op_mode,
- mode);
- } else {
- wilc_add_ptk(vif, params->key, keylen,
- mac_addr, rx_mic, tx_mic,
- op_mode, mode, key_index);
- }
+ if (!pairwise)
+ ret = wilc_add_rx_gtk(vif, params->key, keylen,
+ key_index, params->seq_len,
+ params->seq, rx_mic, tx_mic,
+ op_mode, mode);
+ else
+ ret = wilc_add_ptk(vif, params->key, keylen, mac_addr,
+ rx_mic, tx_mic, op_mode, mode,
+ key_index);
+
break;

default:
--
2.7.4

2018-04-18 11:40:27

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 01/22] staging: wilc1000: rename WILC_WFI_wep_key & WILC_WFI_wep_key_len

Cleanup patch to use lower case for variable name as per linux coding
style.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 3139ead..bdc6c85 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -726,15 +726,15 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
return ret;
}

- memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key));
- memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len));
+ memset(priv->wep_key, 0, sizeof(priv->wep_key));
+ memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));

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

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

wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
@@ -742,8 +742,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
} else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

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

wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
@@ -884,8 +884,8 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
- priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
- memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len);
+ priv->wep_key_len[key_index] = params->key_len;
+ memcpy(priv->wep_key[key_index], params->key, params->key_len);

auth_type = OPEN_SYSTEM;

@@ -899,9 +899,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
u8mode, auth_type);
break;
}
- if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
- priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
- memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len);
+ if (memcmp(params->key, priv->wep_key[key_index], params->key_len)) {
+ priv->wep_key_len[key_index] = params->key_len;
+ memcpy(priv->wep_key[key_index], params->key, params->key_len);

wilc_add_wep_key_bss_sta(vif, params->key,
params->key_len, key_index);
@@ -1060,10 +1060,10 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
}

if (key_index >= 0 && key_index <= 3) {
- if (priv->WILC_WFI_wep_key_len[key_index]) {
- memset(priv->WILC_WFI_wep_key[key_index], 0,
- priv->WILC_WFI_wep_key_len[key_index]);
- priv->WILC_WFI_wep_key_len[key_index] = 0;
+ if (priv->wep_key_len[key_index]) {
+ memset(priv->wep_key[key_index], 0,
+ priv->wep_key_len[key_index]);
+ priv->wep_key_len[key_index] = 0;
wilc_remove_wep_key(vif, key_index);
}
} else {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index d62c4f1..bd0c98a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -124,8 +124,8 @@ struct wilc_priv {
struct host_if_drv *hif_drv;
struct host_if_pmkid_attr pmkid_list;
struct WILC_WFI_stats netstats;
- u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
- u8 WILC_WFI_wep_key_len[4];
+ u8 wep_key[4][WLAN_KEY_LEN_WEP104];
+ u8 wep_key_len[4];
/* The real interface that the monitor is on */
struct net_device *real_ndev;
struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
--
2.7.4

2018-04-18 11:40:35

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 05/22] staging: wilc1000: refactor add_key() to avoid duplicated code

Cleanup fixes by removing the duplicated code in actor add_key().

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ac4cd58..329899f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -922,8 +922,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
const u8 *rx_mic = NULL;
const u8 *tx_mic = NULL;
u8 mode = NO_ENCRYPT;
- u8 gmode = NO_ENCRYPT;
- u8 pmode = NO_ENCRYPT;
+ u8 op_mode;
enum AUTHTYPE auth_type = ANY;
struct wilc *wl;
struct wilc_vif *vif;
@@ -966,71 +965,54 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
wilc_wfi_cfg_allocate_wpa_entry(priv, key_index);

+ if (params->key_len > 16 &&
+ params->cipher == WLAN_CIPHER_SUITE_TKIP) {
+ tx_mic = params->key + 24;
+ rx_mic = params->key + 16;
+ keylen = params->key_len - 16;
+ }
+
if (!pairwise) {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
- gmode = ENCRYPT_ENABLED | WPA | TKIP;
+ mode = ENCRYPT_ENABLED | WPA | TKIP;
else
- gmode = ENCRYPT_ENABLED | WPA2 | AES;
+ mode = ENCRYPT_ENABLED | WPA2 | AES;

- priv->wilc_groupkey = gmode;
+ priv->wilc_groupkey = mode;

- if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
- tx_mic = params->key + 24;
- rx_mic = params->key + 16;
- keylen = params->key_len - 16;
- }
wilc_wfi_cfg_copy_wpa_info(priv->wilc_gtk[key_index],
params);
-
- wilc_add_rx_gtk(vif, params->key, keylen,
- key_index, params->seq_len,
- params->seq, rx_mic,
- tx_mic, AP_MODE, gmode);
-
} else {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
- pmode = ENCRYPT_ENABLED | WPA | TKIP;
+ mode = ENCRYPT_ENABLED | WPA | TKIP;
else
- pmode = priv->wilc_groupkey | AES;
-
- if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
- tx_mic = params->key + 24;
- rx_mic = params->key + 16;
- keylen = params->key_len - 16;
- }
+ mode = priv->wilc_groupkey | AES;

wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index],
params);
-
- wilc_add_ptk(vif, params->key, keylen,
- mac_addr, rx_mic, tx_mic,
- AP_MODE, pmode, key_index);
}
- break;
- }
-
- if (!pairwise) {
- if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
+ op_mode = AP_MODE;
+ } else {
+ if (params->key_len > 16 &&
+ params->cipher == WLAN_CIPHER_SUITE_TKIP) {
rx_mic = params->key + 24;
tx_mic = params->key + 16;
keylen = params->key_len - 16;
}

+ op_mode = STATION_MODE;
+ }
+
+ if (!pairwise) {
wilc_add_rx_gtk(vif, params->key, keylen,
key_index, params->seq_len,
params->seq, rx_mic,
- tx_mic, STATION_MODE,
+ tx_mic, op_mode,
mode);
} else {
- if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
- rx_mic = params->key + 24;
- tx_mic = params->key + 16;
- keylen = params->key_len - 16;
- }
-
wilc_add_ptk(vif, params->key, keylen,
mac_addr, rx_mic, tx_mic,
- STATION_MODE, mode, key_index);
+ op_mode, mode, key_index);
}
break;

--
2.7.4

2018-04-18 11:40:50

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 12/22] staging: wilc1000: remove multiple define used for MAX_SSID_LEN

Cleanup patch to have commonly used macro in common header file to avoid
same defination in mulitple file. Removed MAX_SSID_LEN macro from
coreconfigurator.h header as its already defined in wilc_wlan_if.h.

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

diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 5436fd3..1666b7a 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -17,7 +17,6 @@
#define NUM_RSSI 5

#define MAC_HDR_LEN 24
-#define MAX_SSID_LEN 33
#define FCS_LEN 4
#define TIME_STAMP_LEN 8
#define BEACON_INTERVAL_LEN 2
--
2.7.4

2018-04-23 14:11:42

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 00/22] staging: wilc1000: cleanup patches to follow linux coding style

On Mon, Apr 23, 2018 at 07:31:38PM +0530, Ajay Singh wrote:
> On Mon, 23 Apr 2018 15:45:38 +0200
> Greg KH <[email protected]> wrote:
>
> > On Wed, Apr 18, 2018 at 05:09:02PM +0530, Ajay Singh wrote:
> > > This patch series is based on top of
> > > "[PATCH 00/11] staging: wilc1000: fix for checkpatch and handled
> > > malloc memory properly" and its not applied yet.[1]
> >
> > I don't have that patch set in my queue.
> >
> > So please resend all outstanding patches, my queue of patches for
> > this driver is now empty.
>
> Hi Greg,
>
> Is it okay to resend all the outstanding patch series by clubbing
> them in a single patch series?

Yes, that would be easiest for both of us.

thanks,

greg k-h

2018-04-18 11:40:41

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 08/22] staging: wilc1000: fix line over 80 chars in change_station()

Fix 'line over 80 chars' issue found by checkpatch.pl script.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0d3f85d..bddfbcb 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1155,10 +1155,10 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
wilc_get_statistics(vif, &stats);

sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
- BIT(NL80211_STA_INFO_RX_PACKETS) |
- BIT(NL80211_STA_INFO_TX_PACKETS) |
- BIT(NL80211_STA_INFO_TX_FAILED) |
- BIT(NL80211_STA_INFO_TX_BITRATE);
+ BIT(NL80211_STA_INFO_RX_PACKETS) |
+ BIT(NL80211_STA_INFO_TX_PACKETS) |
+ BIT(NL80211_STA_INFO_TX_FAILED) |
+ BIT(NL80211_STA_INFO_TX_BITRATE);

sinfo->signal = stats.rssi;
sinfo->rx_packets = stats.rx_cnt;
--
2.7.4