staging: comedi: (core): add comedi_dev_from_file_info()
authorIan Abbott <abbotti@mev.co.uk>
Tue, 8 Jan 2013 13:27:48 +0000 (13:27 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jan 2013 00:49:25 +0000 (16:49 -0800)
commitba1bcf6f23e192e88b7c07d20d6221a0bcb7929e
tree21a48a02d281a96c93ceadcff895dc620701c10a
parenta679f36152dab84e9187572b2a3e193ddd95f58d
staging: comedi: (core): add comedi_dev_from_file_info()

Setting `info = comedi_file_info_from_minor(minor)` and `dev =
comedi_dev_from_minor(minor)` in the same function is a bit of a waste.
The latter function is just a call of the former followed by a
conditional return of an embedded pointer (`info->device`) or NULL.  The
former function uses a spin-lock which is where the wastfulness comes
in.

Move the "followed by a conditional return of an embedded pointer" part
into a new function `comedi_dev_from_file_info` and call this instead of
`comedi_dev_from_minor()` in the places where
`comedi_file_info_from_minor()` is also called.

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