linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Oleksandr Kravchenko <x0199363@ti.com>,
	jic23@cam.ac.uk, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: core: Avoid double minus in sysfs output
Date: Fri, 19 Jul 2013 22:06:53 +0100	[thread overview]
Message-ID: <51E9AA6D.3070007@kernel.org> (raw)
In-Reply-To: <CAGH3droXKeE7diARCZQ=n37XkAmYzrcUkyZLvcWjWVLHvJnWVw@mail.gmail.com>

On 07/19/2013 07:15 AM, Oleksandr Kravchenko wrote:
> On Thu, Jul 18, 2013 at 7:24 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
>> On 07/18/2013 05:47 PM, Oleksandr Kravchenko wrote:
>>> From: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
>>>
>>> This patch fixes the issue with double minus in output when
>>> reading channels from sysfs for IIO_VAL_INT_PLUS_MICRO and
>>> IIO_VAL_INT_PLUS_NANO cases. Until this patch if val and val2
>>> both are negatives output string contains "--" before
>>> digits. It is result of "-%d..." in sprintf() format.
>>>
>>
>> Hm, this might be a bug in a driver that is triggering this. The idea is
>> that val2 is only allowed to be negative if val is 0.
>>
>> - Lars
>>
> If I calculate val and val2 in next way:
> *val = adc / 1000000;
> *val2 = adc % 1000000;
> both val and val2 could by negative. Do I have to check it in my driver?
> 
I guess it is will happen occasionally.  In the c89 standard, module for a negative
is implementation specific.  Anyone know if we can assume this will work in all cases
within the kernel?

  reply	other threads:[~2013-07-19 21:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 15:47 [PATCH] iio: core: Avoid double minus in sysfs output Oleksandr Kravchenko
2013-07-18 16:24 ` Lars-Peter Clausen
2013-07-19  6:15   ` Oleksandr Kravchenko
2013-07-19 21:06     ` Jonathan Cameron [this message]
2013-07-22 10:51       ` Oleksandr Kravchenko
  -- strict thread matches above, loose matches on Subject: below --
2013-07-22 10:57 Oleksandr Kravchenko
2013-07-22 11:16 Oleksandr Kravchenko
2013-07-27 11:51 ` Jonathan Cameron

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=51E9AA6D.3070007@kernel.org \
    --to=jic23@kernel.org \
    --cc=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.v.kravchenko@globallogic.com \
    --cc=x0199363@ti.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).