public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: devendra sharma <devendra.sharma9091@gmail.com>, abbotti@mev.co.uk
Cc: hsweeten@visionengravers.com, gregkh@linuxfoundation.org,
	ansonjacob.aj@gmail.com, amitoj1606@gmail.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging:comedi:cb_pcidas64=>Fixed check patch warnings
Date: Sun, 18 Dec 2016 09:30:38 -0800	[thread overview]
Message-ID: <1482082238.2431.3.camel@perches.com> (raw)
In-Reply-To: <1482055995-31664-1-git-send-email-devendra.sharma9091@gmail.com>

On Sun, 2016-12-18 at 15:43 +0530, devendra sharma wrote:
> Fixed check patch warnings about multiple line dereferencing
[].
> diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
[]
> @@ -2476,18 +2475,15 @@ static int setup_channel_queue(struct comedi_device *dev,
>  			for (i = 0; i < cmd->chanlist_len; i++) {
>  				bits = 0;
>  				/* set channel */
> -				bits |= adc_chan_bits(CR_CHAN(cmd->
> -							      chanlist[i]));
> +				bits |= adc_chan_bits(
> +				CR_CHAN(cmd->chanlist[i]));
>  				/* set gain */
>  				bits |= ai_range_bits_6xxx(dev,
> -							   CR_RANGE(cmd->
> -								    chanlist
> -								    [i]));
> +				   CR_RANGE(cmd->chanlist[i]));
>  				/* set single-ended / differential */
>  				bits |= se_diff_bit_6xxx(dev,
> -							 CR_AREF(cmd->
> -								 chanlist[i]) ==
> -							 AREF_DIFF);
> +					 CR_AREF(cmd->chanlist[i]) ==
> +					 AREF_DIFF);
>  				if (CR_AREF(cmd->chanlist[i]) == AREF_COMMON)
>  					bits |= ADC_COMMON_BIT;
>  				/* mark end of queue */

This would be better handled by using a temporary like:

 			for (i = 0; i < cmd->chanlist_len; i++) {
				<type> list = cmd->chanlist[i];

				/* set channel */
				bits |= adc_chan_bits(CR_CHAN(list));
				/* set gain */
				bits |= ai_range_bmts_6xxx(dev, CR_RANGE(list));
				/* set single-ended / differential */
				bits |= se_diff_bit_6xxx(dev,
							 CR_AREF(list) == AREF_DIFF);
				if (CR_AREF(list) == AREF_COMMON)
					bits |= ADC_COMMON_BIT;

Or moving the indented block into a separate function.

      parent reply	other threads:[~2016-12-18 17:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-18 10:13 [PATCH] Staging:comedi:cb_pcidas64=>Fixed check patch warnings devendra sharma
2016-12-18 10:30 ` Greg KH
2016-12-18 17:30 ` Joe Perches [this message]

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=1482082238.2431.3.camel@perches.com \
    --to=joe@perches.com \
    --cc=abbotti@mev.co.uk \
    --cc=amitoj1606@gmail.com \
    --cc=ansonjacob.aj@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devendra.sharma9091@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    /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