linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: vt6656: Fix CamelCase, add comments, change macro to function
@ 2022-02-20 20:30 Philipp Hortmann
  2022-02-20 20:30 ` [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c Philipp Hortmann
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Philipp Hortmann @ 2022-02-20 20:30 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

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

Philipp Hortmann (3):
  staging: vt6656: Fix CamelCase warnings in mac.h and mac.c
  staging: vt6656: Add comment and change macro to function
  staging: vt6656: Remove ftrace-like logging and 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(-)

-- 
2.25.1


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

* [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c
  2022-02-20 20:30 [PATCH 0/3] staging: vt6656: Fix CamelCase, add comments, change macro to function Philipp Hortmann
@ 2022-02-20 20:30 ` Philipp Hortmann
  2022-02-21 12:27   ` Dan Carpenter
  2022-02-20 20:30 ` [PATCH 2/3] staging: vt6656: Add comment and change macro to function Philipp Hortmann
  2022-02-20 20:30 ` [PATCH 3/3] staging: vt6656: Remove ftrace-like logging and unnecessary line breaks Philipp Hortmann
  2 siblings, 1 reply; 8+ messages in thread
From: Philipp Hortmann @ 2022-02-20 20:30 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

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

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/vt6656/mac.c | 14 +++++++-------
 drivers/staging/vt6656/mac.h | 22 +++++++++++-----------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c
index 4f1f9b03a678..49430c0a99b8 100644
--- a/drivers/staging/vt6656/mac.c
+++ b/drivers/staging/vt6656/mac.c
@@ -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);
diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h
index 05af9ca7d69c..4ceecee3e82a 100644
--- a/drivers/staging/vt6656/mac.h
+++ b/drivers/staging/vt6656/mac.h
@@ -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_MO	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
-- 
2.25.1


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

* [PATCH 2/3] staging: vt6656: Add comment and change macro to function
  2022-02-20 20:30 [PATCH 0/3] staging: vt6656: Fix CamelCase, add comments, change macro to function Philipp Hortmann
  2022-02-20 20:30 ` [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c Philipp Hortmann
@ 2022-02-20 20:30 ` Philipp Hortmann
  2022-02-21 12:33   ` Dan Carpenter
  2022-02-21 17:15   ` Greg Kroah-Hartman
  2022-02-20 20:30 ` [PATCH 3/3] staging: vt6656: Remove ftrace-like logging and unnecessary line breaks Philipp Hortmann
  2 siblings, 2 replies; 8+ messages in thread
From: Philipp Hortmann @ 2022-02-20 20:30 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

This patch fixes the checkpatch.pl warnings like:
- CHECK: spinlock_t definition without comment
- CHECK: Avoid CamelCase: <uVar>
- CHECK: Macro argument reuse 'uVar' - possible side-effects?
and moved the only twice used macro to a function in the file
where the function is used.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/vt6656/device.h | 11 ++---------
 drivers/staging/vt6656/wcmd.c   | 13 +++++++++++--
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 8b6623a751f0..eb84590d5eeb 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -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;
 
@@ -381,13 +381,6 @@ struct vnt_private {
 	struct ieee80211_low_level_stats low_stats;
 };
 
-#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {	\
-	if ((uVar) >= ((uModulo) - 1))			\
-		(uVar) = 0;				\
-	else						\
-		(uVar)++;				\
-}
-
 int vnt_init(struct vnt_private *priv);
 
 #endif
diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
index e8ee2fbee76c..77c6d898f660 100644
--- a/drivers/staging/vt6656/wcmd.c
+++ b/drivers/staging/vt6656/wcmd.c
@@ -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 u_var, u8 u_modulo)
+{
+	if (u_var >= (u_modulo - 1))
+		u_var = 0;
+	else
+		u_var++;
+	return u_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)
-- 
2.25.1


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

* [PATCH 3/3] staging: vt6656: Remove ftrace-like logging and unnecessary line breaks
  2022-02-20 20:30 [PATCH 0/3] staging: vt6656: Fix CamelCase, add comments, change macro to function Philipp Hortmann
  2022-02-20 20:30 ` [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c Philipp Hortmann
  2022-02-20 20:30 ` [PATCH 2/3] staging: vt6656: Add comment and change macro to function Philipp Hortmann
@ 2022-02-20 20:30 ` Philipp Hortmann
  2022-02-21 12:35   ` Dan Carpenter
  2 siblings, 1 reply; 8+ messages in thread
From: Philipp Hortmann @ 2022-02-20 20:30 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

This patch fixes the checkpatch.pl warnings like:
WARNING: Unnecessary ftrace-like logging - prefer using ftrace
CHECK: Lines should not end with a '('

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/vt6656/rxtx.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index a31947f2620d..4d29f8ebb393 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -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;
@@ -355,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);
-- 
2.25.1


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

