From: Chanho Park Date: Wed, 25 Sep 2013 07:47:33 +0000 (+0900) Subject: WIP: extcon: do not update cable state if notifier cannot handle it X-Git-Tag: submit/tizen/20141121.110247~3061 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78aebd366aa8fc0c086c2e4a3f1d10efcfb8fd93;p=platform%2Fkernel%2Flinux-3.10.git 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 --- diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 60adc04..e7b851b 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);