summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Czerwinski <l.czerwinski@samsung.com>2014-03-05 08:52:56 +0100
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:47:08 +0900
commite6d78c8d5f59c07b5a5fe726c4e6a8b02de8f8bf (patch)
tree313b5e60d0e599ab92bdae26158d7bbed6e7151b
parent10bc3ab29831f6e1c61d75d3b7cf284bd9c9a6fc (diff)
downloadlinux-3.10-e6d78c8d5f59c07b5a5fe726c4e6a8b02de8f8bf.tar.gz
linux-3.10-e6d78c8d5f59c07b5a5fe726c4e6a8b02de8f8bf.tar.bz2
linux-3.10-e6d78c8d5f59c07b5a5fe726c4e6a8b02de8f8bf.zip
iio:common:st: Prevent disable after read info raw data
This patch prevents disable sensor after read info raw data when events are enabled. Change-Id: Ifc160e7aa5a633c5dc976ea8b775a790a0efaf69 Signed-off-by: Lukasz Czerwinski <l.czerwinski@samsung.com>
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c7
1 files changed, 6 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 53fbc50709b..085eb7d4559 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -315,7 +315,12 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
*val = *val >> ch->scan_type.shift;
- err = st_sensors_set_enable(indio_dev, false);
+ /*
+ * When events are enabled sensor should be always enabled.
+ * It prevents unnecessary sensor off.
+ */
+ if (!sdata->events_flag)
+ err = st_sensors_set_enable(indio_dev, false);
}
mutex_unlock(&indio_dev->mlock);