Skip to contentSkip to conversation

staging: r8188eu: convert functions to return bool

PATCH In review Vihas Makwana 2 participants 18 messages Mar 2, 2022 – Mar 3, 2022 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: convert functions to return bool

There are many functions which return true/false but are marked as int, uint, s32 etc. Mark them as bool.

Vihas Makwana (16):
staging: r8188eu: mark rtw_is_cckrates_included as bool
staging: r8188eu: mark rtw_is_cckratesonly_included as bool
staging: r8188eu: mark rtw_is_desired_network as bool
staging: r8188eu: mark PS_RDY_CHECK as bool
staging: r8188eu: mark check_indicate_seq as bool
staging: r8188eu: mark enqueue_reorder_recvframe as bool
staging: r8188eu: mark recv_indicatepkts_in_order as bool
staging: r8188eu: mark cckrates_included as bool
staging: r8188eu: mark cckratesonly_included as bool
staging: r8188eu: mark is_basicrate as bool
staging: r8188eu: mark is_ap_in_tkip as bool
staging: r8188eu: mark rtl8188eu_xmitframe_complete as bool
staging: r8188eu: mark check_fwstate as bool
staging: r8188eu: mark IS_MCAST as bool
staging: r8188eu: mark IsFrameTypeCtrl as bool
staging: r8188eu: mark rtw_endofpktfile as bool

 drivers/staging/r8188eu/core/rtw_ieee80211.c    | 4 ++--
 drivers/staging/r8188eu/core/rtw_mlme.c         | 2 +-
 drivers/staging/r8188eu/core/rtw_pwrctrl.c      | 2 +-
 drivers/staging/r8188eu/core/rtw_recv.c         | 7 +++----
 drivers/staging/r8188eu/core/rtw_wlan_util.c    | 8 ++++----
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c    | 2 +-
 drivers/staging/r8188eu/include/ieee80211.h     | 4 ++--
 drivers/staging/r8188eu/include/rtl8188e_xmit.h | 2 +-
 drivers/staging/r8188eu/include/rtw_mlme.h      | 2 +-
 drivers/staging/r8188eu/include/rtw_mlme_ext.h  | 6 +++---
 drivers/staging/r8188eu/include/wifi.h          | 4 ++--
 drivers/staging/r8188eu/include/xmit_osdep.h    | 2 +-
 drivers/staging/r8188eu/os_dep/xmit_linux.c     | 2 +-
 13 files changed, 23 insertions(+), 24 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/16 staging: r8188eu: mark rtw_is_cckrates_included as bool

Mark rtw_is_cckrates_included as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_ieee80211.c | 2 +-
 drivers/staging/r8188eu/include/ieee80211.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_ieee80211.c +1 -1
index 62354c319..a7b7b0f14 100644
@@ -68,7 +68,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val)
 	return 0;
 }
 
-uint	rtw_is_cckrates_included(u8 *rate)
+bool	rtw_is_cckrates_included(u8 *rate)
 {
 	u32	i = 0;
 
drivers/staging/r8188eu/include/ieee80211.h +1 -1
index 3a860e132..1a15db097 100644
@@ -872,7 +872,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv);
 
 int rtw_get_bit_value_from_ieee_value(u8 val);
 
-uint	rtw_is_cckrates_included(u8 *rate);
+bool	rtw_is_cckrates_included(u8 *rate);
 
 uint	rtw_is_cckratesonly_included(u8 *rate);
 
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/16 staging: r8188eu: mark rtw_is_cckratesonly_included as bool

In reply to Vihas Makwana

Mark rtw_is_cckratesonly_included as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_ieee80211.c | 2 +-
 drivers/staging/r8188eu/include/ieee80211.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_ieee80211.c +1 -1
index a7b7b0f14..5a0e42ed4 100644
@@ -81,7 +81,7 @@ bool	rtw_is_cckrates_included(u8 *rate)
 	return false;
 }
 
-uint	rtw_is_cckratesonly_included(u8 *rate)
+bool	rtw_is_cckratesonly_included(u8 *rate)
 {
 	u32 i = 0;
 
drivers/staging/r8188eu/include/ieee80211.h +1 -1
index 1a15db097..8c20363cd 100644
@@ -874,7 +874,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val);
 
 bool	rtw_is_cckrates_included(u8 *rate);
 
-uint	rtw_is_cckratesonly_included(u8 *rate);
+bool	rtw_is_cckratesonly_included(u8 *rate);
 
 int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH 3/16 staging: r8188eu: mark rtw_is_desired_network as bool

