[go: nahoru, domu]

History log of /drivers/staging/comedi/drivers/ni_pcidio.c
Revision Date Author Comments
7be7f9c3e3f87fd1263014a14b177409b6542e54 10-Sep-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: prevent "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. The (*do_cmd) then sets up and starts the command without handling the "empty
acquisition". This results in the interrupt function trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

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>
b302b8be957f73a9a59b46bf3982c70bbd737c6c 03-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: use CMDF_ROUND_...

Replace use of the `TRIG_ROUND_...` macros with the new names
`CMDF_ROUND_...`. The numeric values are unchanged.

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>
5f8a5f4fa4c2c3fa7e66c7b002039a8046e4d99d 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: mite: use the comedi_device 'mmio' member

Use the new 'mmio' member in the comedi_device for the ioremap'ed
'daq_io_addr'.

Move the iounmap of this address from mite_detach() to the drivers
that use the mite module.

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>
3bb7c3abe34349a5f3615159d80aaee25c34e2a7 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: mite: pass comedi_device to mite_setup()

For aesthetics, pass the comedi_device to mite_setup() and mite_setup2()
so that the dev->class_dev can be used in the dev_{level} message to make
the messages have consistancy with the other comedi drivers.

Remove the extra dev_warn() noise in the drivers when mite_setup() fails.

Rename the 'use_iodwbsr_1' parameter and change it to a bool.

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>
d546b8966e66b114809d4af14e2d837adeeec2fc 21-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedidev.h: remove 'new_size' param from subdevice (*buf_change)

This parameter is never used by any of the comedi drivers that provide a
(*buf_change) callback. If the 'new_size' is needed in the callback it can
be found from the 's->async->prealloc_bufsz' as done in the ni_pcidio driver.

Remove the unused parameter.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
862755ec07572036b0c69d738b88f89b6beede99 19-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: remove unnecessary *_SIZE defines

Some of the legacy comedi drivers have a *_SIZE define that is only
passed to comedi_request_region() to specify the size of the region.

Some of the pnp drivers (pci, etc.) also have a *_SIZE define which
is unused.

For aesthetics, remove these 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>
5d6e2298b29113e6b71f1c30bfcfc70051abdcec 19-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove forward declarations

Move some of the functions to remove the need for the forward
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>
a207c12f62e8b53e1e1600ca384b13a39a9feed2 19-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: cleanup cmd->flags use

Most of the comedi drivers that support async commands have some sort
of timer to control the acquisition timing. For these drivers, Step 4
of the (*do_cmdtest) operations calls a ns_to_timer() function that
converts the desired ns time of the command into a value used to set
the timer. These ns_to_timer() functions also typically pass the
cmd->flags in order to determine the desired rounding mode.

Some of the drivers mask the cmd->flags with TRIG_ROUND_MASK when
calling the ns_to_timer() functions. Move all the masking into the
ns_to_timer() functions and just pass the cmd->flags directly.

The cmd->flags member is an unsigned int, change the parameter type
in the the ns_to_timer() functions to match.

For aesthetics, rename the parameter in all the ns_to_timer()
functions to 'flags'.

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>
74e9607b978e836d2b6d99cc3ecaa9ca968e0dc5 17-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove use of comedi_error()

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

Fix the 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>
b876e985c2273b7bd2d5539f2147ef69f7701129 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: mite: cleanup mite_unsetup()

This function is only called by comedi drivers during the (*detach) of the
driver. After it is called mite_free() is always called to kfree the allocated
mite_struct pointer.

Rename this function to mite_detach() and merge the kfree() from mite_free()
into it.

Remove the unnecessary clearing of the mite variables since the mite pointer
is going to be kfree()'d anyway.

The mite_detach() function checks if the pointer is valid so remove the
unnecessary checks in the callers.

The check can also be removed in ni_660x since the ni_660x_free_mite_rings()
function does not actually need the 'mite' pointer.

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>
ba9d29fe102d4b4e388ba510f4a71b8b737144b9 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: mite.h: remove mite_irq()

This inline function simply returns the 'irq' of the struct pci_dev pointer
that is stored in struct mite_struct. This pci_dev pointer is the same as
the one that is already available in the (*auto_attach) functions where
mite_irq() is used.

Use the pci_dev pointer directly to get the irq and remove the unnecessary
inline function to remove the indirection.

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>
f4f3f7cf27e7ae015672b59ec40c7deabeaf5d2e 20-Jun-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: introduce comedi_buf_n_bytes_ready()

Introduce an inline helper to return the number of bytes that are
ready to read from the comedi_async buffer. Use the helper in the
comedi drivers that currently do the calculation as part of the
(*poll) operation.

Also, use the helper in comedi_fops where the calculation is used as
part of the subdevice going nonbusy.

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>
370936b1776b7444190850fa050ae912c18f0dd0 27-May-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: use comedi_fc helpers to validate timer arg

Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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>
74f63db7ae614aee8370df6152c0da76e14b6ff0 06-May-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: mite: pass subdevice to mite_sync_input_dma()

`mite_sync_input_dma()` in the "mite" module currently takes a pointer
to a `struct comedi_async` and gets a pointer to the owning `struct
comedi_subdevice` from the `subdevice` member. Change it to take a
pointer to a `struct comedi_subdevice` and use the `async` member.

The motivation for this is to eliminate the `subdevice` member of
`struct comedi_async`.

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>
b74e635d1c00b2532d32de4173115b08047229ed 06-May-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: mite: pass subdevice to mite_buf_change()

`mite_buf_change()` in the "mite" module currently takes a pointer to a
`struct comedi_async` and gets a pointer to the owning `struct
comedi_subdevice` from the `subdevice` member. Change it to take a
pointer to a `struct comedi_subdevice` and use the `async` member.

The motivation for this is to eliminate the `subdevice` member of
`struct comedi_async`.

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>
24e894bbf247ecdeed3ed2f77f658da756760f60 06-May-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: pass subdevice to comedi_buf_write_alloc()

Change the parameters of `comedi_buf_write_alloc()` to pass a pointer to
the comedi subdevice instead of a pointer to the "async" structure
belonging to the subdevice.

The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.

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>
3672effdeae5395d661a2103f69082146ef949fc 06-May-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: pass subdevice to comedi_buf_put()

Change the parameters of `comedi_buf_put()` to pass a pointer to the
comedi subdevice instead of a pointer to the "async" structure belonging
to the subdevice.

The function puts a sample value in the comedi buffer, but currently
only deals with 16-bit sample types. A future version could deal with
16 or 32-bit sample types depending on the value of the SDF_LSAMPL
subdevice flag.

The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.

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>
e702c66c0724c09e8efb87cb6fff8100e988cdb0 17-Apr-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: fix the cmd->start_arg use for TRIG_INT

