diff options
author | Stefan Popa <stefan.popa@analog.com> | 2018-08-20 17:53:43 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2018-08-25 09:16:42 +0100 |
commit | 1c412a321590d4a01698b85710e29b1e575de1a7 (patch) | |
tree | 9386879b6a46482b2aa2377e1dd314c9f7029701 /drivers/iio | |
parent | 1691d4ca7081d3154771c2c4b18ec816936fef4f (diff) | |
download | blackbird-op-linux-1c412a321590d4a01698b85710e29b1e575de1a7.tar.gz blackbird-op-linux-1c412a321590d4a01698b85710e29b1e575de1a7.zip |
iio: adxl372: Provide validate_trigger and validate_device callbacks
This patch provides a validate_device callback for the trigger which makes
sure that other devices are rejected.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/accel/adxl372.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c index d2fdc7581fe0..5a039ba0b3eb 100644 --- a/drivers/iio/accel/adxl372.c +++ b/drivers/iio/accel/adxl372.c @@ -762,11 +762,24 @@ static int adxl372_dready_trig_set_state(struct iio_trigger *trig, return adxl372_set_interrupts(st, mask, 0); } +static int adxl372_validate_trigger(struct iio_dev *indio_dev, + struct iio_trigger *trig) +{ + struct adxl372_state *st = iio_priv(indio_dev); + + if (st->dready_trig != trig) + return -EINVAL; + + return 0; +} + static const struct iio_trigger_ops adxl372_trigger_ops = { + .validate_device = &iio_trigger_validate_own_device, .set_trigger_state = adxl372_dready_trig_set_state, }; static const struct iio_info adxl372_info = { + .validate_trigger = &adxl372_validate_trigger, .read_raw = adxl372_read_raw, .debugfs_reg_access = &adxl372_reg_access, .hwfifo_set_watermark = adxl372_set_watermark, |