On 01/12/2015 02:54 PM, Ivan T. Ivanov wrote:
On Fri, 2015-01-09 at 17:16 +0100, Lars-Peter Clausen wrote:
On 01/09/2015 05:14 PM, Ivan T. Ivanov wrote:
On Fri, 2015-01-09 at 16:54 +0100, Lars-Peter Clausen wrote:
On 01/09/2015 04:50 PM, Ivan T. Ivanov wrote:
On Fri, 2015-01-09 at 16:41 +0100, Lars-Peter Clausen wrote:
On 01/09/2015 04:38 PM, Ivan T. Ivanov wrote:
Instead of checking whether provider module is still
loaded on every access to device just lock module to
memory when client get reference to provider device.
This has nothing to do with the module, it's about the device. In the Linux
device driver model as device can be unbound at any time and the IIO
framework needs to handle this.
Hm. Probably i am missing something here, but is this
still true if we have reference to device structure?
Yes, that only prevents the memory of device from being freed. But the
device can still be unbound from the driver.
Think of e.g. a USB device that is pulled from the USB connector. Nothing
you can do in software about having the device disappear.
Agree, but I think that the patch is still valid. Module
have to be pinned in memory as long as there are device
driver users.
No, the idea of the Linux driver model is that you can remove the module of
a driver at any time, which will unbind the device from the driver. Once you
reinsert the module the device will be re-bound to the driver.
I will say that device can be unbind at any time and not that module be can
unload at any time. But yes, and I'm not saying the opposite. There are a
lot of examples in kernel, where you can not unload driver if it is used by
another driver. See kernel-haking.tmpl.
If you remove the module the driver will be unregistered. Unregistering the
driver will unbind all devices currently bound to the driver. This will
invoke the drivers remove callback for those devices. In the remove callback
the device is supposed to release all resource etc. that depend on the
driver module being loaded. So there is no need to increase the module
refcount and prevent it from being removed if there is a device registered
for the driver.
- 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