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: <CAHp75VcT3VHcA8YVjc02PBXUxErnWg56Wyn1iiJshYVWv1YWxQ@mail.gmail.com>
Date: Wed, 17 Apr 2024 20:08:37 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Alisa-Dariana Roman <alisadariana@...il.com>
Cc: michael.hennerich@...log.com, linux-iio@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	alexandru.tachici@...log.com, lars@...afoo.de, jic23@...nel.org, 
	robh@...nel.org, krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org, 
	lgirdwood@...il.com, broonie@...nel.org, andy@...nel.org, nuno.sa@...log.com, 
	marcelo.schmitt@...log.com, bigunclemax@...il.com, dlechner@...libre.com, 
	okan.sahin@...log.com, fr0st61te@...il.com, alisa.roman@...log.com, 
	marcus.folkesson@...il.com, schnelle@...ux.ibm.com, liambeguin@...il.com
Subject: Re: [PATCH v6 3/5] iio: adc: ad7192: Add aincom supply

On Wed, Apr 17, 2024 at 8:01 PM Alisa-Dariana Roman
<alisadariana@...il.com> wrote:
>
> AINCOM should actually be a supply. AINx inputs are referenced to AINCOM
> in pseduo-differential operation mode. AINCOM voltage represets the

pseudo

> offset of corresponding channels.

..

> +               case IIO_VOLTAGE:
> +                       if (st->aincom_mv && !chan->differential)
> +                               *val += DIV_ROUND_CLOSEST_ULL((u64)st->aincom_mv * 1000000000,

It's quite easy to make a mistake in this long constant. Can you use
an appropriate one from units.h?

> +                                                             st->scale_avail[gain][1]);
> +                       return IIO_VAL_INT;

..

> +       aincom = devm_regulator_get_optional(&spi->dev, "aincom");
> +       if (!IS_ERR(aincom)) {

Why not a positive condition?

> +               ret = regulator_enable(aincom);
> +               if (ret) {

> +                       dev_err(&spi->dev, "Failed to enable specified AINCOM supply\n");

return dev_err_probe();

> +                       return ret;
> +               }
> +
> +               ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, aincom);
> +               if (ret)
> +                       return ret;
> +
> +               ret = regulator_get_voltage(aincom);
> +               if (ret < 0)
> +                       return dev_err_probe(&spi->dev, ret,
> +                                            "Device tree error, AINCOM voltage undefined\n");
> +               st->aincom_mv = ret / 1000;
> +       } else {
> +               st->aincom_mv = 0;
> +       }

..

> @@ -1113,6 +1145,7 @@ static int ad7192_probe(struct spi_device *spi)
>         st->int_vref_mv = ret / 1000;
>
>         st->chip_info = spi_get_device_match_data(spi);
> +
>         indio_dev->name = st->chip_info->name;
>         indio_dev->modes = INDIO_DIRECT_MODE;
>         indio_dev->channels = st->chip_info->channels;

Stray change.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