Skip to content

Commit

Permalink
imu: inv_mpu6050: use devm_iio_trigger_alloc
Browse files Browse the repository at this point in the history
Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Varka Bhadram authored and Jonathan Cameron committed Jan 27, 2015
1 parent d5b97f5 commit b3e9ad7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
int ret;
struct inv_mpu6050_state *st = iio_priv(indio_dev);

st->trig = iio_trigger_alloc("%s-dev%d",
indio_dev->name,
indio_dev->id);
st->trig = devm_iio_trigger_alloc(&indio_dev->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand All @@ -128,7 +129,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
"inv_mpu",
st->trig);
if (ret)
goto error_free_trig;
goto error_ret;
st->trig->dev.parent = &st->client->dev;
st->trig->ops = &inv_mpu_trigger_ops;
iio_trigger_set_drvdata(st->trig, indio_dev);
Expand All @@ -141,8 +142,6 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)

error_free_irq:
free_irq(st->client->irq, st->trig);
error_free_trig:
iio_trigger_free(st->trig);
error_ret:
return ret;
}
Expand All @@ -151,5 +150,4 @@ void inv_mpu6050_remove_trigger(struct inv_mpu6050_state *st)
{
iio_trigger_unregister(st->trig);
free_irq(st->client->irq, st->trig);
iio_trigger_free(st->trig);
}

0 comments on commit b3e9ad7

Please sign in to comment.