Staging(VT6656): Modified camelCase Variables
PATCH 1/1 Staging(VT6656): Modified camelCase Variables
'''
Variables 'uVar' and 'uModulo' were generating camelCase style issue. Modified them as 'u_var' and 'u_modulo' and the issue disappeared.
Recompiled and installed the modules and all was fine. '''
--- drivers/staging/vt6656/device.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +4 -4
@@ -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 · 1 line
2.25.1
Quoted 1 line · majauhar
'''
Please generate your changelog without these quote marks.
Quoted 2 lines
Variables 'uVar' and 'uModulo' were generating camelCase style issue. Modified them as '
u_var' and 'u_modulo' and the issue disappeared.
The 'uVar' naming is an indication of the bad kind of Hungarian notation.
https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/
drivers/staging/vt6656/device.h struct vnt_private { · line 393
Quoted 10 lines
drivers/staging/vt6656/device.h +4
-4-#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)++; \ }
it would be better to rename these to 'var' and 'modulo'.
But then we start to question the entire premise of this macro. It should probably be written as 'var = (var + 1) % modulo' (because arithmetic is generally cheaper than branches). And when you write it like that, you wonder why it's a macro at all instead of just written out. Not to mention that 'ADD_ONE' is generally spelled as 'INC'.
So ... the checkpatch warnings are good, but often they raise more questions than the obvious one.
Hi Matt,
Thanks for the feedback. Since this was my first patch, I was kinda only looking for checkpatch warnings. But this is a good lesson for me.
I will now rename the variables to 'var' and 'modulo' and generate the changelog without the *''' *marks. Please let me know if I should instead remove the macro and make it inline, since then I will also have to look into files that import 'device.h' and use the macro.
Quoted 33 lines · Matthew Wilcox
Quoted 1 line · majauhar
'''
Please generate your changelog without these quote marks.
Quoted 2 lines
Variables 'uVar' and 'uModulo' were generating camelCase style issue. Modified them as '
u_var' and 'u_modulo' and the issue disappeared.The 'uVar' naming is an indication of the bad kind of Hungarian notation.
https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/drivers/staging/vt6656/device.h struct vnt_private { · line 393
Quoted 10 lines
drivers/staging/vt6656/device.h +4
-4-#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)++; \ }it would be better to rename these to 'var' and 'modulo'.
But then we start to question the entire premise of this macro. It should probably be written as 'var = (var + 1) % modulo' (because arithmetic is generally cheaper than branches). And when you write it like that, you wonder why it's a macro at all instead of just written out. Not to mention that '
ADD_ONE' is generally spelled as 'INC'.So ... the checkpatch warnings are good, but often they raise more questions than the obvious one.