Skip to content

Commit

Permalink
staging:iio: Make sure all triggers have a trigger_ops for the owner …
Browse files Browse the repository at this point in the history
…field.

The core needs the owner field to prevent module removal whilst in use and
uses it without confirming that the trigger_ops structure actually exists.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Dec 16, 2011
1 parent 617156f commit 8324e86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/staging/iio/adc/ad7192.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ static irqreturn_t ad7192_data_rdy_trig_poll(int irq, void *private)
return IRQ_HANDLED;
}

static struct iio_trigger_ops ad7192_trigger_ops = {
.owner = THIS_MODULE,
};

static int ad7192_probe_trigger(struct iio_dev *indio_dev)
{
struct ad7192_state *st = iio_priv(indio_dev);
Expand All @@ -621,7 +625,7 @@ static int ad7192_probe_trigger(struct iio_dev *indio_dev)
ret = -ENOMEM;
goto error_ret;
}

st->trig->ops = &ad7192_trigger_ops;
ret = request_irq(st->spi->irq,
ad7192_data_rdy_trig_poll,
IRQF_TRIGGER_LOW,
Expand Down
5 changes: 5 additions & 0 deletions drivers/staging/iio/adc/ad7793.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ static irqreturn_t ad7793_data_rdy_trig_poll(int irq, void *private)
return IRQ_HANDLED;
}

static struct iio_trigger_ops ad7793_trigger_ops = {
.owner = THIS_MODULE,
};

static int ad7793_probe_trigger(struct iio_dev *indio_dev)
{
struct ad7793_state *st = iio_priv(indio_dev);
Expand All @@ -487,6 +491,7 @@ static int ad7793_probe_trigger(struct iio_dev *indio_dev)
ret = -ENOMEM;
goto error_ret;
}
st->trig->ops = &ad7793_trigger_ops;

ret = request_irq(st->spi->irq,
ad7793_data_rdy_trig_poll,
Expand Down

0 comments on commit 8324e86

Please sign in to comment.