From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Philippe Reynes <tremyfr@yahoo.fr>,
Martin Fuzzey <mfuzzey@parkeon.com>,
linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH v3 2/4] iio:mma8452: Use new iio_trigger_validate_own_device() helper
Date: Fri, 23 Sep 2016 17:19:42 +0200 [thread overview]
Message-ID: <1474643984-14262-2-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1474643984-14262-1-git-send-email-lars@metafoo.de>
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>
---
New in v3
---
drivers/iio/accel/mma8452.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index d41e1b5..1c70515 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1347,20 +1347,9 @@ static int mma8452_data_rdy_trigger_set_state(struct iio_trigger *trig,
return mma8452_change_config(data, MMA8452_CTRL_REG4, reg);
}
-static int mma8452_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 const struct iio_trigger_ops mma8452_trigger_ops = {
.set_trigger_state = mma8452_data_rdy_trigger_set_state,
- .validate_device = mma8452_validate_device,
+ .validate_device = iio_trigger_validate_own_device,
.owner = THIS_MODULE,
};
--
2.1.4
next prev parent reply other threads:[~2016-09-23 15:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 15:19 [PATCH v3 1/4] iio:trigger: Add helper function to verify that a trigger belongs to the same device Lars-Peter Clausen
2016-09-23 15:19 ` Lars-Peter Clausen [this message]
2016-09-24 16:25 ` [PATCH v3 2/4] iio:mma8452: Use new iio_trigger_validate_own_device() helper Jonathan Cameron
2016-09-23 15:19 ` [PATCH v3 3/4] iio:max1027: Use " Lars-Peter Clausen
2016-09-24 16:27 ` Jonathan Cameron
2016-09-23 15:19 ` [PATCH v3 4/4] iio:adc: Add support for AD7766/AD7767 Lars-Peter Clausen
2016-09-24 16:32 ` Jonathan Cameron
2016-09-24 16:33 ` Jonathan Cameron
2016-09-24 16:21 ` [PATCH v3 1/4] iio:trigger: Add helper function to verify that a trigger belongs to the same device 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=1474643984-14262-2-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=mfuzzey@parkeon.com \
--cc=pmeerw@pmeerw.net \
--cc=tremyfr@yahoo.fr \
/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;
as well as URLs for NNTP newsgroup(s).