Re: [PATCH] iio: industrialio-core: introduce IIO_VAL_INT_PLUS_NANO

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

 



On 05/27/11 14:51, michael.hennerich@xxxxxxxxxx wrote:
> From: Michael Hennerich <michael.hennerich@xxxxxxxxxx>
> 
> 
As discussed, handling the writing case is more tricky, but as our
only user is read only we can tackle that in the future.
> Signed-off-by: Michael Hennerich <michael.hennerich@xxxxxxxxxx>
Acked-by: Jonathan Cameron <jic23@xxxxxxxxx>
> ---
>  drivers/staging/iio/iio.h               |    1 +
>  drivers/staging/iio/industrialio-core.c |    5 +++++
>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
> index 38f1425..78a0927 100644
> --- a/drivers/staging/iio/iio.h
> +++ b/drivers/staging/iio/iio.h
> @@ -202,6 +202,7 @@ static inline s64 iio_get_time_ns(void)
>   * call to iio_device_register. */
>  #define IIO_VAL_INT 1
>  #define IIO_VAL_INT_PLUS_MICRO 2
> +#define IIO_VAL_INT_PLUS_NANO 3
>  
>  /**
>   * struct iio_info - constant information about device
> diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
> index 94d3bfa..e5a7663 100644
> --- a/drivers/staging/iio/industrialio-core.c
> +++ b/drivers/staging/iio/industrialio-core.c
> @@ -396,6 +396,11 @@ static ssize_t iio_read_channel_info(struct device *dev,
>  			return sprintf(buf, "-%d.%06u\n", val, -val2);
>  		else
>  			return sprintf(buf, "%d.%06u\n", val, val2);
> +	} else if (ret == IIO_VAL_INT_PLUS_NANO) {
> +		if (val2 < 0)
> +			return sprintf(buf, "-%d.%09u\n", val, -val2);
> +		else
> +			return sprintf(buf, "%d.%09u\n", val, val2);
>  	} else
>  		return 0;
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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