Skip to contentSkip to conversation

staging: vt6656: Fix CamelCase, add comments, change macro to function

PATCH In review Philipp Hortmann 2 participants 8 messages Feb 21, 2022 – Feb 22, 2022 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: vt6656: Fix CamelCase, add comments, change macro to function

Various checkpatch.pl fixes as liste below
Tested with device VNT6656G6A40
Transferred this patches over VNT6656G6A40

v2: Patch #1
Changed EN_CFG_PKT_BURST_MO to EN_CFG_PKT_BURST_MD Patch #2
Devided into three patches
Patch #3
Devided into two patches

Philipp Hortmann (6):
staging: vt6656: Fix CamelCase warnings in mac.h and mac.c
staging: vt6656: Add comment for locks
staging: vt6656: Fix CamelCase warnings in macro
staging: vt6656: Change macro to function and moved to better file
staging: vt6656: Remove ftrace-like logging
staging: vt6656: Remove unnecessary line breaks

 drivers/staging/vt6656/device.h | 11 ++---------
 drivers/staging/vt6656/mac.c    | 14 +++++++-------
 drivers/staging/vt6656/mac.h    | 22 +++++++++++-----------
 drivers/staging/vt6656/rxtx.c   |  8 ++------
 drivers/staging/vt6656/wcmd.c   | 13 +++++++++++--
 5 files changed, 33 insertions(+), 35 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/6 staging: vt6656: Fix CamelCase warnings in mac.h and mac.c

This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <EnCFG_BBType_a>
175: FILE: drivers/staging/vt6656/mac.h:175:
+#define EnCFG_BBType_a 0x00
and affected places in mac.c

---
V1 -> V2: Changed EN_CFG_PKT_BURST_MO to EN_CFG_PKT_BURST_MD

---
 drivers/staging/vt6656/mac.c | 14 +++++++-------
 drivers/staging/vt6656/mac.h | 22 +++++++++++-----------
 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/staging/vt6656/mac.c +7 -7
index 4f1f9b03a678..49430c0a99b8 100644
@@ -39,7 +39,7 @@ int vnt_mac_set_bb_type(struct vnt_private *priv, u8 type)
 	u8 data[2];
 
 	data[0] = type;
-	data[1] = EnCFG_BBType_MASK;
+	data[1] = EN_CFG_BB_TYPE_MASK;
 
 	return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0,
 			       MESSAGE_REQUEST_MACREG,	ARRAY_SIZE(data),