In reply to Vihas Makwana

Mark rtw_is_desired_network as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_mlme.c +1 -1
index 4bb6edcc0..8d36ab955 100644
@@ -571,7 +571,7 @@ static void rtw_add_network(struct adapter *adapter,
 /* 			(3) WMM */
 /*			(4) HT */
 /*			(5) others */
-static int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwork)
+static bool rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwork)
 {
 	struct security_priv *psecuritypriv = &adapter->securitypriv;
 	struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
Signature · 1 line
2.30.2
#4 lore raw

PATCH 4/16 staging: r8188eu: mark PS_RDY_CHECK as bool

In reply to Vihas Makwana

Mark PS_RDY_CHECK as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_pwrctrl.c +1 -1
index b20436f75..7beabf82e 100644
@@ -151,7 +151,7 @@ static void pwr_state_check_handler(struct timer_list *t)
 	rtw_ps_cmd(padapter);
 }
 
-static u8 PS_RDY_CHECK(struct adapter *padapter)
+static bool PS_RDY_CHECK(struct adapter *padapter)
 {
 	u32 curr_time, delta_time;
 	struct pwrctrl_priv	*pwrpriv = &padapter->pwrctrlpriv;
Signature · 1 line
2.30.2
#5 lore raw

PATCH 5/16 staging: r8188eu: mark check_indicate_seq as bool

In reply to Vihas Makwana

Mark check_indicate_seq as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_recv.c +1 -1
index d77d98351..402b58a02 100644
@@ -1466,7 +1466,7 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
 	return ret;
 }
 
-static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
+static bool check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
 {
 	u8	wsize = preorder_ctrl->wsize_b;
 	u16	wend = (preorder_ctrl->indicate_seq + wsize - 1) & 0xFFF;/*  4096; */
Signature · 1 line
2.30.2
#6 lore raw

PATCH 6/16 staging: r8188eu: mark enqueue_reorder_recvframe as bool

In reply to Vihas Makwana

Mark enqueue_reorder_recvframe as bool as it returns true/false. Also, make it static as it's only used in rtw_recv.

---
 drivers/staging/r8188eu/core/rtw_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +1 -2
index 402b58a02..81ff22d0e 100644
@@ -1496,8 +1496,7 @@ static bool check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_
 	return true;
 }
 
-int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, struct recv_frame *prframe);
-int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, struct recv_frame *prframe)
+static bool enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, struct recv_frame *prframe)
 {
 	struct rx_pkt_attrib *pattrib = &prframe->attrib;
 	struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
Signature · 1 line
2.30.2
#7 lore raw

PATCH 7/16 staging: r8188eu: mark recv_indicatepkts_in_order as bool

In reply to Vihas Makwana

Mark recv_indicatepkts_in_order as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_recv.c +1 -1
index 81ff22d0e..b6ab2db6d 100644
@@ -1525,7 +1525,7 @@ static bool enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, s
 	return true;
 }
 
-static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced)
+static bool recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctrl *preorder_ctrl, int bforced)
 {
 	struct list_head *phead, *plist;
 	struct recv_frame *prframe;
Signature · 1 line
2.30.2
#8 lore raw

PATCH 8/16 staging: r8188eu: mark cckrates_included as bool

In reply to Vihas Makwana

Mark cckrates_included as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_wlan_util.c   | 2 +-
 drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_wlan_util.c +1 -1
index 33c022820..4f58c8970 100644
@@ -45,7 +45,7 @@ static u8 rtw_basic_rate_mix[7] = {
 	IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
-int cckrates_included(unsigned char *rate, int ratelen)
+bool cckrates_included(unsigned char *rate, int ratelen)
 {
 	int	i;
 
drivers/staging/r8188eu/include/rtw_mlme_ext.h +1 -1
index 26f31f20e..21c7f020a 100644
@@ -632,7 +632,7 @@ void addba_timer_hdl(struct sta_info *psta);
 		_set_timer(&(mlmeext)->link_timer, (ms)); \
 	} while (0)
 
-int cckrates_included(unsigned char *rate, int ratelen);
+bool cckrates_included(unsigned char *rate, int ratelen);
 int cckratesonly_included(unsigned char *rate, int ratelen);
 
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
Signature · 1 line
2.30.2
#9 lore raw

PATCH 9/16 staging: r8188eu: mark cckratesonly_included as bool

In reply to Vihas Makwana

Mark cckratesonly_included as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_wlan_util.c   | 2 +-
 drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_wlan_util.c +1 -1
index 4f58c8970..eef8523c3 100644
@@ -57,7 +57,7 @@ bool cckrates_included(unsigned char *rate, int ratelen)
 	return false;
 }
 
-int cckratesonly_included(unsigned char *rate, int ratelen)
+bool cckratesonly_included(unsigned char *rate, int ratelen)
 {
 	int	i;
 
drivers/staging/r8188eu/include/rtw_mlme_ext.h +1 -1
index 21c7f020a..cf397ac68 100644
@@ -633,7 +633,7 @@ void addba_timer_hdl(struct sta_info *psta);
 	} while (0)
 
 bool cckrates_included(unsigned char *rate, int ratelen);
-int cckratesonly_included(unsigned char *rate, int ratelen);
+bool cckratesonly_included(unsigned char *rate, int ratelen);
 
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
 
Signature · 1 line
2.30.2
#10 lore raw

PATCH 10/16 staging: r8188eu: mark is_basicrate as bool

In reply to Vihas Makwana

Mark is_basicrate as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_wlan_util.c +1 -1
index eef8523c3..8e8a82a1e 100644
@@ -167,7 +167,7 @@ static unsigned char ratetbl_val_2wifirate(unsigned char rate)
 	return val;
 }
 
