2015-11-03 07:17:59

by Glen Lee

[permalink] [raw]
Subject: [PATCH 1/5] staging: wilc1000: change enum variable name with lower case

This patch changes WID_TYPE with wid_type which is preferred style.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.h | 2 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 1ea5f47..7545856 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -72,7 +72,7 @@ typedef enum {

struct wid {
u16 id;
- enum WID_TYPE type;
+ enum wid_type type;
s32 size;
s8 *val;
};
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 1170169..be90558 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -312,7 +312,7 @@ typedef enum {
SW_TRIGGER_ABORT,
} TX_ABORT_OPTION_T;

-enum WID_TYPE {
+enum wid_type {
WID_CHAR = 0,
WID_SHORT = 1,
WID_INT = 2,
--
1.9.1



2015-11-03 07:18:52

by Glen Lee

[permalink] [raw]
Subject: [PATCH 4/5] staging: wilc1000: send_config_pkt: remove unnecessary blank line

This patch remove unnecessary blank line which is reported by checkpatch.pl

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

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 1842f8f..3ddbe23 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -612,7 +612,6 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
wids[counter].id,
wids[counter].val,
wids[counter].size);
-
}
} else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) {
--
1.9.1


2015-11-03 07:18:58

by Glen Lee

[permalink] [raw]
Subject: [PATCH 5/5] staging: wilc1000: move send_config_pkt to wilc_wlan.c

send_config_pkt function and it's related structure wid_type is moved to
wilc_wlan.c because wilc_wlan.c handle message transport. the coreconfigurator
is all about frames, so it will be frame.[ch] later.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 64 -----------------------------
drivers/staging/wilc1000/coreconfigurator.h | 9 ----
drivers/staging/wilc1000/wilc_wlan.c | 49 ++++++++++++++++++++++
drivers/staging/wilc1000/wilc_wlan.h | 9 ++++
4 files changed, 58 insertions(+), 73 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 3ddbe23..1caa66e 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -570,67 +570,3 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)

return s32Error;
}
-
-/**
- * @brief sends certain Configuration Packet based on the input WIDs pstrWIDs
- * using driver config layer
- *
- * @details
- * @param[in] pstrWIDs WIDs to be sent in the configuration packet
- * @param[in] u32WIDsCount number of WIDs to be sent in the configuration packet
- * @param[out] pu8RxResp The received Packet Response
- * @param[out] ps32RxRespLen Length of the received Packet Response
- * @return Error code indicating success/failure
- * @note
- * @author mabubakr
- * @date 1 Mar 2012
- * @version 1.0
- */
-s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
- u32 count, u32 drv)
-{
- s32 counter = 0, ret = 0;
-
- if (mode == GET_CFG) {
- for (counter = 0; counter < count; counter++) {
- netdev_info(dev, "Sending CFG packet [%d][%d]\n",
- !counter, (counter == count - 1));
- if (!wilc_wlan_cfg_get(dev,
- !counter,
- wids[counter].id,
- (counter == count - 1),
- drv)) {
- ret = -EBUSY;
- netdev_err(dev,
- "[Sendconfigpkt]Get Timed out\n");
- break;
- }
- }
- counter = 0;
- for (counter = 0; counter < count; counter++) {
- wids[counter].size = wilc_wlan_cfg_get_val(
- wids[counter].id,
- wids[counter].val,
- wids[counter].size);
- }
- } else if (mode == SET_CFG) {
- for (counter = 0; counter < count; counter++) {
- netdev_info(dev, "Sending config SET PACKET WID:%x\n",
- wids[counter].id);
- if (!wilc_wlan_cfg_set(dev,
- !counter,
- wids[counter].id,
- wids[counter].val,
- wids[counter].size,
- (counter == count - 1),
- drv)) {
- ret = -EBUSY;
- netdev_err(dev,
- "[Sendconfigpkt]Set Timed out\n");
- break;
- }
- }
- }
-
- return ret;
-}
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 7545856..7702a0f 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -70,13 +70,6 @@ typedef enum {
CONNECT_STS_FORCE_16_BIT = 0xFFFF
} tenuConnectSts;

-struct wid {
- u16 id;
- enum wid_type type;
- s32 size;
- s8 *val;
-};
-
typedef struct {
u8 u8Full;
u8 u8Index;
@@ -127,8 +120,6 @@ typedef struct {
size_t ie_len;
} tstrDisconnectNotifInfo;

-s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
- u32 count, u32 drv);
s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 152dba5..44787b0 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -2104,3 +2104,52 @@ u16 set_machw_change_vir_if(struct net_device *dev, bool bValue)

