Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80b46aa6 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Dmitry Torokhov
Browse files

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: default avatarSebastian Reichel <sre@kernel.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 273cf48a
Loading
Loading
Loading
Loading
+6 −10
Original line number Original line Diff line number Diff line
@@ -355,8 +355,7 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
				     struct device_attribute *attr,
				     struct device_attribute *attr,
				     char *buf)
				     char *buf)
{
{
	struct spi_device *spi = to_spi_device(dev);
	struct tsc2005 *ts = dev_get_drvdata(dev);
	struct tsc2005 *ts = spi_get_drvdata(spi);
	unsigned int temp_high;
	unsigned int temp_high;
	unsigned int temp_high_orig;
	unsigned int temp_high_orig;
	unsigned int temp_high_test;
	unsigned int temp_high_test;
@@ -441,8 +440,7 @@ static umode_t tsc2005_attr_is_visible(struct kobject *kobj,
				      struct attribute *attr, int n)
				      struct attribute *attr, int n)
{
{
	struct device *dev = container_of(kobj, struct device, kobj);
	struct device *dev = container_of(kobj, struct device, kobj);
	struct spi_device *spi = to_spi_device(dev);
	struct tsc2005 *ts = dev_get_drvdata(dev);
	struct tsc2005 *ts = spi_get_drvdata(spi);
	umode_t mode = attr->mode;
	umode_t mode = attr->mode;


	if (attr == &dev_attr_selftest.attr) {
	if (attr == &dev_attr_selftest.attr) {
@@ -690,7 +688,7 @@ static int tsc2005_probe(struct spi_device *spi)
			return error;
			return error;
	}
	}


	spi_set_drvdata(spi, ts);
	dev_set_drvdata(&spi->dev, ts);
	error = sysfs_create_group(&spi->dev.kobj, &tsc2005_attr_group);
	error = sysfs_create_group(&spi->dev.kobj, &tsc2005_attr_group);
	if (error) {
	if (error) {
		dev_err(&spi->dev,
		dev_err(&spi->dev,
@@ -718,7 +716,7 @@ static int tsc2005_probe(struct spi_device *spi)


static int tsc2005_remove(struct spi_device *spi)
static int tsc2005_remove(struct spi_device *spi)
{
{
	struct tsc2005 *ts = spi_get_drvdata(spi);
	struct tsc2005 *ts = dev_get_drvdata(&spi->dev);


	sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group);
	sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group);


@@ -730,8 +728,7 @@ static int tsc2005_remove(struct spi_device *spi)


static int __maybe_unused tsc2005_suspend(struct device *dev)
static int __maybe_unused tsc2005_suspend(struct device *dev)
{
{
	struct spi_device *spi = to_spi_device(dev);
	struct tsc2005 *ts = dev_get_drvdata(dev);
	struct tsc2005 *ts = spi_get_drvdata(spi);


	mutex_lock(&ts->mutex);
	mutex_lock(&ts->mutex);


@@ -747,8 +744,7 @@ static int __maybe_unused tsc2005_suspend(struct device *dev)


static int __maybe_unused tsc2005_resume(struct device *dev)
static int __maybe_unused tsc2005_resume(struct device *dev)
{
{
	struct spi_device *spi = to_spi_device(dev);
	struct tsc2005 *ts = dev_get_drvdata(dev);
	struct tsc2005 *ts = spi_get_drvdata(spi);


	mutex_lock(&ts->mutex);
	mutex_lock(&ts->mutex);