aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2011-03-17 01:08:08 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-03-17 02:27:57 -0400
commit6b007d62fabb279b51c784c7c8abc6848b66a917 (patch)
treeb6d5e09b7cd5f858da0bb6f0163532308e85fe55 /drivers/input
parent37bd44694c7215e3e46e6ee4a930d197325a7168 (diff)
Input: tsc2005 - use spi_get/set_drvdata()
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). Tested-by: Aaro Koskinen <aaro.koskinen@nokia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/tsc2005.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index f95f968f18e1..5dad30a4b153 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -366,7 +366,8 @@ static void tsc2005_enable(struct tsc2005 *ts)
366static ssize_t tsc2005_disable_show(struct device *dev, 366static ssize_t tsc2005_disable_show(struct device *dev,
367 struct device_attribute *attr, char *buf) 367 struct device_attribute *attr, char *buf)
368{ 368{
369 struct tsc2005 *ts = dev_get_drvdata(dev); 369 struct spi_device *spi = to_spi_device(dev);
370 struct tsc2005 *ts = spi_get_drvdata(spi);
370 371
371 return sprintf(buf, "%u\n", ts->disabled); 372 return sprintf(buf, "%u\n", ts->disabled);
372} 373}
@@ -375,7 +376,8 @@ static ssize_t tsc2005_disable_store(struct device *dev,
375 struct device_attribute *attr, 376 struct device_attribute *attr,
376 const char *buf, size_t count) 377 const char *buf, size_t count)
377{ 378{
378 struct tsc2005 *ts = dev_get_drvdata(dev); 379 struct spi_device *spi = to_spi_device(dev);
380 struct tsc2005 *ts = spi_get_drvdata(spi);
379 unsigned long res; 381 unsigned long res;
380 int i; 382 int i;
381 383
@@ -401,7 +403,8 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
401 struct device_attribute *attr, 403 struct device_attribute *attr,
402 char *buf) 404 char *buf)
403{ 405{
404 struct tsc2005 *ts = dev_get_drvdata(dev); 406 struct spi_device *spi = to_spi_device(dev);
407 struct tsc2005 *ts = spi_get_drvdata(spi);
405 u16 temp_high; 408 u16 temp_high;
406 u16 temp_high_orig; 409 u16 temp_high_orig;
407 u16 temp_high_test; 410 u16 temp_high_test;
@@ -620,7 +623,7 @@ static int __devinit tsc2005_probe(struct spi_device *spi)
620 if (ts == NULL) 623 if (ts == NULL)
621 return -ENOMEM; 624 return -ENOMEM;
622 625
623 dev_set_drvdata(&spi->dev, ts); 626 spi_set_drvdata(spi, ts);
624 ts->spi = spi; 627 ts->spi = spi;
625 spi->dev.power.power_state = PMSG_ON; 628 spi->dev.power.power_state = PMSG_ON;
626 spi->mode = SPI_MODE_0; 629 spi->mode = SPI_MODE_0;
@@ -637,7 +640,7 @@ static int __devinit tsc2005_probe(struct spi_device *spi)
637 640
638static int __devexit tsc2005_remove(struct spi_device *spi) 641static int __devexit tsc2005_remove(struct spi_device *spi)
639{ 642{
640 struct tsc2005 *ts = dev_get_drvdata(&spi->dev); 643 struct tsc2005 *ts = spi_get_drvdata(spi);
641 644
642 mutex_lock(&ts->mutex); 645 mutex_lock(&ts->mutex);
643 tsc2005_disable(ts); 646 tsc2005_disable(ts);
@@ -661,7 +664,8 @@ static int __devexit tsc2005_remove(struct spi_device *spi)
661#ifdef CONFIG_PM 664#ifdef CONFIG_PM
662static int tsc2005_suspend(struct spi_device *spi, pm_message_t mesg) 665static int tsc2005_suspend(struct spi_device *spi, pm_message_t mesg)
663{ 666{
664 struct tsc2005 *ts = dev_get_drvdata(&spi->dev); 667 struct spi_device *spi = to_spi_device(dev);
668 struct tsc2005 *ts = spi_get_drvdata(spi);
665 669
666 mutex_lock(&ts->mutex); 670 mutex_lock(&ts->mutex);
667 tsc2005_disable(ts); 671 tsc2005_disable(ts);
@@ -672,7 +676,8 @@ static int tsc2005_suspend(struct spi_device *spi, pm_message_t mesg)
672 676
673static int tsc2005_resume(struct spi_device *spi) 677static int tsc2005_resume(struct spi_device *spi)
674{ 678{
675 struct tsc2005 *ts = dev_get_drvdata(&spi->dev); 679 struct spi_device *spi = to_spi_device(dev);
680 struct tsc2005 *ts = spi_get_drvdata(spi);
676 681
677 mutex_lock(&ts->mutex); 682 mutex_lock(&ts->mutex);
678 tsc2005_enable(ts); 683 tsc2005_enable(ts);