summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
AgeCommit message (Collapse)Author
2012-10-22staging: comedi: ni_labpc: fix possible NULL deref during detachIan Abbott
`labpc_common_detach()` is called by the comedi core to clean up if either `labpc_attach()` (including the one in the "ni_labpc_cs" module) or `labpc_attach_pci()` returns an error. It assumes the `thisboard` macro (expanding to `((struct labpc_board_struct *)dev->board_ptr)`) is non-null. This is a valid assumption if `labpc_attach()` fails, but not if `labpc_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `labpc_common_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: das08: fix possible NULL deref during detachIan Abbott
`das08_detach()` is called by the comedi core to clean up if either `das08_attach()` or `das08_attach_pci()` returns an error. It sets `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. This is a valid assumption if `das08_attach()` fails, but not if `das08_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `das08_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_pc263: fix possible NULL deref during detachIan Abbott
`pc263_detach()` is called by the comedi core to clean up if either `pc263_attach()` or `pc263_attach_pci()` returns an error. It sets `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. This is a valid assumption if `pc263_attach()` fails, but not if `pc263_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `pc263_detach()` and return early if it is `NULL`. This is okay because no other resources need cleaning up in this case. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_pc236: fix possible NULL deref during detachIan Abbott
`pc236_detach()` is called by the comedi core to clean up if either `pc236_attach()` or `pc236_attach_pci()` returns an error. It sets `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. This is a valid assumption if `pc236_attach()` fails, but not if `pc236_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `pc236_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_pc236: fix invalid register access during detachIan Abbott
`pc236_detach()` is called by the comedi core if it attempted to attach a device and failed. `pc236_detach()` calls `pc236_intr_disable()` if the comedi device private data pointer (`devpriv`) is non-null. This test is insufficient as `pc236_intr_disable()` accesses hardware registers and the attach routine may have failed before it has saved their I/O base addresses. Fix it by checking `dev->iobase` is non-zero before calling `pc236_intr_disable()` as that means the I/O base addresses have been saved and the hardware registers can be accessed. It also implies the comedi device private data pointer is valid, so there is no need to check it. Cc: <stable@vger.kernel.org> # 3.5.x, 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_dio200: fix possible NULL deref during detachIan Abbott
`dio200_detach()` is called by the comedi core to clean up if either `dio200_attach()` or `dio200_attach_pci()` return an error. It assigns `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. In the case of a previous call to `dio200_attach()` it won't be `NULL` because the comedi core will have pointed it to one of the elements of `dio200_boards[]`, but in the case of a previous call to `dio200_attach_pci()` it could be `NULL`, leading to a null pointer dereference. Check that `thisboard` is valid at the top of `dio200_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: 8255_pci: fix possible NULL deref during detachIan Abbott
`pci_8255_detach()` will be called by the comedi core if `pci_8255_attach_pci()` returns an error. It currently assumes that both `board` (assigned from the return value of `comedi_board(dev)`) and `devpriv` (assigned from `dev->private`) are non-null, but they might be null, leading to a null pointer dereference. `pci_8255_detach()` doesn't need to do anything if either `board` or `devpriv` are null, so just return early in this case. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: ni_daq_700: fix dio subdevice regressionFred Brooks
Here is a small patch to fix a problem caused by a previous patch that removed the callback function. The callback remove patch: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=1de02225358988e8fd48d1dc3fd12336bbae258a I finally booted my dev machine on the latest kernel (running Debian here so it's still on 3.2 normally) to test the ni_daq_700 driver with my test program and noticed this bug. Shift the DIO_R read result to bits 8..15 Digital direction configuration: channels 0-7 output, 8-15 input (8225 device emu as port A output, port B input, port C N/A). Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Fred Brooks <nsaspook@nsaspook.com> 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>
2012-09-27staging: comedi: jr3_pci: fix iomem dereferenceIan Abbott
Correct a direct dereference of I/O memory to use an appropriate I/O memory access function. Note that the pointer being dereferenced is not currently tagged with `__iomem` but I plan to correct that for 3.7. Cc: stable <stable@vger.kernel.org> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-26staging: comedi: drivers: use comedi_fc.h cmdtest helpersH Hartley Sweeten
Use the cfc_check_trigger_src() helper for Step 1 in all the driver cmdtest functions. Use the cfc_check_trigger_is_unique() helper for Step 2 in all the driver cmdtest functions. Note that single source triggers do not need to be checked, they are already unique if they pass Step 1. For aesthetic reasons, change the comments in the cmdtest functions for steps 1 and 2 so that they are all the same. 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>
2012-09-26staging: comedi: ni_mio_common: always lock in ni_ai_poll()Ian Abbott
`ni_ai_poll()` currently acquires (and later releases) the comedi device's spin-lock iff `in_interrupt()` returns 0. However, it is only called during processing of a `COMEDI_POLL` ioctl so `in_interrupt()` will always return 0 in this case. Remove this test and acquire/release the spin-lock unconditionally. This eliminates a sparse warning about different lock contexts for basic block. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-26staging: comedi: s626: add FIXME commentIan Abbott
`s626_enc_insn_config()` is the `insn_config()` handler for a counter subdevice. The `data[0]` value is supposed to be one of the `INSN_CONFIG_...` constants defined in "comedi.h" indicating the type of configuration instruction, but this function seems to be using it as a variable value to preload the counter with. Various values of `data[0]` are going to cause `check_insn_config_length()` in the comedi core ("comedi_fops.c") to return an error, and this function won't be called in those cases. Most other values will log a warning to the kernel log. It's not entirely clear what constant should be checked for in `data[0]`, so add a "FIXME" comment for now. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-26staging: comedi: s626: don't dereference insn->dataIan Abbott
`s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which is a pointer to user memory. It should be dereferencing the separate `data` parameter that points to a copy of the data in kernel memory. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-26staging: comedi: s526: fix if() check in s526_gpct_winsn()H Hartley Sweeten
This if() check was flipped from a test for valid data params to a test for invalid params. As pointed out by Dan Carpenter, the orignal test was: if ((data[1] > data[0]) && (data[0] > 0)) { the flipped test should be: if (data[1] <= data[0]) ... Add the missing '='. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-26staging: comedi: s626: cleanup comments in s626_initialize()H Hartley Sweeten
Cleanup the comments to follow the coding style of the kernel. 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>
2012-09-26staging: comedi: s626: remove clear of kzalloc'ed dataH Hartley Sweeten
The private data is kzalloc'ed. There is no need to set any of the initial data to '0'. 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>
2012-09-26staging: comedi: s626: remove 'WDInterval' from private dataH Hartley Sweeten
This variable is never used in the driver. Just remove it. 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>
2012-09-26staging: comedi: s626: remove 'ChargeEnabled' from private dataH Hartley Sweeten
This variable is never used in the driver. Just remove it. 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>
2012-09-26staging: comedi: s626: remove 'IsBoardRevA' commentH Hartley Sweeten
IsBoardRevA is not defined in the driver. Remove the comment about it. 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>
2012-09-26staging: comedi: s626: #if 0 out the "SAA7146 BUG WORKAROUND"H Hartley Sweeten
Until it's determined if this workaround can be removed, block out the code with an #if 0/#endif and remove the individual comments on each line. 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>
2012-09-26staging: comedi: s626: remove 'allocatedBuf' from private dataH Hartley Sweeten
This variable is only used to count the number of dma buffers allocated during the attach. If an allocation fails, the attach function exits with -ENOMEM. When this variable is checked later it will always be == 2. Just remove the variable and the check. This allows bringing the code back an indent level in s626_initialize(). Note, coding style issues in this function are not addressed yet. 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>
2012-09-26staging: comedi: s626: add final attach messageH Hartley Sweeten
Add a simple dev_info() message after a successfull attach. Change the final return to '0' to indicate success. 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>
2012-09-26staging: comedi: s626: remove unneeded clear of private dataH Hartley Sweeten
The private data is kzalloc'ed. All the variables in it are initially '0'. 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>
2012-09-26staging: comedi: s626: factor out the board init codeH Hartley Sweeten
To make the attach a bit cleaner, factor the board init code out of attach_pci() into a new function. 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>
2012-09-26staging: comedi: s626: cleanup request_irq in s626_attach_pci()H Hartley Sweeten
Only set dev->irq if request_irq is successfull. Remove the kernel message noise. 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>
2012-09-26staging: comedi: s626: factor out the dma buffer allocationH Hartley Sweeten
To make the attach a bit cleaner, factor the dma buffer allocation out of attach_pci() into a new function. 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>
2012-09-26staging: comedi: s626: remove unnecessary checks of 'devpriv->base_addr'H Hartley Sweeten
'devpriv->base_addr' is valid from this point on in the attach_pci() function. Remove the unnecessary checks. 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>
2012-09-26staging: comedi: s626: cleanup ioremap()H Hartley Sweeten
The local variable 'resourceStart' is only used in the ioremap() to hold the PCI bar 0 base address. Just use the pci_resource_start() directly in the ioremap(). Also, instead of assuming the resource size for the ioremap, use pci_resource_len() to get the actual size. Remove the kernel noise when the ioremap fails and change the error code from -ENODEV to -ENOMEM. 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>
2012-09-26staging: comedi: s626: remove 'got_regions' from private dataH Hartley Sweeten
This variable is only used as a flag to indicate that the pci device has been enabled and needs to be disabled in the detach. Use the comedi_device 'iobase' for this and remove the private data variable. 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>
2012-09-26staging: comedi: s626: remove unneeded local variable in attach_pci()H Hartley Sweeten
The 'result' variable is only used to check the return from comedi_pci_enable(). Just reuse the 'ret' variable. Also, remove the kernel noise and use the error code from comedi_pci_enable() instead of returning -ENODEV. 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>
2012-09-26staging: comedi: s626: use dev->board_name for resource nameH Hartley Sweeten
Instead of the literal string "s626", use the dev->board_name for the resource name when enabling the PCI device and requesting the irq. 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>
2012-09-26staging: comedi: s626: store the pci_dev in the comedi_deviceH Hartley Sweeten
Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. 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>
2012-09-26staging: comedi: s626: use attach_pci callbackH Hartley Sweeten
Convert this PCI driver to use the comedi PCI auto config attach mechanism by adding an 'attach_pci' callback function. Since the driver does not require any external configuration options, and the legacy 'attach' callback is not optional, remove it. 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>
2012-09-26staging: comedi: s626: remove boardinfoH Hartley Sweeten
This driver only supports one board type. Move the used board info out of the boardinfo struct and remove it. 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>
2012-09-26staging: comedi: ni_daq_700: add AI subdeviceIan Abbott
Add subdevice 1 as an analog input (AI) subdevice. It currently only supports basic, software-triggered acquisitions. This is mostly the work of Fred Brooks (MODULE_AUTHOR), but he based his update on an older version of the driver. I applied the relevant changes with a few tweaks: adding an explicit `udelay(1)` in a timeout loop, replacing binary constants with hex, renaming functions, replacing `printk()` calls, removing exported symbols, removing (very) incomplete comedi "command" support, and making some coding-style changes. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-26staging: comedi: ni_daq_700: rename functions for DIO subdeviceIan Abbott
Rename `subdev_700_insn()` to `daq700_dio_insn_bits()` and `subdev_700_insn_config()` to `daq700_dio_insn_config()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-26staging: comedi: ni_daq_700: use prefix daq700Ian Abbott
Rename a few functions and variables to use the prefix `daq700` instead of the prefix or suffix `dio700`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21staging: comedi: ni_labpc: don't pass struct comedi_cmd by valueIan Abbott
`labpc_suggest_transfer_size()` has a parameter of type `struct comedi_cmd` passed by value. Change it to pass by pointer reference. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21staging: comedi: das1800: don't pass struct comedi_cmd by valueIan Abbott
Various functions in das1800.c take a `struct comedi_cmd` parameter by value. Change them to pass the parameter by reference instead. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21staging: comedi: das16: pass struct comedi_cmd by referenceIan Abbott
Change `das16_suggest_transfer_size()` to take a pointer to the `struct comedi_cmd` instead of passing it by value. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21staging: comedi: fix memory leak for saved channel listIan Abbott
When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel list, it frees any previously allocated channel list in `async->cmd.chanlist` and replaces it with the new one. However, if the device is ever removed (or "detached") the cleanup code in `cleanup_device()` in "drivers.c" does not free this memory so it is lost. A sensible place to free the kernel copy of the channel list is in `do_become_nonbusy()` as at that point the comedi asynchronous command associated with the channel list is no longer valid. Free the channel list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the pointer to prevent it being freed more than once. Note that `cleanup_device()` could be called at an inappropriate time while the comedi device is open, but that's a separate bug not related to this this patch. Cc: stable@vger.kernel.org Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21staging: comedi: ni_labpc: pass ai scan mode through various functionsIan Abbott
Pass the `enum scan_mode` value calculated by `labpc_ai_scan_mode()` as a parameter to various other functions so they don't have to call it themselves. Amongst others, the affected functions include `labpc_adc_timing()`, `labpc_ai_convert_period()` and `labpc_ai_scan_period()`. `labpc_adc_timing()` calls `labpc_ai_convert_period()` and `labpc_ai_scan_period()` in several places, but the returned values are the same each time, so change it to just call those functions once and re-use the return values. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-21staging: comedi: 8253: mmio address is a void __iomem *H Hartley Sweeten
The inline functions for accessing a memory mapped 8254 device are using a void * for the 'base_address' of the device. Memory mapped io using the read/write functions should be using a void __iomem * for the address. Fixing these exposed a couple other void * / void __iomem * issues in the ni_labpc driver. This fixes a number of sparse warnings like: warning: incorrect type in argument 2 (different address spaces) expected void volatile [noderef] <asn:2>*addr got void * warning: incorrect type in argument 1 (different address spaces) expected void const volatile [noderef] <asn:2>*addr got void *<noident> 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>
2012-09-21staging: comedi: kcomedilib: fix a __user space access issueH Hartley Sweeten
The 'data' field in struct comedi_insn is an unsigned int __user *. The comedi core copies this data to kernel space before passing it on to a drivers insn_bits/insn_config method. kcomedilib provides an interface for external kernel modules to use the comedi drivers. This interface creates a comedi_insn that is then passed to the comedi drivers insn_bits/insn_config method. Unfortunately, kcomedilib is using the comedi_insn 'data' field directly which results in some sparse warnings: warning: incorrect type in argument 4 (different address spaces) expected unsigned int *<noident> got unsigned int [noderef] <asn:1>*data warning: incorrect type in assignment (different address spaces) expected unsigned int [noderef] <asn:1>*[addressable] [assigned] data got unsigned int *<noident> Fix this by passing the kernel data directly, as a separate parameter, instead of trying to put in into the comedi_insn 'data' field. This is how the comedi core handles the data from user space. 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>
2012-09-21staging: comedi: me_daq: use attach_pci callbackH Hartley Sweeten
Convert this PCI driver to use the comedi PCI auto config attach mechanism by adding an 'attach_pci' callback function. Since the driver does not require any external configuration options. and the legacy 'attach' callback is now optional, remove it. Also, make the boardinfo 'name' unique for the different board types. Use this name when requesting the PCI resources. Change the printk at the end of the attach into a dev_info. 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>
2012-09-21staging: comedi: me_daq: use request_firmware()H Hartley Sweeten
This driver requires loading a firmware file for the fpga. This is currently being done by passing the firmware data using the COMEDI_DEVCONFIG ioctl through the attach() hook in the driver. This does not work for auto-configured PCI devices due to the firmware loading options not being set in the comedi_devconfig parameter passed to the driver. Change the driver so it gets the firmware using request_firmware() and ignore any firmware options passed in the comedi_devconfig. 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>
2012-09-21staging: comedi: usbdux: remove usbdux_attachH Hartley Sweeten
This driver originally used the 'attach' method in order to get the firmware for the device from the comedi_config utility. It now uses request_firmware_nowait() in the usb_driver probe to get this firmware. Since this driver has an 'attach_usb' method in the comedi_driver, the 'attach' method can be removed because it is now optional. 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>
2012-09-21staging: comedi: usbduxfast: remove usbduxfast_attachH Hartley Sweeten
This driver originally used the 'attach' method in order to get the firmware for the device from the comedi_config utility. It now uses request_firmware_nowait() in the usb_driver probe to get this firmware. Since this driver has an 'attach_usb' method in the comedi_driver, the 'attach' method can be removed because it is now optional. 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>
2012-09-21staging: comedi: usbduxsigma: remove usbduxsigma_attachH Hartley Sweeten
This driver originally used the 'attach' method in order to get the firmware for the device from the comedi_config utility. It now uses request_firmware_nowait() in the usb_driver probe to get this firmware. Since this driver has an 'attach_usb' method in the comedi_driver, the 'attach' method can be removed because it is now optional. 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>
2012-09-21staging: comedi: s526: rename s526_ai_configH Hartley Sweeten
For aesthetic reasons, rename the private data variable 's526_ai_config' to simply 'ai_config'. Its private data and does not need the 's526_' namespace. 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>