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

Commit 1e46eb32 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by Gerrit - the friendly Code Review server
Browse files

msm: qpnp-power-on: change the usage of mutex while setting debounce delay



Currently, mutex lock of PON input is held while configuring the
debounce delay. However, when there are no input configurations
specified, debounce delay cannot be configured because of the
non-availability of input device and hence its mutex lock.

Fix it by using the mutex lock only when the input configuration
is available so that the debounce delay can be configured even
when there is no input configuration.

CRs-Fixed: 815913
Change-Id: Id4aaeceaae1a3c93dcdf962b7e23b187ebac966d
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent f2a141a4
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -297,12 +297,10 @@ static int qpnp_pon_set_dbc(struct qpnp_pon *pon, u32 delay)
	int rc = 0;
	u32 delay_reg;

	if (!pon->pon_input)
		return -EINVAL;

	mutex_lock(&pon->pon_input->mutex);
	if (delay == pon->dbc)
		goto unlock;
		goto out;
	if (pon->pon_input)
		mutex_lock(&pon->pon_input->mutex);

	if (delay < QPNP_PON_MIN_DBC_US)
		delay = QPNP_PON_MIN_DBC_US;
@@ -321,7 +319,9 @@ static int qpnp_pon_set_dbc(struct qpnp_pon *pon, u32 delay)
	pon->dbc = delay;

unlock:
	if (pon->pon_input)
		mutex_unlock(&pon->pon_input->mutex);
out:
	return rc;
}