All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sean Nyekjaer <sean.nyekjaer@prevas.dk>, linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: core: added support for IIO_VAL_INT
Date: Sat, 31 Oct 2015 09:39:32 +0000	[thread overview]
Message-ID: <56348C54.7070705@kernel.org> (raw)
In-Reply-To: <1445935915-7765-1-git-send-email-sean.nyekjaer@prevas.dk>

On 27/10/15 08:51, Sean Nyekjaer wrote:
> Addded core support for IIO_VAL_INT in write_raw_get_fmt function.
too many 'd's
> 
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
I'm not convinced this works.  In iio_str_to_fixpoint if fract_mult ==1
and the value passed is say 1.2 we will get 1 + fract_mult*2 = 3.

Maybe it's just too early in the morning!  fract_mult = 0 would probably
do the job, but this does all seem rather silly given we can just use
the kstrto* function in the integer case rather than bludgeoning it
into the fixed point string reader.

Jonathan
> ---
>  drivers/iio/industrialio-core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 208358f..2d08c3c 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -571,6 +571,9 @@ static ssize_t iio_write_channel_info(struct device *dev,
>  	if (indio_dev->info->write_raw_get_fmt)
>  		switch (indio_dev->info->write_raw_get_fmt(indio_dev,
>  			this_attr->c, this_attr->address)) {
> +		case IIO_VAL_INT:
> +			fract_mult = 1;
> +			break;
>  		case IIO_VAL_INT_PLUS_MICRO:
>  			fract_mult = 100000;
>  			break;
> 


      reply	other threads:[~2015-10-31  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27  8:51 [PATCH] iio: core: added support for IIO_VAL_INT Sean Nyekjaer
2015-10-31  9:39 ` Jonathan Cameron [this message]

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=56348C54.7070705@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=sean.nyekjaer@prevas.dk \
    /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.