From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/3] iio:Add an IIO_VAL_INTO_PLUS_PICO return type for read_raw callbacks.
Date: Sun, 14 Apr 2013 14:22:04 +0200 [thread overview]
Message-ID: <516A9F6C.70906@metafoo.de> (raw)
In-Reply-To: <1365938625-21778-2-git-send-email-jic23@kernel.org>
On 04/14/2013 01:23 PM, Jonathan Cameron wrote:
> For now not added to the write_raw handling as no usecase yet exists
> and it would involve a more substantial reworking of the string
> processing code to handle it cleanly.
>
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/industrialio-core.c | 5 +++++
> include/linux/iio/types.h | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index e145931..40ef037 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -393,6 +393,11 @@ static ssize_t iio_read_channel_info(struct device *dev,
> return sprintf(buf, "-%d.%09u\n", val, -val2);
> else
> return sprintf(buf, "%d.%09u\n", val, val2);
> + case IIO_VAL_INT_PLUS_PICO:
> + if (val2 < 0)
> + return sprintf(buf, "-%d.%012u\n", val, -val2);
> + else
> + return sprintf(buf, "-%d.%012u\n", val, val2);
This one shouldn't have the minus sign.
> case IIO_VAL_FRACTIONAL:
> tmp = div_s64((s64)val * 1000000000LL, val2);
> val2 = do_div(tmp, 1000000000LL);
> diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
> index 88bf0f0..27e78a6 100644
> --- a/include/linux/iio/types.h
> +++ b/include/linux/iio/types.h
> @@ -58,6 +58,7 @@ enum iio_modifier {
> #define IIO_VAL_INT_PLUS_MICRO 2
> #define IIO_VAL_INT_PLUS_NANO 3
> #define IIO_VAL_INT_PLUS_MICRO_DB 4
> +#define IIO_VAL_INT_PLUS_PICO 5
> #define IIO_VAL_FRACTIONAL 10
> #define IIO_VAL_FRACTIONAL_LOG2 11
>
next prev parent reply other threads:[~2013-04-14 12:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-14 11:23 [PATCH 0/3] staging:iio:adis16130 bits and bobs Jonathan Cameron
2013-04-14 11:23 ` [PATCH 1/3] iio:Add an IIO_VAL_INTO_PLUS_PICO return type for read_raw callbacks Jonathan Cameron
2013-04-14 12:22 ` Lars-Peter Clausen [this message]
2013-04-14 11:23 ` [PATCH 2/3] staging:iio:gyro:adis16130 drop unused list.h header Jonathan Cameron
2013-04-14 11:23 ` [PATCH 3/3] staging:iio:gyro:adis16130 add offset and scale info mask elements Jonathan Cameron
2013-04-14 12:20 ` [PATCH 0/3] staging:iio:adis16130 bits and bobs Lars-Peter Clausen
2013-04-14 17:53 ` Jonathan Cameron
2013-04-14 17:56 ` Jonathan Cameron
2013-04-14 18:31 ` Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=516A9F6C.70906@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.