]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
iio:max1027: Use iio_trigger_validate_own_device() helper
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 23 Sep 2016 15:19:43 +0000 (17:19 +0200)
committerJonathan Cameron <jic23@kernel.org>
Tue, 27 Sep 2016 19:33:00 +0000 (20:33 +0100)
Use the new iio_trigger_validate_own_device() to verify that the trigger
can only be attached to the matching IIO device rather than using a custom
variant.

While the implementation of iio_trigger_validate_own_device() and the
custom variant and are not identical their behaviour is.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/max1027.c

index d60181822833093511a01311191be5ee7ae980a1..3b7c4f78f37aec7f7756e8a8ce6e6fe686d5a458 100644 (file)
@@ -362,17 +362,6 @@ static int max1027_set_trigger_state(struct iio_trigger *trig, bool state)
        return 0;
 }
 
-static int max1027_validate_device(struct iio_trigger *trig,
-                                  struct iio_dev *indio_dev)
-{
-       struct iio_dev *indio = iio_trigger_get_drvdata(trig);
-
-       if (indio != indio_dev)
-               return -EINVAL;
-
-       return 0;
-}
-
 static irqreturn_t max1027_trigger_handler(int irq, void *private)
 {
        struct iio_poll_func *pf = (struct iio_poll_func *)private;
@@ -393,7 +382,7 @@ static irqreturn_t max1027_trigger_handler(int irq, void *private)
 
 static const struct iio_trigger_ops max1027_trigger_ops = {
        .owner = THIS_MODULE,
-       .validate_device = &max1027_validate_device,
+       .validate_device = &iio_trigger_validate_own_device,
        .set_trigger_state = &max1027_set_trigger_state,
 };