* [PATCH 2/7] staging: rtl8188eu: convert unsigned char array to u8
2019-10-26 12:11 [PATCH 1/7] staging: rtl8188eu: cleanup comments in rtw_sta_mgt.c Michael Straube
@ 2019-10-26 12:11 ` Michael Straube
2019-10-26 12:11 ` [PATCH 3/7] staging: rtl8188eu: rename array bcast_addr Michael Straube
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2019-10-26 12:11 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Larry.Finger
Convert array bcast_addr from unsigned char to u8.
Clears a line over 80 characters checkpatch warning.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index cbe970979eb0..394b887a8bde 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -450,7 +450,7 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
{
struct sta_info *psta;
u32 res = _SUCCESS;
- unsigned char bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ u8 bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct sta_priv *pstapriv = &padapter->stapriv;
psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
--
2.23.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/7] staging: rtl8188eu: rename array bcast_addr
2019-10-26 12:11 [PATCH 1/7] staging: rtl8188eu: cleanup comments in rtw_sta_mgt.c Michael Straube
2019-10-26 12:11 ` [PATCH 2/7] staging: rtl8188eu: convert unsigned char array to u8 Michael Straube
@ 2019-10-26 12:11 ` Michael Straube
2019-10-26 12:11 ` [PATCH 4/7] staging: rtl8188eu: convert rtw_access_ctrl to return bool Michael Straube
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2019-10-26 12:11 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Larry.Finger
Rename array bcast_addr to be more consistent in variable naming.
In other places in this file buffers for broadcast addresses are
named bc_addr as well.
bcast_addr -> bc_addr
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 394b887a8bde..157ae2f355ff 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -450,10 +450,10 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
{
struct sta_info *psta;
u32 res = _SUCCESS;
- u8 bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct sta_priv *pstapriv = &padapter->stapriv;
- psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
+ psta = rtw_alloc_stainfo(pstapriv, bc_addr);
if (!psta) {
res = _FAIL;
--
2.23.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/7] staging: rtl8188eu: convert rtw_access_ctrl to return bool
2019-10-26 12:11 [PATCH 1/7] staging: rtl8188eu: cleanup comments in rtw_sta_mgt.c Michael Straube
2019-10-26 12:11 ` [PATCH 2/7] staging: rtl8188eu: convert unsigned char array to u8 Michael Straube
2019-10-26 12:11 ` [PATCH 3/7] staging: rtl8188eu: rename array bcast_addr Michael Straube
@ 2019-10-26 12:11 ` Michael Straube
2019-10-26 12:11 ` [PATCH 5/7] staging: rtl8188eu: remove ternary operator Michael Straube
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2019-10-26 12:11 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Larry.Finger
Function rtw_access_ctrl returns boolean values, so change the return
type to bool. Also convert the local variables that are used for the
return value from u8 to bool.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 6 +++---
drivers/staging/rtl8188eu/include/sta_info.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 157ae2f355ff..282c835a635c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -476,13 +476,13 @@ struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
return rtw_get_stainfo(pstapriv, bc_addr);
}
-u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
+bool rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
{
- u8 res = true;
+ bool res = true;
#ifdef CONFIG_88EU_AP_MODE
struct list_head *plist, *phead;
struct rtw_wlan_acl_node *paclnode;
- u8 match = false;
+ bool match = false;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct __queue *pacl_node_q = &pacl_list->acl_node_q;
diff --git a/drivers/staging/rtl8188eu/include/sta_info.h b/drivers/staging/rtl8188eu/include/sta_info.h
index dc685a14aeb8..6165adafc451 100644
--- a/drivers/staging/rtl8188eu/include/sta_info.h
+++ b/drivers/staging/rtl8188eu/include/sta_info.h
@@ -354,6 +354,6 @@ void rtw_free_all_stainfo(struct adapter *adapt);
struct sta_info *rtw_get_stainfo(struct sta_priv *stapriv, u8 *hwaddr);
u32 rtw_init_bcmc_stainfo(struct adapter *adapt);
struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter);
-u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr);
+bool rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr);
#endif /* _STA_INFO_H_ */
--
2.23.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/7] staging: rtl8188eu: remove ternary operator
2019-10-26 12:11 [PATCH 1/7] staging: rtl8188eu: cleanup comments in rtw_sta_mgt.c Michael Straube
` (2 preceding siblings ...)
2019-10-26 12:11 ` [PATCH 4/7] staging: rtl8188eu: convert rtw_access_ctrl to return bool Michael Straube
@ 2019-10-26 12:11 ` Michael Straube
2019-10-26 12:11 ` [PATCH 6/7] staging: rtl8188eu: cleanup long lines in rtw_sta_mgt.c Michael Straube
2019-10-26 12:11 ` [PATCH 7/7] staging: rtl8188eu: reduce indentation level in rtw_alloc_stainfo Michael Straube
5 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2019-10-26 12:11 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Larry.Finger
Instead of using ternary operator to set variable res, use the value
of variable match (or the negation) directly to simplify the code and
improve readability.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 282c835a635c..3cadc46836e1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -504,9 +504,9 @@ bool rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
spin_unlock_bh(&pacl_node_q->lock);
if (pacl_list->mode == 1)/* accept unless in deny list */
- res = (match) ? false : true;
+ res = !match;
else if (pacl_list->mode == 2)/* deny unless in accept list */
- res = (match) ? true : false;
+ res = match;
else
res = true;
--
2.23.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/7] staging: rtl8188eu: cleanup long lines in rtw_sta_mgt.c
2019-10-26 12:11 [PATCH 1/7] staging: rtl8188eu: cleanup comments in rtw_sta_mgt.c Michael Straube
` (3 preceding siblings ...)
2019-10-26 12:11 ` [PATCH 5/7] staging: rtl8188eu: remove ternary operator Michael Straube
@ 2019-10-26 12:11 ` Michael Straube
2019-10-26 12:11 ` [PATCH 7/7] staging: rtl8188eu: reduce indentation level in rtw_alloc_stainfo Michael Straube
5 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2019-10-26 12:11 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Larry.Finger
Cleanup lines over 80 characters in rtw_sta_mgt.c by adding line
breaks where appropriate.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 3cadc46836e1..43925b1f43ef 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -83,7 +83,8 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
INIT_LIST_HEAD(&pstapriv->sta_hash[i]);
- list_add_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue));
+ list_add_tail(&psta->list,
+ get_list_head(&pstapriv->free_sta_queue));
psta++;
}
@@ -186,9 +187,11 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
_rtw_init_stainfo(psta);
memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
index = wifi_mac_hash(hwaddr);
- RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, ("%s: index=%x", __func__, index));
+ RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
+ ("%s: index=%x", __func__, index));
if (index >= NUM_STA) {
- RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("ERROR => %s: index >= NUM_STA", __func__));
+ RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
+ ("ERROR => %s: index >= NUM_STA", __func__));
psta = NULL;
goto exit;
}
@@ -208,7 +211,8 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
*/
for (i = 0; i < 16; i++)
- memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
+ memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i],
+ &wRxSeqInitialValue, 2);
RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
("alloc number_%d stainfo with hwaddr = %pM\n",
@@ -457,7 +461,8 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
if (!psta) {
res = _FAIL;
- RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("rtw_alloc_stainfo fail"));
+ RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
+ ("rtw_alloc_stainfo fail"));
goto exit;
}
--
2.23.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 7/7] staging: rtl8188eu: reduce indentation level in rtw_alloc_stainfo
2019-10-26 12:11 [PATCH 1/7] staging: rtl8188eu: cleanup comments in rtw_sta_mgt.c Michael Straube
` (4 preceding siblings ...)
2019-10-26 12:11 ` [PATCH 6/7] staging: rtl8188eu: cleanup long lines in rtw_sta_mgt.c Michael Straube
@ 2019-10-26 12:11 ` Michael Straube
2019-10-26 17:18 ` Joe Perches
5 siblings, 1 reply; 8+ messages in thread
From: Michael Straube @ 2019-10-26 12:11 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Larry.Finger
Remove else-arm from if-else statement. Move the else code out of the
if-else and skip it by adding goto exit to the if block. The exit label
was directly after the else-arm, so there is no change in behaviour.
Reduces indentation level and clears a line over 80 characters
checkpatch warning.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 101 ++++++++++---------
1 file changed, 51 insertions(+), 50 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 43925b1f43ef..776931b8bf72 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -181,70 +181,71 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
struct sta_info, list);
if (!psta) {
spin_unlock_bh(&pfree_sta_queue->lock);
- } else {
- list_del_init(&psta->list);
- spin_unlock_bh(&pfree_sta_queue->lock);
- _rtw_init_stainfo(psta);
- memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
- index = wifi_mac_hash(hwaddr);
- RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
- ("%s: index=%x", __func__, index));
- if (index >= NUM_STA) {
- RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
- ("ERROR => %s: index >= NUM_STA", __func__));
- psta = NULL;
- goto exit;
- }
- phash_list = &pstapriv->sta_hash[index];
-
- spin_lock_bh(&pstapriv->sta_hash_lock);
- list_add_tail(&psta->hash_list, phash_list);
- pstapriv->asoc_sta_count++;
- spin_unlock_bh(&pstapriv->sta_hash_lock);
+ goto exit;
+ }
- /* Commented by Albert 2009/08/13
- * For the SMC router, the sequence number of first packet of
- * WPS handshake will be 0. In this case, this packet will be
- * dropped by recv_decache function if we use the 0x00 as the
- * default value for tid_rxseq variable. So, we initialize the
- * tid_rxseq variable as the 0xffff.
- */
+ list_del_init(&psta->list);
+ spin_unlock_bh(&pfree_sta_queue->lock);
+ _rtw_init_stainfo(psta);
+ memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
+ index = wifi_mac_hash(hwaddr);
+ RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
+ ("%s: index=%x", __func__, index));
+ if (index >= NUM_STA) {
+ RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
+ ("ERROR => %s: index >= NUM_STA", __func__));
+ psta = NULL;
+ goto exit;
+ }
+ phash_list = &pstapriv->sta_hash[index];
- for (i = 0; i < 16; i++)
- memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i],
- &wRxSeqInitialValue, 2);
+ spin_lock_bh(&pstapriv->sta_hash_lock);
+ list_add_tail(&psta->hash_list, phash_list);
+ pstapriv->asoc_sta_count++;
+ spin_unlock_bh(&pstapriv->sta_hash_lock);
- RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
- ("alloc number_%d stainfo with hwaddr = %pM\n",
- pstapriv->asoc_sta_count, hwaddr));
+ /* Commented by Albert 2009/08/13
+ * For the SMC router, the sequence number of first packet of
+ * WPS handshake will be 0. In this case, this packet will be
+ * dropped by recv_decache function if we use the 0x00 as the
+ * default value for tid_rxseq variable. So, we initialize the
+ * tid_rxseq variable as the 0xffff.
+ */
- init_addba_retry_timer(pstapriv->padapter, psta);
+ for (i = 0; i < 16; i++)
+ memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i],
+ &wRxSeqInitialValue, 2);
- /* for A-MPDU Rx reordering buffer control */
- for (i = 0; i < 16; i++) {
- preorder_ctrl = &psta->recvreorder_ctrl[i];
+ RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
+ ("alloc number_%d stainfo with hwaddr = %pM\n",
+ pstapriv->asoc_sta_count, hwaddr));
- preorder_ctrl->padapter = pstapriv->padapter;
+ init_addba_retry_timer(pstapriv->padapter, psta);
- preorder_ctrl->enable = false;
+ /* for A-MPDU Rx reordering buffer control */
+ for (i = 0; i < 16; i++) {
+ preorder_ctrl = &psta->recvreorder_ctrl[i];
- preorder_ctrl->indicate_seq = 0xffff;
- preorder_ctrl->wend_b = 0xffff;
- preorder_ctrl->wsize_b = 64;/* 64; */
+ preorder_ctrl->padapter = pstapriv->padapter;
- _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
+ preorder_ctrl->enable = false;
- rtw_init_recv_timer(preorder_ctrl);
- }
+ preorder_ctrl->indicate_seq = 0xffff;
+ preorder_ctrl->wend_b = 0xffff;
+ preorder_ctrl->wsize_b = 64;/* 64; */
- /* init for DM */
- psta->rssi_stat.UndecoratedSmoothedPWDB = -1;
- psta->rssi_stat.UndecoratedSmoothedCCK = -1;
+ _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
- /* init for the sequence number of received management frame */
- psta->RxMgmtFrameSeqNum = 0xffff;
+ rtw_init_recv_timer(preorder_ctrl);
}
+ /* init for DM */
+ psta->rssi_stat.UndecoratedSmoothedPWDB = -1;
+ psta->rssi_stat.UndecoratedSmoothedCCK = -1;
+
+ /* init for the sequence number of received management frame */
+ psta->RxMgmtFrameSeqNum = 0xffff;
+
exit:
return psta;
}
--
2.23.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 7/7] staging: rtl8188eu: reduce indentation level in rtw_alloc_stainfo
2019-10-26 12:11 ` [PATCH 7/7] staging: rtl8188eu: reduce indentation level in rtw_alloc_stainfo Michael Straube
@ 2019-10-26 17:18 ` Joe Perches
0 siblings, 0 replies; 8+ messages in thread
From: Joe Perches @ 2019-10-26 17:18 UTC (permalink / raw)
To: Michael Straube, gregkh; +Cc: devel, linux-kernel, Larry.Finger
On Sat, 2019-10-26 at 14:11 +0200, Michael Straube wrote:
> Remove else-arm from if-else statement. Move the else code out of the
> if-else and skip it by adding goto exit to the if block. The exit label
> was directly after the else-arm, so there is no change in behaviour.
> Reduces indentation level and clears a line over 80 characters
> checkpatch warning.
[]
> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
[]
> @@ -181,70 +181,71 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
> struct sta_info, list);
> if (!psta) {
> spin_unlock_bh(&pfree_sta_queue->lock);
Because exit does no cleanup, it's probably simpler as
return NULL;
and then remove the exit label
> + if (index >= NUM_STA) {
> + RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
> + ("ERROR => %s: index >= NUM_STA", __func__));
> + psta = NULL;
> + goto exit;
here too
[]
> +
> exit:
> return psta;
> }
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 8+ messages in thread