linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: rtl8192e: Fix style warnings in rtl8192e driver
@ 2021-05-10 11:29 Ojaswin Mujoo
  2021-05-10 11:31 ` [PATCH 1/3] staging: rtl8192e: Avoid multiple line dereference Ojaswin Mujoo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ojaswin Mujoo @ 2021-05-10 11:29 UTC (permalink / raw)
  To: linux-staging; +Cc: linux-kernel, ojaswin98, gregkh, atulgopinathan, yashsri421

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(-)

-- 
2.25.1

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

* [PATCH 1/3] staging: rtl8192e: Avoid multiple line dereference
  2021-05-10 11:29 [PATCH 0/3] staging: rtl8192e: Fix style warnings in rtl8192e driver Ojaswin Mujoo
@ 2021-05-10 11:31 ` Ojaswin Mujoo
  2021-05-10 11:34 ` [PATCH 2/3] staging: rtl8192e: Add identifier name to function definition Ojaswin Mujoo
  2021-05-10 11:35 ` [PATCH 3/3] staging: rtl8192e: Fix whitespace around conditional statement Ojaswin Mujoo
  2 siblings, 0 replies; 4+ messages in thread
From: Ojaswin Mujoo @ 2021-05-10 11:31 UTC (permalink / raw)
  To: linux-staging; +Cc: linux-kernel, ojaswin98, gregkh, atulgopinathan, yashsri421

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

Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
---
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(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
index c8506517cc8d..f75a12543781 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
@@ -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]));
 			}
 	}
 
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 15bbb63ca130..16931a4fae5d 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -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 &&
-- 
2.25.1


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

* [PATCH 2/3] staging: rtl8192e: Add identifier name to function definition
  2021-05-10 11:29 [PATCH 0/3] staging: rtl8192e: Fix style warnings in rtl8192e driver Ojaswin Mujoo
  2021-05-10 11:31 ` [PATCH 1/3] staging: rtl8192e: Avoid multiple line dereference Ojaswin Mujoo
@ 2021-05-10 11:34 ` Ojaswin Mujoo
  2021-05-10 11:35 ` [PATCH 3/3] staging: rtl8192e: Fix whitespace around conditional statement Ojaswin Mujoo
  2 siblings, 0 replies; 4+ messages in thread
From: Ojaswin Mujoo @ 2021-05-10 11:34 UTC (permalink / raw)
  To: linux-staging; +Cc: linux-kernel, ojaswin98, gregkh, atulgopinathan, yashsri421

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:

Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index 736f1a824cd2..698552a92100 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -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);
-- 
2.25.1


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

* [PATCH 3/3] staging: rtl8192e: Fix whitespace around conditional statement
  2021-05-10 11:29 [PATCH 0/3] staging: rtl8192e: Fix style warnings in rtl8192e driver Ojaswin Mujoo
  2021-05-10 11:31 ` [PATCH 1/3] staging: rtl8192e: Avoid multiple line dereference Ojaswin Mujoo
  2021-05-10 11:34 ` [PATCH 2/3] staging: rtl8192e: Add identifier name to function definition Ojaswin Mujoo
@ 2021-05-10 11:35 ` Ojaswin Mujoo
  2 siblings, 0 replies; 4+ messages in thread
From: Ojaswin Mujoo @ 2021-05-10 11:35 UTC (permalink / raw)
  To: linux-staging; +Cc: linux-kernel, ojaswin98, gregkh, atulgopinathan, yashsri421

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:

Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index e340be3ebb97..3d5f9dc5882b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -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,
-- 
2.25.1


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

end of thread, other threads:[~2021-05-10 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 11:29 [PATCH 0/3] staging: rtl8192e: Fix style warnings in rtl8192e driver Ojaswin Mujoo
2021-05-10 11:31 ` [PATCH 1/3] staging: rtl8192e: Avoid multiple line dereference Ojaswin Mujoo
2021-05-10 11:34 ` [PATCH 2/3] staging: rtl8192e: Add identifier name to function definition Ojaswin Mujoo
2021-05-10 11:35 ` [PATCH 3/3] staging: rtl8192e: Fix whitespace around conditional statement Ojaswin Mujoo

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