Skip to content

Commit

Permalink
iio: industrialio-core: introduce IIO_VAL_INT_PLUS_NANO
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Michael Hennerich authored and Greg Kroah-Hartman committed Jun 28, 2011
1 parent 6263ba5 commit 71646e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/staging/iio/iio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions drivers/staging/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 71646e2

Please sign in to comment.