lkml.org 
[lkml]   [2024]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/6] iio: pressure: Simplify read_* functions
On Wed, Mar 13, 2024 at 06:40:03PM +0100, Vasileios Amoiridis wrote:

In the Subject: ... read_*() functions

> Add the coefficients for the IIO standard units inside the chip_info
> structure.
>
> Remove the calculations with the coefficients for the IIO compatibility
> from inside the read_(temp/press/humid) functions and move it to the

read_{temp,press,humid}()

> read_raw function.

read_raw()

> Execute the calculations with the coefficients inside the read_raw

read_raw()

> oneshot capture functions.
>
> Also fix raw_* and comp_* values signs.

..

> case IIO_TEMP:
> - ret = data->chip_info->read_temp(data, val, val2);
> + ret = data->chip_info->read_temp(data);
> + *val = data->chip_info->temp_coeffs[0] * ret;
> + *val2 = data->chip_info->temp_coeffs[1];

> + if (!strcmp(indio_dev->name, "bmp580"))
> + ret = IIO_VAL_FRACTIONAL_LOG2;
> + else
> + ret = IIO_VAL_FRACTIONAL;

I'm wondering if we may replace these strcmp():s by using enum and respective
values in chip_info.

> break;

--
With Best Regards,
Andy Shevchenko



\
 
 \ /
  Last update: 2024-03-13 20:18    [W:0.185 / U:1.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site