Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72a7aeac authored by Ram Chandrasekar's avatar Ram Chandrasekar Committed by Gerrit - the friendly Code Review server
Browse files

msm: lmh_lite: Return error on disabling a throttling sensor



Return error when sensor polling is disabled when
it is still throttling. This case can occur due
to a race condition between the sensor value read
and sensor throttling value update.

Change-Id: I1e9a9fa97e0e4221752208cf139df05d6eedccbf
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent d22f4f5f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -188,6 +188,10 @@ static int lmh_reset(struct lmh_sensor_ops *ops)

	down_write(&lmh_sensor_access);
	if (lmh_data->intr_status_val & BIT(lmh_sensor->sensor_sw_id)) {
		if (lmh_sensor->last_read_value) {
			ret = -EAGAIN;
			goto reset_exit;
		}
		lmh_data->intr_status_val ^= BIT(lmh_sensor->sensor_sw_id);
		lmh_sensor->state = LMH_ISR_MONITOR;
		pr_debug("Sensor:[%s] not throttling. Switch to monitor mode\n",