summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-08-24 17:28:33 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-24 14:23:41 -0700
commit5f9c035cae18be30b70efc88c3c88b34283db62f (patch)
treee0661acb4af3c335da36595940806832198032a7
parent6f4ebab56870db3c7d76010dc30410211580461f (diff)
staging:iio:triggers. Add a reference get to the core for triggers.
This is to do with dynamically allocated triggers and the need to ensure the underlying structures don't go away when a consumer is using them. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/iio/industrialio-trigger.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c
index ebacfdadee1..89a993430d1 100644
--- a/drivers/staging/iio/industrialio-trigger.c
+++ b/drivers/staging/iio/industrialio-trigger.c
@@ -8,7 +8,6 @@
*/
#include <linux/kernel.h>
-#include <linux/module.h>
#include <linux/idr.h>
#include <linux/err.h>
#include <linux/device.h>
@@ -478,6 +477,7 @@ struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
IRQ_NOPROBE);
}
iio_get();
+ get_device(&trig->dev);
}
return trig;
}
@@ -501,6 +501,9 @@ EXPORT_SYMBOL(iio_device_register_trigger_consumer);
int iio_device_unregister_trigger_consumer(struct iio_dev *dev_info)
{
+ /* Clean up and associated but not attached triggers references */
+ if (dev_info->trig)
+ iio_put_trigger(dev_info->trig);
sysfs_remove_group(&dev_info->dev.kobj,
&iio_trigger_consumer_attr_group);
return 0;