summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/daqboard2000.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: comedi: daqboard2000: bug fix board type matching codeIan Abbott2016-08-211-1/+1
| | | | | | | | | | | | | | | `daqboard2000_find_boardinfo()` is supposed to check if the DaqBoard/2000 series model is supported, based on the PCI subvendor and subdevice ID. The current code is wrong as it is comparing the PCI device's subdevice ID to an expected, fixed value for the subvendor ID. It should be comparing the PCI device's subvendor ID to this fixed value. Correct it. Fixes: 7e8401b23e7f ("staging: comedi: daqboard2000: add back subsystem_device check") Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: <stable@vger.kernel.org> # 3.7+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: daqboard2000: prefer usleep_range()Ian Abbott2016-06-171-2/+2
| | | | | | | | | | | | | | | | The checkpatch.pl warns about two `udelay(x)` calls, one of 100 microseconds, and one of 10 microseconds. The 100 microseconds one is used when waiting for FPGA to become ready to accept firmware, and is not that critical, so replace it with a call to `usleep_range(100, 1000)`. The 10 microseconds one is called as each 16-bit word of firmware data is written. Replace it with a fairly tight `usleep_range(10, 20)` to avoid slowing down firmware loading too much. The firmware is fairly short, so this would only slow it down firmware loading by about 20 milliseconds or so. 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>
* staging: comedi: daqboard2000: rename CamelCase functionsIan Abbott2016-06-171-39/+41
| | | | | | | | | Rename functions to avoid CamelCase warnings from checkpatch, and to use namespace associated with the driver. 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>
* staging: comedi: daqboard2000: rename reference DACs register macrosIan Abbott2016-06-171-4/+5
| | | | | | | | | | | Rename the macros that define values for the reference DACs register to avoid CamelCase, and to make it clearer which register they are associated with. Add a macro `DB2K_REG_DACS_SET` for the value `0x0080` that triggers setting one of the references. 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>
* staging: comedi: daqboard2000: rename trigger control register macrosIan Abbott2016-06-171-12/+12
| | | | | | | | | | Rename the macros that define values for the trigger control register to avoid CamelCase, and to make it clearer which register they are associated with. 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>
* staging: comedi: daqboard2000: redo DAC status macros and fix busyIan Abbott2016-06-171-15/+13
| | | | | | | | | | | | | | | | | | | | | Rename the macros defining values for the DAC status register to avoid CamelCase, and to make it clear which register they are associated with. Refactor the macros defining the regular DAC channel "busy" bits into a single macro that takes the DAC channel number as a parameter. Add a macro to define the offset of the read-only DAC status register. It is the same offset as the DAC control register, which is write-only. The code in `daqboard2000_ao_eoc()` that checks the status for completion of the DAC conversion looks wrong. The register has a "busy" bit for each channel, but the existing code only works for channels 0 and 1. The driver only supports two DAC channels at the moment, so the bug is currently harmless, but fix it so we can support four DAC channels on some board models. 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>
* staging: comedi: daqboard2000: redo DAC control register macrosIan Abbott2016-06-171-14/+7
| | | | | | | | | | | | Rename the macros used to define values for the DAC control register to avoid CamelCase and to make it clearer which register they are associated with. Refactor the macros used to define values to enable or disable DAC channels to use the channel number as a parameter. None of these macros are currently used by the driver. 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>
* staging: comedi: daqboard2000: rename acq status register macrosIan Abbott2016-06-171-19/+20
| | | | | | | | | | | | | | Rename the macros associated with the acquisition status register to avoid CamelCase and to make it clear which register they are associated with. Add a macro to define the offset of the read-only acquisition status register. It's the same offset as the acquisition control register, which is write-only. 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>
* staging: comedi: daqboard2000: rename acquisition control register macrosIan Abbott2016-06-171-27/+23
| | | | | | | | | | Rename the macros defining values for the acquisition control register to avoid CamelCase, and to make it clearer which register they are associated with. 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>
* staging: comedi: daqboard2000: rename register offset macrosIan Abbott2016-06-171-51/+61
| | | | | | | | | Rename the macros defining register offsets to avoid CamelCase, and to use namespace associated with the driver. 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>
* staging: comedi: daqboard2000: rename serial EEPROM register macrosIan Abbott2016-06-171-13/+13
| | | | | | | | | Rename the macros defining values for the Serial EEPROM Control Register to avoid CamelCase. 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>
* staging: comedi: daqboard2000: add blank line after struct declarationIan Abbott2016-06-171-0/+1
| | | | | | | | | Fix checkpatch issue: "CHECK: Please use a blank line after function/struct/union/enum declarations". 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>
* staging: comedi: daqboard2000: CHECK: spaces preferred around that '*'Ian Abbott2016-06-171-4/+4
| | | | | | | | | Fix checkpatch issues of the form "CHECK: spaces preferred around that '*' (ctx:VxV)". 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>
* staging: comedi: daqboard2000: use usual block comment styleIan Abbott2016-06-171-2/+4
| | | | | | | | | Reformat one of the block comments to conform to the usual style (it's the only one that doesn't). 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>
* staging: comedi: daqboard2000: remove commented out codeIan Abbott2016-06-171-8/+2
| | | | | | | | | | Remove some commented out code. Some of it uses constructs that don't exist in the driver, and probably come from the source code for the MS Windows driver. 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>
* scripts/spelling.txt: add "fimware" misspellingKees Cook2016-05-191-1/+1
| | | | | | | | | | A few instances of "fimware" instead of "firmware" were found. Fix these and add it to the spelling.txt file. Signed-off-by: Kees Cook <keescook@chromium.org> Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* staging: comedi: Fix return flowCristina Moraru2015-10-241-6/+2
| | | | | | | | Simplify function return flow. Issue found with coccinelle. Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: daqboard2000: Use preferred comment styleArno Tiemersma2015-05-101-98/+98
| | | | | | | | | Use the preferred block comment style for the copyright and driver description header comments. Signed-off-by: Arno Tiemersma <arno.tiemersma@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: comedi: fix code indent coding style issues in daqboard2000.cGbenga Adalumo2015-04-301-28/+28
| | | | | | | This is a patch to daqboard2000.c file that fixes code indent errors found by the checkpatch.pl tool Signed-off-by: Gbenga Adalumo <gbengadev@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: comedi: daqboard2000.c fixed trailing whitespaceAndrei Maresu2015-04-301-1/+1
| | | | | | | Fixed a coding style issue. Signed-off-by: Andrei Maresu <andreimaresu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: daqboard2000: include new "comedi_pci.h" headerIan Abbott2015-03-201-2/+1
| | | | | | | | | Include the new "../comedi_pci.h" header instead of <linux/pci.h> and "../comedidev.h", which will now get included indirectly. 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>
* staging: comedi: drivers/*.c: alignment should match open parenthesisH Hartley Sweeten2015-03-061-1/+1
| | | | | | | | Fix the alignment issues in all the comedi drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: have core hook up default (*insn_read) for readbackH Hartley Sweeten2014-11-261-1/+0
| | | | | | | | | | | | | | | Most of the comedi drivers that provide readback for write only subdevices now use the comedi core comedi_alloc_subdev_readback() helper to allocate the subdevice 'reaback' member instead of using some member in their private data. These drivers also hook up the (*insn_read) callback to the comedi_readback_insn_read() helper to provide the readback. Have the core automatically hook up the (*insn_read) callback after allocating the memory if the driver has not already hooked it up to a private function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi_pci: introduce comedi_pci_detach()H Hartley Sweeten2014-08-301-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a generic (*detach) function for comedi PCI drivers to handle the boilerplate code needed to detach a PCI driver. This function works similar to comedi_legacy_detach() where it will: * free the dev->irq if it has been requested * iounmap the dev->mmio addres if it has been ioremap'ed The helper then calls comedi_pci_disable() to release the regions and disable the PCI device. Use the new helper directly for the (*detach) in the following cases: * where comedi_pci_disable() is used directly for the (*detach) * where the detach function is just boilerplate Use the new helper in the (*detach) of the simpler PCI drivers. Call the helper after disabling interrupts (reset) and before any additional cleanup (kfree) to avoid any race conditions with the interrupt handler. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: daqboard2000: use comedi_subdevice 'readback'H Hartley Sweeten2014-08-301-23/+12
| | | | | | | | | | | Use the new comedi_subdevice 'readback' member and the core provided (*insn_read) for the readback of the analog output subdevice channels. For aesthetics, tidy up the (*insn_write) a bit. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: daqboard2000: remove #if 0'ed out code in ao (*insn_write)H Hartley Sweeten2014-08-301-16/+0
| | | | | | | | | This code has been disabled since it's initial commit. It must not be needed so just remove it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: daqboard2000: tidy up daqboard2000_8255_cb()H Hartley Sweeten2014-08-161-6/+4
| | | | | | | | | | | | The 8255 driver (*io) callback now includes the comedi_device pointer. Using this we can get the ioremap'ed base address. Instead of passing the (cast) mmio address to subdev_8255_init(), pass the 'iobase' of the 8255 registers (dioP2ExpansionIO8Bit). 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>
* staging: comedi: 8255: add a comedi_device param to the (*io) callbackH Hartley Sweeten2014-08-161-1/+2
| | | | | | | | | | | | | | | | | The 8255 driver uses an (*io) callback to read/write the registers of the 8255 device. The default callback provided by the driver uses inb()/outb() calls to access to registers based on an 'iobase' that was initialized during the subdev_8255_init() and a 'port' value. The users of this module can optionally provide a custom (*io) callback to handle the read/write in another manner. Make the (*io) callback a bit more flexible by also passing the comedi_device pointer as a parameter. 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>
* staging: comedi: daqboard2000: use the comedi_device 'mmio' memberH Hartley Sweeten2014-07-301-45/+31
| | | | | | | | | Use the new 'mmio' member in the comedi_device for the ioremap'ed base address. 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>
* staging: comedi: daqboard2000: checkpatch.pl cleanup (space before tab)H Hartley Sweeten2014-07-161-4/+4
| | | | | | | | | | Fix these checkpatch.pl warnings: WARNING: please, no space before tabs 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>
* staging: comedi: daqboard2000: checkpatch.pl cleanup (else after return)H Hartley Sweeten2014-07-161-2/+1
| | | | | | | | | | Fix these checkpatch.pl warnings: WARNING: else is not generally useful after a break or return 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>
* staging: comedi: daqboard2000: use comedi_timeout()H Hartley Sweeten2014-02-141-28/+54
| | | | | | | | | | | | | | | | | Use comedi_timeout() to wait for the analog input pipe full, scanning, amd end-of-conversion status. The status to check it passed as the 'context' to comedi_timeout(). Use comedi_timeout() to wait for the analog output end-of-conversion. This also fixes a possible bug where invalid data is returned for the analog input read if the conversion did not complete, The analog output has a similar possible bug where the cached readback value is incorrect if the conversion times out. 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>
* staging: comedi: drivers: remove final 'attach' messagesH Hartley Sweeten2014-02-071-3/+0
| | | | | | | | These messages are just added noise. Remove them. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han2013-12-021-1/+1
| | | | | | | | Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro is not preferred. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: don't rely on comedidev.h to include headersH Hartley Sweeten2013-07-231-0/+1
| | | | | | | | | | | | | | | | | | | | comedidev.h is the main kernel header for comedi. Every comedi driver includes this header which then includes a number of <linux/*> headers. All the drivers need <linux/module.h> and some of them need <linux/delay.h>. The rest are not needed by any of the drivers. Remove all the includes in comedidev.h except for <linux/dma-mapping.h>, which is needed to pick up the enum dma_data_direction for the comedi_subdevice definition, and "comedi.h", which is the uapi header for comedi. Add <linux/module.h> to all the comedi drivers and <linux/delay.h> to the couple that need 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>
* staging: comedi: use comedi_alloc_devpriv()H Hartley Sweeten2013-07-231-2/+1
| | | | | | | | | | | | | Use the helper function to allocate memory and set the comedi_device private data pointer. This removes the dependency on slab.h from most of the drivers so remove the global #include in comedidev.h and the local #include in some of the drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: drivers: let core handle freeing s->privateH Hartley Sweeten2013-06-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | Introduce a new subdevice runflags, SRF_FREE_SPRIV, and a new helper function, comedi_set_spriv(), that the drivers can use to set the comedi_subdevice private data pointer. The helper function will also set SRF_FREE_SPRIV to allow the comedi core to automatically free the subdevice private data during the cleanup_device() stage of the detach. Currently s->private is only allocated by the 8255, addi_watchdog, amplc_dio200_common, and ni_65xx drivers. All users of those drivers can then have the comedi_spriv_free() calls removed and in many cases the (*detach) can then simply be the appropriate comedi core provided function. The ni_65xx driver uses a helper function, ni_65xx_alloc_subdevice_private(), to allocate the private data. Refactor the function to return an errno or call comedi_set_spriv() instead of returning a pointer to the private data and requiring the caller to handle it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: ni_pcidio: use comedi_load_firmware()H Hartley Sweeten2013-05-171-2/+3
| | | | | | | | | | | | | Use comedi_load_firmware() instead of duplicating the code in a private function. This driver loads multiple firmware images to the device. Modify comedi_load_firmware() to take a 'context' that is passed to the firmware upload callback 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>
* staging: comedi: daqboard2000: use comedi_load_firmware()H Hartley Sweeten2013-05-171-18/+3
| | | | | | | | | Use comedi_load_firmware() instead of duplicating the code in a private 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>
* staging: comedi: remove FSF address from boilerplate textH Hartley Sweeten2013-05-131-5/+0
| | | | | | | | | | | | | | Addresses change... Remove the paragraph with the FSF address from all the comedi source files. Also, remove the paragraph about the finding the complete GPL in the COPYING file since it's unnecessary. 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>
* staging: comedi/daqboard2000: use mdelay for large delaysArnd Bergmann2013-04-231-7/+7
| | | | | | | | | | | | | | | | | On ARM, it is not legal to pass values larger than 2ms into udelay(), and mdelay() must be used instead, to avoid this build error: ERROR: "__bad_udelay" [drivers/staging/comedi/drivers/daqboard2000.ko] undefined! On a related note, any use of mdelay() or large udelay() numbers should be carefully reviewed, and replaced with msleep() or a different implementation that does not rely on delaying the work. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: introduce, and use, comedi_spriv_free()H Hartley Sweeten2013-04-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The comedi_subdevice 'private' variable is a void * that is available for the subdevice to use in manner. It's common in comedi drivers for the driver to allocate memory for a subdevice and store the pointer to that memory in the 'private' variable. It's then the responsibility of the driver to free that memory when the device is detached. Due to how the attach/detach works in comedi, the drivers need to do some sanity checking before they can free the allocated memory during the detach. Introduce a helper function, comedi_spriv_free(), to handle freeing the private data allocated for a subdevice. This allows moving all the sanity checks into the helper function and makes it safe to call with any context. It also allows removing some of the boilerplate code in the (*detach) functions. Remove the subdev_8255_cleanup() export in the 8255 subdevice driver as well as the addi_watchdog_cleanup() export in the addi_watchdog driver and use the new helper instead. The amplc_dio200_common driver uses a number of local helper functions to free the private data for it's subdevices. Remove those as well and use the new helper. 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>
* staging: comedi: daqboard2000: use pci_ioremap_bar()H Hartley Sweeten2013-04-111-4/+2
| | | | | | | | | | | Use pci_ioremap_bar() to ioremap the PCI resources. That function just takes the pci device and a bar number. It also has some additional sanity checks to make sure the bar is actually a memory resource. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: remove unneeded settings of `dev->iobase`Ian Abbott2013-03-151-1/+0
| | | | | | | | | | | | | | | Some PCI drivers use the "spare" `iobase` member of `struct comedi_device` as a flag to indicate that the call to `comedi_pci_enable()` was successful. This is no longer necessary now that `comedi_pci_enable()` and `comedi_pci_disable()` use the `ioenabled` member of `struct comedi_device` themselves to keep track of what needs to be done. Remove the unnecessary assignments to the `iobase` member in the relevant drivers. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi_pci: pass comedi_device to comedi_pci_enable()H Hartley Sweeten2013-03-141-2/+2
| | | | | | | | | | | | | | | | | | | | Make comedi_pci_enable() use the same parameter type as comedi_pci_disable(). This also allows comedi_pci_enable to automatically determine the resource name passed to pci_request_regions(). Make sure the errno value returned is passed on instead of assuming an errno. Also, remove any kernel noise that is generated when the call fails. The National Instruments drivers that use the mite module currently enable the PCI device in the mite module. For those drivers move the call to comedi_pci_enable into the driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi_pci: make comedi_pci_disable() safe to callH Hartley Sweeten2013-03-141-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | Currently all the comedi PCI drivers need to do some checking in their (*detach) before calling comedi_pci_disable() in order to make sure the PCI device has actually be enabled. Change the parameter passed to comedi_pci_disable() from a struct pci_dev pointer to a comedi_device pointer and have comedi_pci_disable() handle all the checking. For most comedi PCI drivers this also allows removing the local variable holding the pointer to the pci_dev. For some of the drivers comedi_pci_disable can now be used directly as the (*detach) function. The National Instruments drivers that use the mite module currently enable/disable the PCI device in the mite module. For those drivers move the call to comedi_pci_disable into the driver and make sure dev->iobase is set to a non-zero value. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: comedi: comedi_pci: change the comedi_pci_auto_config() 'context'H Hartley Sweeten2013-03-111-2/+3
| | | | | | | | | | | | | | | | | | | | | The comedi_pci_auto_config() function is used to allow the PCI driver (*probe) function to automatically call the comedi driver (*auto_attach). This allows the comedi driver to be part of the PnP process when the PCI device is detected. Currently the comedi_pci_auto_config() always passes a 'context' of '0' to comedi_auto_config(). This makes the 'context' a bit useless. Modify comedi_pci_auto_config() to allow the comedi pci drivers to pass a 'context' from the PCI driver. Make all the comedi pci drivers pass the pci_device_id 'driver_data' as the 'context'. Since none of the comedi pci drivers currently set the 'driver_data' the 'context' will still be '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>
* staging: comedi: conditionally build in PCI driver supportH Hartley Sweeten2013-01-311-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Separate the comedi_pci_* functions out of drivers.c into a new source file, comedi_pci.c. This allows conditionally building support for comedi PCI drivers into the comedi core. Fix the Kconfig and Makefile appropriately. Group all the comedi_pci_* prototypes and related defines into one place in comedidev.h. Protect these prototypes with an #ifdef and provide some dummy functions so that the mixed ISA/PCI comedi drivers will still build correctly. Remove the #include <linux/pci.h> from comedidev.h and drivers.c. This include is only needed by the comedi PCI driver support code and the PCI drivers. The include should occur in those files. Also, remove the #include <linux/pci.h> from a couple non-PCI drivers since it's not needed. 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>
* staging/comedi: Use comedi_pci_auto_unconfig directly for pci_driver.removePeter Huewe2013-01-251-6/+1
| | | | | | | | | | | | (Almost) all comedi pci drivers have some wrapper for their pci_driver.remove function which simply calls comedi_pci_auto_unconfig which has the same function prototype as the wrapper. -> we can remove these wrappers and call comedi_pci_auto_unconfig directly. This removes a lot some boilerplate code and saves some bytes. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: Comedi: daqboard2000: Fixed Coding Style IssueJake Champlin2013-01-201-1/+1
| | | | | | | Fixed Coding Style Warning Signed-off-by: Jake Champlin <jake.champlin.27@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>