Skip to contentSkip to conversation

staging: wilc1000: fix return type of host_int_del_beacon

PATCH Superseded Chaehyun Lim 2 participants 13 messages Oct 29, 2015 – Nov 4, 2015 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/12 staging: wilc1000: fix return type of host_int_del_beacon

This patch changes return type of host_int_del_beacon 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.

---
V2: resend because 11/12 patch is changed.

 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 dbbe72c..b469962 100644
@@ -4495,9 +4495,9 @@ ERRORHANDLER:
 	return result;
 }
 
-s32 host_int_del_beacon(struct host_if_drv *hif_drv)
+int host_int_del_beacon(struct host_if_drv *hif_drv)
 {
-	s32 result = 0;
+	int result = 0;
 	struct host_if_msg msg;
 
 	if (!hif_drv) {
drivers/staging/wilc1000/host_interface.h +1 -1
index b854db5..698a588 100644
@@ -932,7 +932,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
  *  @date		10 Julys 2012
  *  @version		1.0 Description
  */
-s32 host_int_del_beacon(struct host_if_drv *hWFIDrv);
+int host_int_del_beacon(struct host_if_drv *hWFIDrv);
 
 /*!
  *  @fn		s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv,
Signature · 1 line
2.6.1
#1 lore raw

PATCH v2 2/12 staging: wilc1000: fix parameter name of host_int_del_beacon

This patch changes struct host_if_drv of host_int_del_beacon function declaration from hWFIDrv to hif_drv.
With this change, first parameter name of this function declaration and definition has same name as hif_drv.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.h +1 -1
index 698a588..36de990 100644
@@ -932,7 +932,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
  *  @date		10 Julys 2012
  *  @version		1.0 Description
  */
-int host_int_del_beacon(struct host_if_drv *hWFIDrv);
+int host_int_del_beacon(struct host_if_drv *hif_drv);
 
 /*!
  *  @fn		s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv,
Signature · 1 line
2.6.1
#2 lore raw

PATCH v2 3/12 staging: wilc1000: fix return type of host_int_del_station

In reply to Chaehyun Lim

This patch changes return type of host_int_del_station 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.

---
V2: resend because 11/12 patch is changed.

 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 b469962..be5e652 100644
@@ -4552,9 +4552,9 @@ s32 host_int_add_station(struct host_if_drv *hif_drv,
 	return result;
 }
 
-s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
+int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
 {
-	s32 result = 0;
+	int result = 0;
 	struct host_if_msg msg;
 	struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info;
 
drivers/staging/wilc1000/host_interface.h +1 -1
index 36de990..9eb1b3b 100644
@@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE
  *  @date		15 July 2012
  *  @version		1.0 Description
  */
-s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
+int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
 
 /*!
  *  @fn		s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
Signature · 1 line
2.6.1
#3 lore raw

PATCH v2 4/12 staging: wilc1000: fix parameter name of host_int_del_station

In reply to Chaehyun Lim

This patch changes struct host_if_drv of host_int_del_station function declaration from hWFIDrv to hif_drv.
With this change, first parameter name of this function declaration and definition has same name as hif_drv.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.h +1 -1
index 9eb1b3b..083def57 100644
@@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE
  *  @date		15 July 2012
  *  @version		1.0 Description
  */
-int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
+int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr);
 
 /*!
  *  @fn		s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
Signature · 1 line
2.6.1
#4 lore raw

PATCH v2 5/12 staging: wilc1000: rename pu8MacAddr in host_int_del_station

In reply to Chaehyun Lim

This patch changes pu8MacAddr to mac_addr that is second argument of this function to avoid camelcase.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.c | 6 +++---
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -3
index be5e652..8dba9a3 100644
@@ -4552,7 +4552,7 @@ s32 host_int_add_station(struct host_if_drv *hif_drv,
 	return result;
 }
 
-int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
+int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)
 {
 	int result = 0;
 	struct host_if_msg msg;
@@ -4570,10 +4570,10 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
 	msg.id = HOST_IF_MSG_DEL_STATION;
 	msg.drv = hif_drv;
 
-	if (!pu8MacAddr)
+	if (!mac_addr)
 		eth_broadcast_addr(pstrDelStationMsg->mac_addr);
 	else
-		memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN);
+		memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN);
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
 	if (result)
drivers/staging/wilc1000/host_interface.h +1 -1
index 083def57..be9283f 100644
@@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE
  *  @date		15 July 2012
  *  @version		1.0 Description
  */
-int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr);
+int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr);
 
 /*!
  *  @fn		s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
Signature · 1 line
2.6.1
#5 lore raw

PATCH v2 6/12 staging: wilc1000: rename pstrDelStationMsg in host_int_del_station

In reply to Chaehyun Lim

This patch renames pstrDelStationMsg to del_sta_info to avoid camelcase.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -3
index 8dba9a3..fe4ccdb 100644
@@ -4556,7 +4556,7 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)
 {
 	int result = 0;
 	struct host_if_msg msg;
-	struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info;
+	struct del_sta *del_sta_info = &msg.body.del_sta_info;
 
 	if (!hif_drv) {
 		PRINT_ER("driver is null\n");
@@ -4571,9 +4571,9 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)
 	msg.drv = hif_drv;
 
 	if (!mac_addr)
-		eth_broadcast_addr(pstrDelStationMsg->mac_addr);
+		eth_broadcast_addr(del_sta_info->mac_addr);
 	else
-		memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN);
+		memcpy(del_sta_info->mac_addr, mac_addr, ETH_ALEN);
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
 	if (result)
Signature · 1 line
2.6.1
#6 lore raw

PATCH v2 7/12 staging: wilc1000: fix return type of host_int_add_station

In reply to Chaehyun Lim

This patch changes return type of host_int_add_station 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.

---
V2: resend because 11/12 patch is changed.

 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 fe4ccdb..0f36825 100644
@@ -4516,10 +4516,10 @@ int host_int_del_beacon(struct host_if_drv *hif_drv)
 	return result;
 }
 
-s32 host_int_add_station(struct host_if_drv *hif_drv,
+int host_int_add_station(struct host_if_drv *hif_drv,
 			 struct add_sta_param *pstrStaParams)
 {
-	s32 result = 0;
+	int result = 0;
 	struct host_if_msg msg;
 	struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
 
drivers/staging/wilc1000/host_interface.h +1 -1
index be9283f..3fcff7a 100644
@@ -948,7 +948,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv);
  *  @date		12 July 2012
  *  @version		1.0 Description
  */
