Skip to contentSkip to conversation

staging: wilc1000: fix return type of wilc_hif_set_cfg

PATCH Superseded Chaehyun Lim 2 participants 9 messages Feb 5, 2016 – Feb 7, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 staging: wilc1000: fix return type of wilc_hif_set_cfg

This patch changes return type of wilc_hif_set_cfg from s32 to int. The result variable gets return value from wilc_mq_send that has data type of int. It should be changed return type of this function as well as data type of result variable.

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index d77e2b2..a5b7dd1 100644
@@ -3729,10 +3729,10 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 	return result;
 }
 
-s32 wilc_hif_set_cfg(struct wilc_vif *vif,
+int wilc_hif_set_cfg(struct wilc_vif *vif,
 		     struct cfg_param_val *pstrCfgParamVal)
 {
-	s32 result = 0;
+	int result = 0;
 	struct host_if_msg msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
drivers/staging/wilc1000/host_interface.h +1 -1
index 4c02e6b..fe32a9a 100644
@@ -339,7 +339,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 	      u8 *ch_freq_list, u8 ch_list_len, const u8 *ies,
 	      size_t ies_len, wilc_scan_result scan_result, void *user_arg,
 	      struct hidden_network *hidden_network);
-s32 wilc_hif_set_cfg(struct wilc_vif *vif,
+int wilc_hif_set_cfg(struct wilc_vif *vif,
 		     struct cfg_param_val *pstrCfgParamVal);
 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
 s32 wilc_deinit(struct wilc_vif *vif);
Signature · 1 line
2.7.0
#1 lore raw

PATCH 2/8 staging: wilc1000: rename pstrCfgParamVal in wilc_hif_set_cfg

This patch renames pstrCfgParamVal to cfg_param to avoid camelcase.

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index a5b7dd1..0f8175f 100644
@@ -3730,7 +3730,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 }
 
 int wilc_hif_set_cfg(struct wilc_vif *vif,
-		     struct cfg_param_val *pstrCfgParamVal)
+		     struct cfg_param_val *cfg_param)
 {
 	int result = 0;
 	struct host_if_msg msg;
@@ -3743,7 +3743,7 @@ int wilc_hif_set_cfg(struct wilc_vif *vif,
 
 	memset(&msg, 0, sizeof(struct host_if_msg));
 	msg.id = HOST_IF_MSG_CFG_PARAMS;
-	msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal;
+	msg.body.cfg_info.cfg_attr_info = *cfg_param;
 	msg.vif = vif;
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
drivers/staging/wilc1000/host_interface.h +1 -1
index fe32a9a..4b19bf1 100644
@@ -340,7 +340,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 	      size_t ies_len, wilc_scan_result scan_result, void *user_arg,
 	      struct hidden_network *hidden_network);
 int wilc_hif_set_cfg(struct wilc_vif *vif,
-		     struct cfg_param_val *pstrCfgParamVal);
+		     struct cfg_param_val *cfg_param);
 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
 s32 wilc_deinit(struct wilc_vif *vif);
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
Signature · 1 line
2.7.0
#2 lore raw

PATCH 3/8 staging: wilc1000: fix return type of wilc_deinit

In reply to Chaehyun Lim

This patch changes return type of wilc_deinit from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable.

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index 0f8175f..36eeeb4 100644
@@ -3882,9 +3882,9 @@ _fail_:
 	return result;
 }
 
-s32 wilc_deinit(struct wilc_vif *vif)
+int wilc_deinit(struct wilc_vif *vif)
 {
-	s32 result = 0;
+	int result = 0;
 	struct host_if_msg msg;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
drivers/staging/wilc1000/host_interface.h +1 -1
index 4b19bf1..f4e6839 100644
@@ -342,7 +342,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 int wilc_hif_set_cfg(struct wilc_vif *vif,
 		     struct cfg_param_val *cfg_param);
 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
-s32 wilc_deinit(struct wilc_vif *vif);
+int wilc_deinit(struct wilc_vif *vif);
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
 		    u32 head_len, u8 *head, u32 tail_len, u8 *tail);
 int wilc_del_beacon(struct wilc_vif *vif);
Signature · 1 line
2.7.0
#3 lore raw

PATCH 4/8 staging: wilc1000: fix return error code of wilc_deinit

In reply to Chaehyun Lim

It should be returned error code as -EFAULT instead of 0 when hif_drv is NULL.

---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.c +1 -1
index 36eeeb4..6c91071 100644
@@ -3890,7 +3890,7 @@ int wilc_deinit(struct wilc_vif *vif)
 
 	if (!hif_drv)	{
 		PRINT_ER("hif_drv = NULL\n");
-		return 0;
+		return -EFAULT;
 	}
 
 	down(&hif_sema_deinit);
Signature · 1 line
2.7.0
#4 lore raw

PATCH 5/8 staging: wilc1000: fix return type of wilc_send_config_pkt

In reply to Chaehyun Lim

