All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Sam Muhammed <jane.pnx9@gmail.com>
Cc: William Hubbs <w.d.hubbs@gmail.com>,
	Chris Brannon <chris@the-brannons.com>,
	Kirk Reiser <kirk@reisers.ca>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] Re: [PATCH 1/3] Staging: speakup: Avoid multiple assignments.
Date: Tue, 24 Mar 2020 00:20:09 +0100	[thread overview]
Message-ID: <20200323232009.o7ibnz3b7pv52pkl@function> (raw)
In-Reply-To: <a0fb888ec415ab0ac4aa8900f4e744d71599ecad.camel@gmail.com>

Sam Muhammed, le lun. 23 mars 2020 19:13:16 -0400, a ecrit:
> On Mon, 2020-03-23 at 23:13 +0100, Samuel Thibault wrote:
> > Hello,
> > 
> > Sam Muhammed, le lun. 23 mars 2020 17:38:43 -0400, a ecrit:
> > > Modify the code to avoid multiple assignments by just
> > > doing the assignment in two steps.
> > 
> > The original version of the code is considered easier to read.
> > Yes, the tools say multiple assignments should be avoided, but that's
> > not a strict rule :)
> 
> Well yes! this got me a bit hesitant, but what got me encouraged to
> make this change is that i looked for patches for the same change in
> this driver and i found this commit:
> 
> 	f23519843b01fdc266dd70ca29ef0f0a54f8b064
> 
> which was applied for the same file main.c, so i thought this driver
> adopted this style, maintaining a common practice?

This is a quite different beast:

-               value = spk_lastkey = pad_chars[value];
+               value = pad_chars[value];
+               spk_lastkey = value;

there is not much in common between "value" and "spk_lastkey", and much
more in common between spk_lastkey and the other spk_* assignments
below.


> > > -	spk_x = spk_cx = vc->vc_x;
> > > -	spk_y = spk_cy = vc->vc_y;
> > > -	spk_pos = spk_cp = vc->vc_pos;
> > > +	spk_cx = vc->vc_x;
> > > +	spk_x = spk_cx;
> > > +	spk_cy = vc->vc_y;
> > > +	spk_y = spk_cy;
> > > +	spk_cp = vc->vc_pos;
> > > +	spk_pos = spk_cp;

Here, there is a lot in common between spk_x and spk_cx, the current
form makes it obvious that we are setting two x variables to vc_x. The
proposed form make its much less clear.

> should i revert this change and drop it from the patchset?

Please drop patch 1 from the 3 yes.

Samuel


  reply	other threads:[~2020-03-23 23:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 21:38 [PATCH 0/3] Staging: speakup: Misc cleanups and code reformatting Sam Muhammed
2020-03-23 21:38 ` [PATCH 1/3] Staging: speakup: Avoid multiple assignments Sam Muhammed
2020-03-23 22:13   ` Samuel Thibault
2020-03-23 23:13     ` [Outreachy kernel] " Sam Muhammed
2020-03-23 23:20       ` Samuel Thibault [this message]
2020-03-23 23:27         ` Sam Muhammed
2020-03-23 21:38 ` [PATCH 2/3] Staging: speakup: Use sizeof(*var) in kmalloc() Sam Muhammed
2020-03-23 22:14   ` Samuel Thibault
2020-03-23 21:38 ` [PATCH 3/3] Staging: speakup: Add identifier name to function declaration arguments Sam Muhammed
2020-03-23 22:14   ` Samuel Thibault

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=20200323232009.o7ibnz3b7pv52pkl@function \
    --to=samuel.thibault@ens-lyon.org \
    --cc=chris@the-brannons.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jane.pnx9@gmail.com \
    --cc=kirk@reisers.ca \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=w.d.hubbs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.