mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
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>
This commit is contained in:
parent
e65bc6ac6f
commit
f60c4a02aa
10 changed files with 3 additions and 51 deletions
|
@ -605,12 +605,6 @@ static int ad7192_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
static void ad7192_ring_cleanup(struct iio_dev *indio_dev)
|
static void ad7192_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
/* ensure that the trigger has been detached */
|
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,11 +189,6 @@ int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
void ad7298_ring_cleanup(struct iio_dev *indio_dev)
|
void ad7298_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,12 +152,6 @@ int ad7476_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
void ad7476_ring_cleanup(struct iio_dev *indio_dev)
|
void ad7476_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
/* ensure that the trigger has been detached */
|
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,11 +197,6 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
void ad7606_ring_cleanup(struct iio_dev *indio_dev)
|
void ad7606_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,12 +469,6 @@ static int ad7793_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
static void ad7793_ring_cleanup(struct iio_dev *indio_dev)
|
static void ad7793_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
/* ensure that the trigger has been detached */
|
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,12 +188,6 @@ int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
void ad7887_ring_cleanup(struct iio_dev *indio_dev)
|
void ad7887_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
/* ensure that the trigger has been detached */
|
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,12 +204,6 @@ int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
void ad799x_ring_cleanup(struct iio_dev *indio_dev)
|
void ad799x_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
/* ensure that the trigger has been detached */
|
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,11 +195,6 @@ int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
void max1363_ring_cleanup(struct iio_dev *indio_dev)
|
void max1363_ring_cleanup(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
/* ensure that the trigger has been detached */
|
/* ensure that the trigger has been detached */
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,6 +230,8 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
|
||||||
bool notinuse
|
bool notinuse
|
||||||
= bitmap_empty(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
|
= 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);
|
pf->irq = iio_trigger_get_irq(trig);
|
||||||
ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
|
ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
|
||||||
pf->type, pf->name,
|
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);
|
iio_trigger_put_irq(trig, pf->irq);
|
||||||
free_irq(pf->irq, pf);
|
free_irq(pf->irq, pf);
|
||||||
|
module_put(pf->indio_dev->info->driver_module);
|
||||||
|
|
||||||
error_ret:
|
error_ret:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -127,12 +127,6 @@ static const struct iio_ring_setup_ops ade7758_ring_setup_ops = {
|
||||||
|
|
||||||
void ade7758_unconfigure_ring(struct iio_dev *indio_dev)
|
void ade7758_unconfigure_ring(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
/* ensure that the trigger has been detached */
|
|
||||||
if (indio_dev->trig) {
|
|
||||||
iio_put_trigger(indio_dev->trig);
|
|
||||||
iio_trigger_dettach_poll_func(indio_dev->trig,
|
|
||||||
indio_dev->pollfunc);
|
|
||||||
}
|
|
||||||
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
iio_dealloc_pollfunc(indio_dev->pollfunc);
|
||||||
iio_sw_rb_free(indio_dev->ring);
|
iio_sw_rb_free(indio_dev->ring);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue