[PATCH 4/7] iio: bmg160: Use generic dev_drvdata

From: Markus Pargmann
Date: Wed Jul 29 2015 - 09:47:20 EST


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@xxxxxxxxxxxxxx>
---
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 71c605ea85ad..b47b7af19e32 100644
--- a/drivers/iio/gyro/bmg160.c
+++ b/drivers/iio/gyro/bmg160.c
@@ -1022,7 +1022,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);
@@ -1156,7 +1156,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);
@@ -1168,7 +1168,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);
@@ -1184,7 +1184,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;

@@ -1199,7 +1199,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.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/