linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/2] staging:iio:ad7606: Consolidate channel specs
Date: Sat, 6 Feb 2016 11:24:49 +0000	[thread overview]
Message-ID: <56B5D801.20903@kernel.org> (raw)
In-Reply-To: <1454668354-11450-2-git-send-email-lars@metafoo.de>

On 05/02/16 10:32, Lars-Peter Clausen wrote:
> By slightly reordering the channels in the channel spec array we can reuse
> the same array for all variant of the chip.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Fair enough I suppose, though I find it hard to care much about this sort
of consolidation as it trades slight readability disadvantage off against
reduced code size.

Applied to the togreg branch of iio.git.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/adc/ad7606_core.c | 34 ++++++++--------------------------
>  1 file changed, 8 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c
> index d0b634d..ce9b2c3 100644
> --- a/drivers/staging/iio/adc/ad7606_core.c
> +++ b/drivers/staging/iio/adc/ad7606_core.c
> @@ -250,7 +250,8 @@ static const struct attribute_group ad7606_attribute_group_range = {
>  		},						\
>  	}
>  
> -static const struct iio_chan_spec ad7606_8_channels[] = {
> +static const struct iio_chan_spec ad7606_channels[] = {
> +	IIO_CHAN_SOFT_TIMESTAMP(8),
>  	AD7606_CHANNEL(0),
>  	AD7606_CHANNEL(1),
>  	AD7606_CHANNEL(2),
> @@ -259,25 +260,6 @@ static const struct iio_chan_spec ad7606_8_channels[] = {
>  	AD7606_CHANNEL(5),
>  	AD7606_CHANNEL(6),
>  	AD7606_CHANNEL(7),
> -	IIO_CHAN_SOFT_TIMESTAMP(8),
> -};
> -
> -static const struct iio_chan_spec ad7606_6_channels[] = {
> -	AD7606_CHANNEL(0),
> -	AD7606_CHANNEL(1),
> -	AD7606_CHANNEL(2),
> -	AD7606_CHANNEL(3),
> -	AD7606_CHANNEL(4),
> -	AD7606_CHANNEL(5),
> -	IIO_CHAN_SOFT_TIMESTAMP(6),
> -};
> -
> -static const struct iio_chan_spec ad7606_4_channels[] = {
> -	AD7606_CHANNEL(0),
> -	AD7606_CHANNEL(1),
> -	AD7606_CHANNEL(2),
> -	AD7606_CHANNEL(3),
> -	IIO_CHAN_SOFT_TIMESTAMP(4),
>  };
>  
>  static const struct ad7606_chip_info ad7606_chip_info_tbl[] = {
> @@ -287,20 +269,20 @@ static const struct ad7606_chip_info ad7606_chip_info_tbl[] = {
>  	[ID_AD7606_8] = {
>  		.name = "ad7606",
>  		.int_vref_mv = 2500,
> -		.channels = ad7606_8_channels,
> -		.num_channels = 8,
> +		.channels = ad7606_channels,
> +		.num_channels = 9,
>  	},
>  	[ID_AD7606_6] = {
>  		.name = "ad7606-6",
>  		.int_vref_mv = 2500,
> -		.channels = ad7606_6_channels,
> -		.num_channels = 6,
> +		.channels = ad7606_channels,
> +		.num_channels = 7,
>  	},
>  	[ID_AD7606_4] = {
>  		.name = "ad7606-4",
>  		.int_vref_mv = 2500,
> -		.channels = ad7606_4_channels,
> -		.num_channels = 4,
> +		.channels = ad7606_channels,
> +		.num_channels = 5,
>  	},
>  };
>  
> 


  reply	other threads:[~2016-02-06 11:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 10:32 [PATCH 1/2] staging:iio:ad7606: Consolidate PM ops Lars-Peter Clausen
2016-02-05 10:32 ` [PATCH 2/2] staging:iio:ad7606: Consolidate channel specs Lars-Peter Clausen
2016-02-06 11:24   ` Jonathan Cameron [this message]
2016-02-06 11:22 ` [PATCH 1/2] staging:iio:ad7606: Consolidate PM ops Jonathan Cameron
2016-02-06 11:28   ` Lars-Peter Clausen
2016-02-06 17:54     ` Jonathan Cameron

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=56B5D801.20903@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).