Skip to content

Commit

Permalink
staging:iio: trigger fixes for repeat request of same trigger and all…
Browse files Browse the repository at this point in the history
…ocation failure

Both of these are decidedly silly bugs show up whilst testing
completely different code paths.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent 4c3d153 commit 5dd72ec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/staging/iio/industrialio-trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,16 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
pf->type, pf->name,
pf);
if (trig->ops && trig->ops->set_trigger_state && notinuse)
if (ret < 0) {
module_put(pf->indio_dev->info->driver_module);
return ret;
}

if (trig->ops && trig->ops->set_trigger_state && notinuse) {
ret = trig->ops->set_trigger_state(trig, true);
if (ret < 0)
module_put(pf->indio_dev->info->driver_module);
}

return ret;
}
Expand Down Expand Up @@ -334,6 +342,8 @@ static ssize_t iio_trigger_write_current(struct device *dev,
mutex_unlock(&indio_dev->mlock);

trig = iio_trigger_find_by_name(buf, len);
if (oldtrig == trig)
return len;

if (trig && indio_dev->info->validate_trigger) {
ret = indio_dev->info->validate_trigger(indio_dev, trig);
Expand Down

0 comments on commit 5dd72ec

Please sign in to comment.