diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-08-24 17:28:37 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-24 14:23:42 -0700 |
commit | f60c4a02aa05817f00408ecefdf221f44781e08a (patch) | |
tree | 32fa0c638c81bfd821e7b5c370676f0381bd4a2d /drivers/staging/iio/industrialio-trigger.c | |
parent | e65bc6ac6fa54959ac0b3712b0f35bbf073c073e (diff) |
staging:iio: prevent removal of module connected to trigger.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/industrialio-trigger.c')
-rw-r--r-- | drivers/staging/iio/industrialio-trigger.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c index ccfd558d0902..7012f8ce8fd2 100644 --- a/drivers/staging/iio/industrialio-trigger.c +++ b/drivers/staging/iio/industrialio-trigger.c @@ -230,6 +230,8 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig, bool notinuse = bitmap_empty(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER); + /* Prevent the module being removed whilst attached to a trigger */ + __module_get(pf->indio_dev->info->driver_module); pf->irq = iio_trigger_get_irq(trig); ret = request_threaded_irq(pf->irq, pf->h, pf->thread, pf->type, pf->name, @@ -256,6 +258,7 @@ int iio_trigger_dettach_poll_func(struct iio_trigger *trig, } iio_trigger_put_irq(trig, pf->irq); free_irq(pf->irq, pf); + module_put(pf->indio_dev->info->driver_module); error_ret: return ret; |