summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
AgeCommit message (Collapse)Author
2015-02-13Reset to 3.12.37Scott Wood
2014-05-14Reset to 3.12.19Scott Wood
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: drivers: fix return value of comedi_load_firmware()H Hartley Sweeten
commit c6236c0ce39c809c336ca929f68cf8ad02cf94e0 upstream. 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> 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-11-29staging: comedi: avoid memleak for subdevice privateIan Abbott
commit 67aa4acbc97f6a55b328e4e2305ef19cbe949d85 upstream. `comedi_alloc_spriv()` allocates private storage for a comedi subdevice and sets the `SRF_FREE_SPRIV` flag in the `runflags` member of the subdevice to allow the private storage to be automatically freed when the comedi device is being cleaned up. Unfortunately, the flag gets clobbered by `do_cmd_ioctl()` which calls `comedi_set_subdevice_runflags()` with a mask value `~0` and only the `SRF_USER` and `SRF_RUNNING` flags set, all the other SRF flags being cleared. Change the calls to `comedi_set_subdevice_runflags()` that currently use a mask value of `~0` to use a more relevant mask value. For `do_cmd_ioctl()`, the relevant SRF flags are `SRF_USER`, `SRF_ERROR` and `SRF_RUNNING`. (At one time, `SRF_RT` would be included in that set of flags, but it is no longer used.) For `comedi_alloc_spriv()` replace the call to `comedi_set_subdevice_runflags()` with a simple OR-assignment to avoid unnecessary use of a spin-lock. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdeviceIan Abbott
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> Cc: <stable@vger.kernel.org> # 3.10.y 3.11.y 3.12.y Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>