diff options
Diffstat (limited to 'drivers/input/touchscreen/tsc2005.c')
-rw-r--r-- | drivers/input/touchscreen/tsc2005.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 87420616efa..cbf0ff32267 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c | |||
@@ -358,7 +358,7 @@ static void __tsc2005_enable(struct tsc2005 *ts) | |||
358 | if (ts->esd_timeout && ts->set_reset) { | 358 | if (ts->esd_timeout && ts->set_reset) { |
359 | ts->last_valid_interrupt = jiffies; | 359 | ts->last_valid_interrupt = jiffies; |
360 | schedule_delayed_work(&ts->esd_work, | 360 | schedule_delayed_work(&ts->esd_work, |
361 | round_jiffies(jiffies + | 361 | round_jiffies_relative( |
362 | msecs_to_jiffies(ts->esd_timeout))); | 362 | msecs_to_jiffies(ts->esd_timeout))); |
363 | } | 363 | } |
364 | 364 | ||
@@ -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(jiffies + | 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) |
@@ -663,7 +671,7 @@ static int __devinit tsc2005_probe(struct spi_device *spi) | |||
663 | goto err_remove_sysfs; | 671 | goto err_remove_sysfs; |
664 | } | 672 | } |
665 | 673 | ||
666 | set_irq_wake(spi->irq, 1); | 674 | irq_set_irq_wake(spi->irq, 1); |
667 | return 0; | 675 | return 0; |
668 | 676 | ||
669 | err_remove_sysfs: | 677 | err_remove_sysfs: |