History log of /drivers/staging/comedi/drivers/adv_pci1723.c
Revision Date Author Comments
aac307f9dd5ce1fe651140a036ab4b0a0571b54a 26-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_pci: introduce comedi_pci_detach()

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>
c6d94c74a3548ee688283bca38ebe32969e0c1e0 16-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: adv_pci1723: checkpatch.pl cleanup (missing blank line)

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>
c93999c21319439c4fe2da85f2ec40ed477379ac 03-Feb-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: remove final 'attach' messages

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>
41e043fcfa2236bb2c4a8335eb09f4c8cee224b3 03-Dec-2013 Jingoo Han <jg1.han@samsung.com> staging: remove DEFINE_PCI_DEVICE_TABLE macro

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>
69163089384b93946133fa1b5153791797b8db44 16-Oct-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: adv_pci1723: sample types are unsigned

Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ao_data[]` member of `struct
pci1723_private` from `short` to `unsigned short` for consistency.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
97f4289ad08cffe55de06d4ac4f89ac540450aee 30-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_dio_update_state() for simple cases

Use comedi_dio_update_state() to handle the boilerplate code to update
the subdevice s->state for simple cases where the hardware is updated
when any channel is modified.

Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the
current state is not returned in data[1].

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5dacadcca3176e2b1f8db662e503c080484d71fa 06-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_dio_insn_config() for complex cases

Convert the drivers with complex, port programmable i/o, to use the
comedi_dio_insn_config() helper function.

All of these drivers have some sort of 'port' programmable i/o where multiple
i/o channels are configured as a group. The 'mask' associated with the group
is passed to comedi_dio_insn_config() so that all the channels are configured.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3457bfd6dfb38f7bb66a227fe3473bad4773de06 13-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Revert "staging: comedi: drivers: use comedi_dio_insn_config() for complex cases"

This reverts commit f21c53945cb95f66faa9636af5f23cb00ba73019.

I applied the wrong patch :(

Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f21c53945cb95f66faa9636af5f23cb00ba73019 06-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_dio_insn_config() for complex cases

Convert the drivers with complex, port programmable i/o, to use the
comedi_dio_insn_config() helper function.

All of these drivers have some sort of 'port' programmable i/o where multiple
i/o channels are configured as a group. The 'mask' associated with the group
is passed to comedi_dio_insn_config() so that all the channels are configured.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ce157f8032bbd46d9427034c335b0afd751da25d 25-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: don't rely on comedidev.h to include headers

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>
0bdab509bf9c6d838dc0a3b1d68bbf841fc20b5a 25-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: use comedi_alloc_devpriv()

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>
641f064e5df6fb3aaeb6256031a153a5efb16ca6 25-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: remove FSF address from boilerplate text

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>
5993f3a2692eed3c74c86882155b8703a0060ad5 08-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: remove unnecessary dev->board_name initialization

The dev->board_name is now initialized by the comedi core before calling
the(*attach) or (*auto_attach) function in a driver. As long as the driver
does no additional probing, it's no longer necessary initialize the board_name.

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>
818f569fe930c5b8a05d1a44ece3c63c99c13c88 13-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi_pci: pass comedi_device to comedi_pci_enable()

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>
7f072f54ae5dc9965cbe450419b1389d13e2b849 13-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi_pci: make comedi_pci_disable() safe to call

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>
b8f4ac237e382accd4b30c75043939f7ed9e79a6 05-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_pci: change the comedi_pci_auto_config() 'context'

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>
33782dd5edf8db3cdb7c81a3523bf743dd0209b7 30-Jan-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: conditionally build in PCI driver support

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>
9901a4d75d007686e8f6473189cafc4b216b7449 22-Jan-2013 Peter Huewe <peterhuewe@gmx.de> staging/comedi: Use comedi_pci_auto_unconfig directly for pci_driver.remove

(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>
53b800198592b0ff96577ecc5f116f7d902a4362 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: comedi: remove use of __devexit

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>
a690b7e535f2f97a3a05ee570715abeb60a8910f 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: comedi: remove use of __devinit

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>
a471eace7baa40cdf16d3f26b2f78ddce613ca8f 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: comedi: remove use of __devexit_p

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>
750af5e568d060ec6994cdcb4e86cdddfcd473c0 30-Oct-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi/drivers: use auto_attach instead of attach_pci

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>
12f07ba56bad3defc37416e496c6e790029715b4 25-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: comedidev.h: add PCI_VENDOR_ID_ADVANTECH

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>
7fc465b106b40a598d83a0c98d0e8c2a1b4653ff 23-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: auto-config drivers do not need to set hw_dev

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>
c34fa261b0ac3a862ccd3f71ee55a16b920dfc83 23-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: remove inline alloc_private()

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>
9a1a6cf8ae5ca58171e117335b9983e3cfa2185c 15-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: drivers: remove remaining devpriv macros

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>
dd25ab4546631fd806ca1ef2f595d54f6c49a8dc 06-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: remove subdevice pointer math

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>
edf51472131eedc824609a7bab3be43056cb9eff 18-Aug-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: cleanup card reset

Only one 'reset' of the card is required in the attach. Remove the
one before setting up the subdevices and leave the one before
exiting the attach function.

The 'valid' variable in the private data is not needed. This variable
is used in the detach to determine if it's ok to call the 'reset'
function. Checking if dev->iobase is valid works just as well.

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>
5222687a7fafdb8633151269103714f2075e9c3d 18-Aug-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: use attach_pci callback

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>
c8d3739dd30c0b1cdc34608bf292249f7fa34ed6 18-Aug-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: remove boardinfo

This driver only supports one board type. Remove the boardinfo and
associated code.

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>
11d853f955eca03218fe71f6911d02163013fa4d 18-Aug-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: fix initial dio subdevice state and io_bits

The initial state and io_bits for the dio subdevice is determined in
the pci1723_attach() but it's being saved in the wrong subdevice. Move
the code so it gets saved correctly.

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>
25e443373c171b77a1404d21396c38f12f255e16 18-Aug-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: remove range_pci1723

This comedi_lrange is the same as the global range_bipolar10
exported by the comedi core. Use that range instead.

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>
e201ad6dc3272e9731f896c818f0caacbbe9a1c2 18-Aug-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: remove devpriv and this_board macros

The devpriv macro relies on a local variable having a specific name.
Remove it.

The this_board macro in this driver is a bit different in this driver.
In other comedi drivers, this macro returns the dev->board_ptr. In this
driver its simply 'boardtypes' which returns the first boardinfo element.
Remove this macro also by making sure the dev->board_ptr is set in the
pci1723_find_pci_dev() function and using the comedi_board() helper
to get the pointer in pci1723_attach().

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>
3b7cc136e1990ddc0a7f07c2a99a3500e51470bc 18-Aug-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: remove function trace messages

Remove the DPRINTK function trace messages. 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>
8258d3923c7d8f9a28c43612c3f91c7b9d61191b 20-Jul-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: remove pci_is_enabled() tests

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>
dbe85f1757f1cb6a8ce206a38a855fb7b60ca159 19-Jul-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: store the pci_dev in the comedi_device

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>
cc04c8a5fc82bd284f7f791869a7f9c0bfb528b5 19-Jul-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: move comedi_pci_enable() into the attach

Use pci_is_enabled() in the "find pci device" function to determine if
the found pci device is not in use and move the comedi_pci_enable() call
into the attach.

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>
3dbd666ca4e3c6e6d19101781a62555d0210ff57 19-Jul-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: cleanup "find pci device" code

Use for_each_pci_dev() instead of open-coding the loop using
pci_get_device().

Drop the printk error messages. They just add 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>
05979c7b3c5463eddbbfd3dd56f8a62679508c5e 19-Jul-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: adv_pci1723: factor out the "find pci device" code

Factor the "find pci device" code out of the attach 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>
a2714e3e42e746d6c8525c35fdcc58fb60c2830d 18-Jun-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: fix return value for insn_bits functions

The comedi_subdevice 'insn_bits' functions return the number of data
elements used to perform the command. Most of the insn_bits functions
return an open coded '2' to indicate this. The same value is available
as 'insn->n'. Return that instead to better indicate what the return
means.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8b6c56949ffa83dbc2a6e8fa3f98b10a19372207 12-Jun-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: propogate error code from comedi_alloc_subdevices

comedi_alloc_subdevices can fail with -EINVAL or -ENOMEM. When it
does fail make sure to pass the proper error code back.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbott@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0e4039f3112326d73f66b00fd18468a3804ed29e 12-Jun-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: remove the comed_alloc_subdevices "allocation failed" messages

Remove all the "allocation failed" debug messages that are displayed
when the comedi_alloc_subdevices call fails.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbot <abbott@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2f0b9d082e5d0056a3aca4be038483a564849196 12-Jun-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: export alloc_subdevices as comedi_alloc_subdevices

Move the inline alloc_subdevices() function from comedidev.h
to drivers.c and rename it to comedi_alloc_subdevices(). The
function is large enough to warrant being an exported symbol
rather than being an inline in every driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
55c03cff7fd73349473cc0a964df9d55b312dbbc 22-May-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: remove private header comedi_pci.h

Remove the private header, comedi_pci.h, by moving the two
helper functions into divers.c and providing the prototypes
in comedidev.h.

This allows the comedi_pci_enable/disable helper functions
to be shared instead of having an inline version in every
comedi pci driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
484ecc95d9cdfa8b2f7029e2f3409cf078aed4ab 18-May-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: cleanup all the comedi_driver 'detach' functions

1. Change the return type from int to void

All the detach functions, except for the comedi usb drivers, simply
return success (0). Plus, the return code is never checked in the
comedi core.

The comedi usb drivers do return error codes but the conditions can
never happen.

The first check is:

if (!dev)
return -EFAULT;

This checks that the passed comedi_device pointer is valid. The detach
function itself is called using this pointer so it MUST always be valid
or there is a bug in the core:

if (dev->driver)
dev->driver->detach(dev);

And the second check:

usb = dev->private;
if (!usb)
return -EFAULT;

The dev->private pointer is setup in the attach function to point to the
probed usb device. This value could be NULL if the attach fails. But,
since the comedi core is going to unload the driver anyway and does not
check for errors there is no gain by returning one.

After removing these checks from the comedi usb drivers the detach
functions required a bit of cleanup.

2. Remove all the printk noise in the detach functions

All of the printk output is really just noise. The user did a rmmod to
unload the driver, we really don't need to tell them about it.

Also, some of the messages are output using:

dev_dbg(dev->hw_dev, ...
or
dev_info(dev->hw_dev, ...

Unfortunately the hw_dev value is only used by drivers that are doing
DMA. For most drivers this variable is going to be NULL so the output
is not going to work as expected.

3. Refactor a couple static 'free_resource' functions into the detach
functions.

The 'free_resource' function is only being called by the detach and it
makes more sense to just absorb the code.

4. Remove a couple unnecessary braces for single statements.

5. Remove unnecessary comments.

Most of the comedi drivers appear to be based on the comedi skel driver
and have the comments from that driver included. These comments make
sense in the skel driver for reference but they don't need to be in any
of the actual drivers.

6. Remove all the extra whitespace.

It's not needed to make the functions any more readable.

7. Remove the now unused 'attached_successfully' variable in the
cb_pcimdda driver.

This variable was only used to conditionally output some driver noise
during the detach. Since all the printk's have been removed this
variable is no longer necessary.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
75e6301baa78b2dff00e2cc3051301c32618acd7 12-May-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: Use module_comedi_pci_driver and standardize drivers

Convert the refactored comedi pci drivers to use the
module_comedi_pci_driver() macro which makes the code
smaller and a bit simpler.

In the process, rename some of the symbols in the driver
to standardize the comedi pci drivers.

Based on the driver {name}:
1) Rename the comedi_driver to {name}_driver.
2) Use a static string {name} for the comedi_driver.driver_name.
3) Rename the pci probe/remove functions to {name)_pci_probe/remove.
4) Rename the pci id_table to {name}_pci_table.
5) Add the static string {name} for the pci_driver.name.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3c4ba9e8743d664e6c71cabf09f05aa92b50c366 24-Apr-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: refactor adv_pci7123 driver to remove forward declarations

Move the struct comedi_driver variable and the associated
attach/detach routines to remove the need for the forward
declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
542038f4df5a9d5d806a4af8725d2d21c4423a15 20-Apr-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: use ARRAY_SIZE instead of custom n_boardtypes macros

The n_boardtypes macros are simply open-coded versions of the kernels
ARRAY_SIZE macro. Use the kernel provided macro.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4c093a6dc2240fd54d71a25b284e02d51509e430 30-Mar-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: pass 'struct comedi_driver *' to comedi_..._auto_config

The comedi_pci_auto_config() and comedi_usb_auto_config() functions
currently take a board name parameter which is actually a driver name
parameter. Replace it with a pointer to the struct comedi_driver. This
will allow comedi_pci_auto_config() and comedi_usb_auto_config() to call
bus-type-specific auto-configuration hooks in the struct comedi_driver
if they exist (they don't yet). The idea is that these
bus-type-specific auto-configuration hooks won't have to search the bus
for the device being auto-configured like 'attach()' hook has to.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2d32f746223bfd89994edc0d16716e90e7836e74 01-Jun-2011 Matt Billenstein <matt@vazor.com> staging: comedi (adv_pci1723): coding style, fix whitespace before quoted newline

Small fix in adv_pci1723.c for a "whitespace before quoted newline" warning
from checkpatch.pl

Signed-off-by: Matt Billenstein <matt@vazor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
494a3dd3b99c60fc18082ca11d34f115aaa7ec2c 07-Aug-2010 Javier Martinez Canillas <martinez.javier@gmail.com> staging: comedi (adv_pci1723): use PCI_DEVICE() macro

Use PCI_DEVICE() macro for pci table entries on comedi driver and thus improves readability.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
727b286b44ea359d66f47d241cc2cdad36ed7bdc 06-Jun-2010 Arun Thomas <arun.thomas@gmail.com> Staging: comedi: Remove COMEDI_PCI_INITCLEANUP macro

Move the PCI devinit/devexit routines to the respective C source files
instead of calling COMEDI_PCI_INITCLEANUP

Signed-off-by: Arun Thomas <arun.thomas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
90f703d30dd3e0c16ff80f35e34e511385a05ad5 06-Jun-2010 Arun Thomas <arun.thomas@gmail.com> Staging: comedi: Remove COMEDI_MODULES_MACRO

Add MODULE_AUTHOR, MODULE_LICENSE, and MODULE_DESCRIPTION calls
to the respective C source files instead of calling COMEDI_MODULES_MACRO

Signed-off-by: Arun Thomas <arun.thomas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
59af888d6af8e3d2c91b32e00e43f2ce750589b8 01-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: move another pci vendor id

Move the vendor id to the drivers needing it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
af6ddd57f2e811561ca57a98b4c7a2bb1db6a270 30-Mar-2010 Maurice Dawson <mauricedawson2699@googlemail.com> Staging: comedi: fix brace, print(k) and over 80 character coding style issues in adv_pci1723.c

This is a Patch to the adv_pci1723.c file that fixes up brace, print(k) and over 80 character warnings found by the checkpatch.pl tool

Signed-off-by: Maurice Dawson <mauricedawson2699@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0a85b6f0ab0d2edb0d41b32697111ce0e4f43496 08-Jun-2009 Mithlesh Thukral <mithlesh@linsyssoft.com> Staging: Comedi: Lindent changes to comdi driver in staging tree

Lindent changes to comdi driver in staging tree.
This patch is followed by the checkpatch.pl error fixes.
Did not make them part of this patch as the patch size is already huge.

Signed-off-by: Mithlesh Thukral <mithlesh@linsyssoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5f74ea14c07fee91d3bdbaad88bff6264c6200e6 27-Apr-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: remove comedi-specific wrappers

There are a number of comedi "wrappers" for some RT functions that are
about to go away. This patch removes all of the wrapper calls within
the comedi drivers and core in order to prepare for removing the RT
comedi code.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
68c3dbff9fc9f25872408d0e95980d41733d48d0 23-Apr-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: fix the way structs are initialized.

Change from the foo: bar format to the .foo = bar format.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c3744138715045adb316284ee7a1e608f0278f6c 23-Apr-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: remove assignment in conditionals

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
da91b2692e0939b307f9047192d2b9fe07793e7a 09-Apr-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: fix "foo * bar" should be "foo *bar"

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d6d9bd32a02bd6da4ea3412f0b5131cc5a442399 27-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: remove C99 comments in adv_pci1723.c

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
006449f0fe747774438d714dcc4c6193d3a801ea 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove boardtype and pci1723_private typedefs in adv_pci1723.c

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0707bb04be89b18ee83b5a997e36cc585f0b988d 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_devconfig typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
90035c0886b256d75bced13b3b3cea5234aff136 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_insn typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
9ced1de69125b60f40127eddaa3be2a92bb0a1df 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_lrange typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
139dfbdfacb02e3ef3df936d2fabd1ad5f14ea88 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_driver typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
34c43922e62708d45e9660eee4b4f1fb7b4bf2c7 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_subdevice typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
71b5f4f11971dea972832ad63a994c7e5b45db6b 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_device typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
790c55415aa31f4c732729f94d2c3a54f7d3bfc2 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove lsampl_t and sampl_t typedefs

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
011f01bf9389deb6029e4eb4d93ee19130e6e3b5 19-Feb-2009 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: add adv_pci1723 driver

driver for Advantech PCI-1723 device

From: Ian Abbott <abbotti@mev.co.uk>
Cc: David Schleef <ds@schleef.org>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>