summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
AgeCommit message (Collapse)AuthorFilesLines
2013-12-20staging: comedi: ni_tio.h: rename the CamelCase enum ni_gpct_register labelsH Hartley Sweeten4-429/+295
As prefered by the CodingStyle, rename all the CamelCase labels of the enum ni_gpct_register. Cleanup all the helper functions in ni_tio_internal.h that used the enum. The 'counter_index' parameter to all the functions is the ni_gpct_device 'counter_index' which is initialized when the subdevices are setup. This value is always < 4 so the default: BUG() cases can never happen. For aesthetics, rename the 'counter_idx' to simply 'idx' and fix the type in some of the helpers. Also, remove the unnecessary break statements after the return statements. 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-18staging: comedi: fix result of memdup_user for user chanlistBernd Porr1-0/+2
If the channel list is not set in userspace we get an error at PTR_ERR(async->cmd.chanlist). However, do_become_nonbusy(dev, s) cleans up this pointer which causes a kernel ooops. Setting the channel list in async to NULL and checking this in do_become_nonbusy prevents the oops. [Ian Abbott] Also do the same for the chanlist allocated in do_cmdtest_ioctl(). Signed-off-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18staging/comedi: bug fix for module usage count on device removalIan Abbott1-23/+13
When a dynamically created comedi device is being automatically removed by a call to `comedi_auto_unconfig()` from the lower level driver, `comedi_device_cleanup()` is called to perform the detachment from the lower level driver. If the comedi device is open at the time, `dev->use_count` will be the the number of outstanding opens. The function currently decrements the the module counts of the "comedi" module and the low-level driver module by this amount and reduces `dev->use_count` to zero. There are various problems with this as the `release` file operation handler `comedi_close()` also decrements `dev->use_count` and decrements the module usage counts. This means that `dev->use_count` and the module counts can end up negative. Also, the assumed one-to-one relationship between the file open count and the low-level module usage count is invalid and can get screwed up. We only want to stop the low-level module being unloaded while a comedi device using the module has an open file object. Also, there is no need to manipulate the module count of the core "comedi" module at all since the comedi module is the owner of the file operations structure and the system will not unload the module while there are open file objects using it. Correct the bugs and simplify as follows: 1. Get rid of the module count manipulations of the core "comedi" module (`THIS_MODULE`) altogether. 2. Don't alter `dev->use_count` in `comedi_device_cleanup()` as it should only be altered by the `open` and `release` file operation handlers `comedi_open()` and `comedi_close()`. 3. Increment the low-level module count for the following reasons: a) In `comedi_open()` if the open count was zero and the comedi device is attached to the low-level driver. b) When the `COMEDI_DEVCONFIG` ioctl is used to manually attach an unattached comedi device to a low-level driver. The open count will be greater than zero at this time. The actual increment of the low-level module count is already done by `comedi_device_attach()`. 4. Decrement the low-level module count for the following reasons: a) In `comedi_close()` if the open count was 1 and the comedi device is attached to the low-level driver. b) In `comedi_device_cleanup()` (called via `comedi_auto_unconfig()` --> `comedi_release_hardware_device()` --> `comedi_free_board_dev()` when the comedi device is automatically unconfigured due to action by the low-level driver) if the device was attached (which it should be) and open count was non-zero (greater than zero). c) When the `COMEDI_DEVCONFIG` ioctl is used to manually detach the comedi device from the low-level driver. The open count will be greater than zero at this time. The open count should never go negative. Parts 3 and 4 ensure that the low-level module usage count is incremented on entering the state where the comedi device is attached to the low-level driver AND the open count is greater than zero, and is decremented on leaving that state. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18staging/comedi: keep reference to class device after destroyedIan Abbott1-1/+2
When a dynamically allocated `struct comedi_device` gets automatically unconfigured by a call to `comedi_auto_unconfig()` from a lower-level driver's bus removal function (e.g. when a USB device is disconnected), the class device in `dev->class_dev` (where `dev` points to the `struct comedi_device`) is destroyed by a call to `device_destroy()` that matches a previous call to `device_create()`. However, if the `struct comedi_device` is still associated with an open file object, the now invalid `dev->class_dev` pointer may still be passed to `dev_printk()` (via `dev_dbg()` etc.), producing bogus output or worse. To fix this, call `get_device()` on the class device if `device_create()` was successful. Add a matching call to `put_device()` in `comedi_dev_kref_release()` when the `struct comedi_device` is freed. The calls to `dev_dbg()` etc. after the call to `device_destroy()` will still produce valid output, although the device will have been unregistered in sysfs. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18staging: comedi: drivers: fix return value of comedi_load_firmware()H Hartley Sweeten1-1/+1
Some of the callback functions that upload the firmware in the comedi drivers return a positive value indicating the number of bytes sent to the device. Detect this condition and just return '0' to indicate a successful upload. Reported-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Ian Abbott <abbotti@mev.co.uk> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18staging: comedi: 8255_pci: fix for newer PCI-DIO48HIan Abbott1-3/+12
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> Cc: stablle <stable@vger.kernel.org> # 3.10.y # 3.11.y # 3.12.y # 3.13.y Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17staging: delete non-required instances of include <linux/init.h>Paul Gortmaker4-4/+0
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17staging: comedi: s626: tidy up comedi_lrange tableH Hartley Sweeten1-1/+1
The comedi_lrange tables are fixed length based on the 'length' value before the array of comedi_krange 'range' values. For aesthetics, remove the trailing comma from last 'range' value. 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-17staging: comedi: adl_pci9111: tidy up comedi_lrange tablesH Hartley Sweeten1-2/+1
Tidy up the format of the comedi_lrange table. 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-17staging: comedi: adv_pci1724: tidy up comedi_lrange tablesH Hartley Sweeten1-2/+2
Tidy up the format of the comedi_lrange table. 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-17staging: comedi: usbduxfast: tidy up comedi_lrange tablesH Hartley Sweeten1-1/+4
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: ni_at_a2150: tidy up comedi_lrange tablesH Hartley Sweeten1-4/+3
Tidy up the whitespace in the comedi_lrange tables. Use the BIP_RANGE macro instead of the more generic RANGE macro to reduce the potential for typos. 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-17staging: comedi: comedi_test: tidy up comedi_lrange tablesH Hartley Sweeten1-5/+4
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: dyna_pci10xx: tidy up comedi_lrange tablesH Hartley Sweeten1-5/+6
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: me4000: tidy up comedi_lrange tablesH Hartley Sweeten1-7/+6
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: icp_multi: tidy up comedi_lrange tablesH Hartley Sweeten1-6/+7
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: aio_aio12_8: tidy up comedi_lrange tablesH Hartley Sweeten1-7/+6
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: pcl816: tidy up comedi_lrange tablesH Hartley Sweeten1-10/+11
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: fl512: tidy up comedi_lrange tablesH Hartley Sweeten1-9/+10
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: das16m1: tidy up comedi_lrange tablesH Hartley Sweeten1-12/+12
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: adq12b: tidy up comedi_lrange tablesH Hartley Sweeten1-13/+14
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: dmm32at: tidy up comedi_lrange tablesH Hartley Sweeten1-14/+12
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: amplc_pci230: tidy up comedi_lrange tablesH Hartley Sweeten1-13/+15
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: ni_pcimio: tidy up comedi_lrange tablesH Hartley Sweeten1-16/+18
Tidy up the whitespace in the comedi_lrange tables. Use the BIP_RANGE and UNI_RANGE macros instead of the more generic RANGE macro to reduce possible typo errors. 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-17staging: comedi: amplc_pci224: tidy up comedi_lrange tablesH Hartley Sweeten1-24/+20
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: adl_pci9118: tidy up comedi_lrange tablesH Hartley Sweeten1-20/+22
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: das1800: tidy up comedi_lrange tablesH Hartley Sweeten1-26/+23
Tidy up the whitespace in the comedi_lrange tables. Use the BIP_RANGE and UNI_RANGE macros instead of the more generic RANGE macro to reduce possible typo errors. 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-17staging: comedi: dt282x: tidy up comedi_lrange tablesH Hartley Sweeten1-24/+24
Tidy up the whitespace in the comedi_lrange tables. Use the BIP_RANGE and UNI_RANGE macros instead of the more generic RANGE macro to reduce possible typo errors. 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-17staging: comedi: dt2811: tidy up comedi_lrange tablesH Hartley Sweeten1-24/+24
Tidy up the whitespace in the comedi_lrange tables. Use the BIP_RANGE and UNI_RANGE macros instead of the more generic RANGE macro to reduce possible typo errors. 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-17staging: comedi: ni_atmio16d: tidy up comedi_lrange tablesH Hartley Sweeten1-30/+21
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: cb_pcidas: tidy up comedi_lrange tablesH Hartley Sweeten1-29/+26
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: dt2801: tidy up comedi_lrange tablesH Hartley Sweeten1-44/+28
Tidy up the whitespace in the comedi_lrange tables. Use the BIP_RANGE and UNI_RANGE macros instead of the more generic RANGE macro to reduce possible typo errors. 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-17staging: comedi: das08: tidy up comedi_lrange tablesH Hartley Sweeten1-36/+39
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: adv_pci1710: tidy up comedi_lrange tablesH Hartley Sweeten1-42/+47
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: pcl818: tidy up comedi_lrange tablesH Hartley Sweeten1-41/+63
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: cb_pcidas64: tidy up comedi_lrange tablesH Hartley Sweeten1-75/+67
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: ni_mio_common: tidy up comedi_lrange tablesH Hartley Sweeten1-91/+89
Tidy up the whitespace in the comedi_lrange tables. Use the BIP_RANGE and UNI_RANGE macros instead of the more generic RANGE macro to reduce possible typo errors. 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-17staging: comedi: pcl812: tidy up comedi_lrange tablesH Hartley Sweeten1-116/+132
Tidy up the whitespace in the comedi_lrange 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-12-17staging: comedi: addi_apci_1032: fix subdevice type/flags bugH Hartley Sweeten1-2/+2
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>
2013-12-17staging: comedi: pcmmio: fix final checkpatch warningH Hartley Sweeten1-1/+1
Fis the last checkpatch.pl warning in this driver: WARNING: space prohibited between function name and open parenthesis '(' + comedi_buf_put (s->async, val >> 16)) { 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-17staging: comedi: pcmmio: tidy up the multi-line commentsH Hartley Sweeten1-71/+71
Tidy up the multi-line comments are the beginning of the file to follow the CodingStyle. 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-17staging: comedi: pcmmio: update the MODULE_DESCRIPTIONH Hartley Sweeten1-1/+1
Change the MODULE_DESCRIPTION to something more usefull than the generic "Comedi low-level 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-12-17staging: comedi: pcmmio: return '0' after successful attachH Hartley Sweeten1-1/+3
The comedi core expects the (*attach) functions to return < 0 to indicate an error or >= 0 for success. Change the return to '0' as that is more typical. 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-17staging: comedi: pcmmio: cleanup the private dataH Hartley Sweeten1-5/+4
Fix the types of some of the private data members. The 'enabled_mask' and 'stop_count' should be unsigned int values. The 'active' and 'continuous' members are flags, change them to unsigned int bit fields. Remove the 'sprivs' pointer. This should have been removed when the subdevice private data was removed. 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-17staging: comedi: pcmmio: remove unused definesH Hartley Sweeten1-20/+0
These defines are not longer used in the driver. 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>
2013-12-17staging: comedi: pcmmio: tidy up pcmmio_start_intr()H Hartley Sweeten1-36/+23
Refactor the function to remove some indent levels. Use pcmmio_dio_write() to write the polarity and enable paged registers instead of using the for () loop to write each register in the pages. The for () loop actually has a bug. It switches the page to the 'enab' registers for the first port then switches to the 'pol' registers for all remaining writes. It also was not using the pagelock spinlock to protect the writes to the page registers. Using the pcmmio_dio_write() helper ensures that the writes to the paged registers complete correctly. 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-17staging: comedi: pcmmio: setup irq routing during (*attach)H Hartley Sweeten1-22/+18
To use interrupts the IRQ routing must be configured and interrupts enabled. Currently both steps are being handled in pcmmio_start_intr(). Move the code that sets the IRQ routing into the attach of the board. At this point interrupts are still disabled. The enable and polarity bits just need to be set in pcmmio_start_intr() to enable 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>
2013-12-17staging: comedi: pcmmio: only hook up async command support if irq is availableH Hartley Sweeten1-21/+18
Refactor the board attach so that the async commands support is only hooked up if the irq is actually available. 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-17staging: comedi: pcmmio: tidy up pcmmio_handle_dio_intr()H Hartley Sweeten1-32/+33
Refactor the code to remove some of the indent levels. Remove 'mytrig', the shift and mask end up making it the same as 'triggered' anyway. 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-17staging: comedi: pcmmio: factor the trigger handling out of interrupt_pcmmio()H Hartley Sweeten1-52/+56
Factor the code that actually handles the digital input triggers out of 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>