mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
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>
This commit is contained in:
parent
6f4ebab568
commit
5f9c035cae
1 changed files with 4 additions and 1 deletions
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/idr.h>
|
#include <linux/idr.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
@ -478,6 +477,7 @@ struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
|
||||||
IRQ_NOPROBE);
|
IRQ_NOPROBE);
|
||||||
}
|
}
|
||||||
iio_get();
|
iio_get();
|
||||||
|
get_device(&trig->dev);
|
||||||
}
|
}
|
||||||
return trig;
|
return trig;
|
||||||
}
|
}
|
||||||
|
@ -501,6 +501,9 @@ EXPORT_SYMBOL(iio_device_register_trigger_consumer);
|
||||||
|
|
||||||
int iio_device_unregister_trigger_consumer(struct iio_dev *dev_info)
|
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,
|
sysfs_remove_group(&dev_info->dev.kobj,
|
||||||
&iio_trigger_consumer_attr_group);
|
&iio_trigger_consumer_attr_group);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue