linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Denis Ciocca <denis.ciocca@st.com>
Cc: <linux-iio@vger.kernel.org>, <lorenzo@kernel.org>
Subject: Re: [PATCH 2/7] iio:accel: introduce st_accel_multiread_bit() function
Date: Sat, 22 Jun 2019 11:33:01 +0100	[thread overview]
Message-ID: <20190622113301.1fcec2d7@archlinux> (raw)
In-Reply-To: <20190617234943.10669-3-denis.ciocca@st.com>

On Mon, 17 Jun 2019 16:49:38 -0700
Denis Ciocca <denis.ciocca@st.com> wrote:

> This function is introduced as a preparation for regmap usage.
> 
> Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
This is fine, just a quick query from me inline to ensure I'm
understanding things correctly!

Jonathan

> ---
>  drivers/iio/accel/st_accel.h      |  1 +
>  drivers/iio/accel/st_accel_core.c | 16 ++++++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> index 979ab9679b99..0f0e5e8c8661 100644
> --- a/drivers/iio/accel/st_accel.h
> +++ b/drivers/iio/accel/st_accel.h
> @@ -68,6 +68,7 @@ static const struct st_sensors_platform_data default_accel_pdata = {
>  	.drdy_int_pin = 1,
>  };
>  
> +bool st_accel_multiread_bit(const char *name);
>  int st_accel_common_probe(struct iio_dev *indio_dev);
>  void st_accel_common_remove(struct iio_dev *indio_dev);
>  
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index e02b79931979..5029b399efa8 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -1147,6 +1147,22 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev,
>  #endif
>  }
>  
> +/*
> + * st_accel_multiread_bit() - check if device requires multi-read bit.
> + * @name: device name buffer reference.
> + */
> +bool st_accel_multiread_bit(const char *name)
> +{
> +	int index = st_sensors_get_settings_index(name,
> +					st_accel_sensors_settings,
> +					ARRAY_SIZE(st_accel_sensors_settings));
> +	if (index < 0)
> +		return false;

Slightly odd path given we effectively don't know.  This only works
I guess because we will error out elsewhere if the above can fail?

> +
> +	return st_accel_sensors_settings[index].multi_read_bit;
> +}
> +EXPORT_SYMBOL(st_accel_multiread_bit);
> +
>  int st_accel_common_probe(struct iio_dev *indio_dev)
>  {
>  	struct st_sensor_data *adata = iio_priv(indio_dev);


  reply	other threads:[~2019-06-22 10:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 23:49 [PATCH 0/7] iio:st_sensors: make use of regmap API Denis Ciocca
2019-06-17 23:49 ` [PATCH 1/7] iio:common:st_sensors: add st_sensors_get_settings_index() helper function Denis Ciocca
2019-06-22 10:30   ` Jonathan Cameron
2019-06-17 23:49 ` [PATCH 2/7] iio:accel: introduce st_accel_multiread_bit() function Denis Ciocca
2019-06-22 10:33   ` Jonathan Cameron [this message]
2019-06-17 23:49 ` [PATCH 3/7] iio:magn: introduce st_magn_multiread_bit() function Denis Ciocca
2019-06-17 23:49 ` [PATCH 4/7] iio:gyro: introduce st_gyro_multiread_bit() function Denis Ciocca
2019-06-17 23:49 ` [PATCH 5/7] iio:pressure: introduce st_pressure_multiread_bit() function Denis Ciocca
2019-06-17 23:49 ` [PATCH 6/7] iio: make st_sensors driver use regmap Denis Ciocca
2019-06-22 10:47   ` Jonathan Cameron
2019-06-26 20:45     ` Denis CIOCCA
2019-06-17 23:49 ` [PATCH 7/7] iio:common: make st_sensors_write_data_with_mask() inline Denis Ciocca
2019-06-22 10:49   ` Jonathan Cameron
2019-06-22 10:27 ` [PATCH 0/7] iio:st_sensors: make use of regmap API 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=20190622113301.1fcec2d7@archlinux \
    --to=jic23@kernel.org \
    --cc=denis.ciocca@st.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo@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;
as well as URLs for NNTP newsgroup(s).