]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
iio: common: st_sensors: check odr address value in st_sensors_set_odr()
authorLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Sun, 17 Sep 2017 16:17:10 +0000 (18:17 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 10 Oct 2017 19:39:28 +0000 (20:39 +0100)
Do not try to configure sample frequency if the sensor do not export
odr register address in register map. That change will be used to
properly support LIS3DHH accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/common/st_sensors/st_sensors_core.c

index 40dfdfc0906bd0489f66c5c499d8b27feb77dfb1..57db19182e951f3c19fbccf596ecfd83fb4a7a12 100644 (file)
@@ -93,6 +93,9 @@ 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)
+               return 0;
+
        err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out);
        if (err < 0)
                goto st_sensors_match_odr_error;