Skip to content

Commit

Permalink
extcon: Release locking when sending the notification of connector state
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
chanwoochoi committed Jul 12, 2018
1 parent 11bab5a commit 8a9dbb7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/extcon/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
return index;

spin_lock_irqsave(&edev->lock, flags);

state = !!(edev->state & BIT(index));
spin_unlock_irqrestore(&edev->lock, flags);

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

spin_lock_irqsave(&edev->lock, flags);
/* This could be in interrupt handler */
prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);
if (!prop_buf) {
Expand Down

0 comments on commit 8a9dbb7

Please sign in to comment.