summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi
Commit message (Collapse)AuthorAgeFilesLines
* staging: comedi: ni_mio_common: fix the ni_write[blw]() functionsH Hartley Sweeten2016-03-231-6/+6
| | | | | | | | | | | Memory mapped io (dev->mmio) should not also be writing to the ioport (dev->iobase) registers. Add the missing 'else' to these functions. Fixes: 0953ee4acca0 ("staging: comedi: ni_mio_common: checkpatch.pl cleanup (else not useful)") Cc: <stable@vger.kernel.org> # 3.17+ 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>
* Revert "staging: comedi: drivers: Remove unneeded NULL check before kfree()"Greg Kroah-Hartman2016-03-111-2/+4
| | | | | | | | | | This reverts commit 3545bee9b8ec00ba733e17363f494c8761fb5e49. It's not correct. Reported-by: Hartley Sweeten <HartleyS@visionengravers.com> Cc: Janani Ravichandran <janani.rvchndrn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_pcidio.c: Prefer using macro DIV_ROUND_UPBhaktipriya Shridhar2016-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1)) / (e2) + DIV_ROUND_UP(e1,e2) ) Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: dt282x: Prefer using macro DIV_ROUND_UPBhaktipriya Shridhar2016-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1)) / (e2) + DIV_ROUND_UP(e1,e2) ) Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: rtd520: Prefer using macro DIV_ROUND_UPBhaktipriya Shridhar2016-03-111-3/+2Star
| | | | | | | | | | | | | | | | | | | | The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1)) / (e2) + DIV_ROUND_UP(e1,e2) ) Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: ni_mio_common: Prefer using macro DIV_ROUND_UPBhaktipriya Shridhar2016-03-111-9/+5Star
| | | | | | | | | | | | | | | | | | | | The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1)) / (e2) + DIV_ROUND_UP(e1,e2) ) Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: amplc_pci230: Prefer using macro DIV_ROUND_UPBhaktipriya Shridhar2016-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1)) / (e2) + DIV_ROUND_UP(e1,e2) ) Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: comedi: Use predefined macro offset_in_page() instead of (addr & ↵Sandhya Bankar2016-03-111-1/+1
| | | | | | | | | ~PAGE_MASK). Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK). Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: gsc_hpdi: Remove use of deprecated pci APIAmitoj Kaur Chawla2016-03-111-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace pci_[alloc|free]_consistent occurences with dma_[alloc|free]_coherent. The Coccinelle semantic patch that was used to make some of these changes is as follows: @deprecated@ idexpression id; position p; @@ ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @bad1@ idexpression id; position deprecated.p; @@ ...when != &id->dev when != pci_get_drvdata ( id ) when != pci_enable_device ( id ) ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @depends on !bad1@ idexpression id; expression direction; position deprecated.p; @@ ( - pci_dma_supported@p ( id, + dma_supported ( &id->dev, ... + , GFP_KERNEL ) | - pci_alloc_consistent@p ( id, + dma_alloc_coherent ( &id->dev, ... + , GFP_KERNEL ) ) gsc_hpdi_auto_attach does not affect interrupt status but contains a call to comedi_alloc_devpriv() which calls kzalloc with GFP_KERNEL flag. Thus, there seems to be no danger that dma_alloc_coherent can be called with interrupts turned off, and GFP_KERNEL can be used. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi.h: Fix comment for struct comedi_krangeIan Abbott2016-03-051-1/+1
| | | | | | | | | | | | The kernel-doc comment for `struct comedi_krange` refers to the macro constant `RF_external`. It should be `RF_EXTERNAL`, so fix it. It also documents the value of the constant as `(1 << 8)`, but the macro now expands to the hexadecimal constant `0x100`, so use that as the documented value. 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>
* staging: comedi: comedi.h: Do not use BIT macroIan Abbott2016-03-051-5/+5
| | | | | | | | | | | | | | | The "comedi.h" file is part of the user API for COMEDI devices, and is intended to be migrated to "include/uapi/linux". The `BIT` macro from "include/linux/bitops.h" should not be used there. Replace the use of the `BIT` macro with hexadecimal constants of the same value. The `BIT` macro replaced expressions of the form `(1 << N)` in this file originally, but reverting back to that form would encourage patches changing them back to use the `BIT` macro. 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>
* staging: comedi: cb_pcimdda: Fix long lines in commentsRasmus Linusson2016-03-051-5/+6
| | | | | | | Reorder comments to keep 80 character limit Signed-off-by: Rasmus Linusson <rasmus@linusson.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: cb_pcimdda: Fix multi-line commentsRasmus Linusson2016-03-051-70/+70
| | | | | | | Add asterisks to multi-line comments currently missing them Signed-off-by: Rasmus Linusson <rasmus@linusson.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: comedi: s626.c: Remove unused functionsBhumika Goyal2016-03-051-33/+0Star
| | | | | | | | | The functions s626_get_clk_mult, s626_get_clk_mult, s626_get_enc_mode, s626_set_index_pol are not used anywhere in the kernel so they can be removed. This also cleans the code. Grepped to find the occurences. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: Remove use of deprecated pci APIAmitoj Kaur Chawla2016-03-051-30/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace pci_[alloc|free]_consistent occurences with dma_[alloc|free]_coherent. The Coccinelle semantic patch that was used to make some of these changes is as follows: @deprecated@ idexpression id; position p; @@ ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @bad1@ idexpression id; position deprecated.p; @@ ...when != &id->dev when != pci_get_drvdata ( id ) when != pci_enable_device ( id ) ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @depends on !bad1@ idexpression id; expression direction; position deprecated.p; @@ ( - pci_dma_supported@p ( id, + dma_supported ( &id->dev, ... + , GFP_KERNEL ) | - pci_alloc_consistent@p ( id, + dma_alloc_coherent ( &id->dev, ... + , GFP_KERNEL ) ) alloc_and_init_dma_members does not affect the interrupt status and is only called by auto_attach, which also does not affect the interrupt status. auto_attach() also contains a call to comedi_alloc_devpriv() which calls kzalloc with GFP_KERNEL flag. Thus, there seems to be no danger that dma_alloc_coherent can be called with interrupts turned off, and GFP_KERNEL can be used. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: Remove unneeded NULL check before kfree()Janani Ravichandran2016-03-051-4/+2Star
| | | | | | | Remove NULL check before kfree as it is not needed. Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: comedi: contec_pci_dio: fixed comment blocks coding style issuesPhilippe Loctaux2016-03-051-23/+24
| | | | | | | | | | Makes the comment blocks start with /* on separate lines, and end with */ on separate lines as well, starting with * for each comment lines. Signed-off-by: Philippe Loctaux <phil@philippeloctaux.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: Use macro DIV_ROUND_CLOSESTBhaktipriya Shridhar2016-03-051-16/+12Star
| | | | | | | | | | | | | | | | | | | | | | | | Occurences of the computation (x +d/2)/d can be replaced with the macro DIV_ROUND_CLOSEST. This was detected by the following Coccinelle script. @@ expression e1,e2; @@ ( - ((e1) + e2/2) / (e2) + DIV_ROUND_CLOSEST(e1,e2) | - ((e1) + (e2/2)) / (e2) + DIV_ROUND_CLOSEST(e1,e2) ) Since some lines exceeded the 80 character limit, some changes were made by hand. Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* comedi: note a coverity discovered hole that needs fixingAlan2016-03-051-0/+1
| | | | | | | It's not trivial to just post up a fix, so add it to the TODO list and ensure it doesn't get lost. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: terminate "write" command when stoppedIan Abbott2016-02-211-3/+6
| | | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer by a specified amount (which can be 0) and get the current position. An asynchronous command in the "read" direction is terminated automatically once it has stopped and information about the final position and error has been reported back to the user. That is not currently done for commands in the "write" direction. Change it to terminate the command in the "write" direction automatically. If the command stopped with an error, report an `EPIPE` error back to the user, otherwise just report the final buffer position back to the user. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: return -EPIPE for abnormal readIan Abbott2016-02-211-9/+18
| | | | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer by a specified amount (which can be 0) and get the current position. If an asynchronous command in the "read" direction has stopped normally, the command is terminated as soon as the position has been advanced to the end of all available data. This is not currently done if the command terminated with an error. Change it to allow the command to be terminated even if it stopped with an error, but report an `EPIPE` error to the user first. The `EPIPE` error will not be reported until the "read" position reported back to the user has been advanced to the end of all available data. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: become non-busy even if bytes_read is 0Ian Abbott2016-02-211-4/+3Star
| | | | | | | | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer by a specified amount (which can be 0) and get the new position. On input, the `bytes_read` member of `struct comedi_bufinfo` specified the amount to advance the "read" position for an asynchronous command in the "read" direction. If the command has already stopped normally, and the "read" position has been advanced to the end of all available data, the command is terminated by calling `do_become_nonbusy()`. (That is not currently done if the command stopped with an error.) Currently, the command is only terminated if the user is trying to advance the "read" position by a non-zero amount. Change it to allow the command to be terminated even if the user is not trying to advance the "read" position. This is justifiable, as the only time a command stops without error is when it has been set up to read a finite amount of data. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: return error if no active commandIan Abbott2016-02-211-20/+2Star
| | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer and/or get the current buffer position. If no asynchronous command is active (started via the file object that issued this ioctl), this information is meaningless. Change it to return an error (`-EINVAL`) in this case. Prior to this change, if a command was started via a different file object, the ioctl returned `-EACCES`, but now it will return `-EINVAL`, which is consistent with the current behavior of the "read" and "write" file operation handlers. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: force bytes_written to 0 if stoppedIan Abbott2016-02-211-0/+2
| | | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer by a specified amount (which can be 0) and get the new position. On input, the `bytes_written` member of `struct comedi_bufinfo` specifies the amount to advance the "write" position for an asynchronous command in the "write" direction. On output, the member indicates the amount the "write" position has actually been advanced. Advancing the "write" position is current done even if the command has stopped and cannot use any more written data. Change it to force the amount successfully written to 0 in that case. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: update buffer before becoming non-busyIan Abbott2016-02-211-1/+5
| | | | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer by a specified amount (which can be 0) and get the new position. For an asynchronous command in the "read" direction, if the command has finished acquiring data normally, `do_become_nonbusy()` is called to terminate the command. That resets the buffer position, and currently, the position information returned back to the user is after the buffer has been reset. It should be more useful to return the buffer position before the reset, so move the call to `do_become_nonbusy()` after the code that gets the updated buffer position. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: force bytes_read or bytes_written to 0Ian Abbott2016-02-211-12/+18
| | | | | | | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer by a specified amount (which can be 0) and get the new position. On input, the `bytes_read` member of `struct comedi_bufinfo` specifies the amount to advance the "read" position for an asynchronous command in the "read" direction, and the `bytes_written` member specifies the amount to advance the "write" position for a command in the "write" direction. The handler `do_bufinfo_ioctl()` may adjust these by the amount the position is actually advanced before copying them back to the user. Currently, it ignores the specified `bytes_read` value for a command in the "write" direction, and ignores the specified `bytes_written` for a command in the "read" direction, so the values copied back to the user are unchanged. Change it to force the ignored value to 0 before copying the values back to the user. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: COMEDI_BUFINFO: get amount freed, not amount allocatedIan Abbott2016-02-211-5/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The `COMEDI_BUFINFO` ioctl is used to advance the current position in the buffer by a specified amount (which can be 0) and get the new position. On input, the `bytes_read` member of `struct comedi_bufinfo` specifies the amount to advance the "read" position for an asynchronous command in the "read" direction, and the `bytes_written` member specifies the amount to advance the "write" position for a command in the "write" direction. The handler `do_bufinfo_ioctl()` may limit the specified values according to amount of readable or writable space in the buffer. On output, the `struct comedi_bufinfo` is filled in with the updated position information, along with the adjusted `bytes_read` and `bytes_written` members. Advancing the buffer position occurs in two steps: first, some buffer space is allocated, and second, it is freed, advancing the current "read" or "write" position. Currently, `do_bufinfo_ioctl()` limits `bytes_read` or `bytes_written` to the amount it could allocate in the first step, but that is invisible and irrelevant to the ioctl user. It's mostly irrelevant to the COMEDI internals as well, apart from limiting how much can be freed in the second step. Change it to ignore how much it managed to allocate in the first step and just use the amount that was actually freed in the second step, which is the amount the current buffer position was actually moved by this ioctl call. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: Use DIV_ROUND_CLOSESTAmitoj Kaur Chawla2016-02-216-7/+7
| | | | | | | | | | | | | | | | | The kernel.h macro DIV_ROUND_CLOSEST performs the computation `(x +d/2)/d` but is perhaps more readable. The Coccinelle script used is as follows: // <smpl> @@ expression x,__divisor; @@ - (((x) + ((__divisor) / 2)) / (__divisor)) + DIV_ROUND_CLOSEST(x,__divisor) // </smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: Remove unnecessary else following returnJanani Ravichandran2016-02-211-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | Else is unnecessary when there is a return statement in the corresponding if block. Coccinelle patch: @rule1@ expression e1; @@ if (e1) { ... return ...; } - else{ ... - } @rule2@ expression e2; statement s1; @@ if(e2) { ... return ...; } - else s1 Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: comedi: Prefer using the BIT macroAybuke Ozdemir2016-02-121-5/+5
| | | | | | | | | | | Replace all instances of bit shifting on 1 with the BIT(x) macro. In addition, convert other non-1 shift operations with the equivalent BIT(x) macro for uniformity. Issue pointed out by checkpatch. CHECK: Prefer using the BIT macro Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: Use ARRAY_SIZE for sizes of arraysJanani Ravichandran2016-02-122-5/+2Star
| | | | | | | | | Use ARRAY_SIZE to calculate the size of an array to make code concise. The semantic patch used can be found here: https://github.com/coccinelle/coccinellery/commit/9cbab452a3a2e18439e8386d6c4a68ee42c3ee2b Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi.h: remove SDF_MODE0 etc.Ian Abbott2016-02-121-18/+4Star
| | | | | | | | | | | | | | | | | | | The macros `SDF_MODE0`, `SDF_MODE1`, `SDF_MODE2`, `SDF_MODE3`, and `SDF_MODE4` are COMEDI subdevice flags originally associated with the obsolete (and no longer present) COMEDI "trigger" functionality. They have been of no use since COMEDI release 0.7.61 back in November 2001. Since they were going spare, a couple of them have been aliased as `SDF_PWM_COUNTER` and `SDF_PWM_HBRIDGE` to mean other things. Remove the obsolete macros and redefine `SDF_PWM_COUNTER` and `SDF_PWM_HBRIDGE` as equivalent numeric values. Some code distributed with the userspace COMEDILIB library uses the `SDF_MODE0` etc. flags to display the fact that they are set, but COMEDILIB uses and installs its own, compatible version of "comedi.h" anyway so isn't affected by their removal from the kernel copy. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi.h: remove struct comedi_trigIan Abbott2016-02-121-23/+1Star
| | | | | | | | | | | | | Remove `struct comedi_trig` and some associated macros, `TRIG_DITHER`, `TRIG_DEGLITCH`, `TRIG_CONFIG`, and ioctl code `COMEDI_TRIG`. These have been obsolete since COMEDI release 0.7.61 back in November 2001. The userspace COMEDILIB library still has some deprecated code that may attempt to use these, but it uses its own, compatible version of "comedi.h", so isn't affected by their removal from the kernel copy. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi.h: add kernel-doc comments to struct typesIan Abbott2016-02-121-7/+325
| | | | | | | | | Add "kernel-doc"-formatted comments to the COMEDI `struct` declarations used with ioctls. Don't bother documenting `struct comedi_trig` as it is obsolete and not supported. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi.h: add kernel-doc to common enumsIan Abbott2016-02-121-65/+160
| | | | | | | | | | | | Add "kernel-doc"-formatted comments to COMEDI's general-purpose `enum` type declarations. Don't bother documenting the low-level driver-specific ones for now. Move the declaration of `enum comedi_counter_status_flags` next to the other general-purpose `enum` types. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi.h: tweak start of header commentIan Abbott2016-02-121-2/+2
| | | | | | | | | | The wording at the start of the header comment is a bit misleading, particularly the part in parentheses: "(installed as /usr/include/comedi.h)". This version of "comedi.h" certainly won't be installed as that pathname. Fix it. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* STAGING: COMEDI: Wrap line over 80 charactersPablo G. Gallardo2016-02-081-1/+2
| | | | | | | | This patch wraps lines over 80 characters. Signed-off-by: Pablo G. Gallardo <pggllrd@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* STAGING: COMEDI: Remove unnecessary typecast of c90 int constantPablo G. Gallardo2016-02-081-1/+1
| | | | | | | | This patch removes unnecessary typecast of c90 int constant. Signed-off-by: Pablo G. Gallardo <pggllrd@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_mio_common: add finite regeneration to dio outputSpencer E. Olson2016-02-081-1/+8
| | | | | | | | | | | | | | | | | | | | | | This patch continues the implementation of reinterpreting stop_arg when stop_src == TRIG_NONE for national instruments cdio output on e/m-series devices. This is part of a series of patches that allow a user to have a specific buffer repeated as-is indefinitely. The contents of the DMA buffer can be left static or changed by the user via mmap access to the DMA buffer. If the contents are changed by the user, additional munging is not performed by the driver and only a single call to comedi_mark_buffer_written should be done. The original behavior is preserved when stop_arg == 0, as would be the prior use case. As opposed to analog output, this patch is relatively simple. First, the digital output capabilities are much more limited/simple as compared to the analog output device on NI e/m-series hardware, and second, this patch relies on changes made with the earlier patch to accomplish limiting the DMA buffer transfer. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_mio_common: adds finite regeneration to AO outputSpencer E. Olson2016-02-081-15/+46
| | | | | | | | | | | | | | | This patch implements for analog output the reinterpretation of stop_arg when stop_src == TRIG_NONE to allow the user to specify the length of the buffer that should be repeated. The intent is to allow a user to have a specific buffer repeated as-is indefinitely. The contents of the DMA buffer can be left static or changed by the user via mmap access to the DMA buffer. If the contents are changed by the user, additional munging is not performed by the driver and only a single call to comedi_mark_buffer_written should be done. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_mio_common: Cleans up/clarifies ni_ao_cmdSpencer E. Olson2016-02-081-125/+318
| | | | | | | | | | | | | | | | | | | | | | This patch implements ni_ao_cmd much more closely organized like NI MHDDK examples and DAQ-STC pseudo-code. Adds comments with some more specific references to the DAQ-STC. For stop_src==TRIG_NONE (continuous output mode of entire buffer), the count for the UC counter was corrected to represent the maximum count possible (0xffffff). Prior behavior for stop_src=TRIG_NONE did not actually follow the DAQ-STC. Furthermore, stop_src==TRIG_NONE now correctly uses code specialized for either m-series or e-series devices. It should be noted that stop_src==TRIG_NONE does _not_ with this patch (or with prior behavior in ni_mio_common) actually implement true continuous output. Rather, the output is simply configured to operate as a single buffer output, but where the buffer is as large as is possible with NI-STC hardware. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_mio_common: make more bits in ao_cmd1 reg be statefulSpencer E. Olson2016-02-081-5/+5
| | | | | | | | | | | | | | | | Bits NISTC_AO_CMD1_DAC0_UPDATE_MODE and NISTC_AO_CMD1_DAC1_UPDATE_MODE are now saved in the local copy of the AO_CMD1 register. This is more appropriate than prior methods of setting these bits specifically _both_ in the ni_ao_cmd configuration function _and_ the ni_ao_inttrig trigger function. With this patch, the bits are only specifically called out now in the ni_ao_cmd configuration function. In the ni_ao_inttrig trigger function, only the UI_ARM, UC_ARM, BC_ARM bits of the ao_cmd1 register are specifically called out. Each of these bits is a strobe bit, while the DAC[0-1]_UPDATE_MODE bits are simple write bits. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_mio_common: Cleans up/clarifies ni_ao_resetSpencer E. Olson2016-02-081-24/+46
| | | | | | | | | | This patch implements ni_ao_reset much more closely organized like NI MHDDK examples and DAQ-STC pseudo-code. Adds comments with some more specific references to the DAQ-STC. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: mite: enable continuous regeneration of finite samplesSpencer E. Olson2016-02-082-9/+66
| | | | | | | | | | | | | | | | | | | This change enables the mite DMA controller to only transfer the amount of data needed by a command. By default, the old behavior of transferring the entire comedi DMA data buffer is still in effect. These changes allow a command to only transmit a limited portion of that data buffer as needed. This patch begins to reinterprets stop_arg when stop_src == TRIG_NONE to allow the user to specify the length of the buffer that should be repeated. The intent is to allow a user to have a specific buffer repeated as-is indefinitely. The contents of the DMA buffer can be left static or changed by the user via mmap access to the DMA buffer. If the contents are changed by the user, additional munging is not performed by the driver and only a single call to comedi_mark_buffer_written should be done. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_mio_common: use CR_CHAN more consistentlySpencer E. Olson2016-02-081-1/+2
| | | | | | | | | | | | | | | Generally, the CR_CHAN macro is/should be used to access the relevant bits for channel identification in cmd->*_arg when the corresponding cmd->*_src==TRIG_EXT, including cmd->convert_arg in this case. This patch does not fix a bug per se, as NISTC_AI_MODE1_CONVERT_SRC() already masks the value sufficiently, but using CR_CHAN() here makes the code clearer as it avoids passing some irrelevant bits to NISTC_AI_MODE1_CONVERT_SRC() in the first place. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_tiocmd: change mistaken use of start_src for start_argSpencer E. Olson2016-02-081-1/+1
| | | | | | | | | | | This fixes a bug in function ni_tio_input_inttrig(). The trigger number should be compared to cmd->start_arg, not cmd->start_src. Fixes: 6a760394d7eb ("staging: comedi: ni_tiocmd: clarify the cmd->start_arg validation and use") Cc: <stable@vger.kernel.org> # 3.17+ Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_pcimio: Adds PXI-6251 to supported boardsSpencer E. Olson2016-02-081-1/+19
| | | | | | Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: dt2801: Prefer using the BIT macroBhaktipriya Shridhar2016-02-081-9/+9
| | | | | | | | | As suggested by checkpatch.pl, this patch replaces bit shifting on 1 with the BIT(x) macro. Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* STAGING: COMEDI: Using kernel types in plx9080.hMoritz König2015-12-221-1/+1
| | | | | | | | | | This patch makes plx9080.h use kernel types. Signed-off-by: Moritz König <moritz.koenig@fau.de> Signed-off-by: Fabian Lang <fabian.lang@fau.de> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Acked-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* STAGING: COMEDI: Added spaces around binary operators in plx9080.hMoritz König2015-12-221-1/+1
| | | | | | | | | This patch adds spaces around binary operators in plx9080.h. Signed-off-by: Moritz König <moritz.koenig@fau.de> Signed-off-by: Fabian Lang <fabian.lang@fau.de> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>