staging: rtl8188eu: remove unnecessary ternary operator
PATCH 1/5 staging: rtl8188eu: remove unnecessary ternary operator
The field accept_addba_req of struct mlme_ext_info has type bool. Use the value of accept_addba_req directly instead of the ternary operator in an asignment.
--- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +1 -2
@@ -1504,8 +1504,7 @@ void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) tid = (param>>2 )&0x0f ; preorder_ctrl = &psta->recvreorder_ctrl[tid]; preorder_ctrl->indicate_seq =0xffff ; - preorder_ctrl->enable = (pmlmeinfo->accept_addba_req) ? true - : false; + preorder_ctrl->enable = pmlmeinfo->accept_addba_req; } }
Signature · 1 line
2.19.1
PATCH 2/5 staging: rtl8188eu: change type of a struct field
The field enable of struct recv_reorder_ctrl is only used for boolean values, so change the type from u8 to bool.
--- drivers/staging/rtl8188eu/include/rtw_recv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/include/rtw_recv.h +1 -1
@@ -27,7 +27,7 @@/* for Rx reordering buffer control */ struct recv_reorder_ctrl {struct adapter *padapter; -u8 enable; +bool enable;u16 indicate_seq;/* wstart_b, init_value=0xffff */ u16 wend_b;u8 wsize_b;
Signature · 1 line
2.19.1
PATCH 3/5 staging: rtl8188eu: change return type of rtl8188eu_xmitframe_complete()
In reply to Michael StraubeThe function rtl8188eu_xmitframe_complete() returns true or false. Change the return type from s32 to bool.
--- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 3 ++- drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +2 -1
@@ -412,7 +412,8 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe)return len; } -s32 rtl8188eu_xmitframe_complete (struct adapter *adapt,struct xmit_priv *pxmitpriv) +bool rtl8188eu_xmitframe_complete (struct adapter *adapt, +struct xmit_priv *pxmitpriv) {struct xmit_frame *pxmitframe =NULL ;struct xmit_frame *pfirstframe =NULL ;
drivers/staging/rtl8188eu/include/rtl8188e_xmit.h +2 -2
@@ -149,8 +149,8 @@ s32 rtl8188eu_init_xmit_priv(struct adapter *padapter);s32 rtl8188eu_xmit_buf_handler (struct adapter *padapter);#define hal_xmit_handler rtl8188eu_xmit_buf_handlervoid rtl8188eu_xmit_tasklet (void *priv); -s32 rtl8188eu_xmitframe_complete (struct adapter *padapter, -struct xmit_priv *pxmitpriv); +bool rtl8188eu_xmitframe_complete (struct adapter *padapter, +struct xmit_priv *pxmitpriv);void handle_txrpt_ccx_88e (struct adapter *adapter,u8 *buf);
Signature · 1 line
2.19.1
PATCH 4/5 staging: rtl8188eu: change return type of rtw_hal_xmit()
In reply to Michael StraubeThe function rtw_hal_xmit() returns true or false. Change the return type from s32 to bool.
--- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/rtl8188eu/include/hal_intf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +1 -1
@@ -598,7 +598,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt,* true dump packet directly * false enqueue packet */ -s32 rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) +bool rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) {s32 res;struct xmit_buf *pxmitbuf =NULL ;
drivers/staging/rtl8188eu/include/hal_intf.h +1 -1
@@ -185,7 +185,7 @@ u32 rtw_hal_inirp_init(struct adapter *padapter);void rtw_hal_inirp_deinit (struct adapter *padapter);void usb_intf_stop (struct adapter *padapter); -s32 rtw_hal_xmit (struct adapter *padapter,struct xmit_frame *pxmitframe); +bool rtw_hal_xmit (struct adapter *padapter,struct xmit_frame *pxmitframe);s32 rtw_hal_mgnt_xmit (struct adapter *padapter,struct xmit_frame *pmgntframe);
Signature · 1 line
2.19.1
Re: [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit()
Quoted 2 lines · Michael Straube
The function
rtw_hal_xmit()returns true or false. Change the return type from s32 to bool.
[]
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +0
-0
[]
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c bool rtl8188eu_xmitframe_complete(struct adapter *adapt, · line 603
Quoted 8 lines
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +1
-1@@ -598,7 +598,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt,* true dump packet directly * false enqueue packet */ -s32 rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) +bool rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) {s32 res;
Does "s32 res" need changing to bool too?
Re: [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit()
Quoted 6 lines · Joe Perches
Quoted 2 lines · Michael Straube
The function
rtw_hal_xmit()returns true or false. Change the return type from s32 to bool.[]
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +0
-0[]
Quoted 10 lines
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c bool rtl8188eu_xmitframe_complete(struct adapter *adapt, · line 603
Quoted 8 lines
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +1
-1@@ -598,7 +598,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt,* true dump packet directly * false enqueue packet */ -s32 rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) +bool rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) {s32 res;Does "s32 res" need changing to bool too?
Perhaps all the functions regardless of types
with returns of only _SUCCESS and _FAIL could be
converted to bool.
Re: [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit()
Quoted 18 lines · Joe Perches
Quoted 6 lines · Joe Perches
Quoted 2 lines · Michael Straube
The function
rtw_hal_xmit()returns true or false. Change the return type from s32 to bool.[]
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +0
-0[]
Quoted 10 lines
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c bool rtl8188eu_xmitframe_complete(struct adapter *adapt, · line 603
Quoted 8 lines
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +1
-1@@ -598,7 +598,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt,* true dump packet directly * false enqueue packet */ -s32 rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) +bool rtw_hal_xmit (struct adapter *adapt,struct xmit_frame *pxmitframe) {s32 res;Does "s32 res" need changing to bool too?
Quoted 4 lines
Perhaps all the functions regardless of types
with returns of only_SUCCESSand_FAILcould be
converted to bool.
"s32 res" is not used for return value, so it does not need changing to bool. But it could be converted too.
I'll keep that, and converting functions only returning _SUCCESS and _FAIL to bool, in mind for future patches. Thanks.
Perhaps _SUCCESS / _FAIL could be replaced with true / false throughout the driver to get rid of the defines? Or is that a bad idea?
Regards,
Michael
PATCH 5/5 staging: rtl8188eu: cleanup long line in rtw_hal_xmit()
In reply to Michael StraubeCleanup a line over 80 characters in rtw_hal_xmit() by using if(x) instead of if(x == true). Also clears a missing spaces around '|' checkpatch issue.
--- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +1 -1
@@ -611,7 +611,7 @@ bool rtw_hal_xmit(struct adapter *adapt, struct xmit_frame *pxmitframe)if (rtw_txframes_sta_ac_pending (adapt, pattrib) >0 ) goto enqueue; -if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) +if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING)) goto enqueue; pxmitbuf =rtw_alloc_xmitbuf (pxmitpriv);
Signature · 1 line
2.19.1