Commit 24c6d02f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: tsc2005 - fix locking issue
  Input: tsc2005 - use relative jiffies to schedule the watchdog
  Input: tsc2005 - driver should depend on GENERIC_HARDIRQS
parents 0dd61be7 a0fa2206
...@@ -641,7 +641,7 @@ config TOUCHSCREEN_TOUCHIT213 ...@@ -641,7 +641,7 @@ config TOUCHSCREEN_TOUCHIT213
config TOUCHSCREEN_TSC2005 config TOUCHSCREEN_TSC2005
tristate "TSC2005 based touchscreens" tristate "TSC2005 based touchscreens"
depends on SPI_MASTER depends on SPI_MASTER && GENERIC_HARDIRQS
help help
Say Y here if you have a TSC2005 based touchscreen. Say Y here if you have a TSC2005 based touchscreen.
......
...@@ -358,7 +358,7 @@ static void __tsc2005_enable(struct tsc2005 *ts) ...@@ -358,7 +358,7 @@ static void __tsc2005_enable(struct tsc2005 *ts)
if (ts->esd_timeout && ts->set_reset) { if (ts->esd_timeout && ts->set_reset) {
ts->last_valid_interrupt = jiffies; ts->last_valid_interrupt = jiffies;
schedule_delayed_work(&ts->esd_work, schedule_delayed_work(&ts->esd_work,
round_jiffies(jiffies + round_jiffies_relative(
msecs_to_jiffies(ts->esd_timeout))); msecs_to_jiffies(ts->esd_timeout)));
} }
...@@ -477,7 +477,14 @@ static void tsc2005_esd_work(struct work_struct *work) ...@@ -477,7 +477,14 @@ static void tsc2005_esd_work(struct work_struct *work)
int error; int error;
u16 r; u16 r;
mutex_lock(&ts->mutex); if (!mutex_trylock(&ts->mutex)) {
/*
* If the mutex is taken, it means that disable or enable is in
* progress. In that case just reschedule the work. If the work
* is not needed, it will be canceled by disable.
*/
goto reschedule;
}
if (time_is_after_jiffies(ts->last_valid_interrupt + if (time_is_after_jiffies(ts->last_valid_interrupt +
msecs_to_jiffies(ts->esd_timeout))) msecs_to_jiffies(ts->esd_timeout)))
...@@ -510,11 +517,12 @@ static void tsc2005_esd_work(struct work_struct *work) ...@@ -510,11 +517,12 @@ static void tsc2005_esd_work(struct work_struct *work)
tsc2005_start_scan(ts); tsc2005_start_scan(ts);
out: out:
mutex_unlock(&ts->mutex);
reschedule:
/* re-arm the watchdog */ /* re-arm the watchdog */
schedule_delayed_work(&ts->esd_work, schedule_delayed_work(&ts->esd_work,
round_jiffies(jiffies + round_jiffies_relative(
msecs_to_jiffies(ts->esd_timeout))); msecs_to_jiffies(ts->esd_timeout)));
mutex_unlock(&ts->mutex);
} }
static int tsc2005_open(struct input_dev *input) static int tsc2005_open(struct input_dev *input)
...@@ -663,7 +671,7 @@ static int __devinit tsc2005_probe(struct spi_device *spi) ...@@ -663,7 +671,7 @@ static int __devinit tsc2005_probe(struct spi_device *spi)
goto err_remove_sysfs; goto err_remove_sysfs;
} }
set_irq_wake(spi->irq, 1); irq_set_irq_wake(spi->irq, 1);
return 0; return 0;
err_remove_sysfs: err_remove_sysfs:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment