Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: ab11af049f88 ("extcon: Add the synchronization extcon APIs to support the notification")
Cc: stable@vger.kernel.org
Cc: Roger Quadros <rogerq@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

+2 -1
+2 -1
drivers/extcon/extcon.c
··· 433 433 return index; 434 434 435 435 spin_lock_irqsave(&edev->lock, flags); 436 - 437 436 state = !!(edev->state & BIT(index)); 437 + spin_unlock_irqrestore(&edev->lock, flags); 438 438 439 439 /* 440 440 * Call functions in a raw notifier chain for the specific one ··· 448 448 */ 449 449 raw_notifier_call_chain(&edev->nh_all, state, edev); 450 450 451 + spin_lock_irqsave(&edev->lock, flags); 451 452 /* This could be in interrupt handler */ 452 453 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC); 453 454 if (!prop_buf) {