Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1544179
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] Staging:comedi:cb_pcidas64=>Fixed check patch warnings |
| Date | 2016-12-18 18:40 +0100 |
| Message-ID | <sPNBg-3KK-23@gated-at.bofh.it> (permalink) |
| References | <sPGJs-6tT-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] Staging:comedi:cb_pcidas64=>Fixed check patch warnings devendra sharma <devendra.sharma9091@gmail.com> - 2016-12-18 11:20 +0100 Re: [PATCH] Staging:comedi:cb_pcidas64=>Fixed check patch warnings Greg KH <gregkh@linuxfoundation.org> - 2016-12-18 11:40 +0100 Re: [PATCH] Staging:comedi:cb_pcidas64=>Fixed check patch warnings Joe Perches <joe@perches.com> - 2016-12-18 18:40 +0100
csiph-web