From: Michael Hennerich Date: Mon, 27 Jun 2011 12:07:07 +0000 (+0100) Subject: iio: industrialio-core: introduce IIO_VAL_INT_PLUS_NANO X-Git-Tag: MMI-PSA29.97-13-9~18845^2~493 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=71646e2c7ae4edb92dfa89eccb354d81be1cbbbd;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git iio: industrialio-core: introduce IIO_VAL_INT_PLUS_NANO Signed-off-by: Michael Hennerich Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h index 38f1425f4645..78a0927c9fdf 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 94d3bfaa061d..e5a7663613a7 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; }