summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
AgeCommit message (Collapse)Author
2013-09-17Staging: comedi: Fix dependencies for drivers misclassified as PCIBen Hutchings
The Fastwel UNIOxx-5 is a PC/104 board, so put COMEDI_UNIOXX5 under COMEDI_ISA_DRIVERS. The DIL/Net-PC 1486 is a 486 system, so put COMEDI_SSV_DNP under COMEDI_MISC_DRIVERS and add a dependency on X86_32 || COMPILE_TEST. Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-03Merge tag 'tty-3.12-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty/serial driver patches from Greg KH: "Here's the big tty/serial driver pull request for 3.12-rc1. Lots of n_tty reworks to resolve some very long-standing issues, removing the 3-4 different locks that were taken for every character. This code has been beaten on for a long time in linux-next with no reported regressions. Other than that, a range of serial and tty driver updates and revisions. Full details in the shortlog" * tag 'tty-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (226 commits) hvc_xen: Remove unnecessary __GFP_ZERO from kzalloc serial: imx: initialize the local variable tty: ar933x_uart: add device tree support and binding documentation tty: ar933x_uart: allow to build the driver as a module ARM: dts: msm: Update uartdm compatible strings devicetree: serial: Document msm_serial bindings serial: unify serial bindings into a single dir serial: fsl-imx-uart: Cleanup duplicate device tree binding tty: ar933x_uart: use config_enabled() macro to clean up ifdefs tty: ar933x_uart: remove superfluous assignment of ar933x_uart_driver.nr tty: ar933x_uart: use the clk API to get the uart clock tty: serial: cpm_uart: Adding proper request of GPIO used by cpm_uart driver serial: sirf: fix the amount of serial ports serial: sirf: define macro for some magic numbers of USP serial: icom: move array overflow checks earlier TTY: amiserial, remove unnecessary platform_set_drvdata() serial: st-asc: remove unnecessary platform_set_drvdata() msm_serial: Send more than 1 character on the console w/ UARTDM msm_serial: Add support for non-GSBI UARTDM devices msm_serial: Switch clock consumer strings and simplify code ...
2013-09-03Merge tag 'staging-3.12-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging tree merge from Greg KH: "Here's the bit staging tree pull request for 3.12-rc1. Lots of staging driver updates, and fixes. Lustre is finally enabled in the build, and lots of cleanup started happening in it. There's a new wireless driver in here, and 2 new TTY drivers, which cause the overall lines added/removed to be quite large on the "added" side. The IIO driver updates are also coming through here, as they are tied to the staging iio drivers" * tag 'staging-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (942 commits) staging: dwc2: make dwc2_core_params documentation more complete staging: dwc2: validate the value for phy_utmi_width staging: dwc2: interpret all hwcfg and related register at init time staging: dwc2: properly mask the GRXFSIZ register staging: dwc2: remove redundant register reads staging: dwc2: re-use hptxfsiz variable staging: dwc2: simplify debug output in dwc_hc_init staging: dwc2: add missing shift staging: dwc2: simplify register shift expressions staging: dwc2: only read the snpsid register once staging: dwc2: unshift non-bool register value constants staging: dwc2: fix off-by-one in check for max_packet_count parameter staging: dwc2: remove specific fifo size constants Staging:BCM:DDRInit.c:Renaming __FUNCTION__ staging: bcm: remove Version.h file. staging: rtl8188eu: off by one in rtw_set_802_11_add_wep() staging: r8188eu: copying one byte too much staging: rtl8188eu: || vs && typo staging: r8188eu: off by one bugs staging: crystalhd: Resolve sparse 'different base types' warnings. ...
2013-09-03Merge tag 'driver-core-3.12-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core patches from Greg KH: "Here's the big driver core pull request for 3.12-rc1. Lots of tiny changes here fixing up the way sysfs attributes are created, to try to make drivers simpler, and fix a whole class race conditions with creations of device attributes after the device was announced to userspace. All the various pieces are acked by the different subsystem maintainers" * tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (119 commits) firmware loader: fix pending_fw_head list corruption drivers/base/memory.c: introduce help macro to_memory_block dynamic debug: line queries failing due to uninitialized local variable sysfs: sysfs_create_groups returns a value. debugfs: provide debugfs_create_x64() when disabled rbd: convert bus code to use bus_groups firmware: dcdbas: use binary attribute groups sysfs: add sysfs_create/remove_groups for when SYSFS is not enabled driver core: add #include <linux/sysfs.h> to core files. HID: convert bus code to use dev_groups Input: serio: convert bus code to use drv_groups Input: gameport: convert bus code to use drv_groups driver core: firmware: use __ATTR_RW() driver core: core: use DEVICE_ATTR_RO driver core: bus: use DRIVER_ATTR_WO() driver core: create write-only attribute macros for devices and drivers sysfs: create __ATTR_WO() driver-core: platform: convert bus code to use dev_groups workqueue: convert bus code to use dev_groups MEI: convert bus code to use dev_groups ...
2013-08-27staging: comedi: ni_atmio16d: fix atmio16d_dio_insn_config()H Hartley Sweeten
This is the (*insn_config) function for a DIO subdevice. It should be using the data[0] value as the "instruction" to perform on the subdevice. Use the comedi_dio_insn_config() helper to properly handle instructions. 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-08-27staging: comedi: dmm32at: fix dmm32at_dio_insn_config()H Hartley Sweeten
This is the (*insn_config) function for a DIO subdevice. It should be using the data[0] value as the "instruction" to perform on the subdevice. Use the comedi_dio_insn_config() helper to properly handle instructions. 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-08-27staging: comedi: dt282x: fix dt282x_dio_insn_config()H Hartley Sweeten
This is the (*insn_config) function for a DIO subdevice. It should be using the data[0] value as the "instruction" to perform on the subdevice. Use the comedi_dio_insn_config() helper to properly handle instructions. 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-08-27staging: comedi: dt2817: fix dt2817_dio_insn_config()H Hartley Sweeten
This is the (*insn_config) function for a DIO subdevice. It should be using the data[0] value as the "instruction" to perform on the subdevice. Use the comedi_dio_insn_config() helper to properly handle instructions. 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-08-26staging: comedi: comedi_bond: use correct minor device numbers in nameIan Abbott
The board name for "comedi_bond" is constructed from a space-separated list of items of the form "minor:subdevice" where "minor" is a minor device number and "subdevice" is a subdevice number. Currently, all the "minor" device numbers are for the "comedi_bond" device itself and the "subdevice" numbers are for the bonded devices. It makes makes more sense for the "minor" device numbers to come from the bonded devices as well so that the string is a list of bonded "minor:subdevice" pairs. Fix it. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: use krealloc() and fix memory leakIan Abbott
`do_dev_config()` is called from the comedi 'attach' handler, `bonding_attach()`. The device private data structure contains a dynamically allocated array of pointers to "bonded" device structures which grows during the `do_dev_config()` call. The length of this array is in `devpriv->ndevs`. It currently uses a local function `realloc()` to allocate a new array, copy the old contents over and free the old array. It should be more efficient to use `krealloc()` as it may be able to use slack space at the end of the previous array and avoid a copy. The old `realloc()` function always freed the old buffer which meant that if it failed to allocate the new buffer it would lose the contents of the old buffer. Unfortunately, that contained pointers to more dynamically allocated memory, leading to a memory leak. If `krealloc()` fails, keep the old buffer and avoid the memory leak. The aforementioned pointers to more dynamically allocated memory will be cleaned up by the 'detach' handler, `bonding_detach()` which will be called by the comedi core as a consequence of `krealloc()` failing in `do_dev_config()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: handle base channel for insn_bitsIan Abbott
If a DIO subdevice has more than 32 channels, its 'insn_bits' handler is supposed to take account of the base channel from `CR_CHAN(insn->chanspec)`. (The comedi core will adjust the base channel to 0 and shift the mask and data to compensate if the subdevice has less than or equal to 32 channels.) The "comedi_bond" driver currently ignores the base channel and assumes it is 0. Replace `comedi_dio_bitfield()` in the "kcomedilib" module with `comedi_dio_bitfield2()` that takes account of the base channel, and rewrite the "comedi_bond" driver's 'insn_bits' handler (`bonding_dio_insn_bits()`) to take account of the base channel and use the new function. No other modules use `comedi_dio_bitfield()` so it is safe to replace it with `comedi_dio_bitfield2()`. The name follows that of the equivalent function in the user-space comedilib. If the base channel is non-zero and the subdevice has less than or equal to 32 channels it needs to adjust things in the same way as the comedi core (same as `parse_insn()` in "comedi_fops.c") due to most drivers ignoring the base channel. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: get INSN_CONFIG_DIO_QUERY info from horse's mouthIan Abbott
The DIO subdevice of the "comedi_bond" device attempts to remember the directions of DIO channels itself in the `io_bits` member of the subdevice, but that is only large enough for the first 32 channels and it might not be accurate anyway as changing the direction of one channel may have affected a whole group of channels and we have no idea of the initial directions before the "bonded" device was linked to the the "comedi_bond" device. It would be better to ask the bonded device for this information when handling a `INSN_CONFIG_DIO_QUERY` configuration instruction. Add new function `comedi_dio_get_config()` to the "kcomedilib" module to allow us to get the DIO direction of a channel and use it. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: just check devprivs->devs once on detachIan Abbott
The `while` loop in `bonding_detach()` doesn't need to check `devpriv->devs` each time round the loop. Move the test outside the loop. The enclosing `if (devpriv)` can be changed to `if (devpriv && devpriv->devs)` as everything in this `if` statement is associated with `devpriv->devs` anyway. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: no need to free dev->private on detachIan Abbott
The comedi core will free `dev->private` if it is non-NULL after calling the "detach" handler (`bonding_detach()`), so don't bother freeing it in `bonding_detach()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: remove unused subdev_typeIan Abbott
The `subdev_type` member of `struct bonded_device` is set but not used. Remove it. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: don't map channels individuallyIan Abbott
The private data structure (`struct comedi_bond_private`) for the overall "comedi_bond" device maps each channel individually to a pointer to the `struct bonded_device` it belongs to via array member `chan_id_dev_map[MAX_CHANS]`. This speeds up look-ups from channel number to bonded device a bit, but the length of the array used to look this up is currently fixed at `MAX_CHANS` (256) and there are no overflow checks when filling the array. In practice, there will only be a few bonded devices (actually bonded subdevices) and it is practical to just skip through the list until we reach the one containing the desired channel. The only place where the bonded device is looked up from the channel number is in `bonding_dio_insn_config()`. Change it to do the look-up by skipping through the list of bonded devices and remove the `chan_id_dev_map[]` member. The `chanid_offset` member of `struct bonded_device` is also no longer needed as the value can be derived while skipping through the list of bonded devices, so remove that member as well. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: use bitmap to record opened/closed minorsIan Abbott
`do_dev_config()` currently records the comedi minor devices it has opened by setting `devs_opened[minor]` to the pointer returned by `comedi_open()`. This is checked to avoid opening the same minor device twice. The pointer values in `devs_opened[]` aren't needed; we only need to record which minor device numbers are being used. Change `devs_opened` to a bitmap (declared with `DECLARE_BITMAP()`) of length `COMEDI_NUM_BOARD_MINORS` as the minor device numbers are range-checked to fit in a bitmap of this length. Use `test_and_set_bit()` to record the minor device numbers we attempt to open with `comedi_open()`. `bonding_detach()` calls `comedi_close()` to close the comedi minor devices. Since the minor device numbers may be repeated in its list of bonded subdevices, it currently uses a simple `unsigned long devs_closed` variable as a bitmap to keep track of which minor device numbers it has already closed to avoid closing them twice. As a single `unsigned long` consists of less than `COMEDI_NUM_BOARD_MINORS` bits on a 32-bit machine, change `devs_closed to a bitmap of this length using `DECLARE_BITMAP()` and use `test_and_set_bit()` to avoid calling `comedi_close()` more than once for each minor device number in use. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: change return value of bonding_attach()Ian Abbott
`bonding_attach()` is the comedi "attach" handler for the driver. Any non-negative return value is treated as successful, but 0 is the preferred return value on success. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: return error code in do_dev_config()Ian Abbott
Change `do_dev_config()` to return an error code on failure and 0 on success, instead of 0 on failure and 1 on success. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: no need to initialize file[]Ian Abbott
The `char file[]` variable in `do_dev_config()` doesn't need to be initialized as it gets overwritten with a `snprintf()`. It just needs to be long enough. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: rename CamelCase identifiersIan Abbott
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: shorten module descriptionIan Abbott
Omit the fanciful prose from the MODULE_DESCRIPTION() line and combine concantenated string literals. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26staging: comedi: comedi_bond: reformat some commentsIan Abbott
Reformat some comments according to CodingStyle and remove some comments inherited from the comedi 'skel' example driver. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-23staging: comedi: bug-fix NULL pointer dereference on failed attachIan Abbott
Commit dcd7b8bd63cb81c5b973bf86510ca3c80bbbd162 ("staging: comedi: put module _after_ detach" by myself) reversed a couple of calls in `comedi_device_attach()` when recovering from an error returned by the low-level driver's 'attach' handler. Unfortunately, that introduced a NULL pointer dereference bug as `dev->driver` is NULL after the call to `comedi_device_detach()`. We still have a pointer to the low-level comedi driver structure in the `driv` variable, so use that instead. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: <stable@vger.kernel.org> # 3.10+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-22staging: comedi: pcmuio: fix possible NULL deref on detachIan Abbott
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-08-22staging: comedi: pcmmio: remove unneeded checks on detachIan Abbott
As pointed out by Dan carpenter for the similar pcmuio driver, there is no need to check the pointer passed to `kfree()`, so remove that check from `pcmmio_detach()`. Also, check the `devpriv` (`dev->private`) pointer once, outside the `for` loop. 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-08-21staging: comedi: pcl812: missing break statementDan Carpenter
Smatch complains that there is a missing break statement here. 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-08-21staging: comedi: dt282x: dt282x_ai_insn_read() always failsDan Carpenter
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> Cc: stable <stable@vger.kernel.org> # 2.6.36+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-21staging: comedi: usbdux: allocating too much dataDan Carpenter
We only need to allocate enough space for a pointer. We allocate the space for the urbs themselves with the call to usb_alloc_urb() a few lines later. 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-08-14drivers/staging/comedi/drivers/das16.c: needs slab.hAndrew Morton
alpha allmodconfig: drivers/staging/comedi/drivers/das16.c: In function 'das16_detach': drivers/staging/comedi/drivers/das16.c:1234: error: implicit declaration of function 'kfree' Cc: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: comedi: drivers: use comedi_dio_insn_config() for simple casesH Hartley Sweeten
Convert the drivers with simple, per channel programmable i/o, to use the comedi_dio_insn_config() helper function. All of these pass a 'mask' of '0' to comedi_dio_insn_config() this causes the per channel mask to be used to configure the i/o direction. 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-08-12staging: comedi: skel: use comedi_dio_insn_config()H Hartley Sweeten
Convert this driver to use the comedi_dio_insn_config() helper function. Tidy up the comments to reflect the new code. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: comedi: drivers: introduce comedi_dio_insn_config()H Hartley Sweeten
DIO subdevices always handle the INSN_CONFIG_DIO_{INPUT,OUTPUT} instructions to configure the DIO channels. They also always handle the INSN_CONFIG_DIO_QUERY instruction to query the configuration of a DIO channel. Introduce a helper function to handle the (*insn_config) boilerplate for comedi DIO subdevices. This function has the same paramters as (*insn_config) functions with an additional parameter to allow the caller to pass a 'mask' value for grouped DIO channels. This function returns: 0 if the instruction was successful but requires additional handling by the caller (INSN_CONFIG_DIO_{INPUT,OUTPUT} insn->n if the instruction was handled (INSN_CONFIG_DIO_QUERY) -EINVAL for all unhandled instructions The caller is responsible for actually configuring the hardware based on the configuration (s->io_bits). Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12Revert "staging: comedi: skel: use comedi_dio_insn_config()"Greg Kroah-Hartman
This reverts commit 42ef678bef336a83fd0ae0b03a56c0a93665a18b. It's incorrect as well... time for more coffee... Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12Revert "staging: comedi: core: introduce comedi_dio_insn_config()"Greg Kroah-Hartman
This reverts commit 4f76463d3b8f8cc0cac5bb292ec766848f3f4fa1. I applied an incorrect version here as well :( Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: comedi: drivers: use comedi_dio_insn_config() for complex casesH Hartley Sweeten
Convert the drivers with complex, port programmable i/o, to use the comedi_dio_insn_config() helper function. All of these drivers have some sort of 'port' programmable i/o where multiple i/o channels are configured as a group. The 'mask' associated with the group is passed to comedi_dio_insn_config() so that all the channels are configured. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12Revert "staging: comedi: drivers: use comedi_dio_insn_config() for complex ↵Greg Kroah-Hartman
cases" This reverts commit f21c53945cb95f66faa9636af5f23cb00ba73019. I applied the wrong patch :( Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: comedi: drivers: use comedi_dio_insn_config() for complex casesH Hartley Sweeten
Convert the drivers with complex, port programmable i/o, to use the comedi_dio_insn_config() helper function. All of these drivers have some sort of 'port' programmable i/o where multiple i/o channels are configured as a group. The 'mask' associated with the group is passed to comedi_dio_insn_config() so that all the channels are configured. 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-08-12staging: comedi: skel: use comedi_dio_insn_config()H Hartley Sweeten
Convert this driver to use the comedi_dio_insn_config() helper function. Tidy up the comments to reflect the new 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>
2013-08-12staging: comedi: core: introduce comedi_dio_insn_config()H Hartley Sweeten
DIO subdevices always handle the INSN_CONFIG_DIO_{INPUT,OUTPUT} instructions to configure the dio channels. They also always handle the INSN_CONFIG_DIO_QUERY instruction to query the configuration of a dio channel. Introduce a helper function to handle the (*insn_config) boilerplate for comedi DIO subdevices. This function has the same parameters as (*insn_config) functions with an additional parameter to allow the caller to pass a 'mask' value for grouped dio channels. This function returns: 0 if the instruction was successful but requires additional handling by the caller (INSN_CONFIG_DIO_{INPUT,OUTPUT} insn->n if the instruction was handled (INSN_CONFIG_DIO_QUERY) -EINVAL for all unhandled instructions The caller is responsible for actually configuring the hardware based on the configuration (s->io_bits). 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-07-31staging: comedi: dt9812: Resolve different base types warnings.Shaun Laing
Resolves warnings from the "sparse" checker of the form "warning: incorrect type in assignment (different base types)". Signed-off-by: Shaun Laing <shaun@xresource.ca> Reviewed-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-07-31staging: comedi: allow ISA and PC/104 drivers on non-ISA systemsH Hartley Sweeten
Embedded systems with a PC/104 bus might have a configuration that does not have ISA enabled. This creates a problem in Comedi where the PC/104 drivers cannot be enabled. Remove the 'depends on ISA' for the "Comedi ISA and PC/104 drivers" menu to allow the user to select these drivers on non-ISA systems. 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-07-31staging: comedi: usbduxsigma: absorb usbduxsigma_attach_common() into callerH Hartley Sweeten
This function is only called by usbduxsigma_auto_attach(). Absorb it and refactor the code a bit to match the usbdux 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-07-31staging: comedi: usbdux: tidy up usbdux_free_usb_buffers()H Hartley Sweeten
For aesthetics, pass the comedi_device pointer to this function instead of the private data pointer. The usb_kill_urb() calls are not needed. All the urbs were unlinked before this function was called. 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-07-31staging: comedi: usbdux: tidy up usbdux_detach()H Hartley Sweeten
Make sure the usb intfdata is always cleared when the device is detached. Refactor the code to remove an indent level. Always unlink the urbs when the device is 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>
2013-07-31staging: comedi: usbduxsigma: always clear the usb intfdata in (*detach)H Hartley Sweeten
Make sure the usb intfdata is always cleared when the device is 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>
2013-07-31staging: comedi: usbduxsigma: move urb unlink into usbduxsigma_detach()H Hartley Sweeten
For aesthetics, move the final force unlink of the urbs from usbduxsigma_free_usb_buffers() to usbduxsigma_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-07-31staging: comedi: usbduxsigma: init 'pwm_buf_sz' in usbduxsigma_auto_attach()H Hartley Sweeten
Initialize this variable with then_ai_urbs and n_ao_urbs in the attach. Then usbduxsigma_alloc_usb_buffers() can just check the variable to determine if the urb needs to be allocated. 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-07-31staging: comedi: usbduxsigma: 'dac_commands' does not need to be kzalloc()'dH Hartley Sweeten
The 'dac_commands' buffer is used to pass the ao channel list from usbduxsigma_ao_cmd() to the urb callback, usbduxsigma_ao_urb_complete(). This buffer does not need to be allocated. Change it into a simple array of the correct size. Rename the variable to 'ao_chanlist' to clarify what it actually is. 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-07-31staging: comedi: usbdux: tidy up usbdux_alloc_usb_buffers()H Hartley Sweeten
Tidy up the error path by doing all the basic allocations then checking for failures. We have the comedi device now so fill in the urb->context. 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>