Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Marek Vasut <marex@denx.de>
Cc: linux-iio@vger.kernel.org, otavio@ossystems.com.br,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Shawn Guo <shawn.guo@linaro.org>
Subject: Re: [PATCH] iio: mxs-lradc: Fix misuse of iio->trig
Date: Wed, 03 Jul 2013 20:50:46 +0100	[thread overview]
Message-ID: <51D48096.5000206@kernel.org> (raw)
In-Reply-To: <1372540813-12540-1-git-send-email-marex@denx.de>

On 06/29/2013 10:20 PM, Marek Vasut wrote:
> The struct iio_dev .trig field is to be used only by the IIO core,
> the driver shall not fill this field. This fixes ugly crash when
> the driver is compiled as a module and the module is rmmod'd.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Shawn Guo <shawn.guo@linaro.org>

I've applied this to the fixes-togreg branch of iio.git but had a bit
of fuzz, could you just santiy check that nothing went wrong please.

https://git.kernel.org/cgit/linux/kernel/git/jic23/iio.git/log/?h=fixes-togreg

Thanks

Jonathan
> ---
>  drivers/staging/iio/adc/mxs-lradc.c |   11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index 55a459b..28e029a 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -664,12 +664,13 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio)
>  {
>  	int ret;
>  	struct iio_trigger *trig;
> +	struct mxs_lradc *lradc = iio_priv(iio);
>  
>  	trig = iio_trigger_alloc("%s-dev%i", iio->name, iio->id);
>  	if (trig == NULL)
>  		return -ENOMEM;
>  
> -	trig->dev.parent = iio->dev.parent;
> +	trig->dev.parent = lradc->dev;
>  	trig->private_data = iio;
>  	trig->ops = &mxs_lradc_trigger_ops;
>  
> @@ -679,15 +680,17 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio)
>  		return ret;
>  	}
>  
> -	iio->trig = trig;
> +	lradc->trig = trig;
>  
>  	return 0;
>  }
>  
>  static void mxs_lradc_trigger_remove(struct iio_dev *iio)
>  {
> -	iio_trigger_unregister(iio->trig);
> -	iio_trigger_free(iio->trig);
> +	struct mxs_lradc *lradc = iio_priv(iio);
> +
> +	iio_trigger_unregister(lradc->trig);
> +	iio_trigger_free(lradc->trig);
>  }
>  
>  static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
> 

  reply	other threads:[~2013-07-03 19:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-29 21:20 [PATCH] iio: mxs-lradc: Fix misuse of iio->trig Marek Vasut
2013-07-03 19:50 ` Jonathan Cameron [this message]
2013-07-03 21:47   ` Marek Vasut

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=51D48096.5000206@kernel.org \
    --to=jic23@kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=otavio@ossystems.com.br \
    --cc=shawn.guo@linaro.org \
    /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