staging: wilc1000: fix return type of host_int_set_mac_chnl_num
PATCH 1/10 staging: wilc1000: fix return type of host_int_set_mac_chnl_num
This patch changes return type of host_int_set_mac_chnl_num from s32 to int. s32Error gets return value from wilc_mq_send function that has return type of int. It should be changed return type of host_int_set_mac_chnl_num function by int as well as data type of s32Error.
--- 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
@@ -5315,9 +5315,9 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,* @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum) +int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum) { -s32 s32Error =0 ; +int s32Error =0 ;tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;struct host_if_msg msg;
drivers/staging/wilc1000/host_interface.h +1 -1
@@ -819,7 +819,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,* @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum); +int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum);/** * @brief gets the current channel index
Signature · 1 line
2.6.0
PATCH 2/10 staging: wilc1000: fix NULL comparison style
This patch changes NULL comparison style to use ! operator found by checkpatch.pl
CHECK: Comparison to NULL could be written "!pstrWFIDrv" drivers/staging/wilc1000/host_interface.c:5324:
--- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.c +1 -1
@@ -5321,7 +5321,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;struct host_if_msg msg; -if (pstrWFIDrv ==NULL ) { +if (!pstrWFIDrv) {PRINT_ER ("driver is null\n" );return -EFAULT ; }
Signature · 1 line
2.6.0
PATCH 3/10 staging: wilc1000: rename s32Error in host_int_set_mac_chnl_num
In reply to Chaehyun LimThis patch replaces s32Error with result to avoid camelcase.
--- drivers/staging/wilc1000/host_interface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/host_interface.c +5 -5
@@ -5317,7 +5317,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,*/ int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum) { -int s32Error =0 ; +int result =0 ;tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;struct host_if_msg msg;
@@ -5332,13 +5332,13 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) msg.body.channel_info.u8SetChan = u8ChNum; msg.drvHandler = hWFIDrv; - s32Error =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); -if (s32Error) { + result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); +if (result) {PRINT_ER ("wilc mq send fail\n" ); - s32Error = -EINVAL ; + result = -EINVAL ; } -return s32Error; +return result; }
Signature · 1 line
2.6.0
Re: [PATCH 03/10] staging: wilc1000: rename s32Error in host_int_set_mac_chnl_num
Hi Chaehyun,
Quoted 21 lines · Chaehyun Lim
This patch replaces s32Error with result to avoid camelcase.
Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/host_interface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/staging/wilc1000/host_interface.c +1
-1@@ -5317,7 +5317,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,*/ int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum) { -int s32Error =0 ; +int result =0 ;tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;struct host_if_msg msg;
drivers/staging/wilc1000/host_interface.c int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) · line 5338
Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +3
-3@@ -5332,13 +5332,13 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) msg.body.channel_info.u8SetChan = u8ChNum; msg.drvHandler = hWFIDrv; - s32Error =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); -if (s32Error) { + result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); +if (result) {PRINT_ER ("wilc mq send fail\n" ); - s32Error = -EINVAL ; + result = -EINVAL ;
Why not just have
return -EINVAL;
here?
drivers/staging/wilc1000/host_interface.c int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) · line 5341
Quoted 4 lines
drivers/staging/wilc1000/host_interface.c +1
-1} -return s32Error; +return result;
and
return 0;
here?
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
PATCH 4/10 staging: wilc1000: replace PRINT_ER with pr_err
In reply to Chaehyun LimThis patch replaces PRINT_ER with pr_err.
It would be better to use netdev_err, but it cannot use it in this function, so just use pr_err.
--- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
@@ -5322,7 +5322,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)struct host_if_msg msg;if (!pstrWFIDrv) { -PRINT_ER ("driver is null\n" ); +pr_err ("driver is null\n" );return -EFAULT ; }
@@ -5334,7 +5334,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg ));if (result) { -PRINT_ER ("wilc mq send fail\n" ); +pr_err ("wilc mq send fail\n" ); result = -EINVAL ; }
Signature · 1 line
2.6.0
Greg KH
maintainerRe: [PATCH 04/10] staging: wilc1000: replace PRINT_ER with pr_err
Quoted 14 lines · Chaehyun Lim
This patch replaces
PRINT_ERwithpr_err.
It would be better to usenetdev_err, but it cannot use it in this function, so just usepr_err.Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/wilc1000/host_interface.c +0
-0
drivers/staging/wilc1000/host_interface.c int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) · line 5327
Quoted 7 lines
drivers/staging/wilc1000/host_interface.c +1
-1@@ -5322,7 +5322,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)struct host_if_msg msg;if (!pstrWFIDrv) { -PRINT_ER ("driver is null\n" ); +pr_err ("driver is null\n" );return -EFAULT ; }
I don't see how this check will ever trigger, do you? If not, it should just be removed.
drivers/staging/wilc1000/host_interface.c int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) · line 5337
Quoted 7 lines
drivers/staging/wilc1000/host_interface.c +1
-1@@ -5334,7 +5334,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg ));if (result) { -PRINT_ER ("wilc mq send fail\n" ); +pr_err ("wilc mq send fail\n" );
You should have a network device pointer somewhere here, dig around, it should be possible to use netdev_err().
thanks,
greg k-h
PATCH 5/10 staging: wilc1000: rename u8ChNum of host_int_set_mac_chnl_num
In reply to Chaehyun LimThis patch replaces u8ChNum with channel that is second argument of host_int_set_mac_chnl_num 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
@@ -5315,7 +5315,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,* @date 8 March 2012 * @version 1.0 */ -int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum) +int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 channel) {int result =0 ;tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
@@ -5329,7 +5329,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)/* prepare the set channel message */ memset (&msg,0 ,sizeof (struct host_if_msg )); msg.id =HOST_IF_MSG_SET_CHANNEL ; - msg.body.channel_info.u8SetChan = u8ChNum; + msg.body.channel_info.u8SetChan = channel; msg.drvHandler = hWFIDrv; result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg ));
drivers/staging/wilc1000/host_interface.h +1 -1
@@ -819,7 +819,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,* @date 8 March 2012 * @version 1.0 */ -int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 u8ChNum); +int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 channel);/** * @brief gets the current channel index
Signature · 1 line
2.6.0
PATCH 6/10 staging: wilc1000: rename hWFIDrv of host_int_set_mac_chnl_num
In reply to Chaehyun LimThis patch replaces hWFIDrv with wfi_drv that is first argument of host_int_set_mac_chnl_num to avoid camelcase.
--- 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
@@ -5315,10 +5315,10 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,* @date 8 March 2012 * @version 1.0 */ -int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 channel) +int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *wfi_drv,u8 channel) {int result =0 ; -tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; +tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)wfi_drv;struct host_if_msg msg;if (!pstrWFIDrv) {
@@ -5330,7 +5330,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 channel)memset (&msg,0 ,sizeof (struct host_if_msg )); msg.id =HOST_IF_MSG_SET_CHANNEL ; msg.body.channel_info.u8SetChan = channel; - msg.drvHandler = hWFIDrv; + msg.drvHandler = wfi_drv; result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg ));if (result) {
drivers/staging/wilc1000/host_interface.h +1 -1
@@ -819,7 +819,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,* @date 8 March 2012 * @version 1.0 */ -int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 channel); +int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *wfi_drv,u8 channel);/** * @brief gets the current channel index
Signature · 1 line
2.6.0
Greg KH
maintainerRe: [PATCH 06/10] staging: wilc1000: rename hWFIDrv of host_int_set_mac_chnl_num
Quoted 14 lines · Chaehyun Lim
This patch replaces hWFIDrv with
wfi_drvthat is first argument ofhost_int_set_mac_chnl_numto avoid camelcase.Signed-off-by Chaehyun Lim <[email protected]>--- 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 +0
-0
drivers/staging/wilc1000/host_interface.c s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, · line 5321
Quoted 9 lines
drivers/staging/wilc1000/host_interface.c +2
-2@@ -5315,10 +5315,10 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,* @date 8 March 2012 * @version 1.0 */ -int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *hWFIDrv,u8 channel) +int host_int_set_mac_chnl_num (tstrWILC_WFIDrv *wfi_drv,u8 channel) {int result =0 ; -tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; +tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)wfi_drv;
Not the issue here, but in the future, why is this cast needed? Heck, why is this local variable even needed, why not just use wifi_drv everywhere in this function?
thanks,
greg k-h
PATCH 7/10 staging: wilc1000: fix return type of host_int_wait_msg_queue_idle
In reply to Chaehyun LimThis patch changes return type of host_int_wait_msg_queue_idle from s32 to int. s32Error gets return value from wilc_mq_send that has return type of int. It should be changed return type of host_int_wait_msg_queue_idle by int as well as data type of s32Error.
--- 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
@@ -5342,9 +5342,9 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel) } -s32 host_int_wait_msg_queue_idle (void ) +int host_int_wait_msg_queue_idle (void ) { -s32 s32Error =0 ; +int s32Error =0 ;struct host_if_msg msg;
drivers/staging/wilc1000/host_interface.h +1 -1
@@ -648,7 +648,7 @@ s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress);* @date 19 march 2014 * @version 1.0 */ -s32 host_int_wait_msg_queue_idle (void ); +int host_int_wait_msg_queue_idle (void );/** * @brief sets a start scan request
Signature · 1 line
2.6.0
PATCH 8/10 staging: wilc1000: rename s32Error in host_int_wait_msg_queue_idle
In reply to Chaehyun LimThis patch replaces s32Error with result to avoid camelcase.
--- drivers/staging/wilc1000/host_interface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/host_interface.c +5 -5
@@ -5344,7 +5344,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)int host_int_wait_msg_queue_idle (void ) { -int s32Error =0 ; +int result =0 ;struct host_if_msg msg;
@@ -5352,16 +5352,16 @@ int host_int_wait_msg_queue_idle(void)memset (&msg,0 ,sizeof (struct host_if_msg )); msg.id =HOST_IF_MSG_Q_IDLE ; - s32Error =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); -if (s32Error) { + result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); +if (result) {PRINT_ER ("wilc mq send fail\n" ); - s32Error = -EINVAL ; + result = -EINVAL ; }/* wait untill MSG Q is empty */ down (&hWaitResponse); -return s32Error; +return result; }
Signature · 1 line
2.6.0
Re: [PATCH 08/10] staging: wilc1000: rename s32Error in host_int_wait_msg_queue_idle
Hi Chaehyun,
Quoted 21 lines · Chaehyun Lim
This patch replaces s32Error with result to avoid camelcase.
Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/host_interface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/staging/wilc1000/host_interface.c +1
-1@@ -5344,7 +5344,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)int host_int_wait_msg_queue_idle (void ) { -int s32Error =0 ; +int result =0 ;struct host_if_msg msg;
drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5358
Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +3
-3@@ -5352,16 +5352,16 @@ int host_int_wait_msg_queue_idle(void)memset (&msg,0 ,sizeof (struct host_if_msg )); msg.id =HOST_IF_MSG_Q_IDLE ; - s32Error =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); -if (s32Error) { + result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg )); +if (result) {PRINT_ER ("wilc mq send fail\n" ); - s32Error = -EINVAL ; + result = -EINVAL ;
Same comments here: Why not
return -EINVAL;
drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5364
Quoted 7 lines
drivers/staging/wilc1000/host_interface.c +1
-1}/* wait untill MSG Q is empty */ down (&hWaitResponse); -return s32Error; +return result;
and
return 0;
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
PATCH 9/10 staging: wilc1000: use pr_err in host_int_wait_msg_queue_idle
In reply to Chaehyun LimThis patch changes PRINT_ER by pr_err.
It would be better to use netdev_err, but it cannot use it in this function, so just use pr_err.
--- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.c +1 -1
@@ -5354,7 +5354,7 @@ int host_int_wait_msg_queue_idle(void) msg.id =HOST_IF_MSG_Q_IDLE ; result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg ));if (result) { -PRINT_ER ("wilc mq send fail\n" ); +pr_err ("wilc mq send fail\n" ); result = -EINVAL ; }
Signature · 1 line
2.6.0
Greg KH
maintainerRe: [PATCH 09/10] staging: wilc1000: use pr_err in host_int_wait_msg_queue_idle
Quoted 14 lines · Chaehyun Lim
This patch changes
PRINT_ERbypr_err.
It would be better to usenetdev_err, but it cannot use it in this function, so just usepr_err.Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wilc1000/host_interface.c +0
-0
drivers/staging/wilc1000/host_interface.c int host_int_wait_msg_queue_idle(void) · line 5357
Quoted 5 lines
drivers/staging/wilc1000/host_interface.c +1
-1@@ -5354,7 +5354,7 @@ int host_int_wait_msg_queue_idle(void) msg.id =HOST_IF_MSG_Q_IDLE ; result =wilc_mq_send (&gMsgQHostIF, &msg,sizeof (struct host_if_msg ));if (result) { -PRINT_ER ("wilc mq send fail\n" ); +pr_err ("wilc mq send fail\n" );
Same as before, you should be able to get to a network device, please use netdev_err().
PATCH 10/10 staging: wilc1000: remove blank lines before close brace
In reply to Chaehyun LimThis patch removes blank lines before close brace '}'
CHECK: Blank lines aren't necessary before a close brace '}' drivers/staging/wilc1000/host_interface.c:5366:
--- drivers/staging/wilc1000/host_interface.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/wilc1000/host_interface.c +0 -1
@@ -5362,7 +5362,6 @@ int host_int_wait_msg_queue_idle(void)down (&hWaitResponse);return result; - }s32 host_int_set_wfi_drv_handler (tstrWILC_WFIDrv *u32address)
Signature · 1 line
2.6.0