All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Srikar <ext-srikar.1.bhavanarayana@nokia.com>,
	Phil Carmody <ext-phil.2.carmody@nokia.com>,
	Aaro Koskinen <aaro.koskinen@nokia.com>
Cc: linux-input@vger.kernel.org, lauri.leukkunen@nokia.com,
	David Brownell <dbrownell@users.sourceforge.net>,
	Imre Deak <imre.deak@nokia.com>,
	Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
	Ari Kauppi <Ext-Ari.Kauppi@nokia.com>,
	Tony Lindgren <tony@atomide.com>,
	Jarkko Nikula <jhnikula@gmail.com>,
	Eero Nurkkala <ext-eero.nurkkala@nokia.com>,
	Roman Tereshonkov <roman.tereshonkov@nokia.com>
Subject: [PATCH 01/17] Input: tsc2005 - use spi_get/set_drvdata()
Date: Wed, 16 Mar 2011 00:18:04 -0700	[thread overview]
Message-ID: <20110316071803.25664.84531.stgit@hammer.corenet.prv> (raw)
In-Reply-To: <20110316071503.25664.55116.stgit@hammer.corenet.prv>

Instead of peeking into underlying device and using dev_get/set_drvdata(),
let's use SPI layer's implementation to access driver-private data
(which may be different from driver-core private data).

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/touchscreen/tsc2005.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index f95f968..5dad30a 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -366,7 +366,8 @@ static void tsc2005_enable(struct tsc2005 *ts)
 static ssize_t tsc2005_disable_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
 {
-	struct tsc2005 *ts = dev_get_drvdata(dev);
+	struct spi_device *spi = to_spi_device(dev);
+	struct tsc2005 *ts = spi_get_drvdata(spi);
 
 	return sprintf(buf, "%u\n", ts->disabled);
 }
