Re: [PATCH 6/6] iio: accel: kxcjk-1013: Increment ref counter for indio_dev->trig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17/07/14 01:42, 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@xxxxxxxxxxxxxxx>
I've parked the intervening patches to allow time for the runtime pm one
to sit on the list.

This one is a bug fix (and should have been earlier in the series!).
I've applied it to the togreg branch of iio.git.

Lars is of course correct that we could do this in a nicer fashion, but
I'd rather get the simple fix in place and tidy up later, than delay it
now.

Jonathan
---
  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);

  		ret = iio_trigger_register(trig);
  		if (ret)


--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux