On Wed, Nov 13, 2024 at 8:51 AM <victor.duicu@xxxxxxxxxxxxx> wrote: > > From: Victor Duicu <victor.duicu@xxxxxxxxxxxxx> > > 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@xxxxxxxxx> -- With Best Regards, Andy Shevchenko