aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedidev.h
AgeCommit message (Collapse)Author
2019-04-03staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtestIan Abbott
commit bafd9c64056cd034a1174dcadb65cd3b294ff8f6 upstream. `ni_cdio_cmdtest()` validates Comedi asynchronous commands for the DIO subdevice (subdevice 2) of supported National Instruments M-series cards. It is called when handling the `COMEDI_CMD` and `COMEDI_CMDTEST` ioctls for this subdevice. There are two causes for a possible divide-by-zero error when validating that the `stop_arg` member of the passed-in command is not too large. The first cause for the divide-by-zero is that calls to `comedi_bytes_per_scan()` are only valid once the command has been copied to `s->async->cmd`, but that copy is only done for the `COMEDI_CMD` ioctl. For the `COMEDI_CMDTEST` ioctl, it will use whatever was left there by the previous `COMEDI_CMD` ioctl, if any. (This is very likely, as it is usual for the application to use `COMEDI_CMDTEST` before `COMEDI_CMD`.) If there has been no previous, valid `COMEDI_CMD` for this subdevice, then `comedi_bytes_per_scan()` will return 0, so the subsequent division in `ni_cdio_cmdtest()` of `s->async->prealloc_bufsz / comedi_bytes_per_scan(s)` will be a divide-by-zero error. To fix this error, call a new function `comedi_bytes_per_scan_cmd(s, cmd)`, based on the existing `comedi_bytes_per_scan(s)` but using a specified `struct comedi_cmd` for its calculations. (Also refactor `comedi_bytes_per_scan()` to call the new function.) Once the first cause for the divide-by-zero has been fixed, the second cause is that `comedi_bytes_per_scan_cmd()` can legitimately return 0 if the `scan_end_arg` member of the `struct comedi_cmd` being tested is 0. Fix it by only performing the division (and validating that `stop_arg` is no more than the maximum value) if `comedi_bytes_per_scan_cmd()` returns a non-zero value. The problem was reported on the COMEDI mailing list here: https://groups.google.com/forum/#!topic/comedi_list/4t9WlHzMhKM Reported-by: Ivan Vasilyev <grabesstimme@gmail.com> Tested-by: Ivan Vasilyev <grabesstimme@gmail.com> Fixes: f164cbf98fa8 ("staging: comedi: ni_mio_common: add finite regeneration to dio output") Cc: <stable@vger.kernel.org> # 4.6+ Cc: Spencer E. Olson <olsonse@umich.edu> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-17staging: comedi: comedidev: make bool bit-field unsigned int bit-fields.Giulio Benetti
Checkpatch complains on bool bitfields to be an int or u8/u16/u32 bitfield. Make bool bit-fields to be unsigned int bit-fields. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25staging: comedi: comedidev.h: Fix SPDX-License-Identifier tag styleNishad Kamdar
Replace // SPDX-License-Identifier: GPL-2.0+ by /* SPDX-License-Identifier: GPL-2.0+ */ as per licensing rule for C header files. Issue found by checkpatch. Part of Eudyptula Challenge. Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-26staging: comedi: reformat lines to 80 chars or lessEujon Sellers
This is a cleanup patch to fix line length issue found by checkpatch.pl script. In this patch, lines 186, 192 and 199 have been wrapped. Signed-off-by: Eujon Sellers <eujon.sellers@gmail.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-21staging: comedi: add identifiers to function parametersMichael Gebhard
Fix these checkpatch.pl warnings in comedidev.h: WARNING: function definition argument '<name>' should also have an identifier name Introduces this checkpatch.pl warning in lines 195 and 205: WARNING: line over 80 characters Breaking these lines would make the code less compact. Signed-off-by: Michael Gebhard <im72ywil@cip.cs.fau.de> Signed-off-by: David Sauerwein <la38vyti@cip.cs.fau.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all comedi files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/comedi files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03Staging: comedi: comedidev.h: Drop old style zero-length arrayCheah Kok Cheong
According to Documentation/Changes, the minimum gcc version required to compile the kernel is 3.2 (this is probably outdated too). Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03staging: comedi: comedidev.h: add identifiers to function parametersIan Abbott
Fix checkpatch.pl warnings of the form "function definition argument 'foo' should also have an identifier name". 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>
2016-12-08staging: comedi: comedidev.h: Document usage of 'detach' handlerIan Abbott
Document when the "detach" handler function pointed to by the `detach` member of a `struct comedi_driver` is called by the comedi core, and how the "attach" and "auto_attach" handlers can defer clean-up to it when they return an error to the comedi core. This is already mentioned as part of the documentation for `comedi_auto_config()`, but is useful to document it for `struct comedi_driver` as well, since `comedi_auto_config()` is not usually called directly by low-level comedi drivers, and it is not called at all for "legacy" comedi devices that are configured manually. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-29Staging: comedi: Fix 'unsigned' warning styleAniket Sharma
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 '*'Ian Abbott
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 mutexIan Abbott
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 functionsIan Abbott
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 functionsIan Abbott
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 documentationIan Abbott
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_lrangeIan Abbott
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_mapIan Abbott
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_subdeviceIan Abbott
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_deviceIan Abbott
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_driverIan Abbott
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_asyncIan Abbott
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_... constantsIan Abbott
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 commentIan Abbott
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 operationHari Prasath Gujulan Elango
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"Ian Abbott
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 usageIan Abbott
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.hIan Abbott
"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.hIan Abbott
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_deviceH Hartley Sweeten
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.hIan Abbott
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.hIan Abbott
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"H Hartley Sweeten
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 prototypesH Hartley Sweeten
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" informationH Hartley Sweeten
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()H Hartley Sweeten
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()H Hartley Sweeten
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 #ifdefsIan Abbott
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 functionsIan Abbott
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_asyncH Hartley Sweeten
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()'H Hartley Sweeten
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 functionsIan Abbott
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()H Hartley Sweeten
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()H Hartley Sweeten
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()H Hartley Sweeten
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()H Hartley Sweeten
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()H Hartley Sweeten
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()H Hartley Sweeten
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()H Hartley Sweeten
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()H Hartley Sweeten
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>