This driver only a cmd->start_src of TRIG_NOW or TRIG_INT. The cmd->start_arg
is trivially validated for both sources to be 0. For a TRIG_INT source, the
cmd->start_arg is actually the valid trig_num that is passed to the async
(*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used to check
the trig_num instead of the open coded value.

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>
a4ccee260caee624ffc6c61327ed78ea19d08e3a 08-Mar-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: use cfc_handle_events()

Use the comedi_fc helper function instead of duplicating the code.

In the Kconfig, COMEDI_NI_PCIDIO selects COMEDI_FC indirectly by
selecting COMEDI_MITE which selects COMEDI_FC.

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>
7a68ef933b8d244fafed5bafd1572ed444ca4d1a 05-Dec-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: use dev->read_subdev

Use the dev->read_subdev that was setup in the device attach instead
of accessing the dev->subdevices array directly.

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>
de1e27a6df158162c963f44edfb4c0a1fcfe0766 05-Dec-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: factor board reset out of attach

Factor the code that resets the board and disables the interrupts out
of the attach.

Move the reset so it happens before the subdevices are initialized.

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>
19f5224b754823f1649f3094d916b0a775fc9d42 03-Dec-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: tidy up the irq request

The irq is only needed to support async commands. Tidy up the
code that does the request_irq() and remove the 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>
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>
096669a8301478641abf16bbc02db786e26165bd 26-Nov-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: mite: remove DEBUG_MITE code

The code protected by the DEBUG_MITE define outputs some development
debug information. This information is just added noise in the final
driver. Remove the code.

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>
20dad98dfedd2c3d8905e03b19ed4a6a2c1d73f3 26-Nov-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove use of DPRINTK

Remove the DPRINTK messages that are just function trace noise.

Use dev_dbg() instead of the DPRINTK macro to output the comedi
debugging information.

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>
52cdd1205f4aa1e7f861eab8353740665f078106 26-Nov-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove debug_int()

This function is not used by the driver. Just remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
055ace5e26d2459e472419c5785b88564b7df79a 26-Nov-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove DEBUG_FLAGS define and code

The DEBUG_FLAGS define enables some development code that outputs
interrupt flags and status information in the interrupt handler.
This information is just added noise. 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>
ac50a923858651752e1d08b04c7df8b490787a35 22-Nov-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove custom DPRINTK macro

The comedi core defines a DPRINTK macro in comedidev.h. Use that macro
instead of defining a private version in this driver.

Also, remove the DEBUG define since it was only used to enable the
DPRINTK macro.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
319b67ae1cf3c7c2339225c01c9c2456b4399140 16-Oct-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: sample types are unsigned

Sample values in comedi are generally represented as unsigned values.
Change `nidio_interrupt()` to use unsigned types for sample values
(actually bit-vectors of 1-bit sample values) instead of signed types.

Also rename the `AuxData` variable to `auxdata` and change it from
`long` to `unsigned int` as it only needs to hold a 32-bit value.

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>
ddf62f2c7bd041d35095b525ab33e3a3e0829aaa 06-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_dio_insn_config() for simple cases

Convert the drivers with simple, per channel programmable i/o, to use the
comedi_dio_insn_config() helper function.

All of these pass a 'mask' of '0' to comedi_dio_insn_config() this causes
the per channel mask to be used to configure the i/o direction.

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>
d569541e537e13136fc775a902cda06f4c48bbe1 17-May-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: use comedi_load_firmware()

Use comedi_load_firmware() instead of duplicating the code in a
private function.

This driver loads multiple firmware images to the device. Modify
comedi_load_firmware() to take a 'context' that is passed to the
firmware upload callback function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>
84b44d08993ffe762d9a86ee2243239350b871a4 15-Mar-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: remove unneeded settings of `dev->iobase`

Some PCI drivers use the "spare" `iobase` member of `struct
comedi_device` as a flag to indicate that the call to
`comedi_pci_enable()` was successful. This is no longer necessary now
that `comedi_pci_enable()` and `comedi_pci_disable()` use the
`ioenabled` member of `struct comedi_device` themselves to keep track of
what needs to be done.

Remove the unnecessary assignments to the `iobase` member in the
relevant drivers.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a7401cddcdf739d3cb9598c9b3787a732fc87809 15-Mar-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: make 'dev->attached' a bool bit-field

Change the `attached` member of `struct comedi_device` to a 1-bit
bit-field of type `bool`. Change assigned values to `true` and `false`
and replace or remove comparison operations with simple boolean tests.

We'll put some extra bit-fields in the gap later to save space.

Signed-off-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>
715988871f82a00b8bb36b7f2fdbd865c09b170e 05-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove this_board macro

This macro relies on a local variable having a specific name and
derives a pointer from that local variable.

It's only used in the attach and we already have the local variable
'board' that has the same information. Use that 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>
e69e860ef2f05df0f8f31854f8b353b9a52e85e7 05-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: remove n_ndio_boards macro

This macro is not used in the driver. 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>
6d6d443cb29671c5bb1d67cbbaacbfc503409581 05-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_pcidio: use the pci id_table 'driver_data'

Create an enum to the boardinfo and pass that enum in the pci_driver
id_table as the driver_data.

Change the macro used to fill in the device table from PCI_DEVICE() to
PCI_VDEVICE(). This allows passing the enum as the next field.

This allows removing the 'dev_id' data from the boardinfo as well the
search function that was used to locate the boardinfo for the PCI device.

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>
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>
616a14d7adfb2ee9bec6209500be6399771a2816 14-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_pcidio: use cfc_check_trigger_arg_*() helpers

Use the new helpers in the step 3 tests of ni_pcidio_cmdtest().

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>
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>
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>
27020ffed9166d65ce1e5b523051d13bfa2329b0 26-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: drivers: use comedi_fc.h cmdtest helpers

Use the cfc_check_trigger_src() helper for Step 1 in all the
driver cmdtest functions.

Use the cfc_check_trigger_is_unique() helper for Step 2 in all
the driver cmdtest functions. Note that single source triggers
do not need to be checked, they are already unique if they pass
Step 1.

For aesthetic reasons, change the comments in the cmdtest
functions for steps 1 and 2 so that they are all the same.

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>
08ebfcd205e30a8c42651b00d8c6722d03d9a2ae 17-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_pcidio: local functions should not be exported

The function ni_pcidio_event() 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>
f822a6a1a11759f0a694a4a3547c1186e1a2eaec 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

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>
21b74c2785c4bb28d42ce78ae15d06749e9bedfb 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: use comedi attach_pci callback

Convert this PCI driver to use the comedi `attach_pci` callback instead
of the `attach` callback for PCI auto-configuration. There is no need
to support manual attachment of PCI devices supported by this driver, so
remove the `attach` callback altogether.

Note that this driver still uses the list of PCI "mite" devices created
by the "mite" module. This will be dealt with by a later patch once
dynamic allocation of "mite" structures has been implemented.

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>
9fb5c14ceba8841ece02b5185501e1d999a2bcf6 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: use request_firmware()

The PCI-6534 needs three firmware files loading to work with the driver.
That is currently done by passing the firmware data using the
`COMEDI_DEVCONFIG` ioctl that uses the comedi `attach()` hook in the
driver. This doesn't work for auto-configured PCI devices (which also
currently use the `attach()` hook in this driver, but doesn't have the
firmware-loading options set in the `struct comedi_devconfig *`
parameter).

