Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: tsc2005 - simplify drvdata acquisition

Using dev_*_drvdata() instead of spi_*_drvdata() reduces lines of code and
prepares the driver for possible tsc2004 support, which is i2c based.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Sebastian Reichel and committed by
Dmitry Torokhov
80b46aa6 273cf48a

+6 -10
+6 -10
drivers/input/touchscreen/tsc2005.c
··· 355 355 struct device_attribute *attr, 356 356 char *buf) 357 357 { 358 - struct spi_device *spi = to_spi_device(dev); 359 - struct tsc2005 *ts = spi_get_drvdata(spi); 358 + struct tsc2005 *ts = dev_get_drvdata(dev); 360 359 unsigned int temp_high; 361 360 unsigned int temp_high_orig; 362 361 unsigned int temp_high_test; ··· 440 441 struct attribute *attr, int n) 441 442 { 442 443 struct device *dev = container_of(kobj, struct device, kobj); 443 - struct spi_device *spi = to_spi_device(dev); 444 - struct tsc2005 *ts = spi_get_drvdata(spi); 444 + struct tsc2005 *ts = dev_get_drvdata(dev); 445 445 umode_t mode = attr->mode; 446 446 447 447 if (attr == &dev_attr_selftest.attr) { ··· 688 690 return error; 689 691 } 690 692 691 - spi_set_drvdata(spi, ts); 693 + dev_set_drvdata(&spi->dev, ts); 692 694 error = sysfs_create_group(&spi->dev.kobj, &tsc2005_attr_group); 693 695 if (error) { 694 696 dev_err(&spi->dev, ··· 716 718 717 719 static int tsc2005_remove(struct spi_device *spi) 718 720 { 719 - struct tsc2005 *ts = spi_get_drvdata(spi); 721 + struct tsc2005 *ts = dev_get_drvdata(&spi->dev); 720 722 721 723 sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group); 722 724 ··· 728 730 729 731 static int __maybe_unused tsc2005_suspend(struct device *dev) 730 732 { 731 - struct spi_device *spi = to_spi_device(dev); 732 - struct tsc2005 *ts = spi_get_drvdata(spi); 733 + struct tsc2005 *ts = dev_get_drvdata(dev); 733 734 734 735 mutex_lock(&ts->mutex); 735 736 ··· 744 747 745 748 static int __maybe_unused tsc2005_resume(struct device *dev) 746 749 { 747 - struct spi_device *spi = to_spi_device(dev); 748 - struct tsc2005 *ts = spi_get_drvdata(spi); 750 + struct tsc2005 *ts = dev_get_drvdata(dev); 749 751 750 752 mutex_lock(&ts->mutex); 751 753