From: Lars-Peter Clausen <lars@metafoo.de>
To: Stefan Popa <stefan.popa@analog.com>, jic23@kernel.org
Cc: Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] iio: adxl372: Provide validate_trigger and validate_device callbacks
Date: Mon, 20 Aug 2018 17:47:08 +0200 [thread overview]
Message-ID: <1fc5f7bb-67d1-fa03-2242-b38b94a151ee@metafoo.de> (raw)
In-Reply-To: <1534776823-18703-1-git-send-email-stefan.popa@analog.com>
On 08/20/2018 04:53 PM, Stefan Popa wrote:
> 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
> ---
> drivers/iio/accel/adxl372.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c
> index d2fdc75..5a039ba 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,
I wonder, if the device only works with the trigger and the trigger only
works with the device should we actually register a trigger?
Seems to be just extra hassle when setting up the device without any extra
benefits.
next prev parent reply other threads:[~2018-08-20 15:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 14:53 Stefan Popa
2018-08-20 15:47 ` Lars-Peter Clausen [this message]
2018-08-20 16:37 ` jic23
2018-08-25 8:16 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1fc5f7bb-67d1-fa03-2242-b38b94a151ee@metafoo.de \
--to=lars@metafoo.de \
--cc=Michael.Hennerich@analog.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=stefan.popa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®