* Re: [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c
  2022-02-20 20:30 ` [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c Philipp Hortmann
@ 2022-02-21 12:27   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2022-02-21 12:27 UTC (permalink / raw)
  To: Philipp Hortmann
  Cc: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

On Sun, Feb 20, 2022 at 09:30:29PM +0100, Philipp Hortmann wrote:
>  /* 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_MO	BIT(2)

Presumably you mean "_MD" for mode instead "_MO"?

regards,
dan carpenter


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

* Re: [PATCH 2/3] staging: vt6656: Add comment and change macro to function
  2022-02-20 20:30 ` [PATCH 2/3] staging: vt6656: Add comment and change macro to function Philipp Hortmann
@ 2022-02-21 12:33   ` Dan Carpenter
  2022-02-21 17:15   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2022-02-21 12:33 UTC (permalink / raw)
  To: Philipp Hortmann
  Cc: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

On Sun, Feb 20, 2022 at 09:30:36PM +0100, Philipp Hortmann wrote:
> This patch fixes the checkpatch.pl warnings like:
> - CHECK: spinlock_t definition without comment
> - CHECK: Avoid CamelCase: <uVar>
> - CHECK: Macro argument reuse 'uVar' - possible side-effects?
> and moved the only twice used macro to a function in the file
> where the function is used.
> 
> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> ---
>  drivers/staging/vt6656/device.h | 11 ++---------
>  drivers/staging/vt6656/wcmd.c   | 13 +++++++++++--
>  2 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
> index 8b6623a751f0..eb84590d5eeb 100644
> --- a/drivers/staging/vt6656/device.h
> +++ b/drivers/staging/vt6656/device.h
> @@ -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*/

This needs to be sent as a separate path.  Add a space at the start and
end of the comments.  /* prepare tx USB URB */
/* USB control messages */

I'm not 100% sure I understand these comments but I haven't looked
at them in context.

>  
>  	unsigned long flags;
>  
> @@ -381,13 +381,6 @@ struct vnt_private {
>  	struct ieee80211_low_level_stats low_stats;
>  };
>  
> -#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {	\
> -	if ((uVar) >= ((uModulo) - 1))			\
> -		(uVar) = 0;				\
> -	else						\
> -		(uVar)++;				\
> -}
> -
>  int vnt_init(struct vnt_private *priv);
>  
>  #endif
> diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
> index e8ee2fbee76c..77c6d898f660 100644
> --- a/drivers/staging/vt6656/wcmd.c
> +++ b/drivers/staging/vt6656/wcmd.c
> @@ -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 u_var, u8 u_modulo)

Please don't name variables with Hungarian notation.  Remove the "u_".

regards,
dan carpenter


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

* Re: [PATCH 3/3] staging: vt6656: Remove ftrace-like logging and unnecessary line breaks
  2022-02-20 20:30 ` [PATCH 3/3] staging: vt6656: Remove ftrace-like logging and unnecessary line breaks Philipp Hortmann
@ 2022-02-21 12:35   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2022-02-21 12:35 UTC (permalink / raw)
  To: Philipp Hortmann
  Cc: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

On Sun, Feb 20, 2022 at 09:30:42PM +0100, Philipp Hortmann wrote:
> This patch fixes the checkpatch.pl warnings like:
> WARNING: Unnecessary ftrace-like logging - prefer using ftrace
> CHECK: Lines should not end with a '('
> 

You're going to need to send these as two separate patches.

regards,
dan carpenter


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

* Re: [PATCH 2/3] staging: vt6656: Add comment and change macro to function
  2022-02-20 20:30 ` [PATCH 2/3] staging: vt6656: Add comment and change macro to function Philipp Hortmann
  2022-02-21 12:33   ` Dan Carpenter
@ 2022-02-21 17:15   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2022-02-21 17:15 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: Forest Bond, linux-staging, linux-kernel

On Sun, Feb 20, 2022 at 09:30:36PM +0100, Philipp Hortmann wrote:
> This patch fixes the checkpatch.pl warnings like:
> - CHECK: spinlock_t definition without comment
> - CHECK: Avoid CamelCase: <uVar>
> - CHECK: Macro argument reuse 'uVar' - possible side-effects?

That is 3 different things and so, should be 3 different patches.
Please break patches up into "one patch per logical change".

thanks,

greg k-h

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

end of thread, other threads:[~2022-02-21 17:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-20 20:30 [PATCH 0/3] staging: vt6656: Fix CamelCase, add comments, change macro to function Philipp Hortmann
2022-02-20 20:30 ` [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c Philipp Hortmann
2022-02-21 12:27   ` Dan Carpenter
2022-02-20 20:30 ` [PATCH 2/3] staging: vt6656: Add comment and change macro to function Philipp Hortmann
2022-02-21 12:33   ` Dan Carpenter
2022-02-21 17:15   ` Greg Kroah-Hartman
2022-02-20 20:30 ` [PATCH 3/3] staging: vt6656: Remove ftrace-like logging and unnecessary line breaks Philipp Hortmann
2022-02-21 12:35   ` Dan Carpenter

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