aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/adv_pci_dio.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-06-18staging: comedi: adv_pci_dio: rename 'this_board' variablesH Hartley Sweeten1-24/+24
For aesthetics, rename the 'this_board' variables to 'board'. That name is more commonly used for the boardinfo pointer in 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>
2015-03-20staging: comedi: adv_pci_dio: include new "comedi_pci.h" headerIan Abbott1-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>
2015-03-06staging: comedi: drivers/*.c: remove unnecessary blank linesH Hartley Sweeten1-1/+0
Blank lines are not needed before a close brace '}' or after an open brace '{'. Also remove any multiple blank lines. 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-01staging: comedi: adv_pci_dio: convert driver to use the comedi_8254 moduleH Hartley Sweeten1-77/+10
Some of the hardware supported by this driver includes an 8254 timer. For aesthetics, convert it to use the comedi_8254 module to provide support for the 8254 timer. 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-01staging: comedi: adv_pci_dio: refactor 's8254' boardinfoH Hartley Sweeten1-32/+19
The boardinfo for the 8254 timer is overly complex. The 8254 timer always has 3 channels and the 'regs' and 'specflags' members of diosubd_data are not used. The only necessary information is the base 'addr' offset to the 8254 registers. Replace the 's8254' member with an unsigned long 'timer_regbase'. Use that to determine if the board has an 8254 timer during the attach of the driver. Save the 'timer_regbase' in the subdevice 'private' pointer to use in the subdevice functions. For aesthetics, absorb pci_dio_add_8254() into the driver attach 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>
2015-03-01staging: comedi: adv_pci_dio: simplify counter subdevice I/OH Hartley Sweeten1-33/+14
Only two of the boards supported by this driver have an 8254 counter/timer. Both of these boards have a single 8254 device. Currently the counter subdevice functions are coded to support multiple 8254 devices. This is unnecessary and just complicates the code. Simplfy the subdevice functions to work for a single 8254 counter/timer and refactor the driver (*attach) accordingly. 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-11-03staging: comedi: drivers: remove inappropriate SDF_* flags from subdevicesH Hartley Sweeten1-4/+4
The SDF_GROUND, SDF_COMMON, SDF_DIFF, and SDF_OTHER flags are only useful with the analog input and output subdevices. Remove these flags from the other subdevice types in 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>
2014-09-11staging: comedi: adv_pci_dio: replace comedi_board() callsIan Abbott1-3/+3
The `comedi_board(dev)` inline function calls just return `dev->board_ptr`. Expand the inline function calls. 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-08-30staging: comedi: adv_pci_dio: remove 'valid' member from private dataH Hartley Sweeten1-9/+2
This member is set at the end of the driver attach and is only used to verify that pci_dio_reset() can be called in the (*detach). The only requirement for pci_dio_reset() to work is that the dev->iobase is valid. Remove the 'valid' member from the private data and use 'dev->iobase' to see if the reset can be done. 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 Sweeten1-1/+1
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-16staging: comedi: 8255: provide common defines for registersH Hartley Sweeten1-2/+1
There are a couple comedi drivers that duplicate some of the register defines used by the 8255 module. Move these defines into the header so the duplication can be removed. 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-16staging: comedi: 8255: refactor how the (*io) function worksH Hartley Sweeten1-1/+0
Currently, all users of is module that use the default (*io) function pass an 'iobase' to subdev_8255_init() of the form: dev->iobase + OFFSET_TO_8255_BASE_REG Now that the (*io) callback includes the comedi_device 'dev' pointer the 'dev->iobase' does not need to be included. Modify the default (*io) function, subdev_8255_io(), to automatically add the dev->iobase to the address when reading/writing the port. For aesthetics, rename the subdevice private data member to 'regbase'. Also, rename the local variables in this module that are used to access this member. Add a comment in dev_8255_attach() about the 'iobase' that is passed to subdev_8255_init(). For manually attached 8255 devices the io region is requested with __comedi_request_region() which does not set dev->iobase. For these devices the 'regbase' is actually the 'iobase'. Remove the, now unnecessary, dev->iobase from all the callers of subdev_8255_init(). There are a couple drivers that only passed the dev->iobase. For those drivers pass a 'regbase' of 0x00. Note that the das16m1 driver is a bit goofy. The devpriv->extra_iobase is requested using __comedi_request_region() which does not set the dev->iobase. But the starting address passed is dev->iobase + DAS16M1_82C55 so a 'regbase' of DAS16M1_82C55 is passed to subdev_8255_init(). 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-07-17staging: comedi: adv_pci_dio: remove use of comedi_error()H Hartley Sweeten1-3/+3
The comedi_error() function is just a wrapper around dev_err() that adds the dev->driver->driver_name prefix to the message and a terminating new-line character. The addition of the driver_name is just added noise and some of the users of comedi_error() add unnecessary additional new-line characters. Use dev_err() directly instead of comedi_error() to avoid any confusion and so that all the comedi generated kernel messages have the same format. 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>
2014-07-16staging: comedi: adv_pci_dio: checkpatch.pl cleanup (fallthrough)H Hartley Sweeten1-2/+2
Fix these checkpatch.pl warnings: WARNING: Possible switch case/default not preceeded by break or fallthrough comment 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>
2014-07-16staging: comedi: adv_pci_dio: checkpatch.pl cleanup (missing blank line)H Hartley Sweeten1-0/+1
Fix this checkpatch.pl warning: WARNING: Missing a blank line after declarations 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>
2014-02-07staging: comedi: drivers: propogate errno from subdev_8255_init()H Hartley Sweeten1-4/+6
The initialization of the 8255 subdevice can fail due to the allocation of the private data. Make sure all callers of subdev_8255_init() propogate the errno. 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-02staging: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han1-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>
2013-09-17staging: comedi: drivers: use comedi_dio_update_state() for simple casesH Hartley Sweeten1-21/+12
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-07-23staging: comedi: don't rely on comedidev.h to include headersH Hartley Sweeten1-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>
2013-07-23staging: comedi: use comedi_alloc_devpriv()H Hartley Sweeten1-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>
2013-06-17staging: comedi: drivers: let core handle freeing s->privateH Hartley Sweeten1-8/+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>
2013-04-17staging: comedi: introduce, and use, comedi_spriv_free()H Hartley Sweeten1-7/+5
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>
2013-03-15staging: comedi: adv_pci_dio: restore PCI-1753E supportIan Abbott1-57/+67
Back in the old days (before "staging") when Comedi only supported manual configuration of devices, the "adv_pci_dio" driver supported both PCI-1753 ("pci1753") and PCI-1753E ("pci1753e"). In actual fact, "pci1753e" is just a PCI-1753 connected by a ribbon cable to a PCI-1753E expansion card, which is plugged into a PCI slot but is not a PCI device itself. Now that the "adv_pci_dio" driver only supports automatic configuration of devices and the main "comedi" module no longer allows auto-configuration to be disabled, a PCI-1753 with a PCI-1753E expansion card is always treated as an unexpanded PCI-1753 ("pci1753") and there is no way to override it. (Recently, an undefined macro `USE_PCI1753E_BOARDINFO` was used to make the driver switch to supporting "pci1753e" instead of "pci1753", but this is less than ideal.) Advantech has their own Linux (non-Comedi) driver for the PCI-1753 which detects whether the PCI-1753E expansion card is connected to the PCI-1753 by fiddling with a register at offset 53 from the main registers base. Use Advantech's test in our "adv_pci_dio" driver. If the board appears to be a PCI-1753 ("pci1753"), check if the expansion card appears to be present, and if so, treat the device as a PCI-1753 plus PCI-1753E expansion card ("pci1753e"). Also, get rid of `enum dio_boardid` (`BOARD_...` enum values) which was added recently and just use the older `TYPE_...` enum values from `enum hw_cards_id` instead as the mapping is now 1-to-1. Signed-off-by: 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 Sweeten1-1/+1
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 Sweeten1-5/+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>
2013-03-11staging: comedi: adv_pci_dio: use the pci id_table 'driver_data'H Hartley Sweeten1-79/+72
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 'vendor_id' and 'device_id' data from the boardinfo as well the search function that was used to locate the boardinfo for the PCI device. The pci1753 and pci1753e boards have the same vendor/device id so it is impossible to determine which board is actually detected. The boardinfo for the boards is quite different. Group them in the same enum index in the boardinfo table and #if out the information with USE_PCI1753E_BOARDINFO. Until a better solution is worked out, this will allow the driver to be compiled to support the pci1753 (default) or pci1752e. 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 Sweeten1-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>
2013-01-31staging: comedi: conditionally build in PCI driver supportH Hartley Sweeten1-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>
2013-01-25staging/comedi: Use comedi_pci_auto_unconfig directly for pci_driver.removePeter Huewe1-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>
2012-11-21staging: comedi: remove use of __devexitBill Pemberton1-1/+1
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 Pemberton1-2/+2
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 Pemberton1-1/+1
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 Abbott1-3/+4
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-24staging: comedi: comedidev.h: add PCI_VENDOR_ID_ADVANTECHH Hartley Sweeten1-2/+0
Add a define for the Advantech Co., Ltd. PCI vendor id. Remove the duplicates in the drivers. 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-10-23staging: comedi: auto-config drivers do not need to set hw_devH Hartley Sweeten1-2/+0
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 Sweeten1-4/+4
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 Sweeten1-1/+1
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: adv_pci_dio: remove 'subdev' param from pci_dio_add_*()H Hartley Sweeten1-9/+11
The subdevice index number is not used in the pci_dio_add_*() functions. Just remove them. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05staging: comedi: adv_pci_dio: clarify subdevice index in pci1760_attach()H Hartley Sweeten1-9/+4
The subdevice index numbers are fixed when attaching to a pci1710 card. Remove the subdev variable and just open code the array index numbers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05staging: comedi: adv_pci_dio: remove subdevice pointer mathH Hartley Sweeten1-10/+10
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-09-04staging: comedi: adv_pci_dio: fix bug in 'detach'H Hartley Sweeten1-0/+2
The 'attach' function can fail between when the devpriv and the comedi subdevices are allocated. If it does the 'detach' will try to access unallocated memory when it goes thru the subdevices. 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-04staging: comedi: adv_pci_dio: simplify the 'detach'H Hartley Sweeten1-24/+3
Currently the 'detach' function in this driver walks thru the boardinfo in order to find the subdevice index for any sdio subdevices in order to call the subdev_8255_cleanup(). Then it goes thru all the subdevices to clean the s->private pointer. All the sdio subdevices are unique in that the s->type is COMEDI_SUBD_DIO. Use that to know when to call the cleanup for the 8255 subdevice. 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-04staging: comedi: adv_pci_dio: add the number of subdevices to the boardinfoH Hartley Sweeten1-21/+18
Instead of calculating the number of subdevices in the 'attach' simply add the number to the 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-09-04staging: comedi: adv_pci_dio: remove '0' boardinfo dataH Hartley Sweeten1-84/+0
Remove all the boardinfo data that is simply '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-04staging: comedi: adv_pci_dio: convert boardinfo initialization to C99 formatH Hartley Sweeten1-120/+227
Convert the boardinfo initialization to C99 format to make it less error prone. The struct diosubd_data information is not converted to C99 format yet because some of it will be removed. 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-04staging: comedi: adv_pci_dio: use attach_pci callbackH Hartley Sweeten1-39/+22
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. 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-04staging: comedi: adv_pci_dio: remove devpriv and this_board macrosH Hartley Sweeten1-12/+21
These macros rely on a local variable having a specific name. Remove them and use the comedi_board() helper to get the this_board pointer. 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-04staging: comedi: adv_pci_dio: remove function trace messagesH Hartley Sweeten1-13/+0
Remove the DPRINTK function trace messages and associated PCI_DIO_EXTDEBUG define. These should not be in the final 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-07staging: comedi: remove pci_is_enabled() testsH Hartley Sweeten1-2/+0
As mentioned by Ian Abbott, the comedi pci drivers that try to locate an unused pci device with the pci_is_enabled() test might actually skip over a perfectly good unused device. This test is also not consistent with the other comedi pci drivers. Remove the test from all the comedi pci drivers. Reported-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-19staging: comedi: adv_pci_dio: store the pci_dev in the comedi_deviceH Hartley Sweeten1-11/+12
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>