staging: comedi: use minor device number in attribute functions
authorIan Abbott <abbotti@mev.co.uk>
Thu, 4 Apr 2013 13:59:09 +0000 (14:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Apr 2013 21:33:20 +0000 (14:33 -0700)
commitc88db46908490f8ae3e3bca3533fbe6250762385
tree4f83e2d32175fd5206db94625f56ab85dde2bdcb
parent7f4656c5f780520262f7eeda926844761e859c6b
staging: comedi: use minor device number in attribute functions

The comedi device attribute functions such as
`show_max_read_buffer_kb()` call `dev_get_drvdata()` to get a pointer to
a `struct comedi_file_info` from the private driver data field of class
device.  Change them to use the minor device number to look up this
pointer value so they behave more like the file operation functions.
Check the pointer is non-NULL as the entry in the minor device table
could have been set to NULL.  Note that there is still a race condition
in the use of this pointer value after acquiring the mutex which needs
to be dealt with once reference counting has been implemented for comedi
devices.

The calls to `dev_set_drvdata()` from `comedi_alloc_board_minor()` and
`comedi_alloc_subdevice_minor()` are no longer needed so remove them.

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