Change the driver to request the firmware files using
`request_firmware()`, ignoring any firmware-loading options set in the
`struct comedi_devconfig`.

The PCI-6534 has a main FPGA which needs to be loaded first, and two
"scarabs". Scarab A is loaded with firmware to support digital input
mode, and scarab B is loaded with firmware to support digital output
mode.

I don't think the order of loading the scarab firmwares matters as long
as they are loaded with the correct firmware files. This update loads
scarab B first, whereas the original code loaded scarab A first. The
firmware files are loaded in the following order:

A) main FPGA: "ni6534a.bin" (FW_PCI_6534_MAIN)
B) scarab B: "niscrb02.bin" (FW_PCI_6534_SCARAB_DO)
C) scarab A: "niscrb01.bin" (FW_PCI_6534_SCARAB_DI)

The required firmware files can be found in the
"comedi-nonfree-firmware" tar-ball at
<http://www.comedi.org/download/comedi-nonfree-firmware-2007.06.22.tar.gz>.

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>
6b26ecf0479e660e878014030b1f6e53d3787d75 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: convert printk() calls

Convert the `printk()` calls in this driver to use the `dev_...()` calls
where possible, or the `pr_...()` calls otherwise. Combine
non-line-terminated prints into single-line prints.

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>
b37c1aeed89062a82da9bf78c83db0328d08e95d 13-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: 8255_pci: move ni_pcidio 8255 board support

The 8255 based boards in the ni_pcidio driver are all simple
memory mapped 8255 boards that don't require the dma support
provided by the mite driver.

Move the support for these boards from the ni_pcidio driver to
the generic 8255_pci 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>
88892ca3cebe278b4eaa8ab692d45adb1c1439fc 06-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_pcidio: 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>
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>
520706607befd1f5c20ec14db35d6be45791bc41 18-Jun-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: remove unneeded sanity check in insn_bits functions

The comedi core does the sanity check to make sure that the data length
the INSN_BITS instruction is 2. There is no need for the drivers to do
this check. Remove all the sanity checks in the drivers.

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>
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>
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>
cb4c516ca14efd9dd64caf6dd3ae7558f0d480e3 16-May-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: refactor ni_pcidio driver and use module_comedi_driver

Move the module_init/module_exit routines and the associated
struct comedi_drive and struct pci_driver to the end of the
source. This is more typical of how other drivers are written
and removes the need for the forward declarations.

Convert the driver to use the module_comedi_pci_driver() macro
which makes the code smaller and a bit simpler.

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>
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>
22494ed9b8e9404d6646f85c835bcd7b37d3f562 09-Jan-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: Support trailing edge external trigger

This patch is ported over by me (Ian Abbott) from the out-of-tree Comedi
git repository at "git://comedi.org/git/comedi/comedi.git".

The original patch is by Nicholas Nell.

The patch adds support for trailing (falling) edge external triggers for
scans in asynchronous command support in the ni_pcidio driver. This is
supported at least on the PCI-DIO_32HS and PCI-6533 boards; not sure
about the other boards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Nicholas Nell <nicholas.nell@colorado.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
02f69d67684b77f7f04e281a026a790f0e08b3a3 09-Jan-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: Add comedi_poll support

This patch is ported over by me (Ian Abbott) from the out-of-tree Comedi
git repository at "git://comedi.org/git/comedi/comedi.git".

The original patch is by Nicholas Nell.

The patch adds support for the COMEDI_POLL ioctl to the ni_pcidio
driver.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Nicholas Nell <nicholas.nell@colorado.edu>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
e3794b52f56ac20947a2dbdd505e9ad29013c555 09-Jan-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: Grab MITE spinlock while preparing DMA.

When setting up the DMA for 'read' streaming acquisition command, grab
the MITE channel spinlock before preparing and arming the DMA.

