aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-03-25 04:58:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-03-25 17:06:09 -0400
commit1e9663c62b32f695af37fec4afc473b59f5ca9b4 (patch)
tree8f1c1c9fbaa89c3f75ad14a04dd8ee20ecb6dba0 /drivers/iio/imu
parentc5cf4606b6659e711258b6e567415ab83a3b646c (diff)
iio:trigger: Introduce iio_tigger_{set,get}_drvdata
Introduce iio_tigger_{set,get}_drvdata which allows to attach driver specific data to a trigger. The functions wrap access to the triggers private_data field and all current users are updated to use iio_tigger_{set,get}_drvdata instead of directly accessing the private_data field. This is the first step towards removing the private_data field from the iio_trigger struct. The following coccinelle script has been used to update the drivers: <smpl> @@ struct iio_trigger *trigger; expression priv; @@ -trigger->private_data = priv +iio_trigger_set_drv_data(trigger, priv) @@ struct iio_trigger *trigger; @@ -trigger->private_data +iio_trigger_get_drv_data(trigger) </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu')
-rw-r--r--drivers/iio/imu/adis_trigger.c4
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index 5a24c9cac343..e0017c22bb9c 100644
--- a/drivers/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -19,7 +19,7 @@
19static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig, 19static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig,
20 bool state) 20 bool state)
21{ 21{
22 struct adis *adis = trig->private_data; 22 struct adis *adis = iio_trigger_get_drvdata(trig);
23 23
24 return adis_enable_irq(adis, state); 24 return adis_enable_irq(adis, state);
25} 25}
@@ -57,7 +57,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
57 57
58 adis->trig->dev.parent = &adis->spi->dev; 58 adis->trig->dev.parent = &adis->spi->dev;
59 adis->trig->ops = &adis_trigger_ops; 59 adis->trig->ops = &adis_trigger_ops;
60 adis->trig->private_data = adis; 60 iio_trigger_set_drvdata(adis->trig, adis);
61 ret = iio_trigger_register(adis->trig); 61 ret = iio_trigger_register(adis->trig);
62 62
63 indio_dev->trig = adis->trig; 63 indio_dev->trig = adis->trig;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
index e1d0869e0ad1..03b9372c1212 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
@@ -103,7 +103,7 @@ static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable)
103static int inv_mpu_data_rdy_trigger_set_state(struct iio_trigger *trig, 103static int inv_mpu_data_rdy_trigger_set_state(struct iio_trigger *trig,
104 bool state) 104 bool state)
105{ 105{
106 return inv_mpu6050_set_enable(trig->private_data, state); 106 return inv_mpu6050_set_enable(iio_trigger_get_drvdata(trig), state);
107} 107}
108 108
109static const struct iio_trigger_ops inv_mpu_trigger_ops = { 109static const struct iio_trigger_ops inv_mpu_trigger_ops = {
@@ -130,8 +130,8 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
130 if (ret) 130 if (ret)
131 goto error_free_trig; 131 goto error_free_trig;
132 st->trig->dev.parent = &st->client->dev; 132 st->trig->dev.parent = &st->client->dev;
133 st->trig->private_data = indio_dev;
134 st->trig->ops = &inv_mpu_trigger_ops; 133 st->trig->ops = &inv_mpu_trigger_ops;
134 iio_trigger_set_drvdata(st->trig, indio_dev);
135 ret = iio_trigger_register(st->trig); 135 ret = iio_trigger_register(st->trig);
136 if (ret) 136 if (ret)
137 goto error_free_irq; 137 goto error_free_irq;