summaryrefslogtreecommitdiff
path: root/drivers/iio/common
diff options
context:
space:
mode:
authorLary Gibaud <yarl-baudig@mailoo.org>2020-04-11 17:16:06 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-04-19 17:50:02 +0100
commite450e07c14abae563ad13b064cbce9fdccc6bc8d (patch)
tree9ccae72fa156639e4da4ed8427f3d1a57c7b2192 /drivers/iio/common
parent3b7f9dbb827ce8680b98490215e698b6079a9ec5 (diff)
downloadlwn-e450e07c14abae563ad13b064cbce9fdccc6bc8d.tar.gz
lwn-e450e07c14abae563ad13b064cbce9fdccc6bc8d.zip
iio: st_sensors: rely on odr mask to know if odr can be set
Indeed, relying on addr being not 0 cannot work because some device have their register to set odr at address 0. As a matter of fact, if the odr can be set, then there is a mask. Sensors with ODR register at address 0 are: lsm303dlh, lsm303dlhc, lsm303dlm Fixes: 7d245172675a ("iio: common: st_sensors: check odr address value in st_sensors_set_odr()") Signed-off-by: Lary Gibaud <yarl-baudig@mailoo.org> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/common')
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 0e35ff06f9af..13bdfbbf5f71 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -79,7 +79,7 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
struct st_sensor_odr_avl odr_out = {0, 0};
struct st_sensor_data *sdata = iio_priv(indio_dev);
- if (!sdata->sensor_settings->odr.addr)
+ if (!sdata->sensor_settings->odr.mask)
return 0;
err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out);