aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
AgeCommit message (Collapse)AuthorFilesLines
2016-03-29Staging: comedi: Fix 'unsigned' warning styleGravatar Aniket Sharma 1-2/+2
This patch fixes the checkpatch.pl warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' + unsigned runflags; WARNING: Prefer 'unsigned int' to bare use of 'unsigned' +struct comedi_device *comedi_dev_get_from_minor(unsigned minor); Signed-off-by: Aniket Sharma <badbuddha91@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-13staging: comedi: comedidev.h: spaces preferred around that '*'Gravatar Ian Abbott 1-6/+6
Fix the checkpatch.pl issues: CHECK: spaces preferred around that '*' (ctx:VxV) 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>
2015-10-13staging: comedi: comedidev.h: add comments to spin-lock and mutexGravatar Ian Abbott 1-3/+3
Fix the checkpatch.pl issues: CHECK: spinlock_t definition without comment CHECK: struct mutes definition withoug comment 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>
2015-09-29staging: comedi: comedidev.h: document remaining inline functionsGravatar Ian Abbott 1-1/+113
Add kernel-doc headers to the inline functions that do not have them yet. 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>
2015-09-29staging: comedi: comedidev.h: tweak docs for inline functionsGravatar Ian Abbott 1-33/+59
Tweak the kernel-doc for already documented inline functions for consistency, and document their return values. 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>
2015-09-29staging: comedi: comedidev.h: tweak struct comedi_async documentationGravatar Ian Abbott 1-25/+25
Make the kernel-doc layout for `struct comedi_async` more consistent with the documentation for the other COMEDI data types. 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>
2015-09-29staging: comedi: comedidev.h: document struct comedi_lrangeGravatar Ian Abbott 1-0/+11
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>
2015-09-29staging: comedi: comedidev.h: document struct comedi_buf_mapGravatar Ian Abbott 1-0/+29
Add kernel-doc for `struct comedi_buf_map` and the associated `struct comedi_buf_page`. 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>
2015-09-29staging: comedi: comedidev.h: document struct comedi_subdeviceGravatar Ian Abbott 1-0/+125
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>
2015-09-29staging: comedi: comedidev.h: document struct comedi_deviceGravatar Ian Abbott 1-3/+81
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>
2015-09-29staging: comedi: comedidev.h: document struct comedi_driverGravatar Ian Abbott 1-5/+33
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>
2015-09-29staging: comedi: comedidev.h: tweak kernel-doc for struct comedi_asyncGravatar Ian Abbott 1-7/+12
Tweak the formatting of the kernel-doc formatted comment for `struct comedi_async` in order to stop it generating bogus headings for text before a colon. 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>
2015-09-29staging: comedi: comedidev.h: use enum for COMEDI_CB_... constantsGravatar Ian Abbott 1-11/+12
The existing constants `COMEDI_CB_EOS` etc. are in the form of macros and have a bogus kernel-doc comment. Change them to `enum` constants so they can be documented properly with kernel-doc. 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>
2015-09-29staging: comedi: comedidev.h: reformat copyright commentGravatar Ian Abbott 1-16/+16
Use the preferred block comment style. 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>
2015-06-17staging: comedi: use BIT macro for bit shift operationGravatar Hari Prasath Gujulan Elango 1-6/+6
This patch silences the Checkpatch.pl warning 'Prefer using the BIT macro' Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-30staging: comedi: move COMEDI_SRF_... macros to "comedi_fops.c"Gravatar Ian Abbott 1-17/+0
The `COMEDI_SRF_...` macros define flag combinations in the `runflags` member of `struct comedi_subdevice`. They are only used directly in "comedi_fops.c", so move them to there. 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>
2015-04-30staging: comedi: wrap COMEDI_SRF_FREE_SPRIV usageGravatar Ian Abbott 1-0/+1
The `COMEDI_SRF_FREE_SPRIV` flag in the `runflags` member of `struct comedi_subdevice` indicates that the memory pointed to by the `private` member can be automatically freed by the comedi core on subdevice clean-up (when the low-level comedi device is being "detached"). the flag doesn't really belong in `runflags`, but it was somewhere convenient to keep it without having to add a new member to the structure. Rather than access the `COMEDI_SRF_FREE_SPRIV` flag directly, use some new wrapper functions: * comedi_can_auto_free_spriv(s) - checks whether the subdevice's `s->private` points to memory that can be freed automatically. * comedi_set_spriv_auto_free(s) - marks the subdevice as having a `s->private` that points to memory that can be freed automatically. Export `comedi_set_spriv_auto_free()` for use by the low-level comedi driver modules, in particular the "amplc_dio200_common" module. 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>
2015-04-03staging: comedi: comedi_fc.h: begin migration to comedidev.hGravatar Ian Abbott 1-0/+78
"comedi_fc.h" contains a few inline functions used by the `do_cmdtest` handler functions for comedi subdevices in several low-level comedi drivers for checking asynchronous command trigger sources and arguments. They all use the prefix `cfc_check_trigger_arg`. Copy them over to "../comedidev.h", but change the `cfc_` prefix to `comedi_`. Change the original functions in "comedi_fc.h" into simple wrappers for their replacements. Once the drivers have been changed to call the replacement functions, "comedi_fc.h" can be removed. 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>
2015-03-20staging: comedi: comedi_pci.h: move PCI stuff out of comedidev.hGravatar Ian Abbott 1-43/+0
Move the PCI-specific stuff out of "comedidev.h" into "comedi_pci.h". Comedi PCI drivers now include "comedi_pci.h" instead of "comedidev.h", which now gets pulled in indirectly. 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>
2015-03-01staging: comedi: add 'pacer' member to struct comedi_deviceGravatar H Hartley Sweeten 1-0/+1
Add a new member to the comedi_device struct for a comedi_8254 'pacer'. This provides a convient place to store the data allocated by the comedi_8254 module for boards that use an 8254 device to create the data acquisition pacer clock. Automatically free this pointer in comedi_device_detach_cleanup() so that the drivers don't need to do it when then are detached. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-07staging: comedi: comedi_pcmcia.h: move PCMCIA stuff out of comedidev.hGravatar Ian Abbott 1-33/+0
Move the PCMCIA-specific stuff out of "comedidev.h" into "comedi_pcmcia.h". Comedi PCMCIA drivers now include "comedi_pcmcia.h" instead of "comedidev.h", which now gets pulled in indirectly. 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>
2015-01-28staging: comedi: comedi_usb.h: move USB stuff out of comedidev.hGravatar Ian Abbott 1-29/+0
Move the USB-specific stuff out of "comedidev.h" into "comedi_usb.h". Comedi USB drivers now include "comedi_usb.h" instead of "comedidev.h", which now gets pulled in indirectly. 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>
2015-01-25staging: comedi: comedidev.h: add namespace to the subdevice "runflags"Gravatar H Hartley Sweeten 1-9/+16
Tidy up and document the subdevice "runflags". Rename them so they have comedi namespace. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25staging: comedi: comedidev.h: remove unused "polling" function prototypesGravatar H Hartley Sweeten 1-5/+0
These "polling" functions are not implemented in the comedi core. Remove the unnecessary prototypes. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25staging: comedi: comedidev.h: remove unused "minor bits" informationGravatar H Hartley Sweeten 1-11/+0
The enum comedi_minor_bits and the COMEDI_SUBDEVICE_MINOR_{SHIFT,OFFSET} defines are not used. Remove them. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07staging: comedi: drivers: introduce comedi_nsamples_left()Gravatar H Hartley Sweeten 1-0/+2
Introduce a helper function to calculate the number of samples remaining when the cmd->stop_src is TRIG_COUNT. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07staging: comedi: drivers: introduce comedi_nscans_left()Gravatar H Hartley Sweeten 1-0/+2
Introduce a helper function to determine the number of scans left in the async command. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07staging: comedi: comedidev.h: remove some #ifdefsGravatar Ian Abbott 1-12/+0
Some declarations and macro definitions in "comedidev.h" are protected by various `#ifdef`s for kernel configuration options, but the header file compiles fine without the `#ifdef`s regardless of whether those config option macros are defined or not. Remove the `#ifdef`s and compile the affected code unconditionally. 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>
2014-11-07staging: comedi: comedidev.h: remove dummy PCI support functionsGravatar Ian Abbott 1-26/+0
Some low-level Comedi driver modules used to handle PCI devices and ISA devices in the same module with some conditional compilation. To reduce the amount of conditional compilation, some dummy inline versions of `comedi_to_pci_dev()`, `comedi_pci_enable()`, `comedi_pci_disable()`, and `comedi_pci_detach()` are defined in "comedidev.h" if `CONFIG_COMEDI_PCI_DRIVERS` is undefined. Since those Comedi low-level driver modules have since had PCI support split out into separate modules, there is no need to keep the dummy inline functions around any more, 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>
2014-11-05staging: comedi: comedidev.h: add 'scans_done' member to comedi_asyncGravatar H Hartley Sweeten 1-0/+2
Introduce a new member to comedi_async to count the number of scans completed. This member is cleared by comedi_buf_reset() along with the other comedi_async members. It is incremented in comedi_inc_scan_progress() when the end of scan is detected. This member will be used to clean up the scan counting in the comedi drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-03staging: comedi: remove use of 'bytes_per_sample()'Gravatar H Hartley Sweeten 1-6/+0
This inline helper function has been replaced with comedi_bytes_per_sample(). The same commit (bf33eb4b4f57) introduced a couple other related helper functions a manipulate the sample size. Use the new helper functions to remove the use of 'bytes_per_sample()' and remove it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: introduce some sample size manipulation functionsGravatar Ian Abbott 1-4/+59
Introduce a few static inline helper functions: `comedi_bytes_per_sample(s)` is the same as the existing `bytes_per_sample(s)` and determines the size of a comedi sample in bytes. (`bytes_per_sample(s)` will be removed.) `comedi_sample_shift(s)` determines the log2 of the comedi sample size, so it can be used in bit-shift operations to multiply or divide by the sample size. `comedi_bytes_to_samples(s, nbytes)` converts a number of bytes to a number of samples (rounding down). `comedi_samples_to_bytes(s, nsamples)` converts a number of samples to a number of bytes. 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>
2014-10-29staging: comedi: comedi_buf: don't export comedi_write_array_to_buffer()Gravatar H Hartley Sweeten 1-3/+0
All the comedi drivers have been converted to use comedi_buf_write_samples(). This function is now only used internally by comedi_buf. Remvoe the export. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedi_buf: remove comedi_buf_put()Gravatar H Hartley Sweeten 1-2/+0
All comedi drivers now use comedi_buf_write_samples() to add the samples to the async buffer. Remove this unused function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedi_buf: introduce comedi_buf_write_samples()Gravatar H Hartley Sweeten 1-0/+2
Introduce a generic method to write samples to the async buffer. The number of samples is first checked against the number of samples that would fill the async buffer. The size of each sample is determined using the bytes_per_sample() helper. If all the samples will fit in the async buffer they are written to the buffer using comedi_write_array_to_buffer(). This will allow converting all the comedi drivers to use a common method to write data to the async buffer. Since comedi_write_array_to_buffer() sets the COMEDI_CB_BLOCK event after writing the data, those events can be removed from the drivers. In addition, comedi_inc_scan_progress() will automatically detect the end of scan and set the COMEDI_CB_EOS event. Those events can also be removed from the drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedi_buf: don't export comedi_buf_memcpy_to()Gravatar H Hartley Sweeten 1-3/+0
This function is only used internally. Remove the export. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedi_buf: dont't export comedi_buf_memcpy_from()Gravatar H Hartley Sweeten 1-2/+1
This function is only used internally. Remove the export. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedi_buf: remove comedi_buf_get()Gravatar H Hartley Sweeten 1-1/+0
This function is no longer used. Remove it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedi_buf: remove export of comedi_read_array_from_buffer()Gravatar H Hartley Sweeten 1-2/+0
This function is only used internally. Remove the export. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedi_buf: introduce comedi_buf_read_samples()Gravatar H Hartley Sweeten 1-0/+2
Introduce a generic method to read samples from the async buffer. The number of requested samples is clampled to the number of samples that would fill the async buffer. The size of each sample is determined using the bytes_per_sample() helper. The number of bytes need are then read from the async buffer using comedi_read_array_from_buffer(). This will allow converting all the comedi drivers to use a common method to read data from the async buffer. Since comedi_read_array_from_buffer() sets the COMEDI_CB_BLOCK event after reading the data, those events can be removed from the drivers. In addition, comedi_inc_scan_progress() will automatically detect the end of scan and set the COMEDI_CB_EOS event. Those events can also be removed from the drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedidev.h: clarify async->event error/cancel detectionGravatar H Hartley Sweeten 1-0/+6
Introduce COMEDI_CB_ERROR_MASK and COMEDI_CB_CANCEL_MASK to clarify the async->events that indicate errors and cancel an async command. Use the new defines to tidy up and clarify the code. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29staging: comedi: comedidev.h: don't expose COMEDI_CB_* defines to userspaceGravatar H Hartley Sweeten 1-0/+16
The COMEDI_CB_* defines are the comedi_async "events" that the drivers set to let the core detect the state of running async commands. These "events" are only relevant to the kernel modules and should not be exposed to userspace in the comedi.h user API header. Move the defines to comedidev.h to avoid exposing them. For aesthetics, convert the defines to bit shifts to better indicate that they are bitmask values. Cleanup the documentation. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: comedi: add comedi_read_array_from_buffer()Gravatar Ian Abbott 1-0/+2
The "comedi_fc" module contains a few functions useful to Comedi drivers. Their functionality is being migrated to the core "comedi" module and renamed to start with the prefix `comedi_`. As part of this migration, move `cfc_read_array_from_buffer()` into the core comedi module and rename it to `comedi_read_array_from_buffer()`. Change the external declaration of `cfc_read_array_from_buffer()` into an inline function that calls `comedi_read_array_from_buffer()`. 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>
2014-09-19staging: comedi: add comedi_write_array_to_buffer()Gravatar Ian Abbott 1-0/+3
The "comedi_fc" module contains a few functions useful to Comedi drivers. Their functionality is being migrated to the core "comedi" module and renamed to start with the prefix `comedi_`. As part of this migration, move `cfc_write_array_to_buffer()` into the core comedi module and rename it to `comedi_write_array_to_buffer()`. Change the external declaration of `cfc_write_array_to_buffer()` into an inline function that calls `comedi_write_array_to_buffer()`. 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>
2014-09-19staging: comedi: add comedi_handle_events()Gravatar Ian Abbott 1-0/+3
The "comedi_fc" module contains a few functions useful to Comedi drivers. Their functionality is being migrated to the core "comedi" module and renamed to start with the prefix `comedi_`. As part of this migration, move `cfc_handle_events()` into the core comedi module and rename it to `comedi_handle_events()`. Change the external declaration of `cfc_handle_events()` into an inline function that calls `comedi_handle_events()`. 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>
2014-09-19staging: comedi: add comedi_inc_scan_progress()Gravatar Ian Abbott 1-0/+2
The "comedi_fc" module contains a few functions useful to Comedi drivers. Their functionality is being migrated to the core "comedi" module and renamed to start with the prefix `comedi_`. As part of this migration, move `cfc_inc_scan_progress()` into the core comedi module and rename it to `comedi_inc_scan_progress()`. Change the external declaration of `cfc_inc_scan_progress()` into an inline function that calls `comedi_inc_scan_progress()`. 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>
2014-09-19staging: comedi: add comedi_bytes_per_scan()Gravatar Ian Abbott 1-0/+1
The "comedi_fc" module contains a few functions useful to Comedi drivers. Their functionality is being migrated to the core "comedi" module and renamed to start with the prefix `comedi_`. As part of this migration, move `cfc_bytes_per_scan()` into the core comedi module and rename it to `comedi_bytes_per_scan()`. Change the external declaration of `cfc_bytes_per_scan()` into an inline function that calls `comedi_bytes_per_scan()`. 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>
2014-09-19staging: comedi: remove comedi_board()Gravatar Ian Abbott 1-5/+0
All calls to the inline function `comedi_board()` in "comedidev.h" have been removed, so remove the function. 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>
2014-08-30staging: comedi: comedi_pci: introduce comedi_pci_detach()Gravatar H Hartley Sweeten 1-0/+5
Introduce a generic (*detach) function for comedi PCI drivers to handle the boilerplate code needed to detach a PCI driver. This function works similar to comedi_legacy_detach() where it will: * free the dev->irq if it has been requested * iounmap the dev->mmio addres if it has been ioremap'ed The helper then calls comedi_pci_disable() to release the regions and disable the PCI device. Use the new helper directly for the (*detach) in the following cases: * where comedi_pci_disable() is used directly for the (*detach) * where the detach function is just boilerplate Use the new helper in the (*detach) of the simpler PCI drivers. Call the helper after disabling interrupts (reset) and before any additional cleanup (kfree) to avoid any race conditions with the interrupt handler. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: comedi: add a 'readback' member to comedi_subdeviceGravatar H Hartley Sweeten 1-0/+6
The analog output hardware in most comedi drivers does not provide a way to readback to last values written to the channels. In order to provide an (*insn_read) for the analog output subdevice, the comedi drivers save the last values for each channel in the private data. Add a new member, 'readback', to the comedi_subdevice definition to provide a common way to save these values. Introduce a comedi core function, comedi_alloc_subdev_readback(), to allocate the memory needed to save the values. This memory will be automatically kfree'd when the driver is detached. Introduce a comedi core function, comedi_readback_insn_read(), that the comedi drivers can use for the (*insn_read) of a subdevice to return the saved values for each channel. This will allow removing the boilerplate in the comedi drivers to return the saved values. In some drivers it will also allow removing the private data completely. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>