diff options
author | Varka Bhadram <varkabhadram@gmail.com> | 2015-01-21 22:38:02 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-01-27 13:49:57 -0500 |
commit | b3e9ad703bef139fbcbb6423f4bafe3f89c97b00 (patch) | |
tree | b3b0d86d8ee50b52ddf048c36bbb28d191838996 /drivers/iio | |
parent | d5b97f5c7dfcad98927fb4f3b2e99d4c3beeec9a (diff) |
imu: inv_mpu6050: use devm_iio_trigger_alloc
Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c index 926fccea8de0..c827d21f7381 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | |||
@@ -116,9 +116,10 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) | |||
116 | int ret; | 116 | int ret; |
117 | struct inv_mpu6050_state *st = iio_priv(indio_dev); | 117 | struct inv_mpu6050_state *st = iio_priv(indio_dev); |
118 | 118 | ||
119 | st->trig = iio_trigger_alloc("%s-dev%d", | 119 | st->trig = devm_iio_trigger_alloc(&indio_dev->dev, |
120 | indio_dev->name, | 120 | "%s-dev%d", |
121 | indio_dev->id); | 121 | indio_dev->name, |
122 | indio_dev->id); | ||
122 | if (st->trig == NULL) { | 123 | if (st->trig == NULL) { |
123 | ret = -ENOMEM; | 124 | ret = -ENOMEM; |
124 | goto error_ret; | 125 | goto error_ret; |
@@ -128,7 +129,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) | |||
128 | "inv_mpu", | 129 | "inv_mpu", |
129 | st->trig); | 130 | st->trig); |
130 | if (ret) | 131 | if (ret) |
131 | goto error_free_trig; | 132 | goto error_ret; |
132 | st->trig->dev.parent = &st->client->dev; | 133 | st->trig->dev.parent = &st->client->dev; |
133 | st->trig->ops = &inv_mpu_trigger_ops; | 134 | st->trig->ops = &inv_mpu_trigger_ops; |
134 | iio_trigger_set_drvdata(st->trig, indio_dev); | 135 | iio_trigger_set_drvdata(st->trig, indio_dev); |
@@ -141,8 +142,6 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) | |||
141 | 142 | ||
142 | error_free_irq: | 143 | error_free_irq: |
143 | free_irq(st->client->irq, st->trig); | 144 | free_irq(st->client->irq, st->trig); |
144 | error_free_trig: | ||
145 | iio_trigger_free(st->trig); | ||
146 | error_ret: | 145 | error_ret: |
147 | return ret; | 146 | return ret; |
148 | } | 147 | } |
@@ -151,5 +150,4 @@ void inv_mpu6050_remove_trigger(struct inv_mpu6050_state *st) | |||
151 | { | 150 | { |
152 | iio_trigger_unregister(st->trig); | 151 | iio_trigger_unregister(st->trig); |
153 | free_irq(st->client->irq, st->trig); | 152 | free_irq(st->client->irq, st->trig); |
154 | iio_trigger_free(st->trig); | ||
155 | } | 153 | } |