-s32 host_int_add_station(struct host_if_drv *hWFIDrv,
+int host_int_add_station(struct host_if_drv *hWFIDrv,
 			 struct add_sta_param *pstrStaParams);
 
 /*!
Signature · 1 line
2.6.1
#7 lore raw

PATCH v2 8/12 staging: wilc1000: fix parameter name of host_int_add_station

In reply to Chaehyun Lim

This patch changes struct host_if_drv of host_int_add_station function declaration from hWFIDrv to hif_drv.
With this change, first parameter name of this function declaration and definition has same name as hif_drv.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.h +1 -1
index 3fcff7a..7c9c4c6 100644
@@ -948,7 +948,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv);
  *  @date		12 July 2012
  *  @version		1.0 Description
  */
-int host_int_add_station(struct host_if_drv *hWFIDrv,
+int host_int_add_station(struct host_if_drv *hif_drv,
 			 struct add_sta_param *pstrStaParams);
 
 /*!
Signature · 1 line
2.6.1
#8 lore raw

PATCH v2 9/12 staging: wilc1000: rename pstrStaParams in host_int_add_station

In reply to Chaehyun Lim

This patch renames pstrStaParams to sta_param to avoid camelcase.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.c | 6 +++---
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -3
index 0f36825..57287d4 100644
@@ -4517,7 +4517,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv)
 }
 
 int host_int_add_station(struct host_if_drv *hif_drv,
-			 struct add_sta_param *pstrStaParams)
+			 struct add_sta_param *sta_param)
 {
 	int result = 0;
 	struct host_if_msg msg;
@@ -4535,14 +4535,14 @@ int host_int_add_station(struct host_if_drv *hif_drv,
 	msg.id = HOST_IF_MSG_ADD_STATION;
 	msg.drv = hif_drv;
 
-	memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
+	memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param));
 	if (pstrAddStationMsg->u8NumRates > 0) {
 		u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
 
 		if (!rates)
 			return -ENOMEM;
 
-		memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
+		memcpy(rates, sta_param->pu8Rates, pstrAddStationMsg->u8NumRates);
 		pstrAddStationMsg->pu8Rates = rates;
 	}
 
drivers/staging/wilc1000/host_interface.h +1 -1
index 7c9c4c6..aa92762 100644
@@ -949,7 +949,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv);
  *  @version		1.0 Description
  */
 int host_int_add_station(struct host_if_drv *hif_drv,
-			 struct add_sta_param *pstrStaParams);
+			 struct add_sta_param *sta_param);
 
 /*!
  *  @fn		s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
Signature · 1 line
2.6.1
#9 lore raw

PATCH v2 10/12 staging: wilc1000: rename pstrAddStationMsg in host_int_add_station

In reply to Chaehyun Lim

This patch renames pstrAddStationMsg to add_sta_info to avoid camelcase.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/host_interface.c +6 -6
index 57287d4..3c5de75 100644
@@ -4521,7 +4521,7 @@ int host_int_add_station(struct host_if_drv *hif_drv,
 {
 	int result = 0;
 	struct host_if_msg msg;
-	struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
+	struct add_sta_param *add_sta_info = &msg.body.add_sta_info;
 
 	if (!hif_drv) {
 		PRINT_ER("driver is null\n");
@@ -4535,15 +4535,15 @@ int host_int_add_station(struct host_if_drv *hif_drv,
 	msg.id = HOST_IF_MSG_ADD_STATION;
 	msg.drv = hif_drv;
 
-	memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param));
-	if (pstrAddStationMsg->u8NumRates > 0) {
-		u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
+	memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
+	if (add_sta_info->u8NumRates > 0) {
+		u8 *rates = kmalloc(add_sta_info->u8NumRates, GFP_KERNEL);
 
 		if (!rates)
 			return -ENOMEM;
 
-		memcpy(rates, sta_param->pu8Rates, pstrAddStationMsg->u8NumRates);
-		pstrAddStationMsg->pu8Rates = rates;
+		memcpy(rates, sta_param->pu8Rates, add_sta_info->u8NumRates);
+		add_sta_info->pu8Rates = rates;
 	}
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
Signature · 1 line
2.6.1
#10 lore raw

PATCH v2 11/12 staging: wilc1000: use kmemdup in host_int_add_station

In reply to Chaehyun Lim

This patch replaces kmalloc followed by memcpy with kmemdup.

---
V2: add wilc1000 driver name in commit title
because driver name is not included at V1.

 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -3
index 3c5de75..6b804e6 100644
@@ -4537,12 +4537,12 @@ int host_int_add_station(struct host_if_drv *hif_drv,
 
 	memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
 	if (add_sta_info->u8NumRates > 0) {
-		u8 *rates = kmalloc(add_sta_info->u8NumRates, GFP_KERNEL);
-
+		u8 *rates = kmemdup(sta_param->pu8Rates,
+				    add_sta_info->u8NumRates,
+				    GFP_KERNEL);
 		if (!rates)
 			return -ENOMEM;
 
-		memcpy(rates, sta_param->pu8Rates, add_sta_info->u8NumRates);
 		add_sta_info->pu8Rates = rates;
 	}
 
Signature · 1 line
2.6.1
#11 lore raw

PATCH v2 12/12 staging: wilc1000: remove rates in host_int_add_station

In reply to Chaehyun Lim

Instead of using rates variable, it is used as add_sta_info->pu8Rates directly.

---
V2: resend because 11/12 patch is changed.

 drivers/staging/wilc1000/host_interface.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/host_interface.c +4 -6
index 6b804e6..e2bdac8 100644
@@ -4537,13 +4537,11 @@ int host_int_add_station(struct host_if_drv *hif_drv,
 
 	memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
 	if (add_sta_info->u8NumRates > 0) {
-		u8 *rates = kmemdup(sta_param->pu8Rates,
-				    add_sta_info->u8NumRates,
-				    GFP_KERNEL);
-		if (!rates)
+		add_sta_info->pu8Rates = kmemdup(sta_param->pu8Rates,
+						 add_sta_info->u8NumRates,
+						 GFP_KERNEL);
+		if (!add_sta_info->pu8Rates)
 			return -ENOMEM;
-
-		add_sta_info->pu8Rates = rates;
 	}
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
Signature · 1 line
2.6.1
maintainer
#12 lore raw
In reply to Chaehyun Lim
Quoted 8 lines · Chaehyun Lim

This patch changes return type of host_int_del_beacon 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.

---
V2: resend because 11/12 patch is changed.

Due to changes sent before your series, this series does not apply. Please refresh and resend.

thanks,

greg k-h