@@ -375,7 +376,8 @@ static ssize_t tsc2005_disable_store(struct device *dev,
 				     struct device_attribute *attr,
 				     const char *buf, size_t count)
 {
-	struct tsc2005 *ts = dev_get_drvdata(dev);
+	struct spi_device *spi = to_spi_device(dev);
+	struct tsc2005 *ts = spi_get_drvdata(spi);
 	unsigned long res;
 	int i;
 
@@ -401,7 +403,8 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
 				     struct device_attribute *attr,
 				     char *buf)
 {
-	struct tsc2005 *ts = dev_get_drvdata(dev);
+	struct spi_device *spi = to_spi_device(dev);
+	struct tsc2005 *ts = spi_get_drvdata(spi);
 	u16 temp_high;
 	u16 temp_high_orig;
 	u16 temp_high_test;
@@ -620,7 +623,7 @@ static int __devinit tsc2005_probe(struct spi_device *spi)
 	if (ts == NULL)
 		return -ENOMEM;
 
-	dev_set_drvdata(&spi->dev, ts);
+	spi_set_drvdata(spi, ts);
 	ts->spi = spi;
 	spi->dev.power.power_state = PMSG_ON;
 	spi->mode = SPI_MODE_0;
@@ -637,7 +640,7 @@ static int __devinit tsc2005_probe(struct spi_device *spi)
 
 static int __devexit tsc2005_remove(struct spi_device *spi)
 {
-	struct tsc2005 *ts = dev_get_drvdata(&spi->dev);
+	struct tsc2005 *ts = spi_get_drvdata(spi);
 
 	mutex_lock(&ts->mutex);
 	tsc2005_disable(ts);
@@ -661,7 +664,8 @@ static int __devexit tsc2005_remove(struct spi_device *spi)
 #ifdef CONFIG_PM
 static int tsc2005_suspend(struct spi_device *spi, pm_message_t mesg)
 {
-	struct tsc2005 *ts = dev_get_drvdata(&spi->dev);
+	struct spi_device *spi = to_spi_device(dev);
+	struct tsc2005 *ts = spi_get_drvdata(spi);
 
 	mutex_lock(&ts->mutex);
 	tsc2005_disable(ts);
@@ -672,7 +676,8 @@ static int tsc2005_suspend(struct spi_device *spi, pm_message_t mesg)
 
 static int tsc2005_resume(struct spi_device *spi)
 {
-	struct tsc2005 *ts = dev_get_drvdata(&spi->dev);
+	struct spi_device *spi = to_spi_device(dev);
+	struct tsc2005 *ts = spi_get_drvdata(spi);
 
 	mutex_lock(&ts->mutex);
 	tsc2005_enable(ts);


  reply	other threads:[~2011-03-16  7:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16  7:17 [PATCH 00/17] Merging of TSC2005 driver Dmitry Torokhov
2011-03-16  7:18 ` Dmitry Torokhov [this message]
2011-03-16  7:18 ` [PATCH 02/17] Input: tsc2005 - convert to using dev_pm_ops Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 03/17] Input: tsc2005 - remove incorrect module alias Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 04/17] Input: tsc2005 - remove driver banner message Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 05/17] Input: tsc2005 - add module description Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 06/17] Input: tsc2005 - clear driver data after unbinding Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 07/17] Input: tsc2005 - set up parent device Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 08/17] Input: tsc2005 - set up bus type in input device Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 09/17] Input: tsc2005 - rework driver initialization code Dmitry Torokhov
2011-03-16 15:11   ` Aaro Koskinen
2011-03-16  7:18 ` [PATCH 10/17] Input: tsc2005 - hide selftest attribute if we can't reset Dmitry Torokhov
2011-03-16  7:18 ` [PATCH 11/17] Input: tsc2005 - use true/false for boolean variables Dmitry Torokhov
2011-03-16  7:19 ` [PATCH 12/17] Input: tsc2005 - do not use 0 in place of NULL Dmitry Torokhov
2011-03-16  7:19 ` [PATCH 13/17] Input: tsc2005 - don't use work for 'pen up' handling Dmitry Torokhov
2011-03-16  7:19 ` [PATCH 14/17] Input: tsc2005 - do not rearm timer in hardirq handler Dmitry Torokhov
2011-03-16  7:19 ` [PATCH 15/17] Input: tsc2005 - handle read errors from SPI layer Dmitry Torokhov
2011-03-16  7:19 ` [PATCH 16/17] Input: tsc2005 - add open/close Dmitry Torokhov
2011-03-16 15:37   ` Aaro Koskinen
2011-03-16  7:19 ` [PATCH 17/17] Input: tsc2005 - remove 'disable' sysfs attribute Dmitry Torokhov
2011-03-16  7:41 ` [PATCH 00/17] Merging of TSC2005 driver Dmitry Torokhov
2011-03-16 15:44 ` Aaro Koskinen
2011-03-16 16:40   ` Dmitry Torokhov
  -- strict thread matches above, loose matches on Subject: below --
2011-03-16  7:12 [PATCH 00/17] Series short description Dmitry Torokhov
2011-03-16  7:12 ` [PATCH 01/17] Input: tsc2005 - use spi_get/set_drvdata() Dmitry Torokhov

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=20110316071803.25664.84531.stgit@hammer.corenet.prv \
    --to=dmitry.torokhov@gmail.com \
    --cc=Ext-Ari.Kauppi@nokia.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=aaro.koskinen@nokia.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=ext-eero.nurkkala@nokia.com \
    --cc=ext-phil.2.carmody@nokia.com \
    --cc=ext-srikar.1.bhavanarayana@nokia.com \
    --cc=imre.deak@nokia.com \
    --cc=jhnikula@gmail.com \
    --cc=lauri.leukkunen@nokia.com \
    --cc=linux-input@vger.kernel.org \
    --cc=roman.tereshonkov@nokia.com \
    --cc=tony@atomide.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.