iio: pressure: bmp280: Make read calibration callback optional
authorAngel Iglesias <ang.iglesiasg@gmail.com>
Sun, 19 Feb 2023 16:58:01 +0000 (17:58 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 11 Mar 2023 12:18:28 +0000 (12:18 +0000)
Newer models do not require read the calibration parameters and apply the
compensation algorithms in the sensor.

Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/bb1b95ab3f4e71d3c76543370325c5c9aaa07add.1676823250.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/pressure/bmp280-core.c

index 6467034b1d3e689ac65824639b08b23d1f240e66..22addaaa5393ac38363488996e9f6e953b58a07d 100644 (file)
@@ -1631,10 +1631,12 @@ int bmp280_common_probe(struct device *dev,
         * time once. They will not change.
         */
 
-       ret = data->chip_info->read_calib(data);
-       if (ret < 0)
-               return dev_err_probe(data->dev, ret,
-                                    "failed to read calibration coefficients\n");
+       if (data->chip_info->read_calib) {
+               ret = data->chip_info->read_calib(data);
+               if (ret < 0)
+                       return dev_err_probe(data->dev, ret,
+                                            "failed to read calibration coefficients\n");
+       }
 
        /*
         * Attempt to grab an optional EOC IRQ - only the BMP085 has this