From: Bryan Wu <cooloney@kernel.org>
To: dtor@mail.ru, akpm@linux-foundation.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Hennerich <michael.hennerich@analog.com>,
Bryan Wu <cooloney@kernel.org>
Subject: [PATCH 1/1] input: AD7879 Touchscreen driver cleanup
Date: Thu, 30 Oct 2008 17:47:44 +0800 [thread overview]
Message-ID: <1225360064-20436-1-git-send-email-cooloney@kernel.org> (raw)
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
reply other threads:[~2008-10-30 9:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225360064-20436-1-git-send-email-cooloney@kernel.org \
--to=cooloney@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dtor@mail.ru \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).