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: <CAHp75Vd4a0P3yLMsarcKH=rZ_sBTmJ4Hr545LJCfchCJMyzLUQ@mail.gmail.com>
Date: Wed, 13 Nov 2024 11:25:55 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: victor.duicu@...rochip.com
Cc: matteomartelli3@...il.com, jic23@...nel.org, lars@...afoo.de, 
	linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org, 
	marius.cristea@...rochip.com
Subject: Re: [PATCH v9] iio: adc: pac1921: Add ACPI support to Microchip pac1921

On Wed, Nov 13, 2024 at 8:51 AM <victor.duicu@...rochip.com> wrote:
>
> From: Victor Duicu <victor.duicu@...rochip.com>
>
> This patch implements ACPI support to Microchip pac1921.
> The driver can read the shunt resistor value and label from the ACPI table.

...

> +/*
> + * The maximum acceptable shunt value is 2146.999999 OHM.
> + * This value, which is below INT_MAX, was chosen in order to
> + * allow the readings from dt and ACPI to share the same range
> + * and to simplify the checks.
> + * With this value the maximum current that can be read is
> + * 0.1V / 2146.999999OHM = 46.576 uA
> + * If we use INT_MAX the maximum current that can be read is
> + * 0.1V / 2147.483647OHM = 46.566 uA
> + * The relative error between the two values is
> + * |(46.566 - 46.576) / 46.566| * 100 = 0.0214
> + */
> +#define PAC1921_MAX_SHUNT_VALUE_uOHMS          2146999999

You most likely want to have UL/ULL at the end.

+ blank line.

> +/* f7bb9932-86ee-4516-a236-7a7a742e55cb */
> +static const guid_t pac1921_guid =
> +                       GUID_INIT(0xf7bb9932, 0x86ee, 0x4516, 0xa2,
> +                                 0x36, 0x7a, 0x7a, 0x74, 0x2e, 0x55, 0xcb);
> +

...

> +       /*
> +        * This check validates shunt is not zero

the shunt

> +        * and does not surpass maximum value.
> +        * The check is done before calculating in order
> +        * to avoid val * MICRO overflowing.

Btw, does this use a full room of 80 characters per line?

> +        */

...

> +       if (ACPI_HANDLE(dev))

Probably we want here to have the same check as other drivers use,
i.e. is_acpi_node() / is_acpi_device_node() (choose one that suits
better for you).

> +               ret = pac1921_match_acpi_device(indio_dev);
> +       else
> +               ret = pac1921_parse_of_fw(indio_dev);

...


With above being addressed,
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