summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2013-11-08 15:03:38 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-11 16:16:44 -0800
commit799a66ba36cb51330c53c024dffc6ddb68545c9c (patch)
tree5063dbb4e154d60745dc7a4a37712b62b21b0333 /include/linux
parentbe535c9a058b73600666d5431cfb442f39989a33 (diff)
staging: comedi: kcomedilib: increment reference while device in use
Low-level comedi drivers that use the "kcomedilib" module (currently only the "comedi_bond" driver) call `comedi_open()` to "open" another comedi device (not as a file) and `comedi_close()` to "close" it. (Note: these are the functions exported by the "kcomedilib" module, not the identically named, statically linked functions in the core "comedi" module.) In `comedi_open()`, call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` to get the pointer to the `struct comedi_device` being "opened". This increments its reference count to prevent it being freed. Call `comedi_dev_put()` if `comedi_open()` returns `NULL`, and also call it from `comedi_close()`. This decrements the reference count. Note that although we now protect against the `struct comedi_device` being freed, we do not yet protect against it being "detached" while it is being used. This will be addressed by a later patch. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions