From: Lars-Peter Clausen <lars@metafoo.de>
To: Ezequiel Garcia <ezequiel.garcia@imgtec.com>,
Jonathan Cameron <jic23@kernel.org>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: Module get needed for iio_channel_get and friends
Date: Mon, 20 Apr 2015 17:06:44 +0200 [thread overview]
Message-ID: <55351604.4000808@metafoo.de> (raw)
In-Reply-To: <552EC350.2000506@imgtec.com>
On 04/15/2015 10:00 PM, Ezequiel Garcia wrote:
> Jonathan, Lars:
>
> I've noticed that iio_channel_{get, get_all} don't call try_module_get
> on the module associated to the indio_dev.
>
> This means that an IIO driver can be removed while having a consumer for
> any of its channels.
The device can still be unbound from the driver, even if you pin the module.
E.g. device hot-unplug.
>
> If each channel can have a completely different indio_dev, this means we
> need to increase the refcount of the module on each indio_dev, right?
>
I think we already handle this correctly. The device ref-count is
incremented when a channel is requested. This means even when the device is
unbound from the driver it will stay around until the channel is freed and
the final reference is dropped. At the same time we set the info field of
the IIO device to NULL when the driver is unbound from the driver and in
iio_write_channel_raw() return -ENODEV when the info field is NULL.
- Lars
next prev parent reply other threads:[~2015-04-20 15:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 20:00 Module get needed for iio_channel_get and friends Ezequiel Garcia
2015-04-20 15:06 ` Lars-Peter Clausen [this message]
2015-04-20 21:06 ` Ezequiel Garcia
2015-04-21 5:52 ` 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=55351604.4000808@metafoo.de \
--to=lars@metafoo.de \
--cc=ezequiel.garcia@imgtec.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.