[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcU8B8fydh874p6HpgGXXRYvNGdphH=i17JHB3DYJ1JZQ@mail.gmail.com>
Date: Wed, 22 Dec 2021 20:49:26 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Muhammad Usama Anjum <usama.anjum@...labora.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
Mihail Chindris <mihail.chindris@...log.com>,
"open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
Collabora Kernel ML <kernel@...labora.com>,
kernel-janitors <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] drivers:iio:dac make expression evaluation 64-bit
On Wed, Dec 22, 2021 at 5:59 PM Muhammad Usama Anjum
<usama.anjum@...labora.com> wrote:
>
> Two 32-bit values are being evaluated using 32-bit arithmetic and then
> passed to s64 type. It is wrong. Expression should be evaluated using
> 64-bit arithmetic and then passed.
...
> dac->ch_data[ch].scale_dec = DIV_ROUND_CLOSEST((s64)rem * 1000000,
> 65536);
Shouldn't the above be fixed as well? Has anybody tried to compile on
32-bit arch this?
> - dac->ch_data[ch].offset_int = div_s64_rem(v_min * 65536, span, &rem);
> + dac->ch_data[ch].offset_int = div_s64_rem(v_min * 65536L, span, &rem);
> tmp = (s64)rem * 1000000;
> dac->ch_data[ch].offset_dec = div_s64(tmp, span);
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists