Re: [PATCH v3 1/2] iio: pressure: dps310: Refactor startup procedure

From: Andy Shevchenko
Date: Wed May 25 2022 - 12:35:36 EST


On Tue, May 24, 2022 at 10:35 PM Eddie James <eajames@xxxxxxxxxxxxx> wrote:
>
> Move the startup procedure into a function, and correct a missing
> check on the return code for writing the PRS_CFG register.

...

> +/*
> + * Some verions of chip will read temperatures in the ~60C range when

versions
of the chip(s)

> + * its actually ~20C. This is the manufacturer recommended workaround

it's

> + * to correct the issue. The registers used below are undocumented.
> + */

Yes, they are in the original code, but you may just fix while at it.

...

> + rc = dps310_temp_workaround(data);
> + if (rc < 0)

These ' < 0' parts are cargo cult, I believe.
That's why this makes code longer and confusing by "what is the
meaning of the positive values here?"

> + return rc;
> +
> + return 0;

That said,

return dps310_temp_workaround(data);

should suffice.

--
With Best Regards,
Andy Shevchenko