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

Commit 3df32f98 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi
Browse files

power: bcl_peripheral: Fix deadlock condition not accounted correctly



If bcl peripheral driver is in polling mode either for vbat or ibat
and bcl disable request comes simultaneously, there is a deadlock
condition where bcl disable context tries to cancel worker thread for
either ibat or vbat within mutex context and the same time the worker
thread is waiting for the same mutex.
To fix this deadlock scenario, use non blocking call
cancel_delayed_work instead of cancel_delayed_work_sync within mutex
context. It is safe and no need to flush this worker thread since
disable request already changes state from polling to inactive which
makes sure that post disable request even if there is queued worker
thread instance, it safely exit from last execution.

Change-Id: I652d276472f784d6ea0bc01af0d0ea489a615c78
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent 3803e4f8
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -365,8 +365,7 @@ static int bcl_access_monitor_enable(bool enable)
				/* Fall through to clear the poll work */
			case BCL_PARAM_INACTIVE:
			case BCL_PARAM_POLLING:
				cancel_delayed_work_sync(
					&perph_data->poll_work);
				cancel_delayed_work(&perph_data->poll_work);
				break;
			default:
				break;