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>
2 files changed