staging: comedi: don't poll_wait on same subdevice twice
authorIan Abbott <abbotti@mev.co.uk>
Fri, 9 Oct 2015 11:26:47 +0000 (12:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 17:28:40 +0000 (10:28 -0700)
commit322146d5d485cddb93761bd2593fbc932399b0a1
tree154d56757d0114f3418897b272f791b35b4642b0
parent944fd0c92ab7642dd027c1dac0cfb7199904a56d
staging: comedi: don't poll_wait on same subdevice twice

Comedi subdevices that support asynchronous acquisition commands have a
wait queue head used for blocking reads or writes and for the poll file
operation.  The comedi device may have several subdevices that support
"read" and/or "write" commands, but each open file object has at most
one "read" subdevice and one "write" subdevice.  It's possible (though
rare) for those to be the same subdevice if the subdevice supports
commands in either direction.  In that case, the "poll" file operation
doesn't really need to do a `poll_wait()` on the same subdevice twice.
Although harmless, it wastes a poll table entry.  Check for that, and
avoid it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c