]> asedeno.scripts.mit.edu Git - linux.git/commit
staging: comedi: add comedi_dev_get_from_minor()
authorIan Abbott <abbotti@mev.co.uk>
Fri, 8 Nov 2013 15:03:33 +0000 (15:03 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Nov 2013 00:16:44 +0000 (16:16 -0800)
commitb449c1cad7e3acf80834d4bdb1b6241d5d8dd249
treeb02f278cb85f0b6f98b998b448c3e5ae97a8cde7
parent5b13ed94a7d24fdc8abbac81e7e4d30ab22c6540
staging: comedi: add comedi_dev_get_from_minor()

Add function `struct comedi_device *comedi_dev_get_from_minor(unsigned
minor)`.  This behaves like the existing `comedi_dev_from_minor()`
except that it also increments the `struct kref refcount` member (via
new helper function `comedi_dev_get()`) to prevent it being freed.  If
it returns a valid pointer, the caller is responsible for calling
`comedi_dev_put()` to decrement the reference count.

Export `comedi_dev_get_from_minor()` and `comedi_dev_put()` as they will
be used by the "kcomedilib" module in addition to the "comedi" module
itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c
drivers/staging/comedi/comedidev.h