summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-04-30 15:15:48 +0200
committerJonathan Cameron <jic23@kernel.org>2015-05-07 10:42:33 +0100
commitbb60646c8befe218d0bd49e71e62252cd6408ae5 (patch)
tree4d1902ce4ed58973318ee09b2384403b79b66700
parentd2bc431868a1c3172bb8fa3187a90fa806bba484 (diff)
iio: st_sensors: make BDU optional
Not all sensors support BDU (block data update) and in fact a bunch of the in-kernel sensor settings do not specify the BDU address field. Make this optional. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 5a01093b29a2..cbeb5e01bc3a 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -344,11 +344,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
return err;
/* set BDU */
- err = st_sensors_write_data_with_mask(indio_dev,
+ if (sdata->sensor_settings->bdu.addr) {
+ err = st_sensors_write_data_with_mask(indio_dev,
sdata->sensor_settings->bdu.addr,
sdata->sensor_settings->bdu.mask, true);
- if (err < 0)
- return err;
+ if (err < 0)
+ return err;
+ }
err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);