iio: pressure: bmp280: simplify driver initialization logic
authorAngel Iglesias <ang.iglesiasg@gmail.com>
Mon, 12 Sep 2022 23:47:31 +0000 (01:47 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 21 Sep 2022 17:42:54 +0000 (18:42 +0100)
commitb00e805a47a86fb5890a1c2451e4d89043b1761d
tree935f8556d39df7ca2a3980b8e91d2a93294052aa
parent83cb40beaefaf59b224efdabecaac611b783da74
iio: pressure: bmp280: simplify driver initialization logic

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.

Separated bme280 specific calibration code from bmp280 function. Dropped
the additional chip_id argument in bmp280 code as is not longer required.
Now both bmp280/bme280 calibration function use same signature as bmp180.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/584c90f309e4f24bf2e4aa2b15c8577d288f978d.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/pressure/bmp280-core.c