Skip to contentSkip to conversation

staging: vt6656: fixed a CamelCase coding style issue.

PATCH In review Selvakumar Elangovan 3 participants 4 messages Feb 19, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: fixed a CamelCase coding style issue.

This patch renames CamelCase macros uVar and uModulo into u_var and u_module in device.h

This issue was reported by checkpatch.pl

---
 drivers/staging/vt6656/device.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +4 -4
index 947530fefe94..6615d356f74a 100644
@@ -385,11 +385,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(u_var, u_modulo) {	\
+	if ((u_var) >= ((u_modulo) - 1))			\
+		(u_var) = 0;				\
 	else						\
-		(uVar)++;				\
+		(u_var)++;				\
 }
 
 int vnt_init(struct vnt_private *priv);
Signature · 6 lines
2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
maintainer
#1 lore raw
Quoted 15 lines · Selvakumar Elangovan

This patch renames CamelCase macros uVar and uModulo into u_var and u_module in device.h

This issue was reported by checkpatch.pl

---
 drivers/staging/vt6656/device.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +0 -0
index 947530fefe94..6615d356f74a 100644

drivers/staging/vt6656/device.h struct vnt_private { · line 388

Quoted 7 lines
drivers/staging/vt6656/device.h +1 -3
@@ -385,11 +385,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(u_var, u_modulo) {	\

"u_" does not really make any sense, right?

Just use "var" and "modulo" please.

But first, why is this needed at all? Isn't there an in-kernel function that should be used instead?

thanks,

greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#2 lore raw
In reply to Selvakumar Elangovan

You're not asking the right questions.

Quoted 3 lines · Selvakumar Elangovan

This patch renames CamelCase macros uVar and uModulo into u_var and u_module in device.h

Is "u_var" a good name? What does the "u_" even mean?

Quoted 12 lines

This issue was reported by checkpatch.pl

---
 drivers/staging/vt6656/device.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +0 -0
index 947530fefe94..6615d356f74a 100644

drivers/staging/vt6656/device.h struct vnt_private { · line 389

Quoted 8 lines
drivers/staging/vt6656/device.h +2 -3
@@ -385,11 +385,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(u_var, u_modulo) {	\
+	if ((u_var) >= ((u_modulo) - 1))			\

The \ is not aligned any more.

drivers/staging/vt6656/device.h struct vnt_private { · line 393

Quoted 5 lines
drivers/staging/vt6656/device.h +2 -1
+		(u_var) = 0;				\
 	else						\
-		(uVar)++;				\
+		(u_var)++;				\
 }

This macro is rubbish. How does the wrap around even make sense? I hope that if you review the code a bit I think you will find that the wrap around is impossible? Just fix the two callers and delete this macro.

regards,
dan carpenter

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#3 lore raw

Hi Dan Carpenter

Thanks for the feedback, I'll work on the suggestion and come back with a fix.

Regards
Selvakumar Elangovan

Quoted 40 lines · Dan Carpenter

You're not asking the right questions.

Quoted 3 lines · Selvakumar Elangovan

This patch renames CamelCase macros uVar and uModulo into u_var and u_module in device.h

Is "u_var" a good name? What does the "u_" even mean?

Quoted 12 lines

This issue was reported by checkpatch.pl

---
 drivers/staging/vt6656/device.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +0 -0
index 947530fefe94..6615d356f74a 100644

drivers/staging/vt6656/device.h struct vnt_private { · line 389

Quoted 8 lines
drivers/staging/vt6656/device.h +2 -3
@@ -385,11 +385,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(u_var, u_modulo) {  \
+     if ((u_var) >= ((u_modulo) - 1))                        \

The \ is not aligned any more.

drivers/staging/vt6656/device.h struct vnt_private { · line 393

Quoted 5 lines
drivers/staging/vt6656/device.h +2 -1
+             (u_var) = 0;                            \
      else                                            \
-             (uVar)++;                               \
+             (u_var)++;                              \
 }
Quoted 8 lines

This macro is rubbish. How does the wrap around even make sense? I hope that if you review the code a bit I think you will find that the wrap around is impossible? Just fix the two callers and delete this macro.

regards,
dan carpenter

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees