power: smb-lib: Fix mutex deadlock during PD hard reset

rdstd_cc2_detach_work relies on "pd_hard_reset" flag for holding
"chg_lock" mutex, as pd_hard_reset is updated asynchronously there
could be a situation where "pd_hard_reset" is updated while
rdstd_cc2_detach_work is running thus resulting in deadlock.
Fix this by maintaining locking status in a variable and avoid lock
acquisition if lock is already held.

Change-Id: Iff9ee211ef4b80c5d48b3d73f0ccbe010434fd6c
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2 files changed