Skip to content

Commit 8a9dbb7

Browse files
committed
extcon: Release locking when sending the notification of connector state
Previously, extcon used the spinlock before calling the notifier_call_chain to prevent the scheduled out of task and to prevent the notification delay. When spinlock is locked for sending the notification, deadlock issue occured on the side of extcon consumer device. To fix this issue, extcon consumer device should always use the work. it is always not reasonable to use work. To fix this issue on extcon consumer device, release locking when sending the notification of connector state. Fixes: ab11af0 ("extcon: Add the synchronization extcon APIs to support the notification") Cc: [email protected] Cc: Roger Quadros <[email protected]> Cc: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent 11bab5a commit 8a9dbb7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/extcon/extcon.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
433433
return index;
434434

435435
spin_lock_irqsave(&edev->lock, flags);
436-
437436
state = !!(edev->state & BIT(index));
437+
spin_unlock_irqrestore(&edev->lock, flags);
438438

439439
/*
440440
* Call functions in a raw notifier chain for the specific one
@@ -448,6 +448,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
448448
*/
449449
raw_notifier_call_chain(&edev->nh_all, state, edev);
450450

451+
spin_lock_irqsave(&edev->lock, flags);
451452
/* This could be in interrupt handler */
452453
prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);
453454
if (!prop_buf) {

0 commit comments

Comments
 (0)