aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/extcon/extcon.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 0e2af1728965..43b57b02d050 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -275,20 +275,25 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state)
275 spin_lock_irqsave(&edev->lock, flags); 275 spin_lock_irqsave(&edev->lock, flags);
276 276
277 if (edev->state != ((edev->state & ~mask) | (state & mask))) { 277 if (edev->state != ((edev->state & ~mask) | (state & mask))) {
278 u32 old_state;
279
278 if (check_mutually_exclusive(edev, (edev->state & ~mask) | 280 if (check_mutually_exclusive(edev, (edev->state & ~mask) |
279 (state & mask))) { 281 (state & mask))) {
280 spin_unlock_irqrestore(&edev->lock, flags); 282 spin_unlock_irqrestore(&edev->lock, flags);
281 return -EPERM; 283 return -EPERM;
282 } 284 }
283 285
284 for (index = 0; index < edev->max_supported; index++) { 286 old_state = edev->state;
285 if (is_extcon_changed(edev->state, state, index, &attached))
286 raw_notifier_call_chain(&edev->nh[index], attached, edev);
287 }
288
289 edev->state &= ~mask; 287 edev->state &= ~mask;
290 edev->state |= state & mask; 288 edev->state |= state & mask;
291 289
290 for (index = 0; index < edev->max_supported; index++) {
291 if (is_extcon_changed(old_state, edev->state, index,
292 &attached))
293 raw_notifier_call_chain(&edev->nh[index],
294 attached, edev);
295 }
296
292 /* This could be in interrupt handler */ 297 /* This could be in interrupt handler */
293 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC); 298 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);
294 if (prop_buf) { 299 if (prop_buf) {