-static int is_basicrate(struct adapter *padapter, unsigned char rate)
+static bool is_basicrate(struct adapter *padapter, unsigned char rate)
 {
 	int i;
 	unsigned char val;
Signature · 1 line
2.30.2
#11 lore raw

PATCH 11/16 staging: r8188eu: mark is_ap_in_tkip as bool

In reply to Vihas Makwana

Mark is_ap_in_tkip as bool as it returns true/false.

---
 drivers/staging/r8188eu/core/rtw_wlan_util.c   | 2 +-
 drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_wlan_util.c +1 -1
index 8e8a82a1e..665b07719 100644
@@ -1013,7 +1013,7 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru
 	}
 }
 
-unsigned int is_ap_in_tkip(struct adapter *padapter)
+bool is_ap_in_tkip(struct adapter *padapter)
 {
 	u32 i;
 	struct ndis_802_11_var_ie *pIE;
drivers/staging/r8188eu/include/rtw_mlme_ext.h +1 -1
index cf397ac68..0c555ea67 100644
@@ -508,7 +508,7 @@ unsigned int receive_disconnect(struct adapter *padapter,
 
 unsigned char get_highest_rate_idx(u32 mask);
 int support_short_GI(struct adapter *padapter, struct HT_caps_element *caps);
-unsigned int is_ap_in_tkip(struct adapter *padapter);
+bool is_ap_in_tkip(struct adapter *padapter);
 
 void report_join_res(struct adapter *padapter, int res);
 void report_survey_event(struct adapter *padapter, struct recv_frame *precv_frame);
Signature · 1 line
2.30.2
#12 lore raw

PATCH 12/16 staging: r8188eu: mark rtl8188eu_xmitframe_complete as bool

In reply to Vihas Makwana

Mark rtl8188eu_xmitframe_complete as bool as it returns true/false.

---
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c    | 2 +-
 drivers/staging/r8188eu/include/rtl8188e_xmit.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +1 -1
index 69b66eb45..55032d7ae 100644
@@ -376,7 +376,7 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe)
 	return len;
 }
 
-s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
+bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
 {
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt);
 	struct xmit_frame *pxmitframe = NULL;
drivers/staging/r8188eu/include/rtl8188e_xmit.h +1 -1
index 85eb0aad8..8adb672f7 100644
@@ -143,7 +143,7 @@ s32 rtl8188eu_mgnt_xmit(struct adapter *padapter, struct xmit_frame *frame);
 s32 rtl8188eu_xmit_buf_handler(struct adapter *padapter);
 #define hal_xmit_handler rtl8188eu_xmit_buf_handler
 void rtl8188eu_xmit_tasklet(unsigned long priv);
-s32 rtl8188eu_xmitframe_complete(struct adapter *padapter,
+bool rtl8188eu_xmitframe_complete(struct adapter *padapter,
 				 struct xmit_priv *pxmitpriv,
 				 struct xmit_buf *pxmitbuf);
 
Signature · 1 line
2.30.2
#13 lore raw

PATCH 13/16 staging: r8188eu: mark check_fwstate as bool

In reply to Vihas Makwana

Mark check_fwstate as bool as it returns true/false.

---
 drivers/staging/r8188eu/include/rtw_mlme.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/include/rtw_mlme.h +1 -1
index d418d57f9..42d850f9d 100644
@@ -451,7 +451,7 @@ static inline u8 *get_bssid(struct mlme_priv *pmlmepriv)
 	return pmlmepriv->cur_network.network.MacAddress;
 }
 