wilc_send_config_pkt is returned 0 or -ETIMEDOUT according to return value of wilc_wlan_cfg_get or wilc_wlan_cfg_set.
It is better to use int type to represent linux standard error code.

---
 drivers/staging/wilc1000/coreconfigurator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +3 -2
index 49ae9b1..323a0cd 100644
@@ -449,10 +449,11 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
  *  @date		1 Mar 2012
  *  @version	1.0
  */
-s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
+int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 			 u32 count, u32 drv)
 {
-	s32 counter = 0, ret = 0;
+	s32 counter = 0;
+	int ret = 0;
 
 	if (mode == GET_CFG) {
 		for (counter = 0; counter < count; counter++) {
Signature · 1 line
2.7.0
maintainer
#5 lore raw

Re: [PATCH 5/8] staging: wilc1000: fix return type of wilc_send_config_pkt

Quoted 8 lines · Chaehyun Lim

wilc_send_config_pkt is returned 0 or -ETIMEDOUT according to return value of wilc_wlan_cfg_get or wilc_wlan_cfg_set.
It is better to use int type to represent linux standard error code.

---
 drivers/staging/wilc1000/coreconfigurator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

This, and the remaining patches in the series, don't apply anymore due to patches I took right before your series. Can you refresh these and resend?

thanks,

greg k-h

#6 lore raw

PATCH 6/8 staging: wilc1000: use int type for counter variable

In reply to Chaehyun Lim

counter is used as for-loop control variable and indicating index of struct wid array so that it is better to use int type. There is no need to set to 0 when it is declared at the top of this function. It is initialized as 0 in for-loop statement.

---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/coreconfigurator.c +1 -1
index 323a0cd..4008872 100644
@@ -452,7 +452,7 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
 int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 			 u32 count, u32 drv)
 {
-	s32 counter = 0;
+	int counter;
 	int ret = 0;
 
 	if (mode == GET_CFG) {
Signature · 1 line
2.7.0
#7 lore raw

PATCH 7/8 staging: wilc1000: remove initialization code of counter variable

In reply to Chaehyun Lim

There is no need to set to 0 for counter variable before entering next for-loop statement because counter is initialized again in for-loop statement, so just remove it.

---
 drivers/staging/wilc1000/coreconfigurator.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -1
index 4008872..dda81ee 100644
@@ -468,7 +468,6 @@ int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 				break;
 			}
 		}
-		counter = 0;
 		for (counter = 0; counter < count; counter++) {
 			wids[counter].size = wilc_wlan_cfg_get_val(
 					wids[counter].id,
Signature · 1 line
2.7.0
#8 lore raw

PATCH 8/8 staging: wilc1000: rename counter in wilc_send_config_pkt

In reply to Chaehyun Lim

counter is used as for-loop control variable and indicating index of struct wid array. It is to improve readability by changing counter variable name as i because wilc_send_config_pkt has a similar argument name as count.

---
 drivers/staging/wilc1000/coreconfigurator.c | 38 ++++++++++++++---------------
 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +19 -19
index dda81ee..00081bc 100644
@@ -452,36 +452,36 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
 int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 			 u32 count, u32 drv)
 {
-	int counter;
+	int i;
 	int ret = 0;
 
 	if (mode == GET_CFG) {
-		for (counter = 0; counter < count; counter++) {
-			PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter,
-				   (counter == count - 1));
-			if (!wilc_wlan_cfg_get(wilc, !counter,
-					       wids[counter].id,
-					       (counter == count - 1),
+		for (i = 0; i < count; i++) {
+			PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !i,
+				   (i == count - 1));
+			if (!wilc_wlan_cfg_get(wilc, !i,
+					       wids[i].id,
+					       (i == count - 1),
 					       drv)) {
 				ret = -ETIMEDOUT;
 				printk("[Sendconfigpkt]Get Timed out\n");
 				break;
 			}
 		}
-		for (counter = 0; counter < count; counter++) {
-			wids[counter].size = wilc_wlan_cfg_get_val(
-					wids[counter].id,
-					wids[counter].val,
-					wids[counter].size);
+		for (i = 0; i < count; i++) {
+			wids[i].size = wilc_wlan_cfg_get_val(
+					wids[i].id,
+					wids[i].val,
+					wids[i].size);
 		}
 	} 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);
-			if (!wilc_wlan_cfg_set(wilc, !counter,
-					       wids[counter].id,
-					       wids[counter].val,
-					       wids[counter].size,
-					       (counter == count - 1),
+		for (i = 0; i < count; i++) {
+			PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[i].id);
+			if (!wilc_wlan_cfg_set(wilc, !i,
+					       wids[i].id,
+					       wids[i].val,
+					       wids[i].size,
+					       (i == count - 1),
 					       drv)) {
 				ret = -ETIMEDOUT;
 				printk("[Sendconfigpkt]Set Timed out\n");
Signature · 1 line
2.7.0