From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:39 +0000 (+0000) Subject: staging: comedi: kcomedilib: protect against device detachment X-Git-Tag: v3.14-rc1~150^2~775^2~86 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69e2387f3bfd408c7fb6c0d14b83d792f67ed638;p=pandora-kernel.git staging: comedi: kcomedilib: protect against device detachment The functions in "kcomedilib" need to prevent the comedi device being detached during their operation. This can be done by acquiring either the main mutex or the "attach lock" semaphore in the `struct comedi_device`. Use the attach lock when merely checking whether the device is attached. Use the mutex when processing a comedi instruction. Also, don't bother trying to manipulate the module use count of low-level comedi driver in `comedi_open()` and `comedi_close()`. If the device gets detached while it is "open", we wouldn't be able to decrement the module use count anyway. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed