提交 14ee64f4 编写于 作者: O Octavian Purdila 提交者: Jonathan Cameron

iio: bmc150: exit early if event / trigger state is not changed

Previous of this patch the check was only done if we enabled the event
and it was already enabled. We can do the same if the event is
disabled and we want to disable it.

The patch also adds the same check on the trigger code.
Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
Acked-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 8e22f477
......@@ -748,7 +748,7 @@ static int bmc150_accel_write_event_config(struct iio_dev *indio_dev,
struct bmc150_accel_data *data = iio_priv(indio_dev);
int ret;
if (state && data->ev_enable_state)
if (state == data->ev_enable_state)
return 0;
mutex_lock(&data->mutex);
......@@ -984,6 +984,18 @@ static int bmc150_accel_data_rdy_trigger_set_state(struct iio_trigger *trig,
mutex_lock(&data->mutex);
if (data->motion_trig == trig) {
if (data->motion_trigger_on == state) {
mutex_unlock(&data->mutex);
return 0;
}
} else {
if (data->dready_trigger_on == state) {
mutex_unlock(&data->mutex);
return 0;
}
}
if (!state && data->ev_enable_state && data->motion_trigger_on) {
data->motion_trigger_on = false;
mutex_unlock(&data->mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册