Re: [PATCH v2 2/5] iio: pressure: bmp280: Add preinit callback
From: Andy Shevchenko
Date: Tue Dec 27 2022 - 16:41:33 EST
On Mon, Dec 26, 2022 at 03:29:21PM +0100, Angel Iglesias wrote:
> Adds preinit callback to execute operations on probe before applying
> initial configuration.
...
> @@ -935,6 +936,7 @@ static const struct bmp280_chip_info bmp280_chip_info = {
> .read_temp = bmp280_read_temp,
> .read_press = bmp280_read_press,
> .read_calib = bmp280_read_calib,
> + .preinit = NULL,
> };
>
> static int bme280_chip_config(struct bmp280_data *data)
> @@ -979,6 +981,7 @@ static const struct bmp280_chip_info bme280_chip_info = {
> .read_press = bmp280_read_press,
> .read_humid = bmp280_read_humid,
> .read_calib = bme280_read_calib,
> + .preinit = NULL,
> };
Useless changes.
...
> @@ -1604,6 +1614,7 @@ static const struct bmp280_chip_info bmp180_chip_info = {
> .read_temp = bmp180_read_temp,
> .read_press = bmp180_read_press,
> .read_calib = bmp180_read_calib,
> + .preinit = NULL,
> };
Ditto.
...
> + /*
> + * Some chips like the BMP3xx have preinit tasks to run
> + * before applying the initial configuration.
> + */
> + if (data->chip_info->preinit) {
> + ret = data->chip_info->preinit(data);
> + dev_err(dev, "error running preinit tasks");
Huh?! I guess you wanted
> if (ret < 0)
> return ret;
if (ret < 0)
return dev_err_probe(...);
> }
--
With Best Regards,
Andy Shevchenko