return ret;
}
+
+s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
+ u32 count, u32 drv)
+{
+ s32 counter = 0, ret = 0;
+
+ if (mode == GET_CFG) {
+ for (counter = 0; counter < count; counter++) {
+ netdev_info(dev, "Sending CFG packet [%d][%d]\n",
+ !counter, (counter == count - 1));
+ if (!wilc_wlan_cfg_get(dev,
+ !counter,
+ wids[counter].id,
+ (counter == count - 1),
+ drv)) {
+ ret = -EBUSY;
+ netdev_err(dev,
+ "[Sendconfigpkt]Get Timed out\n");
+ break;
+ }
+ }
+ counter = 0;
+ for (counter = 0; counter < count; counter++) {
+ wids[counter].size = wilc_wlan_cfg_get_val(
+ wids[counter].id,
+ wids[counter].val,
+ wids[counter].size);
+ }
+ } else if (mode == SET_CFG) {
+ for (counter = 0; counter < count; counter++) {
+ netdev_info(dev, "Sending config SET PACKET WID:%x\n",
+ wids[counter].id);
+ if (!wilc_wlan_cfg_set(dev,
+ !counter,
+ wids[counter].id,
+ wids[counter].val,
+ wids[counter].size,
+ (counter == count - 1),
+ drv)) {
+ ret = -EBUSY;
+ netdev_err(dev,
+ "[Sendconfigpkt]Set Timed out\n");
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 73e01a7..e5dcea9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -295,6 +295,13 @@ typedef struct {
u32 seq_no;
} wilc_cfg_rsp_t;

+struct wid {
+ u16 id;
+ enum wid_type type;
+ s32 size;
+ s8 *val;
+};
+
int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
u32 buffer_size);
int wilc_wlan_start(struct net_device *dev);
@@ -312,4 +319,6 @@ int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
u32 buffer_size, wilc_tx_complete_func_t func);
void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime);
+s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
+ u32 count, u32 drv);
#endif
--
1.9.1


2015-11-03 07:18:22

by Glen Lee

[permalink] [raw]
Subject: [PATCH 2/5] staging: wilc1000: send_config_pkt: use netdev print

This patch use netdev_xxx print format instead of custom print api and printk.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 74fb556..637e8ca 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -593,15 +593,16 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,

if (mode == GET_CFG) {
for (counter = 0; counter < count; counter++) {
- PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter,
- (counter == count - 1));
+ netdev_info(dev, "Sending CFG packet [%d][%d]\n",
+ !counter, (counter == count - 1));
if (!wilc_wlan_cfg_get(dev,
!counter,
wids[counter].id,
(counter == count - 1),
drv)) {
ret = -1;
- printk("[Sendconfigpkt]Get Timed out\n");
+ netdev_err(dev,
+ "[Sendconfigpkt]Get Timed out\n");
break;
}
}
@@ -615,7 +616,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
}
} else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) {
- PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id);
+ netdev_info(dev, "Sending config SET PACKET WID:%x\n",
+ wids[counter].id);
if (!wilc_wlan_cfg_set(dev,
!counter,
wids[counter].id,
@@ -624,7 +626,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
(counter == count - 1),
drv)) {
ret = -1;
- printk("[Sendconfigpkt]Set Timed out\n");
+ netdev_err(dev,
+ "[Sendconfigpkt]Set Timed out\n");
break;
}
}
--
1.9.1


2015-11-04 20:52:59

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/5] staging: wilc1000: change enum variable name with lower case

On Tue, Nov 03, 2015 at 04:20:58PM +0900, Glen Lee wrote:
> This patch changes WID_TYPE with wid_type which is preferred style.
>
> Signed-off-by: Glen Lee <[email protected]>
> ---
> drivers/staging/wilc1000/coreconfigurator.h | 2 +-
> drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)

Some of these patches applied, some did not, please refresh and resend
the ones I didn't take.

thanks,

greg k-h

2015-11-03 07:18:28

by Glen Lee

[permalink] [raw]
Subject: [PATCH 3/5] staging: wilc1000: send_config_pkt: return linux error number

Use proper linux error number instead of -1.

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

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 637e8ca..1842f8f 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -600,7 +600,7 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
wids[counter].id,
(counter == count - 1),
drv)) {
- ret = -1;
+ ret = -EBUSY;
netdev_err(dev,
"[Sendconfigpkt]Get Timed out\n");
break;
@@ -625,7 +625,7 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
wids[counter].size,
(counter == count - 1),
drv)) {
- ret = -1;
+ ret = -EBUSY;
netdev_err(dev,
"[Sendconfigpkt]Set Timed out\n");
break;
--
1.9.1