public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Subject: Re: [PATCH 3/4] iio: accel: bma180: Use explicit member assignment
Date: Mon, 23 Dec 2019 17:22:28 +0000	[thread overview]
Message-ID: <20191223172228.0457ec7a@archlinux> (raw)
In-Reply-To: <20191211213819.14024-3-linus.walleij@linaro.org>

On Wed, 11 Dec 2019 22:38:18 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:

> This uses the C99 explicit .member assignment for the
> variant data in struct bma180_part_info. This makes it
> easier to understand and add new variants.
> 
> Cc: Peter Meerwald <pmeerw@pmeerw.net>
> Cc: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

This I like.  Sensible improvement to readability.
Not sure why I let it through in the form it was in originally.
oh well.

Applied,

Thanks,

Jonathan

> ---
>  drivers/iio/accel/bma180.c | 68 ++++++++++++++++++++++++--------------
>  1 file changed, 44 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
> index 4a619b5a544a..f583f10ccbb9 100644
> --- a/drivers/iio/accel/bma180.c
> +++ b/drivers/iio/accel/bma180.c
> @@ -632,32 +632,52 @@ static const struct iio_chan_spec bma250_channels[] = {
>  
>  static const struct bma180_part_info bma180_part_info[] = {
>  	[BMA180] = {
> -		bma180_channels, ARRAY_SIZE(bma180_channels),
> -		bma180_scale_table, ARRAY_SIZE(bma180_scale_table),
> -		bma180_bw_table, ARRAY_SIZE(bma180_bw_table),
> -		BMA180_CTRL_REG0, BMA180_RESET_INT,
> -		BMA180_CTRL_REG0, BMA180_SLEEP,
> -		BMA180_BW_TCS, BMA180_BW,
> -		BMA180_OFFSET_LSB1, BMA180_RANGE,
> -		BMA180_TCO_Z, BMA180_MODE_CONFIG, BMA180_LOW_POWER,
> -		BMA180_CTRL_REG3, BMA180_NEW_DATA_INT,
> -		BMA180_RESET,
> -		bma180_chip_config,
> -		bma180_chip_disable,
> +		.channels = bma180_channels,
> +		.num_channels = ARRAY_SIZE(bma180_channels),
> +		.scale_table = bma180_scale_table,
> +		.num_scales = ARRAY_SIZE(bma180_scale_table),
> +		.bw_table = bma180_bw_table,
> +		.num_bw = ARRAY_SIZE(bma180_bw_table),
> +		.int_reset_reg = BMA180_CTRL_REG0,
> +		.int_reset_mask = BMA180_RESET_INT,
> +		.sleep_reg = BMA180_CTRL_REG0,
> +		.sleep_mask = BMA180_SLEEP,
> +		.bw_reg = BMA180_BW_TCS,
> +		.bw_mask = BMA180_BW,
> +		.scale_reg = BMA180_OFFSET_LSB1,
> +		.scale_mask = BMA180_RANGE,
> +		.power_reg = BMA180_TCO_Z,
> +		.power_mask = BMA180_MODE_CONFIG,
> +		.lowpower_val = BMA180_LOW_POWER,
> +		.int_enable_reg = BMA180_CTRL_REG3,
> +		.int_enable_mask = BMA180_NEW_DATA_INT,
> +		.softreset_reg = BMA180_RESET,
> +		.chip_config = bma180_chip_config,
> +		.chip_disable = bma180_chip_disable,
>  	},
>  	[BMA250] = {
> -		bma250_channels, ARRAY_SIZE(bma250_channels),
> -		bma250_scale_table, ARRAY_SIZE(bma250_scale_table),
> -		bma250_bw_table, ARRAY_SIZE(bma250_bw_table),
> -		BMA250_INT_RESET_REG, BMA250_INT_RESET_MASK,
> -		BMA250_POWER_REG, BMA250_SUSPEND_MASK,
> -		BMA250_BW_REG, BMA250_BW_MASK,
> -		BMA250_RANGE_REG, BMA250_RANGE_MASK,
> -		BMA250_POWER_REG, BMA250_LOWPOWER_MASK, 1,
> -		BMA250_INT_ENABLE_REG, BMA250_DATA_INTEN_MASK,
> -		BMA250_RESET_REG,
> -		bma250_chip_config,
> -		bma250_chip_disable,
> +		.channels = bma250_channels,
> +		.num_channels = ARRAY_SIZE(bma250_channels),
> +		.scale_table = bma250_scale_table,
> +		.num_scales = ARRAY_SIZE(bma250_scale_table),
> +		.bw_table = bma250_bw_table,
> +		.num_bw = ARRAY_SIZE(bma250_bw_table),
> +		.int_reset_reg = BMA250_INT_RESET_REG,
> +		.int_reset_mask = BMA250_INT_RESET_MASK,
> +		.sleep_reg = BMA250_POWER_REG,
> +		.sleep_mask = BMA250_SUSPEND_MASK,
> +		.bw_reg = BMA250_BW_REG,
> +		.bw_mask = BMA250_BW_MASK,
> +		.scale_reg = BMA250_RANGE_REG,
> +		.scale_mask = BMA250_RANGE_MASK,
> +		.power_reg = BMA250_POWER_REG,
> +		.power_mask = BMA250_LOWPOWER_MASK,
> +		.lowpower_val = 1,
> +		.int_enable_reg = BMA250_INT_ENABLE_REG,
> +		.int_enable_mask = BMA250_DATA_INTEN_MASK,
> +		.softreset_reg = BMA250_RESET_REG,
> +		.chip_config = bma250_chip_config,
> +		.chip_disable = bma250_chip_disable,
>  	},
>  };
>  


  reply	other threads:[~2019-12-23 17:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 21:38 [PATCH 1/4] iio: accel: bma180: Add dev helper variable Linus Walleij
2019-12-11 21:38 ` [PATCH 2/4] iio: accel: bma180: Basic regulator support Linus Walleij
2019-12-23 17:20   ` Jonathan Cameron
2019-12-11 21:38 ` [PATCH 3/4] iio: accel: bma180: Use explicit member assignment Linus Walleij
2019-12-23 17:22   ` Jonathan Cameron [this message]
2019-12-11 21:38 ` [PATCH 4/4] iio: accel: bma180: BMA254 support Linus Walleij
2019-12-19 21:49   ` Rob Herring
2019-12-23 17:28   ` Jonathan Cameron
2019-12-23 20:18     ` Linus Walleij
2019-12-23 17:18 ` [PATCH 1/4] iio: accel: bma180: Add dev helper variable 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=20191223172228.0457ec7a@archlinux \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=o.v.kravchenko@globallogic.com \
    --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