Skip to contentSkip to conversation

staging: rtl8192e: Fix style warnings in rtl8192e driver

PATCH New Ojaswin Mujoo 1 participant 4 messages May 10, 2021 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8192e: Fix style warnings in rtl8192e driver

This patchset fixes several style warnings as reported by the checkpatch.pl script, in the rtl8192e staging driver.

In patch 1/3, the changes have improved readability at the cost of crossing the 80 character limit, by a few characters. I believe the trade off is worth it however would love to hear your thoughts on it.

Ojaswin Mujoo (3):
staging: rtl8192e: Avoid multiple line dereference
staging: rtl8192e: Add identifier name to function definition
staging: rtl8192e: Fix whitespace around conditional statement

 drivers/staging/rtl8192e/rtl8192e/rtl_cam.c  | 12 ++++--------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  4 ++--
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c   |  2 +-
 drivers/staging/rtl8192e/rtllib_rx.c         |  3 +--
 4 files changed, 8 insertions(+), 13 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 staging: rtl8192e: Avoid multiple line dereference

Avoid multiple line dereference to make the code more readable, as suggested by checkpatch.pl

This patch fixes the following checkpatch.pl warning:

- WARNING: Avoid multiple line dereference

    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'

FILE: ./rtl8192e/rtl8192e/rtl_cam.c:189

- WARNING: Avoid multiple line dereference

    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'

FILE: ./rtl8192e/rtl8192e/rtl_cam.c:195

- WARNING: Avoid multiple line dereference

    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'

FILE: ./rtl8192e/rtl8192e/rtl_cam.c:204

- WARNING: Avoid multiple line dereference

    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'

FILE: ./rtl8192e/rtl8192e/rtl_cam.c:209

- WARNING: Avoid multiple line dereference

    prefer 'info_element->data[info_element->len]'

FILE: ./rtl8192e/rtllib_rx.c:2287

---
These changes cause some of the lines to cross 80 characters however I believe that they improve the readability and provide a good trade off. Would love to hear your thoughts and suggestions on this.

 drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 12 ++++--------
 drivers/staging/rtl8192e/rtllib_rx.c        |  3 +--
 2 files changed, 5 insertions(+), 10 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +4 -8
index c8506517cc8d..f75a12543781 100644
@@ -185,14 +185,12 @@ void rtl92e_cam_restore(struct net_device *dev)
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type,
 				       (u8 *)dev->dev_addr, 0,
-				       (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 		} else {
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type,
 				       MacAddr, 0,
-				       (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 		}
 
 	} else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP) {
@@ -200,13 +198,11 @@ void rtl92e_cam_restore(struct net_device *dev)
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type,
 				       (u8 *)dev->dev_addr, 0,
-				       (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 		} else {
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type, MacAddr,
-				       0, (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       0, (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 			}
 	}
 
drivers/staging/rtl8192e/rtllib_rx.c +1 -2
index 15bbb63ca130..16931a4fae5d 100644
@@ -2283,8 +2283,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 
 		length -= sizeof(*info_element) + info_element->len;
 		info_element =
-		    (struct rtllib_info_element *)&info_element->
-		    data[info_element->len];
+		    (struct rtllib_info_element *)&info_element->data[info_element->len];
 	}
 
 	if (!network->atheros_cap_exist && !network->broadcom_cap_exist &&
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 staging: rtl8192e: Add identifier name to function definition

In reply to Ojaswin Mujoo

The patch fixes the following checkpatch.pl warnings:

- WARNING: function definition argument 'struct net_device *' should also have an identifier name
FILE: ./rtl8192e/rtl8192e/rtl_core.h:572:

- WARNING: function definition argument 'struct net_device *' should also have an identifier name
FILE: ./rtl8192e/rtl8192e/rtl_core.h:573:

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +2 -2
index 736f1a824cd2..698552a92100 100644
@@ -569,8 +569,8 @@ void rtl92e_writel(struct net_device *dev, int x, u32 y);
 
 void force_pci_posting(struct net_device *dev);
 
-void rtl92e_rx_enable(struct net_device *);
-void rtl92e_tx_enable(struct net_device *);
+void rtl92e_rx_enable(struct net_device *dev);
+void rtl92e_tx_enable(struct net_device *dev);
 
 void rtl92e_hw_sleep_wq(void *data);
 void rtl92e_commit(struct net_device *dev);
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/3 staging: rtl8192e: Fix whitespace around conditional statement

In reply to Ojaswin Mujoo

This patch fixes the following checkpatch.pl warnings:

- WARNING: suspect code indent for conditional statements (8, 17)
FILE: ./rtl8192e/rtl8192e/rtl_dm.c:1735:

- WARNING: Statements should start on a tabstop
FILE: ./rtl8192e/rtl8192e/rtl_dm.c:1736:

---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +1 -1
index e340be3ebb97..3d5f9dc5882b 100644
@@ -1733,7 +1733,7 @@ static void _rtl92e_dm_check_edca_turbo(struct net_device *dev)
 			priv->bcurrent_turbo_EDCA = true;
 		}
 	} else {
-		 if (priv->bcurrent_turbo_EDCA) {
+		if (priv->bcurrent_turbo_EDCA) {
 			u8 tmp = AC0_BE;
 
 			priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM,
Signature · 1 line
2.25.1