Re: [PATCH 2/7] iio:accel: introduce st_accel_multiread_bit() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> This function is introduced as a preparation for regmap usage.
> 
> Signed-off-by: Denis Ciocca <denis.ciocca@xxxxxx>
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);




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux