[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 8 Aug 2022 10:18:57 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Angel Iglesias <ang.iglesiasg@...il.com>
Cc: linux-iio <linux-iio@...r.kernel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Ulf Hansson <ulf.hansson@...aro.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Paul Cercueil <paul@...pouillou.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 1/5] iio: pressure: bmp280: simplify driver
initialization logic
On Sun, Aug 7, 2022 at 1:55 PM Angel Iglesias <ang.iglesiasg@...il.com> 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
Powered by blists - more mailing lists