Re: [PATCH v5 1/5] iio: pressure: bmp280: simplify driver initialization logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 7, 2022 at 1:55 PM Angel Iglesias <ang.iglesiasg@xxxxxxxxx> wrote:
>
> Simplified common initialization logic of different sensor types
> unifying calibration and initial configuration recovery.
>
> Default config param values of each sensor type are stored inside
> chip_info structure and used to initialize sensor data struct instance.
>
> The helper functions for read each sensor type calibration are converted
> to a callback available on the chip_info struct.
>
> Revised BMP180 and BMP280 definitions and code functions to use GENMASK
> and FIELD_PREP/FIELD_GET utilities to homogenize structure with more
> recent drivers, in preparation for the patches adding support for the
> BMP380 sensors.

...

>         int ret;
>         unsigned int tmp;
>         __le16 l16;
>         __be16 b16;
>         struct device *dev = data->dev;
> +       struct bmp280_calib *calib = &data->calib.bmp280;

When you add longer lines, try to put them to be first.

>         __le16 t_buf[BMP280_COMP_TEMP_REG_COUNT / 2];
>         __le16 p_buf[BMP280_COMP_PRESS_REG_COUNT / 2];

...

>         int ret;
> -       u8 osrs = BMP280_OSRS_TEMP_X(data->oversampling_temp + 1) |
> -                 BMP280_OSRS_PRESS_X(data->oversampling_press + 1);
> +       u8 osrs = FIELD_PREP(BMP280_OSRS_TEMP_MASK, data->oversampling_temp + 1) |
> +                 FIELD_PREP(BMP280_OSRS_PRESS_MASK, data->oversampling_press + 1);

Ditto, move it to be before `int ret;` at the same time. Same for
other similar cases.

...

> +       /* apply initial values from chip info structure */

Make (one-line) comments consistent...

>         /* Bring up regulators */

...see the difference?

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux