summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/adl_pci6208.c
AgeCommit message (Collapse)Author
2018-03-14staging: comedi: adl_pci6208: remove redundant initialization of 'val'Colin Ian King
Variable 'val' is initialized with a value that is never read, it is updated with a new value again after intitialization. Remove the redundant initialization and move the declaration and assignment into the scope of the for-loop. Cleans up clang warning: drivers/staging/comedi/drivers/adl_pci6208.c:61:15: warning: Value stored to 'val' during its initialization is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: drivers: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all comedi files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/comedi files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: comedi: adl_pci6208: prefer using the BIT macroH Hartley Sweeten
As suggested by checkpatch.pl, use the BIT macro to define the register 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>
2015-03-20staging: comedi: adl_pci6208: include new "comedi_pci.h" headerIan Abbott
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>
2015-03-01staging: comedi: adl_pci6208: support old PLX device IDIan Abbott
ADLINK's MS Windows drivers for the PCI-6208/6216 boards include the following line in the DDInstall secion of the INF file: %String6208%=DriverInstall6208.NT,PCI\VEN_10B5&DEV_9050&SUBSYS_62089999 That's for a PLX PCI 9050/9052 PCI interface chip with custom subvendor and subdevice ID. The "%String6208%" macro expands to "ADLINK PCI-6208" in the INF file. Add a corresponding entry to this driver module's PCI device table. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01staging: comedi: adl_pci6208: remove multiple board type supportIan Abbott
This driver module now only supports a single board type, so remove the infrastructure for describing multiple board types. The comedi "auto_attach" handler, `pci6208_auto_attach()` doesn't need to set the comedi device's `board_name` or `board_ptr` members. The former is automatically pointed to the comedi driver's `driver_name` by the core comedi module, and the latter is not used anywhere else. The AO subdevice's `n_chans` member can be set to 16 without looking it up in the single element of `pci6208_boards[]`. There is no need to pass a board index from the PCI device table to the "auto_attach" handler. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01staging: comedi: adl_pci6208: combine PCI-6208 and PCI-6216 supportIan Abbott
This module's PCI device table has separate PCI device IDs for PCI-6208 and PCI-6216, but in reality, both boards and their cPCI and PCIe variants seem to have the same PCI device ID: 0x6208. The PCI subdevice ID doesn't seem to help either. It shouldn't do any harm to claim 16 AO channels for all devices supported by this driver. The original PCI-6216 is just a PCI-6208 with a daughter board providing the extra DACs. The data is clocked out to the DACs serially with no acknowledgment. I assume this would still happen when the DACs for the upper 8 channels are missing. Therefore, change the driver to support a single board type with 16 AO channels, and remove the suspicious PCI device ID for the PCI-6216. Evidence about lack of a separate PCI device ID for PCI-6216 follows.... 1. Jesus Vasquez reports the following lspci output for a PCIe-6216 on his Ubuntu 12.04 system: lspci -n -vvv 07:00.0 1180: 144a:6208 (rev 02) Subsystem: 144a:6208 Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Region 0: Memory at f6000000 (32-bit, non-prefetchable) [size=128] Region 1: I/O ports at c100 [size=128] Region 2: I/O ports at c000 [size=256] Kernel driver in use: adl_pci6208 Kernel modules: adl_pci6208 That system's "adl_pci6208" module only has the single PCI device ID for the PCI-6208, but works for his PCIe-6216 except that it only supports 8 analog output channels instead of 16. 2. ADLINK's binary Linux module "pci6208.ko" (there is no separate module for the PCI-6216) has a single alias: alias: pci:v0000144Ad00006208sv*sd*bc*sc*i* 3. The MS Windows drivers include this set of hardware IDs for the PCI-6208 series, with nothing more specific for the PCI-6216 (they are all tied to the same name "ADLINK PCI-6208" and there is no mention of PCI-6216): PCI\VEN_10B5&DEV_9050&SUBSYS_62089999 PCI\VEN_144A&DEV_6208&SUBSYS_6208144A PCI\VEN_144A&DEV_6208&SUBSYS_62089999 PCI\VEN_144A&DEV_6208&SUBSYS_C208144A PCI\VEN_144A&DEV_6208&SUBSYS_C20855AA PCI\VEN_144A&DEV_6208 Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-09staging: comedi: adl_pci6208: rewrite "Devices:" lineIan Abbott
Rewrite the "Devices:" line in the comedi "driver" comment to conform to the usual comedi format for this line. The line should be a comma-separated list where the first item is in the following format: [Manufacturer] BOARD-NAME (comedi-board-name) The "[Manufacturer]" and/or "(comedi-board-name)" parts may be omitted from following items, in which case the parts from the preceding item are used. The "Devices:" line may be continued continued over several lines by using one or more spaces at the start of each continuation line (not counting the space after the "*" in the block comment). 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>
2014-11-26staging: comedi: drivers: have core hook up default (*insn_read) for readbackH Hartley Sweeten
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>
2014-08-30staging: comedi: comedi_pci: introduce comedi_pci_detach()H Hartley Sweeten
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>
2014-08-30staging: comedi: adl_pci6208: use comedi_subdevice 'readback'H Hartley Sweeten
Use the new comedi_subdevice 'readback' member and the core provided (*insn_read) for the readback of the analog output subdevice channels. The loop used to write the values could timeout. Move the saving of the readback value so that the last value written is always saved. Remove the unused private data and its allocation. 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-02-14staging: comedi: adl_pci6208x: use comedi_timeout()H Hartley Sweeten
Use comedi_timeout() to wait for the analog output end-of-conversion. 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>
2013-12-02staging: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han
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>
2013-09-25staging: comedi: adl_pci6208: change MODULE_DESCRIPTIONH Hartley Sweeten
Change the MODULE_DESCRIPTION to something useful instead of the generic "Comedi low-level driver". Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25staging: comedi: adl_pci6208: tidy up multi-line commentsH Hartley Sweeten
Tidy up the multi-line comments to follow the CodingStyle. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25staging: comedi: adl_pci6208: remove board attach noiseH Hartley Sweeten
Remove the final dev_info() at the end of the board attach. This is just added noise. 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-09-25staging: comedi: adl_pci6208: tidy up pci6208_ao_rinsn()H Hartley Sweeten
For aesthetics, rename this function to help with greps, Change the type of 'chan' to match the type of the insn->chanspec that it is derived from using the CR_CHAN macro. 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-09-25staging: comedi: adl_pci6208: tidy up pci6208_ao_winsn()H Hartley Sweeten
For aesthetics, rename this function to help with greps, Change the type of 'chan' to match the type of the insn->chanspec that it is derived from using the CR_CHAN macro. 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-09-25staging: comedi: adl_pci6208: use comedi_offset_munge()H Hartley Sweeten
Use comedi_offset_munge() to munge the offset binary values from the comedi core into the two's complement form that the hardware expects. This removes the hard coded assumption that the analog outputs are 16-bits and instead does the munging based on the s->maxdata. 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-09-25staging: comedi: adl_pci6208: don't deadlock while waiting to write ao dataH Hartley Sweeten
Remove a possible deadlock while waiting to write the analog output data. The data transfer rate for every D/A data write in this driver is 2.2us. Wait up to 10us for the board to be ready then and return -ETIME. 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-09-25staging: comedi: adl_pci6208: save raw data for analog output readbackH Hartley Sweeten
This driver munges the raw data from the comedi core into its two's complement form before writing it to the hardware. The last value written to the hardware is saved in the private data for readback. Since the comedi core always expects the data to be in offset binary coding, make sure to save the un-munged value for readback. Also, prefetch the current readback value before attempting to update the hardware. This ensures that the readback value is correct if 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>
2013-09-17staging: comedi: drivers: use comedi_dio_update_state() for simple casesH Hartley Sweeten
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>
2013-09-17staging: comedi: initialize subdevice s->io_bits in postconfigH Hartley Sweeten
The subdevice 'io_bits' is a bit mask of the i/o configuration for digital subdevices. '0' values indicate that a channel is configured as an input and '1' values that the channel is an output. Since the subdevice data is kzalloc()'d, all channels default as inputs. Modify __comedi_device_postconfig() so that 'io_bits' is correctly initialized for Digital Output subdevices. Remove all the unnecessary initializations of 's->io_bits' from the drivers. Also, remove the unnecessary initialization of the 's->state'. 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-23staging: comedi: don't rely on comedidev.h to include headersH Hartley Sweeten
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>
2013-07-23staging: comedi: use comedi_alloc_devpriv()H Hartley Sweeten
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>
2013-05-13staging: comedi: remove FSF address from boilerplate textH Hartley Sweeten
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>
2013-03-14staging: comedi_pci: pass comedi_device to comedi_pci_enable()H Hartley Sweeten
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>
2013-03-14staging: comedi_pci: make comedi_pci_disable() safe to callH Hartley Sweeten
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>
2013-03-11staging: comedi: adl_pci6208: use the pci id_table 'driver_data'H Hartley Sweeten
Create an enum to the boardinfo and pass that enum in the pci_driver id_table as the driver_data. Change the macro used to fill in the device table from PCI_DEVICE() to PCI_VDEVICE(). This allows passing the enum as the next field. This allows removing the 'dev_id' data from the boardinfo as well the search function that was used to locate the boardinfo for the PCI device. Since the PCI device ids are now only used in the id_table, remove the defines and open code the device ids. 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>
2013-03-11staging: comedi: comedi_pci: change the comedi_pci_auto_config() 'context'H Hartley Sweeten
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>
2013-01-31staging: comedi: conditionally build in PCI driver supportH Hartley Sweeten
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>
2013-01-25staging/comedi: Use comedi_pci_auto_unconfig directly for pci_driver.removePeter Huewe
(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>
2012-11-21staging: comedi: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: comedi: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: comedi: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-30staging: comedi/drivers: use auto_attach instead of attach_pciIan Abbott
Change comedi drivers for PCI boards to use the new `auto_attach()` method instead of the `attach_pci()` method. I plan to remove the `attach_pci()` and `attach_usb()` methods from `struct comedi_driver` once nothing is using them. Tag the functions with `__devinit` where they are not already so tagged, as they are only called during PCI probe. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-23staging: comedi: auto-config drivers do not need to set hw_devH Hartley Sweeten
The comedi core now sets the 'hw_dev' pointer in the function comedi_auto_config_helper() before calling the auto attach function in the driver. Remove the now unnecessary call to comedi_set_hw_dev() in the drivers that use the auto-config attach mechanism. 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>
2012-10-23staging: comedi: remove inline alloc_private()H Hartley Sweeten
This inline function has a very generic name and it's only a wrapper around a simple kzalloc(). Since the inline function does not save any lines-of-code, instead of renaming it just remove it and do the kzalloc() directly. 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>
2012-10-22staging: comedi: drivers: remove remaining devpriv macrosH Hartley Sweeten
The remaining comedi drivers that still have a devpriv macro are all pretty straight forward for removing the devpriv macro. This macro relies on a local variable having a specific name. Remove its use by replacing it with a local variable where used. The inline function alloc_private(), used to kzalloc the dev->private memory, returns non-zero if there is an error. Fix all the alloc_private() calls accordingly and remove any kernel messages or obvious comments that still exist in the drivers. Leave a comment in the skel 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>
2012-09-05staging: comedi: adl_pci6208: remove subdevice pointer mathH Hartley Sweeten
Convert the comedi_subdevice access from pointer math to array access. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-17staging: comedi: adl_pci6208: remove manual legacy attachH Hartley Sweeten
This driver uses the 'attach_pci' callback to attach the pci device to the comedi subsystem. Since the 'attach' callback is now optional it can be removed from 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>
2012-08-13staging: comedi: adl_pci6208: use the 'board_name' for the resource nameH Hartley Sweeten
Use the 'dev->board_name' instead of the 'dev->driver->driver_name' as the resource name used when requesing the pci regions in comedi_pci_enable(). The board_name has a closer affinity to the card. Also, remove the dev_err() message when comedi_pci_enable() fails. It's just noise and doesn't actually tell the real reason why the call failed. It could have failed either the pci_enable_device() or the pci_request_regions(). 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-08-13staging: comedi: adl_pci6208: split the digital i/o subdeviceH Hartley Sweeten
The PCI-6208/6216 cards have 4 digital inputs and 4 digital outputs. These are currently being handled by an 8 channel COMEDI_SUBD_DIO subdevice in this driver. This causes the 4 digital outputs to appear as channels 0 thru 3 and the 4 digital inputs to appear as channels 4 thru 7. Userspace can only work out part thisby doing the COMEDI_INSNLIST ioctl with the INSN_CONFIG_DIO_QUERY instruction for each channel to determine the io direction. Make things a bit cleaner for userspace by creating two subdevices instead. One for the 4 digital inputs and one for the 4 digital outputs. For both subdevices the channel number indicates the actual digital input/output signal. 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-08-13staging: comedi: adl_pci6208: add support for the PCI-6216 cardH Hartley Sweeten
Add the boardinfo and pci device table information for the PCI-6216 card. 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-08-13staging: comedi: adl_pci6208: 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, disable the legacy attach by making the attach callback simply return -ENOSYS. This removes the need to walk the pci bus to find the pci_dev and the need for the pci_dev_put() in the detach. For aesthetic reasons, rename the local variable 'thisboard' to 'boardinfo'. 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-07-19staging: comedi: adl_pci6208: 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-07-06staging: comedi: adl_pci6208: use the driver_name for the resource nameH Hartley Sweeten
Use the dev->driver->driver_name for the resource name passed to pci_request_regions(), by way of comedi_pci_enable(), instead of the open coded string "adl_pci6208". 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-07-06staging: comedi: adl_pci6208: cleanup pci6208_attach()H Hartley Sweeten
For aesthetic reasons, set the dev->board_name as soon as the thisboard pointer is available. 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-07-06staging: comedi: adl_pci6208: cleanup pci6208_ao_rinsn()H Hartley Sweeten
For aesthetic reasons, reorder the local variables and change the return value to 'insn->n'. 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>