Re: [PATCH 2/4] staging: r8188eu: reformat long computation lines
From: Deepak R Varma
Date: Mon Oct 17 2022 - 10:40:41 EST
On Mon, Oct 17, 2022 at 04:09:49PM +0200, Greg KH wrote:
> On Mon, Oct 17, 2022 at 06:52:50PM +0530, Deepak R Varma wrote:
> > Reformat long running computation instructions to improve code readability.
> > Address following checkpatch script complaints:
> > CHECK: line length of 171 exceeds 100 columns
> > CHECK: line length of 113 exceeds 100 columns
> >
> > Signed-off-by: Deepak R Varma <drv@xxxxxxxxx>
> > ---
> > drivers/staging/r8188eu/core/rtw_br_ext.c | 20 +++++++++++++-------
> > 1 file changed, 13 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..427da7e8ba4c 100644
> > --- a/drivers/staging/r8188eu/core/rtw_br_ext.c
> > +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
> > @@ -211,8 +211,10 @@ 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] ^
>
> Why not go out to [4] here and then you are one line shorter?
Thank you for the feedback.
Arranging 4 on a line still made the line extend 90+ columns. It appeared wide
to me. Stacking three in one line made it look better.
I will resend the patch with 4 in line and let you suggest if that is
acceptable.
Thank you,
./drv
>
> > + 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 +226,20 @@ 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] ^
>
> Same here
>
>
> > + 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];
>
> And here.
>
> thanks,
>
> greg k-h
>