public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Deepak R Varma <drv@mailo.com>
To: Joe Perches <joe@perches.com>
Cc: David Laight <David.Laight@aculab.com>,
	'Greg KH' <gregkh@linuxfoundation.org>,
	"outreachy@lists.linux.dev" <outreachy@lists.linux.dev>,
	"Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>,
	"phil@philpotter.co.uk" <phil@philpotter.co.uk>,
	"paskripkin@gmail.com" <paskripkin@gmail.com>,
	"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kumarpraveen@linux.microsoft.com"
	<kumarpraveen@linux.microsoft.com>,
	"saurabh.truth@gmail.com" <saurabh.truth@gmail.com>
Subject: Re: [PATCH 2/4] staging: r8188eu: reformat long computation lines
Date: Wed, 19 Oct 2022 11:47:04 +0530	[thread overview]
Message-ID: <Y0+WYIVTugrs6khA@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <e2675698427ed987dd88ed5f9996fe86e5315dbb.camel@perches.com>

On Tue, Oct 18, 2022 at 10:43:07PM -0700, Joe Perches wrote:
> On Tue, 2022-10-18 at 18:12 +0530, Deepak R Varma wrote:
> > On Tue, Oct 18, 2022 at 11:21:26AM +0000, David Laight wrote:
> > > From: Greg KH
> > > > Sent: 17 October 2022 15:10
> > > >
> > > > 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
> []
> > > > > diff --git 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?
> > >
> > > and/or use a shorter variable name....
> > Hi David,
> > I have already re-submitted the patch set with 4 in line arrangement. Do you
> > still suggest using shorter variable names?
>
> Assuming this code is not performance sensitive, I suggest not just
> molifying checkpatch but perhaps improving the code by adding a helper
> function something like:
>
> u8 xor_array_u8(u8 *x, size_t len)
> {
> 	size_t i;
> 	u8 xor = x[0];
>
> 	for (i = 1; i < len; i++)
> 		xor ^= x[i];
>
> 	return xor;
> }
>
> so for instance this could be:
>
> 		x = xor_array_u8(&network_addr[1], 10);
>

Hi Joe,
Great suggestion. Thank you.
Is there a way to confirm that this improvement won't impact performance? Will I
need any specific hardware / device to run tests?

./drv







  reply	other threads:[~2022-10-19  6:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 13:20 [PATCH 0/4] staging: r8188eu: trivial code cleanup patches Deepak R Varma
2022-10-17 13:21 ` [PATCH 1/4] staging: r8188eu: use Linux kernel variable naming convention Deepak R Varma
2022-10-17 13:56   ` Julia Lawall
2022-10-17 14:12     ` Deepak R Varma
2022-10-17 13:23 ` [PATCH 3/4] staging: r8188eu: remove {} for single statement blocks Deepak R Varma
2022-10-17 13:57   ` Julia Lawall
2022-10-17 14:13     ` Deepak R Varma
2022-10-17 13:24 ` [PATCH 4/4] staging: r8188eu: use htons macro instead of __constant_htons Deepak R Varma
2022-10-19  6:08   ` Joe Perches
2022-10-19  9:27     ` Deepak R Varma
2022-11-05 15:00     ` Deepak R Varma
2022-10-17 13:26 ` [PATCH 2/4] staging: r8188eu: reformat long computation lines Deepak R Varma
2022-10-17 13:22   ` Deepak R Varma
2022-10-17 14:09   ` Greg KH
2022-10-17 14:10     ` Deepak R Varma
2022-10-17 14:52       ` Greg KH
2022-10-18 11:21     ` David Laight
2022-10-18 12:42       ` Deepak R Varma
2022-10-19  5:43         ` Joe Perches
2022-10-19  6:17           ` Deepak R Varma [this message]
2022-10-19  6:38             ` Joe Perches
2022-10-19  6:44               ` Deepak R Varma
2022-10-19  9:02                 ` Deepak R Varma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y0+WYIVTugrs6khA@debian-BULLSEYE-live-builder-AMD64 \
    --to=drv@mailo.com \
    --cc=David.Laight@aculab.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=kumarpraveen@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=outreachy@lists.linux.dev \
    --cc=paskripkin@gmail.com \
    --cc=phil@philpotter.co.uk \
    --cc=saurabh.truth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox