* [PATCH 1/1] input: AD7879 Touchscreen driver cleanup
@ 2008-10-30 9:47 Bryan Wu
0 siblings, 0 replies; only message in thread
From: Bryan Wu @ 2008-10-30 9:47 UTC (permalink / raw)
To: dtor, akpm; +Cc: linux-input, linux-kernel, Michael Hennerich, Bryan Wu
From: Michael Hennerich <michael.hennerich@analog.com>
- Rename ad7879_destruct() to ad7879_destroy()
- 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/ad7879.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 6865974..8e62f8a 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -242,10 +242,12 @@ static void ad7879_disable(struct ad7879 *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->bus->irq);
spin_unlock_irqrestore(&ts->lock, flags);
@@ -264,10 +266,11 @@ static void ad7879_enable(struct ad7879 *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->bus->irq);
spin_unlock_irqrestore(&ts->lock, flags);
@@ -485,7 +488,7 @@ err_free_mem:
return err;
}
-static int __devexit ad7879_destruct(bus_device *bus, struct ad7879 *ts)
+static int __devexit ad7879_destroy(bus_device *bus, struct ad7879 *ts)
{
ad7879_disable(ts);
ad7879_write(ts->bus, AD7879_REG_CTRL2,
@@ -667,7 +670,7 @@ static int __devexit ad7879_remove(struct spi_device *spi)
{
struct ad7879 *ts = dev_get_drvdata(&spi->dev);
- ad7879_destruct(spi, ts);
+ ad7879_destroy(spi, ts);
dev_set_drvdata(&spi->dev, NULL);
kfree(ts);
return 0;
@@ -753,7 +756,7 @@ static int __devexit ad7879_remove(struct i2c_client *client)
{
struct ad7879 *ts = dev_get_drvdata(&client->dev);
- ad7879_destruct(client, ts);
+ ad7879_destroy(client, ts);
i2c_set_clientdata(client, NULL);
kfree(ts);
return 0;
--
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:47 [PATCH 1/1] input: AD7879 Touchscreen driver cleanup 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).