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@xxxxxxxxxxxxxxx> --- 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 -- 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