Change inspired by ni_ai_setup_MITE_dma() in ni_mio_common.c.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
41add2e84bff0c887949698e01dab28105f11a6b 09-Jan-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_pcidio: Mark buffer for writing when setting up DMA.

When setting up the DMA for 'read' streaming acquisition on the DIO
subdevice, mark the whole buffer as writable before starting the DMA.
This prevents a spurious detection of a DMA overwrite of good data
during the first interrupt.

Problem reported by Nicholas Nell. Fix suggested by Frank Mori Hess.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13a9e03c0c209b59f07b72c5388845a5f55eda2a 19-Jul-2011 Bojan Prtvar <prtvar.b@gmail.com> Staging: comedi: fix initialization of static to 0 in ni_pcidio.c

This patch removes initialization of static to 0 or NULL error found
by checkpatch.pl tool

Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
3c323c01b6bd5fd01be21a8f0cdc11e55997aa06 07-Feb-2011 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: Add MODULE_LICENSE and similar to NI modules

As mentioned by W. Trevor King on the devel@linuxdriverproject.org list
on "Thu, 27 Jan 2011 18:52:15 -0500", "Message-ID:
<20110127235214.GA5107@thialfi.dhcp.drexel.edu>", the ni_pcimio module
is missing module metadata, including a license.

This patch adds module metadata to all the NI comedi driver modules. It
also removes a duplicate MODULE_LICENSE("GPL") line from the "mite"
module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: W. Trevor King <wking@drexel.edu>
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>
4e40cee9c8a46d4231d28ae7ae6d9938cf0526d5 01-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: use the standard NI pci device id

Don't redefine something that we already have in the core
kernel. Also move to use PCI_DEVICE() macros to make things
a bit simpler when changing the define.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2d2facda0b71609be294aa1fd5f56d2cdbcbb794 06-Feb-2010 Benjamin Adolphi <b.adolphi@googlemail.com> Staging: comedi: ni_pcidio: Checkpatch cleanups

This fixes almost all checkpatch issues in the ni_pcidio comedi driver.

Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
828684f9a6e096f9150bad523c43b75d74b9badd 29-Sep-2009 Dirk Hohndel <hohndel@infradead.org> Staging: comedi: trivial fix of a very frequent spelling mistake

something-bility is spelled as something-blity so a grep for 'blit'
would find these lines

this is so trivial that I didn't split it by subsystem / copy additional
maintainers - all changes are to comments The only purpose is to get
fewer false positives when grepping around the kernel sources.

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
4377a026500a3f59e9c41c23d03e55ff2e712379 12-Oct-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: fix sched.h build breakage

commit d43c36dc removed sched.h from interrupt.h. This broke some of
the comedi drivers. This patch fixes this.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
b6ac161364eccce1bea4a23a9de395883e90d7ab 22-Jul-2009 Stoyan Gaydarov <sgayda2@uiuc.edu> Staging: ARRAY_SIZE changes

These changes were a direct result of using a semantic patch
More information can be found at http://www.emn.fr/x-info/coccinelle/

Signed-off-by: Stoyan Gaydarov <sgayda2@uiuc.edu>
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>
25436dc9d84f1be60ff549c9ab712bba2835f284 28-Apr-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: remove RT code

This removes the unused RT code from the comedi subsystem.

A lot of drivers needed to then include interrupt.h on their own, as they
were picking it up through the comedi_rt.h inclusion.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
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>
56e9e16619a0c14dc948cf88b3a7aaa70ac92b45 23-Apr-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: more remove C99 comments

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
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>
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>
70265d24e3404fe798b6edd55a02016b1edb49d7 26-Mar-2009 Jiri Slaby <jirislaby@gmail.com> staging: comedi, remove interrupt.h

Remove interrupt wraparound. Use defines from linux/interrupt.h
instead.

Change also parameter types of functions taking ISR to irq_handler_t.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
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>
2e93aa5b5b8050090a22e162f9af6b18ca3ec47a 19-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove nidio96_private typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a7195f3d92f5fc560e597598a56d9c394b65ee81 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove nidio_board 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>
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>
ea6d0d4cab4f4f2d6a88f3bce4707fe92696fd3f 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_cmd 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>
d163679ceec20c50f9aee880fa76c0c1185244a8 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_async 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>
e20903165f0f11827657e0c5d3bfbfdaed13207b 19-Feb-2009 David Schleef <ds@schleef.org> Staging: comedi: add ni_pcidio driver

Driver for National Instruments PCI-DIO-96/PCI-6508, PCI-DIO-32HS, and
PCI-6503 cards.

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