[go: nahoru, domu]

History log of /drivers/staging/comedi/drivers/ni_mio_cs.c
Revision Date Author Comments
0615c162f659fb96cbb97dfb2a0a315eecb7861f 14-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_common: refactor 'num_p0_dio_channels' boardinfo

All of the board supported by this driver have at least 8 Digital I/O
channels. A couple of the PCI boards in ni_pcimio have 32 channels.

For aesthetics, change this member of the boardinfo into a bit-field
flag, 'has_32dio_chan', and use that when initializing the DIO subdevice
to set the number of channels to 32 or 8.

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>
c5f26499998476edf599b599cd88163305dee5b2 14-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_stc.h: refactor 'aobits' boardinfo

For aesthetics, change the 'aobits' in the boardinfo to 'ao_maxdata'
to remove the need for the calculation of the subdevice '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>
db2255f5a0394fc5bc295a4b3e96667c46a7b9ef 14-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_stc.h: refactor 'adbits' boardinfo

For aesthetics, change the 'adbits' in the boardinfo to 'ai_maxdata'
to remove the need for the calculation of the subdevice '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>
b3d471e9bb845a542ee3bbc087e38a5b64170084 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_cs: remove ATMIO and PCIMIO defines

These defines were probably intended to be used so that ni_mio_common.c
could detect if it was included by a driver that uses ioport or memory
mapped register access. This can actually be detected by checking if
the 'mite' member in the private data has been allocated.

Regardless, the symbols are not used. Just 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>
b674f9df207dc7da7b77ada82e0fb072ba06267c 26-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_stc.h: the boardinfo 'name' should be first

By convention, the first member of the boardinfo is a 'const char *' to
the board name, especially for those comedi drivers that rely on the
comedi core to set dev->board_ptr to the entry matching the board name
when doing a legacy (*attach) to a comedi driver.

Modify the ni_board_struct appropriately for consistency, although the
board name is only used for informational purposes by this driver (only
the driver name is matched by the comedi core).

For aesthetics, also move the members in the boardinfo declarations.

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>
bfc8049a6508e1f1b6df5a71d13a0ded026b0ba5 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_cs: remove NI_SIZE define

This define is not used by the driver. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1fa955ba355bfa6eb83b8fd9cc6064a561291d1f 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_common.c: remove IRQ_POLARITY defines

Pass the irq_polarity to ni_E_init() and remove the defines.

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>
614b5cf097faabb969a0f7bc0f0a5eff3e48a07f 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_common.c: remove interrupt_pin() macros

Pass the 'interrupt_pin' to ni_E_init() and remove the macros.

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>
b30f0d0caa1ffc1051c82cfb42014e084b6ac4c3 19-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_stc.h: remove stc read/write callbacks from ni_private

The drivers that include ni_mio_common.c set the stc register read/write
callbacks to private functions that handle the read/write operations in
the correct manner for the hardware.

The ni_atmio and ni_mio_cs drivers use identical code to handle the
operations.

The ni_pcimio driver is a bit different due to the non-windowed setup
of the stc registers on the m series boards. For the other boards
supported by the ni_pcimio driver, the direct access of the first 8
STC registers is also disabled due to a difference on the 611x devices.

These differences can all be handled in the ni_stc_{read,write}[lw]()
helpers. Refactor the helpers and remove the callbacks from the private
data.

Also, move the helper functions the handle the mapping of the windowed
STC register offsets to M series register offset from ni_pcimio.c to
ni_mio_common.c.

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>
ac63baf5517cb7c22d63e2c5d269994f3002c7e0 19-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_stc.h: remove read/write callbacks from ni_private

The drivers that include ni_mio_common.c set the read/write callbacks
to private functions that handle the read/write operations in the
correct manner for the hardware. The ni_atmio and ni_mio_cs drivers
use ioport register access and the ni_pcimio driver uses memory mapped
register access. The memory mapped base address is stored in the 'mite'
pointer in the private data which is only allocated and initialized by
the ni_pcimio driver.

Detect the need for memory mapped register access by checking if the
'mite' pointer is set in the private data and remove the callbacks
from 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>
9c340ac934dbbfd46e776465b08391baac32d486 29-May-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_stc.h: add read/write callbacks to struct ni_private

The {read,write}[bwl] macros used to access the registers in the ni_atmio,
ni_mio_cs, and ni_pcimio drivers and the included ni_mio_common.c file all
rely on a local variable having a specific name. They also require some of
the ni_mio_common code to need a __maybe_unused tag on the devpriv local
variable.

Remove all the macros by converting them into private functions and storing
the callbacks in the private data.

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>
ffd0a782bae3ac8355963a1c2e8028a73c666018 29-May-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_stc.h: remove NI_PRIVATE_COMMON macro

This macro is used to create the private data structure that is used by
the ni_atmio, ni_mio_cs, and ni_pcimio drivers. These drivers all include
the ni_mio_common.c source to provide most of the driver functionality.

The only driver specific information needed to convert the macro into a
proper struct definition is the MAX_N_CALDACS define. This define is used
to size a couple array members in the struct. The ni_atmio and ni_mio_cs
drivers both define MAX_N_CALDACS as 32. The ni_pcimio driver defines it
as (16+16+2). The ni_mio_common file only uses this define to sanity check
that the struct members are large enough for the number of channels in
the calibration subdevice.

Move the MAX_N_CALDACS define to ni_stc.h and set it to the largest number
of caldacs (34).

The ni_atmio and ni_mio_cs drivers also add one additional member to the
private data struct before using the NI_PRIVATE_COMMON macro.

For the ni_atmio driver, the struct pnp_dev pointer can be saved in the
comedi_device as the 'hw_dev'. The (*detach) of this driver can then use
to_pnp_dev() to get it back when detaching the pnp device.

In the ni_mio_cs driver, the struct pcmia_device pointer is not used so
it can simply be removed.

The NI_PRIVATE_COMMON macro can then be converted into a proper struct
definition.

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>
d2601699d3381525d87cc7ccb3e886697c5af812 22-Nov-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: remove comedi_debug module parameter

Remove this module parameter and use the CONFIG_COMEDI_DEBUG option to
enable normal kernel debugging with -DDEBUG flag.

Remove the #undef DEBUG from all the comedi source files so they will
honour the -DDEBUG flag.

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>
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>
82e9ee616a89f152f42c7051c5f9f5f0d7663652 06-Feb-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_cs: use pcmcia_request_irq()

Use pcmcia_request_irq() instead of request_irq() to request the
shared irq for the PCMCIA device. This allows the PCMCIA core to
clean up the registration in pcmcia_disable_device().

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>
5cd8e852629fc7f1bdaacbdd32fe4139b9944f8b 06-Feb-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_cs: use comedi_pcmcia_{enable, disable}

Use the comedi_pcmcia_{enable,disable} helpers to enable/disable
the PCMCIA device.

This driver uses a local (*conf_check) to check the pcmcia_device
configuration.

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>
42d1aeea844874961af00621f0a5584aa9b9e1a5 31-Jan-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_mio_cs: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the "hack" needed to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_driver.

We still need the boardinfo because ni_mio_common.c uses it. Cleanup
ni_getboardtype() so it returns a pointer to the boardinto instead
of the index.

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>
885d8bce7f6e834c190ee3c60561c1c6c0e6174b 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: cleanup the boardinfo declaration

For aesthetic reasons, reformat the boardinfo declaration and
add some whitespace. Remove all the information that is set to
'0' as this is the default.

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>
678a6ff3e98ddbb049f3a012520c36da3065af4d 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: cleanup mio_cs_attach()

Remove the DPRINTK() function trace message as well as the #if 0'ed
out debug code that dumps the board "fingerprint".

Remove the need for the local variable that holds the link->irq
passed to request_irq(). Also, return the error code from that
function instead of assuming -EINVAL. Use the dev->board_name for
the resource string passed to request_irq() instead of the open
coded string "ni_mio_cs".

For aesthetic reasons, add some whitespace to the initializatio
of the devpriv values.

Just return the result of ni_E_init() instead of checking it for
an error, returning the error, or returning "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>
616b7a479e190e099f75073231c027fa393da5b2 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: remove last forward declaration

Move the ni_getboardtype() function to remove the last forward
declaration in this file.

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>
abbe0796baa03610f3147c786c7c3f20b0050c1d 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: move mio_cs_detach()

For aesthetic reasons, move this function down so it's by the
comedi_driver declaration.

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>
aaefe848e056474a583b43c13c4891fbda50caa4 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: move comedi_driver declaration

Move the comedi_driver declaration down in the file. This gets
rid of the need for a couple forward declarations.

For aesthetic reasons, add some whitespace to the declaration.

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>
e5e7ff89e660e8e1a0861062197f3fd4d7576c41 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: cleanup cs_attach()

Absorb the code from mio_cs_config() into this function and
properly return the error if the configuration fails.

Remove the DPRINTK() function trace message.

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>
1b69a7577a2a67841c0a6fb742392457a7aa989c 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: remove cs_release()

This function simply calls pcmcia_disable_device(). Remove it and
just call pcmcia_disable_device() where 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>
bea5b9035dae264e5da4a8a6aacc8bace0647c35 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: move pcmcia_driver functions

For aesthetic reasons, move all the pcmcia_driver functions so they
are near the pcmcia_driver declaration. This also removes the need
for a couple forward 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>
63e563af82e643cc0aaf3409fea2328809f2cf36 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: remove pcmcia_driver suspend/resume

The pcmcia_driver suspend and resume functions in this driver
don't do anything. Since they are optional just remove them.

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>
b8f4c930e0ff5340e3fea6b1142ccf7100df6d76 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: remove setting dev->driver

The comedi core sets the dev->driver pointer before calling the
comedi_driver 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>
a7538b8271b2abe6fa4cc8b8ce684d2970de1bfb 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: cleanup pcmcia_driver

For aesthetic reasons, reorder the pcmcia_driver variables and
add some whitespace.

Also, remove the unnecessary '&' before the function names. They
are already addresses.

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>
27629c600d6090af0f9d5af9a09bf9dd2aff5adf 26-Jan-2013 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: move MODULE_* info to end of file

For aesthetic reasons, move all the MODULE_* information to the end
of the file.

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>
235bee772b0fa4cf059c669bcaa733da08b4894c 14-Jan-2013 Peter Huewe <peterhuewe@gmx.de> staging/comedi/ni_mio_cs: Convert to module_comedi_pcmcia_driver

This patch removes the boring init/exit functions with the new
module_comedi_pcmcia_driver macro.

Also removed the superflous #ifdef MODULE

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a29f7a9525f9d8bae1614c0295a008029dfd3079 01-Nov-2012 YAMANE Toshiaki <yamanetoshi@gmail.com> staging/comedi: Use dev_ printks in drivers/ni_mio_cs.c

fixed below checkpatch warnings.
- WARNING: printk() should include KERN_ facility level

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d03bf7ad255cc29204b06761e5f8c3adb3173024 01-Nov-2012 YAMANE Toshiaki <yamanetoshi@gmail.com> staging/comedi: fix the initialize statics issue in drivers/ni_mio_cs.c

fixed below checkpatch error.
- ERROR: do not initialise statics to 0 or NULL

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31d7424be0f3ef613b01ac1c9b9ec59b49e59287 01-Nov-2012 YAMANE Toshiaki <yamanetoshi@gmail.com> staging/comedi: fix the spaces issue at the start of line in drivers/ni_mio_cs.c

fixed below checkpatch warnings.
- WARNING: please, no spaces at the start of a line

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0e05c55226bffcdd3f1393d5ab74cd0d9faff385 15-Oct-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_common: remove devpriv macro

The ni_mio_common.c file is #include'd by the ni_atmio, ni_mio_cs,
and ni_pcimio drivers. Those drivers all have a devpriv macro of
this type:

This macro relies on a local variable having a specific name.
Remove its use in all the files by replacing it with a local
variable.

Some of the functions in ni_mio_common.c don't always use the
devpriv variable due to differences in how the low-level i/o
is handled by the driver. Tag the variable in those functions
with __maybe_unused to avoid compile warnings.

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>
3243785c39836fdded4ad76797941fad7e504227 17-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_mio_cs: local symbols should not be exported

The symbol ni_mio_cs_driver is only referenced in this file. Make
it static.

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>
5b6137d8807524c9ecd9a35ff77421ab52a8e955 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_mio_common: don't pass config options to ni_E_init()

