lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcvA=dDOJXSFzgz69JVgbez4Lz27EGOEF7JWUehyrwQrA@mail.gmail.com>
Date:   Wed, 11 Aug 2021 19:06:43 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Lars-Peter Clausen <lars@...afoo.de>
Cc:     Mugilraj Dhavachelvan <dmugil2000@...il.com>,
        "Bogdan, Dragos" <Dragos.Bogdan@...log.com>,
        Darius <Darius.Berghe@...log.com>,
        Rob Herring <robh+dt@...nel.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Chris Packham <chris.packham@...iedtelesis.co.nz>,
        Slawomir Stepien <sst@...zta.fm>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110

On Wed, Aug 11, 2021 at 11:15 AM Lars-Peter Clausen <lars@...afoo.de> wrote:
> On 8/10/21 2:49 PM, Andy Shevchenko wrote:
> >
> >> +       data->tol = data->cfg->kohms * (val & GENMASK(6, 0)) * 10 / 8;
> >> +       if (!(val & BIT(7)))
> >> +               data->tol *= -1;
> > Shouldn't you simple use corresponding sign_extend*()?
> The data is encoded a sign-magnitude. sign_extend() works for two's
> complement numbers.

Good catch!
I'm wondering if it's a good idea to have a sign_magnitude_to_int()
helper or so?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