@@ -120,8 +120,8 @@ int vnt_mac_enable_protect_mode(struct vnt_private *priv)
 {
 	u8 data[2];
 
-	data[0] = EnCFG_ProtectMd;
-	data[1] = EnCFG_ProtectMd;
+	data[0] = EN_CFG_PROTECT_MD;
+	data[1] = EN_CFG_PROTECT_MD;
 
 	return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0,
 			       MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
@@ -132,7 +132,7 @@ int vnt_mac_disable_protect_mode(struct vnt_private *priv)
 	u8 data[2];
 
 	data[0] = 0;
-	data[1] = EnCFG_ProtectMd;
+	data[1] = EN_CFG_PROTECT_MD;
 
 	return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0,
 			       MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
@@ -142,8 +142,8 @@ int vnt_mac_enable_barker_preamble_mode(struct vnt_private *priv)
 {
 	u8 data[2];
 
-	data[0] = EnCFG_BarkerPream;
-	data[1] = EnCFG_BarkerPream;
+	data[0] = EN_CFG_BARKER_PREAM;
+	data[1] = EN_CFG_BARKER_PREAM;
 
 	return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2,
 			       MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
@@ -154,7 +154,7 @@ int vnt_mac_disable_barker_preamble_mode(struct vnt_private *priv)
 	u8 data[2];
 
 	data[0] = 0;
-	data[1] = EnCFG_BarkerPream;
+	data[1] = EN_CFG_BARKER_PREAM;
 
 	return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2,
 			       MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
drivers/staging/vt6656/mac.h +11 -11
index 05af9ca7d69c..0ac845bd3c5a 100644
@@ -172,20 +172,20 @@
 #define TFTCTL_TSFCNTREN	BIT(0)
 
 /* Bits in the EnhanceCFG_0 register */
-#define EnCFG_BBType_a		0x00
-#define EnCFG_BBType_b		BIT(0)
-#define EnCFG_BBType_g		BIT(1)
-#define EnCFG_BBType_MASK	(EnCFG_BBType_b | EnCFG_BBType_g)
-#define EnCFG_ProtectMd		BIT(5)
+#define EN_CFG_BB_TYPE_A	0x00
+#define EN_CFG_BB_TYPE_B	BIT(0)
+#define EN_CFG_BB_TYPE_G	BIT(1)
+#define EN_CFG_BB_TYPE_MASK	(EN_CFG_BB_TYPE_B | EN_CFG_BB_TYPE_G)
+#define EN_CFG_PROTECT_MD	BIT(5)
 
 /* Bits in the EnhanceCFG_1 register */
-#define EnCFG_BcnSusInd		BIT(0)
-#define EnCFG_BcnSusClr		BIT(1)
+#define EN_CFG_BCN_SUS_IND	BIT(0)
+#define EN_CFG_BCN_SUS_CLR	BIT(1)
 
 /* Bits in the EnhanceCFG_2 register */
-#define EnCFG_NXTBTTCFPSTR	BIT(0)
-#define EnCFG_BarkerPream	BIT(1)
-#define EnCFG_PktBurstMode	BIT(2)
+#define EN_CFG_NXTBTTCFPSTR	BIT(0)
+#define EN_CFG_BARKER_PREAM	BIT(1)
+#define EN_CFG_PKT_BURST_MD	BIT(2)
 
 /* Bits in the CFG register */
 #define CFG_TKIPOPT		BIT(7)
@@ -333,7 +333,7 @@
 #define PKT_TYPE_ERROR_CRC	BIT(1)
 #define PKT_TYPE_BSSID		BIT(0)
 
-#define Default_BI              0x200
+#define DEFAULT_BI		0x200
 
 /* MiscFIFO Offset */
 #define MISCFIFO_KEYETRY0	32
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/6 staging: vt6656: Add comment for locks

In reply to Philipp Hortmann

This patch fixes the checkpatch.pl warnings like:
- CHECK: spinlock_t definition without comment

---
V1 -> V2: Devided patch into three patches

---
 drivers/staging/vt6656/device.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vt6656/device.h +2 -2
index 8b6623a751f0..dda38c2a6f06 100644
@@ -268,8 +268,8 @@ struct vnt_private {
 	u32 rx_buf_sz;
 	int mc_list_count;
 
-	spinlock_t lock;
-	struct mutex usb_lock;
+	spinlock_t lock;		/* prepare tx USB URB */
+	struct mutex usb_lock;		/* USB control messages */
 
 	unsigned long flags;
 
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/6 staging: vt6656: Fix CamelCase warnings in macro

In reply to Philipp Hortmann

This patch fixes the checkpatch.pl warnings like:
- CHECK: Avoid CamelCase: <uVar>

---
V1 -> V2: Devided patch into three

---
 drivers/staging/vt6656/device.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +4 -4
index dda38c2a6f06..0ab2d60204e8 100644
@@ -381,11 +381,11 @@ struct vnt_private {
 	struct ieee80211_low_level_stats low_stats;
 };
 
-#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {	\
-	if ((uVar) >= ((uModulo) - 1))			\
-		(uVar) = 0;				\
+#define ADD_ONE_WITH_WRAP_AROUND(var, modulo) {	\
+	if ((var) >= ((modulo) - 1))			\
+		(var) = 0;				\
 	else						\
-		(uVar)++;				\
+		(var)++;				\
 }
 
 int vnt_init(struct vnt_private *priv);
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 4/6 staging: vt6656: Change macro to function and moved to better file

In reply to Philipp Hortmann

This patch fixes the checkpatch.pl warning like:
- CHECK: Macro argument reuse 'uVar' - possible side-effects? Moved the only twice used function to the file where it is used.

---
V1 -> V2: Devided patch into three

---
 drivers/staging/vt6656/device.h |  7 -------
 drivers/staging/vt6656/wcmd.c   | 13 +++++++++++--
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/staging/vt6656/device.h +0 -7
index 0ab2d60204e8..ca974d61d3f4 100644
@@ -381,13 +381,6 @@ struct vnt_private {
 	struct ieee80211_low_level_stats low_stats;
 };
 
-#define ADD_ONE_WITH_WRAP_AROUND(var, modulo) {	\
-	if ((var) >= ((modulo) - 1))			\
-		(var) = 0;				\
-	else						\
-		(var)++;				\
-}
-
 int vnt_init(struct vnt_private *priv);
 
 #endif
drivers/staging/vt6656/wcmd.c +11 -2
index e8ee2fbee76c..14b8aa587119 100644
@@ -31,6 +31,15 @@ static void vnt_cmd_timer_wait(struct vnt_private *priv, unsigned long msecs)
 	schedule_delayed_work(&priv->run_command_work, msecs_to_jiffies(msecs));
 }
 
