linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Vlad Dogaru <vlad.dogaru@intel.com>,
	Paul Bolle <pebolle@tiscali.nl>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de, Markus Pargmann <mpa@pengutronix.de>
Subject: [PATCH v3 3/6] iio: bmg160: Use generic dev_drvdata
Date: Wed, 12 Aug 2015 16:50:06 +0200	[thread overview]
Message-ID: <1439391009-6051-4-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1439391009-6051-1-git-send-email-mpa@pengutronix.de>

i2c_get_clientdata() is specifically for i2c. Replace it with the
generic dev_get/set_drvdata() to support different protocols.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/iio/gyro/bmg160.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c
index 4701ea17baea..6eab91ba8977 100644
--- a/drivers/iio/gyro/bmg160.c
+++ b/drivers/iio/gyro/bmg160.c
@@ -1020,7 +1020,7 @@ static int bmg160_probe(struct i2c_client *client,
 		return -ENOMEM;
 
 	data = iio_priv(indio_dev);
-	i2c_set_clientdata(client, indio_dev);
+	dev_set_drvdata(&client->dev, indio_dev);
 	data->dev = &client->dev;
 
 	ret = bmg160_chip_init(data);
@@ -1154,7 +1154,7 @@ static int bmg160_remove(struct i2c_client *client)
 #ifdef CONFIG_PM_SLEEP
 static int bmg160_suspend(struct device *dev)
 {
-	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct bmg160_data *data = iio_priv(indio_dev);
 
 	mutex_lock(&data->mutex);
@@ -1166,7 +1166,7 @@ static int bmg160_suspend(struct device *dev)
 
 static int bmg160_resume(struct device *dev)
 {
-	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct bmg160_data *data = iio_priv(indio_dev);
 
 	mutex_lock(&data->mutex);
@@ -1182,7 +1182,7 @@ static int bmg160_resume(struct device *dev)
 #ifdef CONFIG_PM
 static int bmg160_runtime_suspend(struct device *dev)
 {
-	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct bmg160_data *data = iio_priv(indio_dev);
 	int ret;
 
@@ -1197,7 +1197,7 @@ static int bmg160_runtime_suspend(struct device *dev)
 
 static int bmg160_runtime_resume(struct device *dev)
 {
-	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct bmg160_data *data = iio_priv(indio_dev);
 	int ret;
 
-- 
2.4.6


  parent reply	other threads:[~2015-08-12 14:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 14:50 [PATCH v3 0/6] iio: bmg160: Add SPI connection Markus Pargmann
2015-08-12 14:50 ` [PATCH v3 1/6] iio: bmg160: Use i2c regmap instead of direct i2c access Markus Pargmann
2015-08-12 16:01   ` Srinivas Pandruvada
2015-08-15 14:41     ` Jonathan Cameron
2015-08-15 14:43       ` Jonathan Cameron
2015-08-12 14:50 ` [PATCH v3 2/6] iio: bmg160: Remove i2c_client from data struct Markus Pargmann
2015-08-12 16:03   ` Srinivas Pandruvada
2015-08-15 14:50     ` Jonathan Cameron
2015-08-12 14:50 ` Markus Pargmann [this message]
2015-08-12 16:05   ` [PATCH v3 3/6] iio: bmg160: Use generic dev_drvdata Srinivas Pandruvada
2015-08-15 14:50     ` Jonathan Cameron
2015-08-12 14:50 ` [PATCH v3 4/6] iio: bmg160: Remove remaining uses of i2c_client Markus Pargmann
2015-08-12 16:08   ` Srinivas Pandruvada
2015-08-15 14:53     ` Jonathan Cameron
2015-08-12 14:50 ` [PATCH v3 5/6] iio: bmg160: Separate i2c and core driver Markus Pargmann
2015-08-12 16:16   ` Srinivas Pandruvada
2015-08-15 14:59     ` Jonathan Cameron
2015-08-12 14:50 ` [PATCH v3 6/6] iio: bmg160: Add SPI driver Markus Pargmann
2015-08-12 15:19   ` Peter Meerwald
2015-08-15 15:03     ` Jonathan Cameron
2015-08-17  6:41       ` Markus Pargmann
2015-08-17  6:39     ` Markus Pargmann
2015-08-12 15:04 ` [PATCH v3 0/6] iio: bmg160: Add SPI connection Lars-Peter Clausen
2015-08-15 14:49   ` Jonathan Cameron
2015-08-17  9:27   ` Tirdea, Irina

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=1439391009-6051-4-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=vlad.dogaru@intel.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).