summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers
AgeCommit message (Collapse)Author
2014-04-26staging: comedi: 8255_pci: initialize MITE data windowIan Abbott
commit 268d1e799663b795cba15c64f5d29407786a9dd4 upstream. According to National Instruments' PCI-DIO-96/PXI-6508/PCI-6503 User Manual, the physical address in PCI BAR1 needs to be OR'ed with 0x80 and written to register offset 0xC0 in the "MITE" registers (BAR0). Do so during initialization of the National Instruments boards handled by the "8255_pci" driver. The boards were previously handled by the "ni_pcidio" driver, where the initialization was done by `mite_setup()` in the "mite" module. The "mite" module comes with too much extra baggage for the "8255_pci" driver to deal with so use a local, simpler initialization function. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-22staging: comedi: adv_pci1710: fix analog output readback valueH Hartley Sweeten
commit 1e85c1ea1ff2a60659e790ef8ec76c7339445841 upstream. The last value written to a analog output channel is cached in the private data of this driver for readback. Currently, the wrong value is cached in the (*insn_write) functions. The current code stores the data[n] value for readback afer the loop has written all the values. At this time 'n' points past the end of the data array. Fix the functions by using a local variable to hold the data being written to the analog output channel. This variable is then used after the loop is complete to store the readback value. The current value is retrieved before the loop in case no values are actually written.. 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-01-25staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()H Hartley Sweeten
commit 48108fe3daa0d142f9b97178fdb23704ea3a407b upstream. The dev->irq passed to request_irq() will always be 0 when the auto_attach function is called. The pcidev->irq should be used instead to get the correct irq number. 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-01-25staging: comedi: addi_apci_1032: fix subdevice type/flags bugH Hartley Sweeten
commit 90daf69a7a3f1d1a41018c799968a0bb896d65e0 upstream. The SDF_CMD_READ should be one of the s->subdev_flags not part of the s->type. 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-01-09staging: comedi: 8255_pci: fix for newer PCI-DIO48HIan Abbott
commit 0283f7a100882684ad32b768f9f1ad81658a0b92 upstream. At some point, Measurement Computing / ComputerBoards redesigned the PCI-DIO48H to use a PLX PCI interface chip instead of an AMCC chip. This meant they had to put their hardware registers in the PCI BAR 2 region instead of PCI BAR 1. Unfortunately, they kept the same PCI device ID for the new design. This means the driver recognizes the newer cards, but doesn't work (and is likely to screw up the local configuration registers of the PLX chip) because it's using the wrong region. Since the PCI subvendor and subdevice IDs were both zero on the old design, but are the same as the vendor and device on the new design, we can tell the old design and new design apart easily enough. Split the existing entry for the PCI-DIO48H in `pci_8255_boards[]` into two new entries, referenced by different entries in the PCI device ID table `pci_8255_pci_table[]`. Use the same board name for both entries. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ssv_dnp: use comedi_dio_update_state()H Hartley Sweeten
commit f6b316bcd8c421acd6fa5a6e18b4c846ecb9d965 upstream. Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state. Also, fix a bug where the state of the channels is returned in data[0]. The comedi core expects it to be returned in data[1]. 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>
2013-12-20staging: comedi: drivers: use comedi_dio_update_state() for simple casesH Hartley Sweeten
commit 97f4289ad08cffe55de06d4ac4f89ac540450aee upstream. [Split from original patch subject: "staging: comedi: drivers: use comedi_dio_update_state() for simple cases"] Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state for simple cases where the hardware is updated when any channel is modified. Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the current state is not returned in data[1]. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: pcmuio: fix possible NULL deref on detachIan Abbott
commit 2fd2bdfccae61efe18f6b92b6a45fbf936d75b48 upstream. pcmuio_detach() is called by the comedi core even if pcmuio_attach() returned an error, so `dev->private` might be `NULL`. Check for that before dereferencing it. Also, as pointed out by Dan Carpenter, there is no need to check the pointer passed to `kfree()` is non-NULL, so remove that check. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-13staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdeviceIan Abbott
commit 677a31565692d596ef42ea589b53ba289abf4713 upstream. The `insn_bits` handler `ni_65xx_dio_insn_bits()` has a `for` loop that currently writes (optionally) and reads back up to 5 "ports" consisting of 8 channels each. It reads up to 32 1-bit channels but can only read and write a whole port at once - it needs to handle up to 5 ports as the first channel it reads might not be aligned on a port boundary. It breaks out of the loop early if the next port it handles is beyond the final port on the card. It also breaks out early on the 5th port in the loop if the first channel was aligned. Unfortunately, it doesn't check that the current port it is dealing with belongs to the comedi subdevice the `insn_bits` handler is acting on. That's a bug. Redo the `for` loop to terminate after the final port belonging to the subdevice, changing the loop variable in the process to simplify things a bit. The `for` loop could now try and handle more than 5 ports if the subdevice has more than 40 channels, but the test `if (bitshift >= 32)` ensures it will break out early after 4 or 5 ports (depending on whether the first channel is aligned on a port boundary). (`bitshift` will be between -7 and 7 inclusive on the first iteration, increasing by 8 for each subsequent operation.) Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26staging: comedi: dt282x: dt282x_ai_insn_read() always failsDan Carpenter
commit 2c4283ca7cdcc6605859c836fc536fcd83a4525f upstream. In dt282x_ai_insn_read() we call this macro like: wait_for(!mux_busy(), comedi_error(dev, "timeout\n"); return -ETIME;); Because the if statement doesn't have curly braces it means we always return -ETIME and the function never succeeds. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13staging: comedi: ni_mio_common: only do counter commands for ni_pcimioIan Abbott
"ni_mio_common.c" holds common code included by "ni_pcimio.c", "ni_atmio.c" and "ni_mio_cs.c", including a common initialization function `ni_E_init()`. Amongst other things, this initializes some counter subdevices to support comedi instructions and asynchronous commands. However, even though it sets up the handlers to support asynchronous commands on these subdevices, the handlers will return an error unless the `PCIDMA` macro is defined (which is defined only in "ni_pcimio.c"). If the `PCIDMA` macro is not defined, the comedi core will needlessly allocate buffers to support the asynchronous commands. Also, `s->async_dma_dir` is set to `DMA_BIDIRECTIONAL`, causing the physical pages for the buffers to be allocated using `dma_alloc_coherent()`. If the comedi core cannot call `dma_alloc_coherent()` because `CONFIG_HAS_DMA` is not defined, it will fail to allocate the buffers, which ultimately causes `ni_E_init()` to fail. Avoid the wastage and prevent the failure by only setting up asynchronous command support for the counter subdevices if the `PCIDMA` macro is defined. 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>
2013-05-13staging: comedi: ni_labpc: fix build when VIRT_TO_BUS is not definedH Hartley Sweeten
After merging the final tree, the next-20130424 build (powerpc allyesconfig) failed like this: drivers/staging/comedi/drivers/ni_labpc.c: In function 'labpc_ai_cmd': drivers/staging/comedi/drivers/ni_labpc.c:980:9: error: implicit declaration of function 'virt_to_bus' [-Werror=implicit-function-declaration] The virt_to_bus() is only needed for the ISA DMA support in this driver. On powerpc, CONFIG_COMEDI_NI_LABPC_ISA cannot be enabled due to the depends on VIRT_TO_BUS but the PCI driver, ni_labpc_pci, can be enabled. That driver uses the ni_labpc driver for the common support code shared by the ISA, PCI, and PCMCIA boards. The ISA specific support, and the optional ISA DMA support, are currently still in the common ni_labpc driver. The ISA specific code is protected by #if IS_ENABLED(CONFIG_COMEDI_NI_LABPC_ISA) and the ISA DMA support is protected by #ifdef CONFIG_ISA_DMA_API. This allows the ISA support to be enabled on architectures that support VIRT_TO_BUS and optionally enables ISA DMA support if ISA_DMA_API is enabled. Unfortunately, the ISA DMA code uses virt_to_bus(). This results in the build failure for architectures that enable ISA_DMA_API but do not have VIRT_TO_BUS. Add a new member to the private data, dma_addr, to hold the phys_addr_t returned by virt_to_bus() and initialize it in the ISA specific labpc_attach(). For architectures that enable ISA_DMA_API but not VIRT_TO_BUS, this will fix the build error. This is also safe for architectures the enable both options but don't enable COMEDI_NI_LABPC_ISA because the dma channel (devpriv->dma_chan) is only initialized in the ISA specific labpc_attach(). Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-23staging: comedi: ni_labpc: fix legacy driver buildH Hartley Sweeten
CONFIG_COMEDI_NI_LABPC_ISA is a tristate option. #if IS_ENABLED() needs to be used instead of #ifdef in order to build the legacy specific code in this driver. The local variable 'board' is not used in labpc_attach(). Remove it. The labpc_detach() function is only referenced in this file. Make it static. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-23staging: comedi: das800: cleanup the cio-das802/16 fifo commentsH Hartley Sweeten
Cleanup the comments about the cio-das802/16 specific register defines. This also removes a checkpatch.pl warning about > 80 char lines. 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>
2013-04-23staging: comedi: das800: rename CamelCase vars in das800_ai_do_cmd()H Hartley Sweeten
Rename the CamelCase variables in das800_ai_do_cmd(). For aesthetic reasons, initialize the variables when they are declared. 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>
2013-04-23staging: comedi: das800: tidy up the private dataH Hartley Sweeten
For aesthetic reasons, change the 'do_bits' type to unsigned int to match the subdevice s->state. and change the 'forever' flag to a bool. 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>
2013-04-23staging: comedi: das800: tidy up das800_interrupt()H Hartley Sweeten
Rename the CamelCase variable 'dataPoint'. Cleanup some of the comments and fix the > 80 char lines. Use the das800_ai_get_sample() helper to get the analog input data. Change the fifo flags into bools and make sure to check for the fifo overflow while reading the samples. This also fixes the overflow detection for 12-bit resolutions. In the current code the 'dataPoint' value has been shifted and masked. This could result in fifo_overflow being invalidly true. Remove the need for the 'thisboard' pointer by using the subdevice 'maxdata' to determine the sample size. The devpriv->forever flag is really a bool. Treat it as such. Remove the comedi_error() messages. The user will get the error condition back in the async event. The message is just added noise. 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>
2013-04-23staging: comedi: das800: tidy up das800_ai_insn_read()H Hartley Sweeten
Introduce a couple helper functions to read the 16-bit analog input sample and to wait for the analog conversion to complete. Tidy up the das800_ai_insn_read() function by using the new helpers. Also, remove the need for 'thisboard' in the function by checking the subdevice 'maxdata' variable to determine the analog input resolution. 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>
2013-04-23staging: comedi: das800: tidy up das800_di_insn_bits()H Hartley Sweeten
For digital input subdevices, the (*insn_bits) function simply needs to return the status of the input channels in data[1]. 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>
2013-04-23staging: comedi: das800: tidy up das800_do_insn_bits()H Hartley Sweeten
Use a couple local variables, mask and bits, to clarify this function. Its only necessary to update the outputs if the mask indicates that the bits are changing. Modify this function accordingly. Also, use the subdevice 'state' variable to hold the actual output channel state instead of needing to get it from the private data and shift 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>
2013-04-23staging: comedi: das800: remove extra divisor calculation callH Hartley Sweeten
The comedi core always calls the (*do_cmdtest) function before it calls the (*do_cmd) function. The divisors were already calculated in das800_ai_do_cmdtest(), it is not necessary to calculate them again in das800_ai_do_cmd(). 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>
2013-04-23staging: comedi: das800: rename {enable,disable}_das800H Hartley Sweeten
For aesthetic reasons, rename these functions to match the namespace of the rest of the driver. Also, remove the unnecessary comments. 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>
2013-04-23staging: comedi: das800: tidy up subdevice initH Hartley Sweeten
For aesthetic reasons, rename some of the subdevice functions to help with greps and add some whitespace to the subdevice init. 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>
2013-04-23staging: comedi: das800: allow attaching without interrupt supportH Hartley Sweeten
Interrupts are only requires for the analog input async command support. Allow the driver to attach to the board if the request_irq() fails. 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>
2013-04-23staging: comedi: das800: interrupts are required for async command supportH Hartley Sweeten
Interrupt support is optional with this driver. Only hook up the async command support for the analog input subdevice if the user requested an interrupt when attaching to the board. This also allows removing the extra test in das800_ai_do_cmd(). For aesthetic reasons, add some whitespace to the subdevice init. 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>
2013-04-23staging: comedi: das800: tidy up das800_ai_do_cmdtest()H Hartley Sweeten
For aesthetic reasons, move some of the local variables to the place they are actually used. Also, rename the CamelCase 'startChan' local variable. Remove the unnecessary '()' around the variables passed in the i8253_cascade_ns_to_timer_2div() call. Add a local variable, 'next', to hold the cmd->chanlist[i] value used in the loop that checks the channel/gain list. Replace the comedi_error() with dev_dbg() and shorten the messages a bit. 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>
2013-04-23staging: comedi: das800: remove 'volatile' on private data variablesH Hartley Sweeten
As indicated by checkpatch.pl, "WARNING: Use of volatile is usually wrong: ...". The variables in the private data that are marked volatile don't need to be. Remove the volatile. Also, cleanup the comments to avoid > 80 char lines. 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>
2013-04-23staging: comedi: das800: cleanup the boardinfoH Hartley Sweeten
For aesthetic reasons, name the enum used for the boardinfo indexes and change them to uppercase with the prefix BOARD_. Add some whitespace to the boardinfo declaration and use the enum values to clarify the table. Tidy up the das800_probe() function and only output a dev_dbg() message if a board model is actually probed. If the user provided the correct boardname when attaching to this driver the message is just added noise. For the 'default' case when checking the proded id, output the id_bits and return -EINVAL. It should not be assumed that unknown boards will work with this driver. 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>
2013-04-23staging: comedi: das800: cleanup range table declarationsH Hartley Sweeten
Use the BIP_RANGE and UNI_RANGE macros to define the range tables instead of the more generic RANGE macro. Tidy up the whitespace of the tables. 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>
2013-04-23staging: comedi: das800: introduce das800_ind_{write, read}()H Hartley Sweeten
The GAS800_GAIN register contains some bits that enable indirect writing to additional registers on the board through iobase + 2 and indirect reading of addition registers through iobase + 7. Introduce some helper functions to handle the indirect register write/read. 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>
2013-04-23staging: comedi: das800: remove forward declarationsH Hartley Sweeten
Move the das800_cancel() and das800_interrupt() functions to remove the need for the remaining forward declarations. 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>
2013-04-23staging: comedi: das800: move das800_set_frequency()H Hartley Sweeten
Move das800_set_frequency() to avoid the need for the forward declaration. 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>
2013-04-23staging: comedi: das800: move das800_probe()H Hartley Sweeten
For aesthetic reasons, move the das800_probe() function near its only caller, das800_attach(). 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>
2013-04-23staging: comedi: das800: move das800_attach()H Hartley Sweeten
The move the das800_attach() function near the comedi_driver declaration at the end of the file. This also removes the need for some of the forward declarations. 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>
2013-04-23staging: comedi: das800: move module_{init, exit} to end of fileH Hartley Sweeten
The module_comedi_driver() macro provides the module_{init.exit} code for this driver. Move the macro call and the comedi_driver declaration to the end of the file. This also removes the need for the das800_attach() forward declaration. 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>
2013-04-23staging: comedi: ni_labpc: remove 'bustype' from boardinfoH Hartley Sweeten
The 'bustype' in the boardinfo is not 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>
2013-04-23staging: comedi: ni_labpc: remove unnecessary 'bustype' checkH Hartley Sweeten
Only the ISA versions of the LabPC boards support DMA and the devpriv->dma_chan is only set during the ISA board attach if DMA is available. The extra check of the board->bustype is not necessary in labpc_ai_cmd(). 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>
2013-04-23staging: comedi: ni_labpc: pass the isr_flags to labpc_common_attach()H Hartley Sweeten
The PCI and PCMCIA LabPC boards use shared interrupts and need the IRQF_SHARED flag set when requesting the irq, the ISA boards do not. Instead of checking the 'bustype' in labpc_common_attach() in order to determine the isr_flags, just pass the flags as a parameter to the 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>
2013-04-23staging: comedi: ni_labpc: move DMA init out of the common attachH Hartley Sweeten
Only the ISA versions of the LabPC boards support DMA. Move the DMA initialization out of the labpc_common_attach() and put it in the ISA specific labpc_attach() function. Remove the 'dma_chan' parameter from labpc_common_attach(). 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>
2013-04-23staging: comedi: ni_labpc: split out PCI supportH Hartley Sweeten
Currently the ni_labpc driver is used by the legacy (ISA), PCI, and PCMCIA versions of the LabPC board. The driver is enabled under the COMEDI_PCI_DRIVERS section of the Kconfig. This means that PCI support must be enabled in order to use the ni_labpc driver for the PCI or PCMCIA drivers. Split the PCI support code out of the ni_labpc driver into a separate driver, ni_labpc_pci. The PCMCIA support is already slip out as ni_labpc_cs. Modify the Kconfig so that the common code in ni_labpc is enabled by the Kconfig option COMEDI_NI_LABPC. The ISA support code is currently still in the ni_labpc driver but is only compiled in if COMEDI_NI_LABPC_ISA is also enabled. This allows the PCI and PCMCIA drivers to be enabled without the need for the ISA stuff. 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>
2013-04-23staging: comedi/daqboard2000: use mdelay for large delaysArnd Bergmann
On ARM, it is not legal to pass values larger than 2ms into udelay(), and mdelay() must be used instead, to avoid this build error: ERROR: "__bad_udelay" [drivers/staging/comedi/drivers/daqboard2000.ko] undefined! On a related note, any use of mdelay() or large udelay() numbers should be carefully reviewed, and replaced with msleep() or a different implementation that does not rely on delaying the work. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-22staging: comedi: pcl816: remove unused RTC dma supportH Hartley Sweeten
All the RTC dma support code in this driver is #ifdef'ed out. Remove the unused code to assist in cleaning up this driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-22staging: comedi: pcl818: remove unused RTC dma supportH Hartley Sweeten
All the RTC dma support code in this driver is #ifdef'ed out. Remove the unused code to assist in cleaning up this driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-19staging: comedi: drivers: free_irq() in comedi_legacy_detach()H Hartley Sweeten
All the legacy comedi drivers now call comedi_legacy_detach() either directly or as part of their (*detach). Move the free_irq() into comedi_legacy_detach() so that the drivers don't have to deal with it. For drivers that then only call comedi_legacy_detach() in their private (*detach), remove the private function and use the helper directly for the (*detach). The amplc_pc236 and ni_labpc drivers are hybrid legacy/PCI drivers. In the detach of a PCI board free_irq() still needs to be handled by the driver. The pcl724 and pcl726 drivers currently have the free_irq() #ifdef'ed out. The comedi_legacy_detach() function sanity checks that the irq has been requested before freeing it so they are safe to convert. For aesthetic reasons, move the #ifdef unused chunk in the pcl816 driver up to the previous #ifdef unused block. The pcmio and pcmuio drivers request multiple irqs and handle the freeing of them. Remove the 'dev->irq = irq[0]' in those drivers so that comedi_legacy_detach() does not attempt to free the irq. 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>
2013-04-19staging: comedi: drivers: use comedi_legacy_detach()H Hartley Sweeten
Use comedi_legacy_detach() to release the I/O region requested by these 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>
2013-04-19staging: comedi: skel: use comedi_legacy_detach()H Hartley Sweeten
Update the skeleton driver to use the new comedi_legacy_detach() helper in the (*detach) to release the I/O region. Also, update the comment about 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>
2013-04-19staging: comedi: amplc_dio200: use comedi_legacy_detach()H Hartley Sweeten
The I/O region used by this driver is always requested using comedi_request_region(). The devpriv->io union is only used by the common code shared by the legacy and PCI drivers. Use the new comedi_legacy_detach() helper in the (*detach) to release the I/O region requested by this driver. That function will handle the proper sanity checking before releasing the resource. 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>
2013-04-19staging: comedi: drivers: use comedi_legacy_detach() in simple driversH Hartley Sweeten
Use the new comedi_legacy_detach() helper in the (*detach) to release the I/O region requested by these drivers. Since the (*detach) for these drivers only releases the region, remove the private (*detach) functions and use comedi_legacy_detach() directly for the (*detach). 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>
2013-04-19staging: comedi: das1800: use comedi_legacy_detach()H Hartley Sweeten
Use the new comedi_legacy_detach() helper in the (*detach) to release the first I/O region requested by this driver. An additional I/O region is requested for some of the boards this driver supports. The iobase for that region is stored in the private data so that the (*detach) knows it needs to be released. Remove the extra cleanup in the (*attach) that releases the first region. For aesthetics, move the release of the additional region in the (*detach) so it follows the (*attach) order. 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>
2013-04-19staging: comedi: das16m1: check for subdev_8255_init() failureH Hartley Sweeten
Make sure to check if subdev_8255_init() fails and propogate the error 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>