`ni_E_init()` doesn't use the second parameter pointing to a `struct
comedi_devconfig` passed from a comedi `attach` handler, so remove the
parameter.

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>
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>
2202a5a7490a9de282846ea8d4a56d0249e09033 04-May-2011 Joe Perches <joe@perches.com> staging: pcmcia: Convert pcmcia_device_id declarations to const

Reduces data, increases text.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2e9b981a7c63ee8278df6823f8389d69dad1a499 08-Aug-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: move driver name to struct pcmcia_driver

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
00990e7ce0b0e596fe41d9c64d6933ea70084003 30-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: use autoconfiguration feature for ioports and iomem

When CONF_AUTO_SET_IO or CONF_AUTO_SET_IOMEM are set, the corresponding
fields in struct pcmcia_device *p_dev->resource[0,1,2] are set
accordinly. Drivers wishing to override certain settings may do so in
the callback function, but they no longer need to parse the CIS entries
stored in cistpl_cftable_entry_t themselves.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: linux-bluetooth@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
440eed43e2a95bb842488755683716814da10f2b 30-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: introduce autoconfiguration feature

Introduce an autoconfiguration feature to set certain values in
pcmcia_loop_config(), instead of copying the same code over and over
in each PCMCIA driver. At first, introduce the following options:

CONF_AUTO_CHECK_VCC check or matching Vcc entry
CONF_AUTO_SET_VPP set Vpp
CONF_AUTO_AUDIO enable the speaker line

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
1ac71e5a35eebee60cdcf15b3980bd94498f037b 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device

pcmcia_enable_device() now replaces pcmcia_request_configuration().
Instead of config_req_t, all necessary flags are either passed as
a parameter to pcmcia_enable_device(), or (in rare circumstances)
set in struct pcmcia_device -> flags.

With the last remaining user of include/pcmcia/cs.h gone, remove
all references.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
37979e1546a790c44adbc7f27a85569944480ebc 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: simplify IntType

IntType was only set to INT_MEMORY (driver pcmciamtd) or INT_MEMORY_AND_IO
(all other drivers). As this flags seems to relate to ioport access, make
it conditional to the driver having requested IO port access. There are two
drivers which do not request IO ports, but did set INT_MEMORY_AND_IO:
ray_cs and b43. For those, we consistently only set INT_MEMORY in future.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
90abdc3b973229bae98dd96649d9f7106cc177a4 24-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: do not use io_req_t when calling pcmcia_request_io()

Instead of io_req_t, drivers are now requested to fill out
struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
ranges. After a call to pcmcia_request_io(), the ports found there
are reserved, after calling pcmcia_request_configuration(), they may
be used.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Michael Buesch <mb@bu3sch.de>
Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
9a017a910346afd88ec2e065989903bf211a7d37 24-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: do not use io_req_t after call to pcmcia_request_io()

After pcmcia_request_io(), do not make use of the values stored in
io_req_t, but instead use those found in struct pcmcia_device->resource[].

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
ac8b422838046ffc26be4874a3cbae0d313f4209 21-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: remove cs_types.h

Remove cs_types.h which is no longer needed: Most definitions aren't
used at all, a few can be made away with, and two remaining definitions
(typedefs, unfortunatley) may be moved to more specific places.

CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/)
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
ebe8622342f12bed387f7de4b5fb7c52005ccb29 31-May-2010 Martin Homuth-Rosemann <homuth-rosemann@gmx.net> Staging: comedi - correct parameter gainlkup for DAQCard-6024E in driver ni_mio_cs.c

Correct at least one of the incorrect specs for a national instrument
data acquisition card DAQCard-6024E. This card has only four different
gain settings (+-10V, +-5V, +-0.5V, +-0.05V).

Signed-off-by: Martin Homuth-Rosemann <homuth-rosemann@gmx.net>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
bfc2cc3497dfa7800faa9d2915e997d65daaf56e 30-Apr-2010 Javier Martinez Canillas <martinez.javier@gmail.com> drivers/staging/comedi: dev_node removal (ni_mio_cs)

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
6c7f81967b8984e6fb6b1f04c63f32d90a15c479 13-May-2010 Alexander Kurz <linux@blala.de> staging: comedi PCMCIA-drivers: adding MODULE_AUTHOR, MODULE_DESCRIPTION and MODULE_LICENSE

this adds and sorts the module labels MODULE_AUTHOR, MODULE_DESCRIPTION
and MODULE_LICENSE for all comedi PCMCIA drivers.

Signed-off-by: Alexander Kurz <linux@kbdbabel.org>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
eb14120f743d29744d9475bffec56ff4ad43a749 07-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: re-work pcmcia_request_irq()

Instead of the old pcmcia_request_irq() interface, drivers may now
choose between:

- calling request_irq/free_irq directly. Use the IRQ from *p_dev->irq.

- use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
clean up automatically on calls to pcmcia_disable_device() or
device ejection.

- drivers still not capable of IRQF_SHARED (or not telling us so) may
use the deprecated pcmcia_request_exclusive_irq() for the time
being; they might receive a shared IRQ nonetheless.

CC: linux-bluetooth@vger.kernel.org
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: linux-usb@vger.kernel.org
CC: linux-ide@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
b055d0d3c74a7b9bbf18806b2814632a9da922f3 08-Oct-2009 Daniel Patrick Johnson <teknotus@teknot.us> Staging: comedi: ni_mio_cs.c: coding style cleanup

Signed-off-by: Daniel Patrick Johnson <teknotus@teknot.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5fa9167a1bf5f5a4b7282f5e7ac56a4a5a1fa044 08-Nov-2009 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia: rework the irq_req_t typedef

Most of the irq_req_t typedef'd struct can be re-worked quite
easily:

(1) IRQInfo2 was unused in any case, so drop it.

(2) IRQInfo1 was used write-only, so drop it.

(3) Instance (private data to be passed to the IRQ handler):
Most PCMCIA drivers using pcmcia_request_irq() to actually
register an IRQ handler set the "dev_id" to the same pointer
as the "priv" pointer in struct pcmcia_device. Modify the two
exceptions (ipwireless, ibmtr_cs) to also work this waym and
set the IRQ handler's "dev_id" to p_dev->priv unconditionally.

(4) Handler is to be of type irq_handler_t.

(5) Handler != NULL already tells whether an IRQ handler is present.
Therefore, we do not need the IRQ_HANDLER_PRESENT flag in
irq_req_t.Attributes.

CC: netdev@vger.kernel.org
CC: linux-bluetooth@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-scsi@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: Jaroslav Kysela <perex@perex.cz>
CC: Jiri Kosina <jkosina@suse.cz>
CC: Karsten Keil <isdn@linux-pingi.de>
for the Bluetooth parts: Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
55a19b39acb8888af8e9cfe5b762d03c52fdb48c 29-Oct-2009 Dominik Brodowski <linux@dominikbrodowski.net> pcmcia/staging: update comedi drivers

Update comedi PCMCIA drivers to work with recent PCMCIA changes documented
in Documentation/pcmcia/driver-changes.txt:

- use pcmcia_config_loop()
- don't use PCMCIA_DEBUG, but use dev_dbg()
- don't use cs_error()
- re-use prod_id and card_id values already stored

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
3d1c28848ea37bf117940e10826f7a485aa32337 22-Sep-2009 Frank Mori Hess <fmhess@users.sourceforge.net> Staging: comedi: pcmcia irq fixes

Replaced IRQ_TYPE_EXCLUSIVE with IRQ_TYPE_DYNAMIC_SHARING for pcmcia
drivers.

Signed-off-by: Frank Mori Hess <fmhess@users.sourceforge.net>
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>
f7cbd7aad063b2a4b7aff6a743b2b00015ce3c3e 09-Apr-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Add spaces after commas

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>
72a822807272f8bb29a527e7e3c60efc7032a9ba 17-Apr-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: fix build errors in pcmcia comedi drivers

This fixes a few minor build errors that were previously undetected in
the comedi pcmcia drivers.

Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2696fb57e6af653dd8b4df41b16754579f42fc78 27-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove C99 comments

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

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>
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>
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>
4dc6b15bce9c0635850a9f5c1a493e09d2e8fe61 03-Mar-2009 Mariusz Kozlowski <m.kozlowski@tuxland.pl> Staging: comedi: remove unnecessary #include <linux/version.h>

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
4fecf4a2a64c453ea8e57c166edb5385082e3948 13-Feb-2009 David Schleef <ds@schleef.org> Staging: comedi: add nt_mio_cs driver

Hardware driver for NI PCMCIA MIO E series cards
Supports DAQCard-AI-16XE-50 (ni_mio_cs), DAQCard-AI-16E-4,
DAQCard-6062E, DAQCard-6024E, DAQCard-6036E

From: 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>