2022-10-17 17:03:30

by Deepak R Varma

[permalink] [raw]
Subject: [PATCH v1 0/4] staging: r8188eu: trivial code cleanup patches

Address different kinds of checkpatch complains for the staging/r8188eu module.
The patches are required to be applied in sequence.

Changes in v1:
1. Improve language / grammar for the patch descriptions
2. Further improve code reformatting

Deepak R Varma (4):
staging: r8188eu: use Linux kernel variable naming convention
staging: r8188eu: reformat long computation lines
staging: r8188eu: remove {} for single statement blocks
staging: r8188eu: use htons macro instead of __constant_htons

drivers/staging/r8188eu/core/rtw_br_ext.c | 122 +++++++++++-----------
1 file changed, 62 insertions(+), 60 deletions(-)

--
2.30.2




2022-10-17 17:05:18

by Deepak R Varma

[permalink] [raw]
Subject: [PATCH v1 2/4] staging: r8188eu: reformat long computation lines

Reformat long running computation instructions to improve code readability.
Address checkpatch script complaints like:
CHECK: line length of 171 exceeds 100 columns

Signed-off-by: Deepak R Varma <[email protected]>
---

Changes in v1:
1. Further improve the formatting per feedback from [email protected]


drivers/staging/r8188eu/core/rtw_br_ext.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index 79daf8f269d6..8b1c9fdf6ed2 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -211,8 +211,9 @@ static int __nat25_network_hash(unsigned char *network_addr)
} else if (network_addr[0] == NAT25_IPX) {
unsigned long x;

- x = network_addr[1] ^ network_addr[2] ^ network_addr[3] ^ network_addr[4] ^ network_addr[5] ^
- network_addr[6] ^ network_addr[7] ^ network_addr[8] ^ network_addr[9] ^ network_addr[10];
+ x = network_addr[1] ^ network_addr[2] ^ network_addr[3] ^ network_addr[4] ^
+ network_addr[5] ^ network_addr[6] ^ network_addr[7] ^ network_addr[8] ^
+ network_addr[9] ^ network_addr[10];

return x & (NAT25_HASH_SIZE - 1);
} else if (network_addr[0] == NAT25_APPLE) {
@@ -224,16 +225,18 @@ static int __nat25_network_hash(unsigned char *network_addr)
} else if (network_addr[0] == NAT25_PPPOE) {
unsigned long x;

- x = network_addr[0] ^ network_addr[1] ^ network_addr[2] ^ network_addr[3] ^ network_addr[4] ^ network_addr[5] ^ network_addr[6] ^ network_addr[7] ^ network_addr[8];
+ x = network_addr[0] ^ network_addr[1] ^ network_addr[2] ^ network_addr[3] ^
+ network_addr[4] ^ network_addr[5] ^ network_addr[6] ^ network_addr[7] ^
+ network_addr[8];

return x & (NAT25_HASH_SIZE - 1);
} else if (network_addr[0] == NAT25_IPV6) {
unsigned long x;

- x = network_addr[1] ^ network_addr[2] ^ network_addr[3] ^ network_addr[4] ^ network_addr[5] ^
- network_addr[6] ^ network_addr[7] ^ network_addr[8] ^ network_addr[9] ^ network_addr[10] ^
- network_addr[11] ^ network_addr[12] ^ network_addr[13] ^ network_addr[14] ^ network_addr[15] ^
- network_addr[16];
+ x = network_addr[1] ^ network_addr[2] ^ network_addr[3] ^ network_addr[4] ^
+ network_addr[5] ^ network_addr[6] ^ network_addr[7] ^ network_addr[8] ^
+ network_addr[9] ^ network_addr[10] ^ network_addr[11] ^ network_addr[12] ^
+ network_addr[13] ^ network_addr[14] ^ network_addr[15] ^ network_addr[16];

return x & (NAT25_HASH_SIZE - 1);
} else {
--
2.30.2



2022-10-17 21:39:20

by Philipp Hortmann

[permalink] [raw]
Subject: Re: [PATCH v1 0/4] staging: r8188eu: trivial code cleanup patches

On 10/17/22 17:56, Deepak R Varma wrote:
> Address different kinds of checkpatch complains for the staging/r8188eu module.
> The patches are required to be applied in sequence.
>
> Changes in v1:
> 1. Improve language / grammar for the patch descriptions
> 2. Further improve code reformatting
>
> Deepak R Varma (4):
> staging: r8188eu: use Linux kernel variable naming convention
> staging: r8188eu: reformat long computation lines
> staging: r8188eu: remove {} for single statement blocks
> staging: r8188eu: use htons macro instead of __constant_htons
>
> drivers/staging/r8188eu/core/rtw_br_ext.c | 122 +++++++++++-----------
> 1 file changed, 62 insertions(+), 60 deletions(-)
>
> --
> 2.30.2
>
>
>
>

I think this patch series should be v2 as the first one was a v1. The
next one should be the v3.

Please do variable changes driver wide and not only limited to a file.
Example:
This line contains the old variable:
void *scdb_findEntry(struct adapter *priv, unsigned char *ipAddr);

But in this line you have already changed ip_addr.
void *scdb_findEntry(struct adapter *priv, unsigned char *ip_addr)
{
unsigned char network_addr[MAX_NETWORK_ADDR_LEN];
struct nat25_network_db_entry *db;
int hash;
...


Please change all networkAddr and not only some.

Is it possible to changing __constant_htons as well in the entire driver?

Driver can be applied and compiled.
Tested device.

Thanks

Bye Philipp


2022-10-17 21:44:12

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH v1 0/4] staging: r8188eu: trivial code cleanup patches

On Mon, Oct 17, 2022 at 11:06:19PM +0200, Philipp Hortmann wrote:
> On 10/17/22 17:56, Deepak R Varma wrote:
> > Address different kinds of checkpatch complains for the staging/r8188eu module.
> > The patches are required to be applied in sequence.
> >
> > Changes in v1:
> > 1. Improve language / grammar for the patch descriptions
> > 2. Further improve code reformatting
> >
> > Deepak R Varma (4):
> > staging: r8188eu: use Linux kernel variable naming convention
> > staging: r8188eu: reformat long computation lines
> > staging: r8188eu: remove {} for single statement blocks
> > staging: r8188eu: use htons macro instead of __constant_htons
> >
> > drivers/staging/r8188eu/core/rtw_br_ext.c | 122 +++++++++++-----------
> > 1 file changed, 62 insertions(+), 60 deletions(-)
> >
> > --
> > 2.30.2
> >
> >
> >
> >

Hello Philipp,
Thank you for testing the patch set and the following feedback. Much appreciate.

>
> I think this patch series should be v2 as the first one was a v1. The next
> one should be the v3.

Okay. I will switch it to v3 if there is opportunity for another revision of
this patch set.

>
> Please do variable changes driver wide and not only limited to a file.
> Example:
> This line contains the old variable:
> void *scdb_findEntry(struct adapter *priv, unsigned char *ipAddr);
>
> But in this line you have already changed ip_addr.
> void *scdb_findEntry(struct adapter *priv, unsigned char *ip_addr)
> {
> unsigned char network_addr[MAX_NETWORK_ADDR_LEN];
> struct nat25_network_db_entry *db;
> int hash;
> ...

Since this is my first patch set, I wanted to be small and manageable. I also
made changes only to function parameters and local variable. I am now
comfortable to make similar change for the other files and symbols such as
functions and structures. I will send in a separate patch set for the remaining
files of this driver.

>
>
> Please change all networkAddr and not only some.

For this file, I changed all networkAddr definitions except those that are part
of global structure definition. I will include those changes in the next patch
set.

>
> Is it possible to changing __constant_htons as well in the entire driver?

Sure, in the next patch set.

>
> Driver can be applied and compiled.
> Tested device.
Thank you again.

./drv

>
> Thanks
>
> Bye Philipp
>
>