-static inline int check_fwstate(struct mlme_priv *pmlmepriv, int state)
+static inline bool check_fwstate(struct mlme_priv *pmlmepriv, int state)
 {
 	if (pmlmepriv->fw_state & state)
 		return true;
Signature · 1 line
2.30.2
#14 lore raw

PATCH 14/16 staging: r8188eu: mark IS_MCAST as bool

In reply to Vihas Makwana

Mark IS_MCAST as bool as it returns true/false.

---
 drivers/staging/r8188eu/include/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/include/wifi.h +1 -1
index 39b7a596e..df3331b13 100644
@@ -295,7 +295,7 @@ enum WIFI_REG_DOMAIN {
 
 #define GetAddr4Ptr(pbuf)	((unsigned char *)((size_t)(pbuf) + 24))
 
-static inline int IS_MCAST(unsigned char *da)
+static inline bool IS_MCAST(unsigned char *da)
 {
 	if ((*da) & 0x01)
 		return true;
Signature · 1 line
2.30.2
#15 lore raw

PATCH 15/16 staging: r8188eu: mark IsFrameTypeCtrl as bool

In reply to Vihas Makwana

Mark IsFrameTypeCtrl as bool as it returns true/false.

---
 drivers/staging/r8188eu/include/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/include/wifi.h +1 -1
index df3331b13..c1c9bae58 100644
@@ -372,7 +372,7 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
 	return sa;
 }
 
-static inline int IsFrameTypeCtrl(unsigned char *pframe)
+static inline bool IsFrameTypeCtrl(unsigned char *pframe)
 {
 	if (WIFI_CTRL_TYPE == GetFrameType(pframe))
 		return true;
Signature · 1 line
2.30.2
#16 lore raw

PATCH 16/16 staging: r8188eu: mark rtw_endofpktfile as bool

In reply to Vihas Makwana

Mark rtw_endofpktfile as bool as it returns true/false.

---
 drivers/staging/r8188eu/include/xmit_osdep.h | 2 +-
 drivers/staging/r8188eu/os_dep/xmit_linux.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/include/xmit_osdep.h +1 -1
index 3e778dff0..00658681f 100644
@@ -40,7 +40,7 @@ void rtw_os_xmit_resource_free(struct adapter *padapter,
 uint rtw_remainder_len(struct pkt_file *pfile);
 void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
 uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
-int rtw_endofpktfile(struct pkt_file *pfile);
+bool rtw_endofpktfile(struct pkt_file *pfile);
 
 void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
 void rtw_os_xmit_complete(struct adapter *padapter,
drivers/staging/r8188eu/os_dep/xmit_linux.c +1 -1
index 717b980a8..a6012cffd 100644
@@ -54,7 +54,7 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
 	return len;
 }
 
-int rtw_endofpktfile(struct pkt_file *pfile)
+bool rtw_endofpktfile(struct pkt_file *pfile)
 {
 
 	if (pfile->pkt_len == 0) {
Signature · 1 line
2.30.2
Reviewed-by on the v1 series
#17 lore raw
In reply to Vihas Makwana
Quoted 12 lines · Vihas Makwana

There are many functions which return true/false but are marked as int, uint, s32 etc. Mark them as bool.

Vihas Makwana (16):
staging: r8188eu: mark rtw_is_cckrates_included as bool
staging: r8188eu: mark rtw_is_cckratesonly_included as bool
staging: r8188eu: mark rtw_is_desired_network as bool
staging: r8188eu: mark PS_RDY_CHECK as bool
staging: r8188eu: mark check_indicate_seq as bool
staging: r8188eu: mark enqueue_reorder_recvframe as bool
staging: r8188eu: mark recv_indicatepkts_in_order as bool
staging: r8188eu: mark cckrates_included as bool

Quoted 9 lines

staging: r8188eu: mark cckratesonly_included as bool
staging: r8188eu: mark is_basicrate as bool
staging: r8188eu: mark is_ap_in_tkip as bool
staging: r8188eu: mark rtl8188eu_xmitframe_complete as bool
staging: r8188eu: mark check_fwstate as bool
staging: r8188eu: mark IS_MCAST as bool
staging: r8188eu: mark IsFrameTypeCtrl as bool
staging: r8188eu: mark rtw_endofpktfile as bool

Looks good. Thanks!

regards,
dan carpenter