linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	jic23@kernel.org
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 6/6] iio: accel: kxcjk-1013: Increment ref counter for indio_dev->trig
Date: Sun, 20 Jul 2014 13:29:52 +0200	[thread overview]
Message-ID: <53CBA830.3020306@metafoo.de> (raw)
In-Reply-To: <1405557754-19601-6-git-send-email-srinivas.pandruvada@linux.intel.com>

On 07/17/2014 02:42 AM, Srinivas Pandruvada wrote:
> Assigning indio_dev->trig is not a good idea, as this can result in
> wrong reference count for trigger device. If assigned, it is better to
> increment reference counter by calling iio_trigger_get.
> Refer to http://www.spinics.net/lists/linux-iio/msg13669.html for discussion
> with Jonathan.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
>   drivers/iio/accel/kxcjk-1013.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index f5bb682..40ecf8b 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -1020,6 +1020,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
>   		iio_trigger_set_drvdata(trig, indio_dev);
>   		data->trig = trig;
>   		indio_dev->trig = trig;
> +		iio_trigger_get(indio_dev->trig);

Hm, we should change the signature of iio_trigger_get() to return the 
trigger, this gets it more in sync with other ..._get() APIs in the kernel. 
Then the above two lines become indio_dev->trig = iio_trigger_get(trig).

- Lars

  reply	other threads:[~2014-07-20 11:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  0:42 [PATCH 1/6] iio: accel: kxcjk-1013: Fix setting frequency Srinivas Pandruvada
2014-07-17  0:42 ` [PATCH 2/6] iio: accel: kxcjk-1013: Use try_reenable to ack intr Srinivas Pandruvada
2014-07-20 15:20   ` Jonathan Cameron
2014-07-17  0:42 ` [PATCH 3/6] iio: accel: kxcjk-1013: support runtime pm Srinivas Pandruvada
2014-07-20 15:37   ` Jonathan Cameron
2014-07-22  1:23     ` Rafael J. Wysocki
2014-07-27 13:42       ` Jonathan Cameron
2014-07-27 14:26         ` Srinivas Pandruvada
2014-07-17  0:42 ` [PATCH 4/6] iio: accel: kxcjk-1013: Set adjustable range Srinivas Pandruvada
2014-07-20 15:45   ` Jonathan Cameron
2014-07-24 23:04     ` Srinivas Pandruvada
2014-07-27 13:51       ` Jonathan Cameron
2014-07-17  0:42 ` [PATCH 5/6] iio: accel: kxcjk-1013: Support thresholds Srinivas Pandruvada
2014-07-20 16:04   ` Jonathan Cameron
2014-07-20 16:34     ` Srinivas Pandruvada
2014-07-20 17:01       ` Jonathan Cameron
2014-07-17  0:42 ` [PATCH 6/6] iio: accel: kxcjk-1013: Increment ref counter for indio_dev->trig Srinivas Pandruvada
2014-07-20 11:29   ` Lars-Peter Clausen [this message]
2014-07-20 12:24     ` Jonathan Cameron
2014-07-20 15:39   ` Jonathan Cameron
2014-07-20 15:19 ` [PATCH 1/6] iio: accel: kxcjk-1013: Fix setting frequency 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=53CBA830.3020306@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.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;
as well as URLs for NNTP newsgroup(s).