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] [day] [month] [year] [list]
Message-ID: <CAHp75Vf8nNTUM0RtScwMwRTndOyyDNO2dE-2yVML-WOh6s4uXA@mail.gmail.com>
Date:   Fri, 2 Sep 2022 18:10:41 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Oleksij Rempel <o.rempel@...gutronix.de>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Sascha Hauer <kernel@...gutronix.de>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>
Subject: Re: [PATCH v4 2/3] iio: adc: tsc2046: add vref support

On Fri, Sep 2, 2022 at 4:19 PM Oleksij Rempel <o.rempel@...gutronix.de> wrote:
>
> If VREF pin is attached, we should use external VREF source instead of
> the internal. Otherwise we will get wrong measurements on some of channel

the channel

> types.

Below are minor changes, not sure if you need a new version for that.

...

> +       priv->vref_reg = devm_regulator_get_optional(dev, "vref");

> +       if (IS_ERR(priv->vref_reg) && PTR_ERR(priv->vref_reg) != -ENODEV)
> +               return PTR_ERR(priv->vref_reg);
> +
> +       if (IS_ERR_OR_NULL(priv->vref_reg)) {
> +               priv->vref_reg = NULL;
> +               /* Use internal reference */
> +               priv->vref_mv = TI_TSC2046_INT_VREF;
> +               return 0;
> +       }

This can be refactored now

       if (IS_ERR(priv->vref_reg)) {
           /* If regulator exists but can't be get, return an error */
           if (PTR_ERR(priv->vref_reg) != -ENODEV)
               return PTR_ERR(priv->vref_reg);
           priv->vref_reg = NULL;
       }
       if (!priv->vref_reg) {
               /* Use internal reference */
               priv->vref_mv = TI_TSC2046_INT_VREF;
               return 0;
       }

...

> +       ret = devm_add_action_or_reset(dev, tsc2046_adc_regulator_disable,
> +                                      priv);

I believe it's fine to be on one line.

> +       if (ret)
> +               return ret;

...

> +       priv->vref_mv = ret / 1000;

MILLI?


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