summaryrefslogtreecommitdiff
path: root/drivers/extcon/extcon-class.c
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2013-09-25 16:47:33 +0900
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:44:48 +0900
commit78aebd366aa8fc0c086c2e4a3f1d10efcfb8fd93 (patch)
treebf7cf6699dc31279c4d7b546976b1dd39ab8f5b0 /drivers/extcon/extcon-class.c
parentf4849fe0afe1b23c5b2ef7692f9c4f27435f4f82 (diff)
downloadlinux-3.10-78aebd366aa8fc0c086c2e4a3f1d10efcfb8fd93.tar.gz
linux-3.10-78aebd366aa8fc0c086c2e4a3f1d10efcfb8fd93.tar.bz2
linux-3.10-78aebd366aa8fc0c086c2e4a3f1d10efcfb8fd93.zip
WIP: extcon: do not update cable state if notifier cannot handle it
During probing a extcon-max77693 driver, extcon-port driver can't receive nb callback due to initializing sequences. Thus, if the callback can't be handled, we do not update the cable state. I'm not sure this patch is good solution :) Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-class.c')
-rw-r--r--drivers/extcon/extcon-class.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 60adc04b056..e7b851bfdc3 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -229,6 +229,7 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state)
int env_offset = 0;
int length;
unsigned long flags;
+ int ret;
spin_lock_irqsave(&edev->lock, flags);
@@ -244,7 +245,12 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state)
edev->state &= ~mask;
edev->state |= state & mask;
- raw_notifier_call_chain(&edev->nh, old_state, edev);
+ ret = raw_notifier_call_chain(&edev->nh, old_state, edev);
+ if ((ret & ~NOTIFY_STOP_MASK) != NOTIFY_OK) {
+ edev->state = old_state;
+ spin_unlock_irqrestore(&edev->lock, flags);
+ return -ENODEV;
+ }
/* This could be in interrupt handler */
prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);