Staging: rtl8723au: core: rtw_ieee80211: Fixed space and brace coding style issue.
PATCH 3/3 Staging: rtl8723au: core: rtw_ieee80211: Fixed space and brace coding style issue.
Fixed the space and brace coding style error.
ERROR: space required before that '='
ERROR: that open brace { should be on the previous line.
--- drivers/staging/rtl8723au/core/rtw_ieee80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723au/core/rtw_ieee80211.c +2 -2
@@ -65,8 +65,8 @@ static u8 WIFI_OFDMRATES[] = {int rtw_get_bit_value_from_ieee_value23a (u8 val) { -unsigned char dot11_rate_table[] = - {2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 }; +unsigned char dot11_rate_table[] = { +2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 };int i =0 ;
Signature · 1 line
1.9.1
Jes Sorensen
NAKQuoted 14 lines · Rakhi Sharma
Fixed the space and brace coding style error.
ERROR: space required before that '='
ERROR: that open brace { should be on the previous line.Signed-off-by Rakhi Sharma <[email protected]>--- drivers/staging/rtl8723au/core/rtw_ieee80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723au/core/rtw_ieee80211.c +0
-0
drivers/staging/rtl8723au/core/rtw_ieee80211.c static u8 WIFI_OFDMRATES[] = { · line 71
Quoted 9 lines
drivers/staging/rtl8723au/core/rtw_ieee80211.c +2
-2@@ -65,8 +65,8 @@ static u8 WIFI_OFDMRATES[] = {int rtw_get_bit_value_from_ieee_value23a (u8 val) { -unsigned char dot11_rate_table[] = - {2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 }; +unsigned char dot11_rate_table[] = { +2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 };int i =0 ;
This is a great example of checkpatch doing the wrong thing. What you did here was to make the code uglier rather than better.
NACK
Jes
Quoted 28 lines · Jes Sorensen
Quoted 21 lines · Rakhi Sharma
Fixed the space and brace coding style error.
ERROR: space required before that '='
ERROR: that open brace { should be on the previous line.Signed-off-by Rakhi Sharma <[email protected]>---
drivers/staging/rtl8723au/core/rtw_ieee80211.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723au/core/rtw_ieee80211.c +0
-0@@ -65,8 +65,8 @@ static u8 WIFI_OFDMRATES[] = {
intrtw_get_bit_value_from_ieee_value23a(u8 val)
{drivers/staging/rtl8723au/core/rtw_ieee80211.c +2
-2-unsigned char dot11_rate_table[] = - {2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 }; +unsigned char dot11_rate_table[] = { +2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 };Quoted 2 lines
int i = 0;This is a great example of checkpatch doing the wrong thing. What you did here was to make the code uglier rather than better.
Quoted 1 line
NACK
Here's the original code:
int rtw_get_bit_value_from_ieee_value23a(u8 val)
{
unsigned char dot11_rate_table[]=
{2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0};
int i = 0;
while (dot11_rate_table[i] != 0) {
if (dot11_rate_table[i] == val)
return BIT(i);
i++;
}
return 0;
}It has several nominal style defects:
o compares different types (unsigned char to u8)
o uses a while loop and test of a known sized array
o array isn't declared static const
o array initialization is different style from others in the same file. "type foo[] = { bar, baz };"
o the function argument is tested on the right side tested on left side is more common.
So this could be transformed into something like:
int rtw_get_bit_value_from_ieee_value23a(u8 val)
{
int i;
static const u8 dot11_rate_table[] = {
2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108
};
for (i = 0; i < ARRAY_SIZE(dot11_rate_table); i++) {
if (val == dot11_rate_table[i])
return BIT(i);
}
return 0;
}Rakhi, do please strive to make the code "better" rather than merely shut up checkpatch.
Quoted 59 lines · Joe Perches
Quoted 29 lines · Jes Sorensen
Quoted 22 lines · Rakhi Sharma
Fixed the space and brace coding style error.
ERROR: space required before that '='
ERROR: that open brace { should be on the previous line.Signed-off-by Rakhi Sharma <[email protected]>---
drivers/staging/rtl8723au/core/rtw_ieee80211.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723au/core/rtw_ieee80211.c +0
-0@@ -65,8 +65,8 @@ static u8 WIFI_OFDMRATES[] = {
intrtw_get_bit_value_from_ieee_value23a(u8 val)
{drivers/staging/rtl8723au/core/rtw_ieee80211.c +2
-2-unsigned char dot11_rate_table[] = - {2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 }; +unsigned char dot11_rate_table[] = { +2 ,4 ,11 ,22 ,12 ,18 ,24 ,36 ,48 ,72 ,96 ,108 ,0 };Quoted 2 lines
int i = 0;This is a great example of checkpatch doing the wrong thing. What you did here was to make the code uglier rather than better.
Quoted 1 line
NACK
Here's the original code:
int
rtw_get_bit_value_from_ieee_value23a(u8 val){ unsigned char dot11_rate_table[]= {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0}; int i = 0; while (dot11_rate_table[i] != 0) { if (dot11_rate_table[i] == val) return BIT(i); i++; } return 0; }It has several nominal style defects:
o compares different types (unsigned char to u8)
o uses a while loop and test of a known sized array
o array isn't declared static const
o array initialization is different style from others in the same file. "type foo[] = { bar, baz };"
o the function argument is tested on the right side tested on left side is more common.
Quoted 8 lines
So this could be transformed into something like:
int
rtw_get_bit_value_from_ieee_value23a(u8 val){ int i; static const u8 dot11_rate_table[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };
and per my previous email, the above is worse than than the original. The cleaner way to list it would be:
static const char dot11_rate_table[] =
{ 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };Jes
Quoted 1 line · Jes Sorensen
Joe Perches <[email protected]> writes:
[]
Quoted 9 lines
Quoted 8 lines
so this could be transformed into something like:
int
rtw_get_bit_value_from_ieee_value23a(u8 val){ int i; static const u8 dot11_rate_table[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };
Quoted 5 lines
and per my previous email, the above is worse than than the original. The cleaner way to list it would be:
static const char dot11_rate_table[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };
Either style is OK, but the style I used is slightly more common in the kernel overall, about 2:1.
The type should ideally be u8 and not char.
Quoted 12 lines · Joe Perches
Quoted 1 line · Jes Sorensen
Joe Perches <[email protected]> writes:
[]
Quoted 9 lines
Quoted 8 lines
so this could be transformed into something like:
int
rtw_get_bit_value_from_ieee_value23a(u8 val){ int i; static const u8 dot11_rate_table[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };
Quoted 8 lines
Quoted 5 lines
and per my previous email, the above is worse than than the original. The cleaner way to list it would be:
static const char dot11_rate_table[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };Either style is OK, but the style I used is slightly more common in the kernel overall, about 2:1.
It wastes a line for now reason and having the open bracket on a line by itself is slightly more obfuscating.
Quoted 1 line
The type should ideally be u8 and not char.
u8 or char is not a big deal for me here, I'm fine with either.
Jes