diff options
-rw-r--r-- | drivers/input/touchscreen/tsc2005.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 2a9a7260fe8e..cbf0ff322676 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c | |||
@@ -477,7 +477,14 @@ static void tsc2005_esd_work(struct work_struct *work) | |||
477 | int error; | 477 | int error; |
478 | u16 r; | 478 | u16 r; |
479 | 479 | ||
480 | mutex_lock(&ts->mutex); | 480 | if (!mutex_trylock(&ts->mutex)) { |
481 | /* | ||
482 | * If the mutex is taken, it means that disable or enable is in | ||
483 | * progress. In that case just reschedule the work. If the work | ||
484 | * is not needed, it will be canceled by disable. | ||
485 | */ | ||
486 | goto reschedule; | ||
487 | } | ||
481 | 488 | ||
482 | if (time_is_after_jiffies(ts->last_valid_interrupt + | 489 | if (time_is_after_jiffies(ts->last_valid_interrupt + |
483 | msecs_to_jiffies(ts->esd_timeout))) | 490 | msecs_to_jiffies(ts->esd_timeout))) |
@@ -510,11 +517,12 @@ static void tsc2005_esd_work(struct work_struct *work) | |||
510 | tsc2005_start_scan(ts); | 517 | tsc2005_start_scan(ts); |
511 | 518 | ||
512 | out: | 519 | out: |
520 | mutex_unlock(&ts->mutex); | ||
521 | reschedule: | ||
513 | /* re-arm the watchdog */ | 522 | /* re-arm the watchdog */ |
514 | schedule_delayed_work(&ts->esd_work, | 523 | schedule_delayed_work(&ts->esd_work, |
515 | round_jiffies_relative( | 524 | round_jiffies_relative( |
516 | msecs_to_jiffies(ts->esd_timeout))); | 525 | msecs_to_jiffies(ts->esd_timeout))); |
517 | mutex_unlock(&ts->mutex); | ||
518 | } | 526 | } |
519 | 527 | ||
520 | static int tsc2005_open(struct input_dev *input) | 528 | static int tsc2005_open(struct input_dev *input) |