Re: [PATCH 1/5] iio: pressure: bmp280: Add enumeration to handle chip variants

From: Andy Shevchenko
Date: Tue Dec 27 2022 - 16:36:28 EST


On Sun, Dec 25, 2022 at 05:56:07PM +0100, Angel Iglesias wrote:
> Adds enumeration to improve handling the different supported sensors
> on driver initialization. This avoid collisions if different variants
> share the same device idetifier on ID register.

...

> static const struct of_device_id bmp280_of_i2c_match[] = {
> - { .compatible = "bosch,bmp085", .data = (void *)BMP180_CHIP_ID },
> - { .compatible = "bosch,bmp180", .data = (void *)BMP180_CHIP_ID },
> - { .compatible = "bosch,bmp280", .data = (void *)BMP280_CHIP_ID },
> - { .compatible = "bosch,bme280", .data = (void *)BME280_CHIP_ID },
> - { .compatible = "bosch,bmp380", .data = (void *)BMP380_CHIP_ID },
> + { .compatible = "bosch,bmp085", .data = (void *)BMP180 },
> + { .compatible = "bosch,bmp180", .data = (void *)BMP180 },
> + { .compatible = "bosch,bmp280", .data = (void *)BMP280 },
> + { .compatible = "bosch,bme280", .data = (void *)BME280 },
> + { .compatible = "bosch,bmp380", .data = (void *)BMP380 },

Seems an unneeded churn. If we want to have chip info, then provide a pointer
here. And in case it's done later, squash into this patch.

--
With Best Regards,
Andy Shevchenko