linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] staging: rtl8188eu: remove unnecessary ternary operator
@ 2018-10-27 20:28 Michael Straube
  2018-10-27 20:28 ` [PATCH 2/5] staging: rtl8188eu: change type of a struct field Michael Straube
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Michael Straube @ 2018-10-27 20:28 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Michael Straube

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.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 3e05e2c7f61b..d678dcee7312 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -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;
 	}
 }
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] staging: rtl8188eu: change type of a struct field
  2018-10-27 20:28 [PATCH 1/5] staging: rtl8188eu: remove unnecessary ternary operator Michael Straube
@ 2018-10-27 20:28 ` Michael Straube
  2018-10-27 20:28 ` [PATCH 3/5] staging: rtl8188eu: change return type of rtl8188eu_xmitframe_complete() Michael Straube
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2018-10-27 20:28 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Michael Straube

The field enable of struct recv_reorder_ctrl is only used for boolean
values, so change the type from u8 to bool.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/include/rtw_recv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 54b7ba367293..8fc500496f92 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -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;
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] staging: rtl8188eu: change return type of rtl8188eu_xmitframe_complete()
  2018-10-27 20:28 [PATCH 1/5] staging: rtl8188eu: remove unnecessary ternary operator Michael Straube
  2018-10-27 20:28 ` [PATCH 2/5] staging: rtl8188eu: change type of a struct field Michael Straube
@ 2018-10-27 20:28 ` Michael Straube
  2018-10-27 20:28 ` [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit() Michael Straube
  2018-10-27 20:28 ` [PATCH 5/5] staging: rtl8188eu: cleanup long line in rtw_hal_xmit() Michael Straube
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2018-10-27 20:28 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Michael Straube

The function rtl8188eu_xmitframe_complete() returns true or false.
Change the return type from s32 to bool.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c    | 3 ++-
 drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index a11bee16d070..69a0edd27710 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -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;
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h
index 20d35480dab8..421e9f45306f 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h
@@ -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_handler
 void 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);
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit()
  2018-10-27 20:28 [PATCH 1/5] staging: rtl8188eu: remove unnecessary ternary operator Michael Straube
  2018-10-27 20:28 ` [PATCH 2/5] staging: rtl8188eu: change type of a struct field Michael Straube
  2018-10-27 20:28 ` [PATCH 3/5] staging: rtl8188eu: change return type of rtl8188eu_xmitframe_complete() Michael Straube
@ 2018-10-27 20:28 ` Michael Straube
  2018-10-27 22:57   ` Joe Perches
  2018-10-27 20:28 ` [PATCH 5/5] staging: rtl8188eu: cleanup long line in rtw_hal_xmit() Michael Straube
  3 siblings, 1 reply; 8+ messages in thread
From: Michael Straube @ 2018-10-27 20:28 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Michael Straube

The function rtw_hal_xmit() returns true or false.
Change the return type from s32 to bool.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 2 +-
 drivers/staging/rtl8188eu/include/hal_intf.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index 69a0edd27710..35bc8fc32db1 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -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;
diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h b/drivers/staging/rtl8188eu/include/hal_intf.h
index e5be27af7bf5..8b65fcba1967 100644
--- a/drivers/staging/rtl8188eu/include/hal_intf.h
+++ b/drivers/staging/rtl8188eu/include/hal_intf.h
@@ -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);
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] staging: rtl8188eu: cleanup long line in rtw_hal_xmit()
  2018-10-27 20:28 [PATCH 1/5] staging: rtl8188eu: remove unnecessary ternary operator Michael Straube
                   ` (2 preceding siblings ...)
  2018-10-27 20:28 ` [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit() Michael Straube
@ 2018-10-27 20:28 ` Michael Straube
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2018-10-27 20:28 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Michael Straube

Cleanup 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.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index 35bc8fc32db1..a72e069269b8 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -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);
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit()
  2018-10-27 20:28 ` [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit() Michael Straube
@ 2018-10-27 22:57   ` Joe Perches
  2018-10-27 23:08     ` Joe Perches
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2018-10-27 22:57 UTC (permalink / raw)
  To: Michael Straube, gregkh; +Cc: devel, linux-kernel

On Sat, 2018-10-27 at 22:28 +0200, Michael Straube wrote:
> The function rtw_hal_xmit() returns true or false.
> Change the return type from s32 to bool.
[]
> diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
[]
> @@ -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?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit()
  2018-10-27 22:57   ` Joe Perches
@ 2018-10-27 23:08     ` Joe Perches
  2018-10-28  8:57       ` Michael Straube
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2018-10-27 23:08 UTC (permalink / raw)
  To: Michael Straube, gregkh; +Cc: devel, linux-kernel

On Sat, 2018-10-27 at 15:57 -0700, Joe Perches wrote:
> On Sat, 2018-10-27 at 22:28 +0200, Michael Straube wrote:
> > The function rtw_hal_xmit() returns true or false.
> > Change the return type from s32 to bool.
> [] 
> > diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
> []
> > @@ -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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit()
  2018-10-27 23:08     ` Joe Perches
@ 2018-10-28  8:57       ` Michael Straube
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2018-10-28  8:57 UTC (permalink / raw)
  To: Joe Perches, gregkh; +Cc: devel, linux-kernel

On 10/28/18 1:08 AM, Joe Perches wrote:
> On Sat, 2018-10-27 at 15:57 -0700, Joe Perches wrote:
>> On Sat, 2018-10-27 at 22:28 +0200, Michael Straube wrote:
>>> The function rtw_hal_xmit() returns true or false.
>>> Change the return type from s32 to bool.
>> []
>>> diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
>> []
>>> @@ -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.
> 

"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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-28  8:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-27 20:28 [PATCH 1/5] staging: rtl8188eu: remove unnecessary ternary operator Michael Straube
2018-10-27 20:28 ` [PATCH 2/5] staging: rtl8188eu: change type of a struct field Michael Straube
2018-10-27 20:28 ` [PATCH 3/5] staging: rtl8188eu: change return type of rtl8188eu_xmitframe_complete() Michael Straube
2018-10-27 20:28 ` [PATCH 4/5] staging: rtl8188eu: change return type of rtw_hal_xmit() Michael Straube
2018-10-27 22:57   ` Joe Perches
2018-10-27 23:08     ` Joe Perches
2018-10-28  8:57       ` Michael Straube
2018-10-27 20:28 ` [PATCH 5/5] staging: rtl8188eu: cleanup long line in rtw_hal_xmit() Michael Straube

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).