[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Ve_vv619-UxdBN+xhWGm32tCJkkN3epVRgCiLF7p6xMOw@mail.gmail.com>
Date: Tue, 21 Dec 2021 07:42:31 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Liam Beguin <liambeguin@...il.com>
Cc: Peter Rosin <peda@...ntia.se>, Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-iio <linux-iio@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Rob Herring <robh+dt@...nel.org>
Subject: Re: [PATCH v10 03/14] iio: inkern: make a best effort on offset calculation
On Mon, Dec 20, 2021 at 11:17 AM Liam Beguin <liambeguin@...il.com> wrote:
>
> From: Liam Beguin <lvb@...hos.com>
>
> iio_convert_raw_to_processed_unlocked() assumes the offset is an
> integer. Make a best effort to get a valid offset value for fractional
> cases without breaking implicit truncations.
...
> + offset_val /= (1 << offset_val2);
Besides potentially being problematic (if arg is 31 for the left
shift) why not simply
_val >>= _val2;
?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists