* [PATCH 1/1] input: AD7877 driver fixup
@ 2008-10-30 9:46 Bryan Wu
0 siblings, 0 replies; only message in thread
From: Bryan Wu @ 2008-10-30 9:46 UTC (permalink / raw)
To: dtor, akpm; +Cc: linux-input, linux-kernel, Michael Hennerich, Bryan Wu
From: Michael Hennerich <michael.hennerich@analog.com>
- Test flag with spinlock hold
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/input/touchscreen/ad7877.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index aaf88c9..6615bcd 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -388,10 +388,11 @@ static irqreturn_t ad7877_irq(int irq, void *handle)
* doesn't get issued twice while in work.
*/
- if (ts->pending)
- return IRQ_HANDLED;
-
spin_lock_irqsave(&ts->lock, flags);
+ if (ts->pending) {
+ spin_unlock_irqrestore(&ts->lock, flags);
+ return IRQ_HANDLED;
+ }
ts->pending = 1;
spin_unlock_irqrestore(&ts->lock, flags);
@@ -420,10 +421,12 @@ static void ad7877_disable(struct ad7877 *ts)
{
unsigned long flags;
- if (ts->disabled)
+ spin_lock_irqsave(&ts->lock, flags);
+ if (ts->disabled) {
+ spin_unlock_irqrestore(&ts->lock, flags);
return;
+ }
- spin_lock_irqsave(&ts->lock, flags);
ts->disabled = 1;
disable_irq(ts->spi->irq);
spin_unlock_irqrestore(&ts->lock, flags);
@@ -443,10 +446,11 @@ static void ad7877_enable(struct ad7877 *ts)
{
unsigned long flags;
- if (!ts->disabled)
- return;
-
spin_lock_irqsave(&ts->lock, flags);
+ if (ts->disabled) {
+ spin_unlock_irqrestore(&ts->lock, flags);
+ return;
+ }
ts->disabled = 0;
enable_irq(ts->spi->irq);
spin_unlock_irqrestore(&ts->lock, flags);
--
1.5.6
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-30 9:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-30 9:46 [PATCH 1/1] input: AD7877 driver fixup Bryan Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).