lkml.org 
[lkml]   [2013]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] iio: core: Avoid double minus in sysfs output
From
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?


\
 
 \ /
  Last update: 2013-07-19 09:01    [W:1.085 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site