+static u32 add_one_with_wrap_around(u32 var, u8 modulo)
+{
+	if (var >= (modulo - 1))
+		var = 0;
+	else
+		var++;
+	return var;
+}
+
 static int vnt_cmd_complete(struct vnt_private *priv)
 {
 	priv->command_state = WLAN_CMD_IDLE;
@@ -42,7 +51,7 @@ static int vnt_cmd_complete(struct vnt_private *priv)
 
 	priv->command = priv->cmd_queue[priv->cmd_dequeue_idx];
 
-	ADD_ONE_WITH_WRAP_AROUND(priv->cmd_dequeue_idx, CMD_Q_SIZE);
+	priv->cmd_dequeue_idx = add_one_with_wrap_around(priv->cmd_dequeue_idx, CMD_Q_SIZE);
 	priv->free_cmd_queue++;
 	priv->cmd_running = true;
 
@@ -157,7 +166,7 @@ int vnt_schedule_command(struct vnt_private *priv, enum vnt_cmd command)
 
 	priv->cmd_queue[priv->cmd_enqueue_idx] = command;
 
-	ADD_ONE_WITH_WRAP_AROUND(priv->cmd_enqueue_idx, CMD_Q_SIZE);
+	priv->cmd_enqueue_idx = add_one_with_wrap_around(priv->cmd_enqueue_idx, CMD_Q_SIZE);
 	priv->free_cmd_queue--;
 
 	if (!priv->cmd_running)
Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 5/6 staging: vt6656: Remove ftrace-like logging

In reply to Philipp Hortmann

This patch fixes the checkpatch.pl warning like:
WARNING: Unnecessary ftrace-like logging - prefer using ftrace

---
V1 -> V2: Devided patch into two

---
 drivers/staging/vt6656/rxtx.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/vt6656/rxtx.c +0 -2
index a31947f2620d..5839b34b2e93 100644
@@ -58,8 +58,6 @@ static struct vnt_usb_send_context
 	struct vnt_usb_send_context *context = NULL;
 	int ii;
 
-	dev_dbg(&priv->usb->dev, "%s\n", __func__);
-
 	for (ii = 0; ii < priv->num_tx_context; ii++) {
 		if (!priv->tx_context[ii])
 			return NULL;
Signature · 1 line
2.25.1
#6 lore raw

PATCH v2 6/6 staging: vt6656: Remove unnecessary line breaks

In reply to Philipp Hortmann

This patch fixes the checkpatch.pl warning like:
CHECK: Lines should not end with a '('

---
V1 -> V2: Devided patch into two

---
 drivers/staging/vt6656/rxtx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/vt6656/rxtx.c +2 -4
index 5839b34b2e93..4d29f8ebb393 100644
@@ -353,10 +353,8 @@ static bool vnt_fill_txkey(struct vnt_tx_buffer *tx_buffer, struct sk_buff *skb)
 		ether_addr_copy(mic_hdr->addr2, hdr->addr2);
 		ether_addr_copy(mic_hdr->addr3, hdr->addr3);
 
-		mic_hdr->frame_control = cpu_to_le16(
-			le16_to_cpu(hdr->frame_control) & 0xc78f);
-		mic_hdr->seq_ctrl = cpu_to_le16(
-				le16_to_cpu(hdr->seq_ctrl) & 0xf);
+		mic_hdr->frame_control = cpu_to_le16(le16_to_cpu(hdr->frame_control) & 0xc78f);
+		mic_hdr->seq_ctrl = cpu_to_le16(le16_to_cpu(hdr->seq_ctrl) & 0xf);
 
 		if (ieee80211_has_a4(hdr->frame_control))
 			ether_addr_copy(mic_hdr->addr4, hdr->addr4);
Signature · 1 line
2.25.1
Reviewed-by on the v2 series
#7 lore raw
In reply to Philipp Hortmann
Quoted 10 lines · Philipp Hortmann

Various checkpatch.pl fixes as liste below
Tested with device VNT6656G6A40
Transferred this patches over VNT6656G6A40

v2: Patch #1
Changed EN_CFG_PKT_BURST_MO to EN_CFG_PKT_BURST_MD Patch #2
Devided into three patches
Patch #3
Devided into two patches

Thanks!

The one thing per patch rule is slightly complicated and different maintainers have slightly different lines that they draw. You could have merged patches 3 and 4 together and it would have been fine. But what you sent is also fine.

regards,
dan carpenter