[PATCH 19/38] iio: sensors-core: st: Support sensors which don't have a Data Ready pin

Jonathan Cameron jic23 at kernel.org
Sat Sep 14 12:53:44 EDT 2013


On 09/10/13 13:49, Lee Jones wrote:
> Not all ST's sensors support data ready, so let's make the declaration
> of one conditional.
> 
> Signed-off-by: Lee Jones <lee.jones at linaro.org>

Hi Lee,

This one doesn't actually build:

  CC [M]  drivers/iio/common/st_sensors/st_sensors_core.o
drivers/iio/common/st_sensors/st_sensors_core.c: In function 'st_sensors_set_drdy_int_pin':
drivers/iio/common/st_sensors/st_sensors_core.c:211:4: error: 'err' undeclared (first use in this function)
drivers/iio/common/st_sensors/st_sensors_core.c:211:4: note: each undeclared identifier is reported only once for each
function it appears in
drivers/iio/common/st_sensors/st_sensors_core.c:228:3: error: label 'init_error' used but not defined
make[4]: *** [drivers/iio/common/st_sensors/st_sensors_core.o] Error 1


The following patch gets rid of these lines so I'm guessing you reorganised your patch
series then didn't check buildling them in the new order.

Please fix this up before reposting the remainder of the series.

> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 24 +++++++++++++++++++-----
>  drivers/iio/pressure/st_pressure_core.c         |  3 ++-
>  2 files changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index eb261a5..b86cad2 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -198,14 +198,11 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
>  }
>  EXPORT_SYMBOL(st_sensors_set_axis_enable);
>  
> -int st_sensors_init_sensor(struct iio_dev *indio_dev,
> -					struct st_sensors_platform_data *pdata)
> +int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
> +				struct st_sensors_platform_data *pdata)
>  {
> -	int err;
>  	struct st_sensor_data *sdata = iio_priv(indio_dev);
>  
> -	mutex_init(&sdata->tb.buf_lock);
> -
>  	switch (pdata->drdy_int_pin) {
>  	case 1:
>  		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
> @@ -231,6 +228,20 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  		goto init_error;
>  	}
>  
> +	return 0;
> +}
> +
> +int st_sensors_init_sensor(struct iio_dev *indio_dev,
> +					struct st_sensors_platform_data *pdata)
> +{
> +	int err = 0;
> +	struct st_sensor_data *sdata = iio_priv(indio_dev);
> +
> +	mutex_init(&sdata->tb.buf_lock);
> +
> +	if (pdata)
> +		err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
> +
>  	err = st_sensors_set_enable(indio_dev, false);
>  	if (err < 0)
>  		goto init_error;
> @@ -266,6 +277,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
>  	u8 drdy_mask;
>  	struct st_sensor_data *sdata = iio_priv(indio_dev);
>  
> +	if (!sdata->sensor->drdy_irq.addr)
> +		return 0;
> +
>  	/* Enable/Disable the interrupt generator 1. */
>  	if (sdata->sensor->drdy_irq.ig1.en_addr > 0) {
>  		err = st_sensors_write_data_with_mask(indio_dev,
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 16cfbc5..279aafd 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -232,7 +232,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  
>  	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>  
> -	if (!plat_data)
> +	/* Some devices don't support a data ready pin. */
> +	if (!plat_data && pdata->sensor->drdy_irq.addr)
>  		plat_data =
>  			(struct st_sensors_platform_data *)&default_press_pdata;
>  
> 



More information about the linux-arm-kernel mailing list