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>
Showing
Please register or sign in to comment