Commit b3e9ad70 authored by Varka Bhadram's avatar Varka Bhadram Committed by Jonathan Cameron

imu: inv_mpu6050: use devm_iio_trigger_alloc

Signed-off-by: default avatarVarka Bhadram <varkab@cdac.in>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent d5b97f5c
...@@ -116,7 +116,8 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) ...@@ -116,7 +116,8 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
int ret; int ret;
struct inv_mpu6050_state *st = iio_priv(indio_dev); struct inv_mpu6050_state *st = iio_priv(indio_dev);
st->trig = iio_trigger_alloc("%s-dev%d", st->trig = devm_iio_trigger_alloc(&indio_dev->dev,
"%s-dev%d",
indio_dev->name, indio_dev->name,
indio_dev->id); indio_dev->id);
if (st->trig == NULL) { if (st->trig == NULL) {
...@@ -128,7 +129,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) ...@@ -128,7 +129,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
"inv_mpu", "inv_mpu",
st->trig); st->trig);
if (ret) if (ret)
goto error_free_trig; goto error_ret;
st->trig->dev.parent = &st->client->dev; st->trig->dev.parent = &st->client->dev;
st->trig->ops = &inv_mpu_trigger_ops; st->trig->ops = &inv_mpu_trigger_ops;
iio_trigger_set_drvdata(st->trig, indio_dev); iio_trigger_set_drvdata(st->trig, indio_dev);
...@@ -141,8 +142,6 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) ...@@ -141,8 +142,6 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
error_free_irq: error_free_irq:
free_irq(st->client->irq, st->trig); free_irq(st->client->irq, st->trig);
error_free_trig:
iio_trigger_free(st->trig);
error_ret: error_ret:
return ret; return ret;
} }
...@@ -151,5 +150,4 @@ void inv_mpu6050_remove_trigger(struct inv_mpu6050_state *st) ...@@ -151,5 +150,4 @@ void inv_mpu6050_remove_trigger(struct inv_mpu6050_state *st)
{ {
iio_trigger_unregister(st->trig); iio_trigger_unregister(st->trig);
free_irq(st->client->irq, st->trig); free_irq(st->client->irq, st->trig);
iio_trigger_free(st->trig);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment