linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
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
Subject: Re: [PATCH v3 2/4] iio:mma8452: Use new iio_trigger_validate_own_device() helper
Date: Sat, 24 Sep 2016 17:25:37 +0100	[thread overview]
Message-ID: <d848e02c-c7f3-88c5-7d2b-f02e37d32491@kernel.org> (raw)
In-Reply-To: <1474643984-14262-2-git-send-email-lars@metafoo.de>

On 23/09/16 16:19, Lars-Peter Clausen wrote:
> 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>
I wonder if having iio_trigger_set_drvdata use the mma8452_data pointer
instead might not make more sense after this change?

Anyhow, this is good on it's own and that should be a follow up patch
so applied to the togreg branch of iio.git - initially pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> ---
> 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,
>  };
>  
> 


  reply	other threads:[~2016-09-24 16:25 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 ` [PATCH v3 2/4] iio:mma8452: Use new iio_trigger_validate_own_device() helper Lars-Peter Clausen
2016-09-24 16:25   ` Jonathan Cameron [this message]
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=d848e02c-c7f3-88c5-7d2b-f02e37d32491@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.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).