History log of /drivers/staging/comedi/drivers/ni_labpc.c
Revision Date Author Comments
1b41976933378192871629ba8afa37cfa1003f85 19-Aug-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: split common code to ni_labpc_common

The "ni_labpc" module is a Comedi driver for the National Instruments
Lab-PC series of ISA data acquistion boards, and also provides common
code for the "ni_labpc_pci" and "ni_labpci_cs" modules (for PCI boards
and PCMCIA cards).

Split out the common code into a new module "ni_labpc_common", leaving
the driver for the ISA boards in the existing "ni_labpc" module. This
removes the C preprocessor conditional directives from the resulting
".c" files (although they remain in the included header file
"ni_labpc_isadma.h").

Unneccessary `#include` directives have been removed from the resulting
".c" files.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9439881a38c2bef6807954732768d636ff94c0d5 19-Aug-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: break lines after operators

For consistency, break lines before operators, not after.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4e3f39b16650db36bdc3f6a456f0a6509b6b6729 19-Aug-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: Logical continuations should be on the previous line

Fix checkpatch issues "CHECK: Logical continuations should be on the
previous line".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bd98a4abff8018e11273767404fb9ef3cdf8a807 19-Aug-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: Alignment should match open parenthesis

Fix checkpatch issues "CHECK: Alignment should match open parenthesis".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6569f098279225258e805e4c9a20805d87ab4277 19-Aug-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: use braces on all arms of `if` statement

Fix checkpatch issues "CHECK: braces {} should be used on all arms of
this statement".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13fec56c96b5b81d425c4eba734b02ab0377e5a7 19-Aug-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: remove unnecessary braces in labpc_common_attach()

Correct checkpatch issue "WARNING: braces {} are not necessary for any
arm of this statement".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5c19084bbd4ef7c0a10e5b01145b940edf872a63 12-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: 8255: handle memory mapped io

The drivers that use this module with memory mapped io all have the
ioremap'ed base address stored in the comedi_device 'mmio' member.

Introduce a default (*io) function that does 8-bit memory mapped io.

Modify subdev_8255_init() so that it takes a flag parameter indicating
if the io is port or memory mapped. Make the function static and rename
it to __subdev_8255_init().

Introduce two exported wrappers for __subdev_8255_init():

subdev_8255_init() - for drivers that do 8-bit port io
subdev_8255_mm_init() - for drivers that do 8-bit memory mapped io

Use subdev_8255_mm_init() in the drivers that do 8-bit memory mapped io
and remove the private (*io) functions.

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>
4085e93b9fecfad454159694c19efc36e7ac1cdf 12-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: 8255: refactor how the (*io) function works

Currently, all users of is module that use the default (*io) function
pass an 'iobase' to subdev_8255_init() of the form:

dev->iobase + OFFSET_TO_8255_BASE_REG

Now that the (*io) callback includes the comedi_device 'dev' pointer
the 'dev->iobase' does not need to be included.

Modify the default (*io) function, subdev_8255_io(), to automatically
add the dev->iobase to the address when reading/writing the port.

For aesthetics, rename the subdevice private data member to 'regbase'.
Also, rename the local variables in this module that are used to
access this member.

Add a comment in dev_8255_attach() about the 'iobase' that is passed
to subdev_8255_init(). For manually attached 8255 devices the io
region is requested with __comedi_request_region() which does not
set dev->iobase. For these devices the 'regbase' is actually the
'iobase'.

Remove the, now unnecessary, dev->iobase from all the callers of
subdev_8255_init(). There are a couple drivers that only passed the
dev->iobase. For those drivers pass a 'regbase' of 0x00.

Note that the das16m1 driver is a bit goofy. The devpriv->extra_iobase
is requested using __comedi_request_region() which does not set the
dev->iobase. But the starting address passed is dev->iobase + DAS16M1_82C55
so a 'regbase' of DAS16M1_82C55 is passed to subdev_8255_init().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ed8c80d0a4c65c062ee520cd167649b80afce16f 12-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: tidy up labpc_8255_mmio()

The 8255 driver (*io) callback now includes the comedi_device pointer.

Instead of passing the (cast) pointer to subdev_8255_init(), pass the
'iobase' of the 8255 registers (DIO_BASE_REG).

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>
09d6dd7490ee7f1dda926e309df370e28679a71c 12-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: 8255: add a comedi_device param to the (*io) callback

The 8255 driver uses an (*io) callback to read/write the registers
of the 8255 device. The default callback provided by the driver uses
inb()/outb() calls to access to registers based on an 'iobase' that
was initialized during the subdev_8255_init() and a 'port' value.

The users of this module can optionally provide a custom (*io) callback
to handle the read/write in another manner.

Make the (*io) callback a bit more flexible by also passing the
comedi_device pointer as a 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>
70f72867147b18fc36d2717cda6ddbaf4f71cf77 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: use the comedi_device 'mmio' member

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

Only the ni_labpc_pci module does the ioremap, its also the only
module that sets the 'has_mmio' member in the boardinfo. Remove
this member from the boardinfo and use dev->mmio to determine if
the I/O is memory mapped.

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>
adcd16a2983c4f29cabd0af3bc2881e97348a4ee 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: refactor labpc_8255_mmio()

Refactor the 8255 support code in preperation for using the comedi_device
'mmio' member.

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>
7c555f06fb6afc9e83b8b375e8cf131cfe355e95 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: don't pass dev->iobase to labpc_counter_set_mode()

Use the comedi_device parameter that is passed to this function to find
the dev->iobase so it does not have to be included in each call.

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>
3f1ecb9b429eb909cee4ab35b34cb8de5e0b3f78 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: don't pass dev->iobase to labpc_counter_load()

Use the comedi_device parameter that is passed to this function to find
the dev->iobase so it does not have to be included in each call.

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>
ac482be4b6312263ffd5101dc5e560d55c00b571 30-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: pass comedi_device to the I/O callbacks

This driver uses some callbacks in the private data to handle the
port mapped or memory mapped I/O used to access the hardware.

Pass the comedi_device pointer to the helper functions so that the
base address can be found and does not need to be included in each
call.

Also, remove the inline from the helper functions.

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>
2042088cd67d0064d18c52c13c69af2499907bb1 17-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: tidy up labpc_ai_scan_mode()

This function checks the cmd->chanlist to determine the scan mode
used to sample the analog inputs. All possible modes are checked
so the final pr_err() and return 0 can never be reached.

Tidy up the function a bit and remove the unreachable code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
b3780f1da1b1d4e0af32b0f71b590b2bfd9c3e63 17-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: 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>
d88e3da90f5210f859b19a11a00fa4d539eb7dbd 16-Jul-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: checkpatch.pl cleanup (else is not useful)

Fix the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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>
b727a91f59df86f022f868522fd0d1f9d294ca0b 27-May-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: use comedi_cmd pointer

Use a local variable to access the comedi_cmd as a pointer instead
of getting to from the comedi_async 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>
e74e98993da8dff62190c937d4371eda962e64b9 29-Apr-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix 8254 timer programming

As pointed out by Ian Abbott, the i8254_load() function does not
use the I8254_MODE* values to specify the "mode".

The labpc_counter_load() function in this driver is passed an
I8254_MODE* value so we need to use the i8254_set_mode() and
i8254_write() helpers instead of i8254_load() to program the
timers.

The calls to labpc_counter_load() will not fail so change the
return to void and remove all the unnecessary error handling.

Similarly, change the return type of labpc_counter_set_mode() to
void and remove the unnecessary error handling.

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>
c55881686302a5e7f19b82f0a163beec2cc314c3 17-Apr-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: clarify the cmd->start_arg validation

This driver supports cmd->start_src sources of TRIG_NOW and TRIG_EXT.
Refactor the (*do_cmdtest) to clarify the trivial validation of the
cmd->start_arg.

This also fixes a bug, the cmd->start_src has the trigger not the
cmd->start_arg.

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>
5089b058966c4f6a5ca33556ca8c3bc88be0ab4c 16-Apr-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: tidy up the chanlist checking

The labpc_ai_chanlist_invalid() function validates that the cmd->chanlist
is compatible with the hardware. This is step 5 of the (*do_cmdtest).

For aesthetics, rename this function and tidy up the code.

To minimize the noise, change the comedi_error(), which is a wrapper around
dev_err(), to dev_dbg().

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

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Also, remove the clearing of the events, comedi_event() does that.

In the Kconfig, COMEDI_NI_LABPC already 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>
cf7b57fd6ab357198a327e0c74100e984bbf850f 10-Feb-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: use comedi_timeout()

Use comedi_timeout() to wait for the analog input end-of-conversion.

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

Sample values in comedi are generally represented as unsigned values.
Change the type of the `data` variable in `labpc_ai_cmd()` from `short`
to `unsigned short` for consistency.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cb9cfd7ed3f6ed4c40167b4251cdb382b6b3ba1c 26-Sep-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: 8253.h: tidy up the i8253_cascade_ns_to_timer*() users

Introduce a couple defines for the common 8254 oscillator base values
used in the comedi drivers and remove the custom defines and open
coded values.

Change the i8253_cascade_ns_to_timer_2div() calls in the drivers to
the more generic i8253_cascade_ns_to_timer(). They are identical due
to the #define in the 8253.h header.

Remove the extra mask by TRIG_ROUND_MASK of the 'round_mode' parameter
to i8253_cascade_ns_to_timer(). That function already handles the mask.

Tidy up all the calls to i8253_cascade_ns_to_timer().

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>
a49061af1fe303964a56e27e3884361809e4b004 29-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: use comedi_range_is_unipolar()

Use the core provided helper function instead of duplicating it as
a private function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
72f2baeb75ba2e6e3ffbfb64890438f576f1d931 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: tidy up after DMA code migration

After migrating the ISA DMA handling code to the "ni_labpc_isadma"
module, get rid of an unneeded `#include` and a couple of unused
static variables.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9bd53e0398f490707549455c00475af4923df872 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: migrate DMA status handling

Migrate the code for checking and handling the interrupt status handling
for ISA DMA transfers into new a new function
`labpc_handle_dma_status()` in the "ni_labpc_isadma" module. Provide a
dummy inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma"
module is not being built.

The static function `handle_isa_dma()` also needs to move across to the
new module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f88e8e09880d4abe3cad98ec8889e0f46eb89e4d 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: migrate labpc_drain_dma()

Move `labpc_drain_dma()` into the "ni_labpc_isadma" module. Provide a
dummy inline function in "ni_labpc_isadma.h" if the module is not being
built.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
88dd0c0a8016d6d80ed47eb306c5b41e8af0f83a 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: migrate DMA transfer set-up

Migrate the code for setting up an ISA DMA transfer into a new function
`labpc_setup_dma()` in the "ni_labpc_isadma" module. Provide a dummy
inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma" module
is not being built.

The static function `labpc_suggest_transfer_size()` also needs to move
across to the new module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
50787fa99d80e86c9a22b7af16fd9827f733f3ab 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: move register defs to new file

The new "ni_labpc_isadma" module will need to access some register
definitions from "ni_labpc.c", which is not part of the module's source.
Move all the register definitions into a new, common header file
"ni_labpc_regs.h".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5c8a138e9d33df4960e3cb497c60723c7fbdacf9 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: use labpc_have_dma_chan()

Call the new static inline function `labpc_have_dma_chan()` from
`labpc_ai_cmd()` to check if the ISA DMA channel has been initialized,
tidying up the surrounding code and removing an `#ifdef`. If the
"ni_labpc_isadma" module is not being built, `labpc_have_dma_chan()`
doesn't bother checking the DMA channel and just returns `false`,
allowing the compiler to optimize out a small amount of code.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
86aff4bb11eb721b9be40dcd51f7571fb00edcde 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: migrate DMA channel init & free

Migrate the code for requesting an ISA DMA channel and a DMA buffer, and
the code for freeing them into two new functions in the
"ni_labpc_isadma" module: `labpc_init_dma_chan()` and
`labpc_free_dma_chan()`. Dummy inline functions are provided in
"ni_labpc_isadma.h" if the "ni_labpc_isadma" module is not being built.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9a6386623fc8a67f792b9df56acbd8758e1aa93d 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc_isadma: new module for ISA DMA support

It's just an empty module at the moment, selected by COMEDI_NI_LABPC_ISA
&& ISA_DMA_API && VIRT_TO_BUS, but will be populated by later patches to
migrate ISA DMA support for NI Lab-PC cards out of the "ni_labpc"
module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f12a34ca0b7f02f725965f39f9ccf5d5c339d3e0 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: don't clear cmd3 bits explicitly in labpc_ai_cmd()

`labpc_ai_cmd()` calls `labpc_cancel()` which already sets
`devpriv->cmd3` to 0. Remove the lines from `labpc_ai_cmd()` that clear
specific bits in `devpriv->cmd3` explicitly as they have no effect.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
725a70d8a68ef5368652c0c49631fefb361d62cf 28-Jun-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: fix possible double-free of dma_buffer

If `labpc_attach()` allocates memory for `devpriv->dma_buffer` but fails
to request a DMA channel, it frees `devpriv->dma_buffer` but leaves the
pointer set. Later, `labpc_detach()` frees `devpriv->dma_buffer` again,
which means it has been freed twice in this case.

Fix it by only setting `devpriv->dma_buffer` in `labpc_attach()` if the
DMA channel was requested successfully.

Signed-off-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>
588ba6dc5fb4bdca47a3da38c2718fbb82d3eee1 11-Jun-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: let core handle freeing s->private

Introduce a new subdevice runflags, SRF_FREE_SPRIV, and a new helper
function, comedi_set_spriv(), that the drivers can use to set the
comedi_subdevice private data pointer. The helper function will also
set SRF_FREE_SPRIV to allow the comedi core to automatically free the
subdevice private data during the cleanup_device() stage of the detach.

Currently s->private is only allocated by the 8255, addi_watchdog,
amplc_dio200_common, and ni_65xx drivers. All users of those drivers
can then have the comedi_spriv_free() calls removed and in many cases
the (*detach) can then simply be the appropriate comedi core provided
function.

The ni_65xx driver uses a helper function, ni_65xx_alloc_subdevice_private(),
to allocate the private data. Refactor the function to return an errno
or call comedi_set_spriv() instead of returning a pointer to the private
data and requiring the caller to handle it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5e763f7bd9fea0027e246e6c2cee291566a390a9 14-May-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove *_ai_gain_bits tables

The bits needed to set the analog input gain can be simply calculated
based on the 'range'.

The LabPC versions of the board do not have the '0x10' gain that the
LabPC+ board supports. By incrementing the range appropriately the
correct gain bits can still be calculated.

This allows removing the two gain tables, as well as the export, along
with the 'ai_range_code' data in the boardinfo.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1581a03573e6c9ebd931e31f9172cce25dcb69e6 24-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix build when VIRT_TO_BUS is not defined

After merging the final tree, the next-20130424 build (powerpc
allyesconfig) failed like this:

drivers/staging/comedi/drivers/ni_labpc.c: In function 'labpc_ai_cmd':
drivers/staging/comedi/drivers/ni_labpc.c:980:9: error:
implicit declaration of function 'virt_to_bus'
[-Werror=implicit-function-declaration]

The virt_to_bus() is only needed for the ISA DMA support in this driver.

On powerpc, CONFIG_COMEDI_NI_LABPC_ISA cannot be enabled due to the
depends on VIRT_TO_BUS but the PCI driver, ni_labpc_pci, can be enabled.
That driver uses the ni_labpc driver for the common support code shared
by the ISA, PCI, and PCMCIA boards.

The ISA specific support, and the optional ISA DMA support, are currently
still in the common ni_labpc driver. The ISA specific code is protected
by #if IS_ENABLED(CONFIG_COMEDI_NI_LABPC_ISA) and the ISA DMA support
is protected by #ifdef CONFIG_ISA_DMA_API. This allows the ISA support
to be enabled on architectures that support VIRT_TO_BUS and optionally
enables ISA DMA support if ISA_DMA_API is enabled.

Unfortunately, the ISA DMA code uses virt_to_bus(). This results in
the build failure for architectures that enable ISA_DMA_API but do not
have VIRT_TO_BUS.

Add a new member to the private data, dma_addr, to hold the phys_addr_t
returned by virt_to_bus() and initialize it in the ISA specific
labpc_attach().

For architectures that enable ISA_DMA_API but not VIRT_TO_BUS, this
will fix the build error. This is also safe for architectures the
enable both options but don't enable COMEDI_NI_LABPC_ISA because the
dma channel (devpriv->dma_chan) is only initialized in the ISA
specific labpc_attach().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
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>
70d52bce5523f2c6a7bf3f9a54dacc0be112a3e8 23-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove range_labpc_1200_ai export

The 'ai_range_table' boardinfo is only used to initialize the
analog input subdevice s->range_table. We can use the 'is_labpc1200'
flag in the boardinfo to determine which range table is needed.

This allows making range_labpc_1200_ai static and removing the
export as well as removing the 'ai_range_table' from the boardinfo.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
63d6ba20bab01ea1a92b3fe7718416a8527e009a 23-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup true/false flags in boardinfo

The 'register_layout' in the boardinfo can be represented as
a true/false flag instead of an enum. Rename the variable to
'is_labpc1200' and change it to an unsigned 1-bit bit-field.

The 'has_ao' variable is also a true/false flag. Change it to
an unsigned 1-bit bit-field.

Reorder the boardinfo data so that the bit-field data is grouped
together.

For aesthetic reasons, and move the 'const' variables then
reorder the boardinfo declarations to match the definition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a0eeed40100b2eca57afdf99d76c57dedd218a8a 23-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix legacy driver build

CONFIG_COMEDI_NI_LABPC_ISA is a tristate option. #if IS_ENABLED()
needs to be used instead of #ifdef in order to build the legacy
specific code in this driver.

The local variable 'board' is not used in labpc_attach(). Remove it.

The labpc_detach() function is only referenced in this file. Make
it static.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a9b3ea3dbbb54f9160465f6f1086f877e958fdcc 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove 'bustype' from boardinfo

The 'bustype' in the boardinfo is not used. 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>
3a0a73b3c884ef43487d6c3b43af077d6da124b7 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove unnecessary 'bustype' check

Only the ISA versions of the LabPC boards support DMA and the
devpriv->dma_chan is only set during the ISA board attach if
DMA is available. The extra check of the board->bustype is not
necessary in labpc_ai_cmd().

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>
3e034797191de9981cddff4d1a8203d020360958 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: pass the isr_flags to labpc_common_attach()

The PCI and PCMCIA LabPC boards use shared interrupts and need the
IRQF_SHARED flag set when requesting the irq, the ISA boards do not.

Instead of checking the 'bustype' in labpc_common_attach() in order
to determine the isr_flags, just pass the flags as a parameter to the
function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
767308842b4b970ca105b1e80cd92af39355dfc5 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: move DMA init out of the common attach

Only the ISA versions of the LabPC boards support DMA. Move the DMA
initialization out of the labpc_common_attach() and put it in the
ISA specific labpc_attach() function.

Remove the 'dma_chan' parameter from labpc_common_attach().

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>
fa3cb2191091657038ddb9207888b6cfb11fdf6e 22-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: split out PCI support

Currently the ni_labpc driver is used by the legacy (ISA), PCI, and
PCMCIA versions of the LabPC board. The driver is enabled under the
COMEDI_PCI_DRIVERS section of the Kconfig. This means that PCI support
must be enabled in order to use the ni_labpc driver for the PCI or
PCMCIA drivers.

Split the PCI support code out of the ni_labpc driver into a separate
driver, ni_labpc_pci. The PCMCIA support is already slip out as
ni_labpc_cs.

Modify the Kconfig so that the common code in ni_labpc is enabled by the
Kconfig option COMEDI_NI_LABPC. The ISA support code is currently still
in the ni_labpc driver but is only compiled in if COMEDI_NI_LABPC_ISA is
also enabled.

This allows the PCI and PCMCIA drivers to be enabled without the need
for the ISA stuff.

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>
3d1fe3f785c80e17f62acf8f92570ae9210bd588 18-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: free_irq() in comedi_legacy_detach()

All the legacy comedi drivers now call comedi_legacy_detach()
either directly or as part of their (*detach). Move the free_irq()
into comedi_legacy_detach() so that the drivers don't have to
deal with it.

For drivers that then only call comedi_legacy_detach() in their
private (*detach), remove the private function and use the helper
directly for the (*detach).

The amplc_pc236 and ni_labpc drivers are hybrid legacy/PCI drivers.
In the detach of a PCI board free_irq() still needs to be handled
by the driver.

The pcl724 and pcl726 drivers currently have the free_irq() #ifdef'ed
out. The comedi_legacy_detach() function sanity checks that the irq
has been requested before freeing it so they are safe to convert.

For aesthetic reasons, move the #ifdef unused chunk in the pcl816
driver up to the previous #ifdef unused block.

The pcmio and pcmuio drivers request multiple irqs and handle the
freeing of them. Remove the 'dev->irq = irq[0]' in those drivers
so that comedi_legacy_detach() does not attempt to free the irq.

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>
a32c6d0084992d3e58a93120c9ce9527e80c651e 18-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: drivers: use comedi_legacy_detach()

Use comedi_legacy_detach() to release the I/O region requested
by these 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>
2f69915c728c3be41e12dbbbdd4eeb8d3388d58c 16-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: introduce, and use, comedi_spriv_free()

The comedi_subdevice 'private' variable is a void * that is available
for the subdevice to use in manner. It's common in comedi drivers for
the driver to allocate memory for a subdevice and store the pointer
to that memory in the 'private' variable. It's then the responsibility
of the driver to free that memory when the device is detached.

Due to how the attach/detach works in comedi, the drivers need to do
some sanity checking before they can free the allocated memory during
the detach.

Introduce a helper function, comedi_spriv_free(), to handle freeing
the private data allocated for a subdevice. This allows moving all the
sanity checks into the helper function and makes it safe to call
with any context. It also allows removing some of the boilerplate
code in the (*detach) functions.

Remove the subdev_8255_cleanup() export in the 8255 subdevice driver
as well as the addi_watchdog_cleanup() export in the addi_watchdog
driver and use the new helper instead.

The amplc_dio200_common driver uses a number of local helper functions
to free the private data for it's subdevices. Remove those as well and
use the new helper.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5b365a8ace90bd027a34f0db4c1c28f2ba433910 10-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: use comedi_request_region()

Use comedi_request_region() to request the I/O region used by this
driver.

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>
de024b3d57ba93f8a63a1610a15587e3358d4a4d 10-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: only ISA boards need to request_region()

Currently this driver calls request_region() in labpc_common_attach()
which is the common attach function for the ISA, PCMCIA, and PCI
versions of the labpc board.

The PCMCIA support is handled in a separate driver, ni_labpc_cs.
That driver sets the dev->iobase after aquiring the resource and
then just passes it to labpc_common_attach() which then sets
dev->iobase again.

The PCI support, currently in this driver, calls mite_setup() to
aquire the resource and then passes it to labpc_common_attach()
to set the dev->iobase.

The ISA support, also in this driver, passes a user supplied
configuration option to labpc_common_attach() which then does
the request_region() before setting the dev->iobase.

Move the request_region() to the ISA support code in labpc_attach()
and set the dev->iobase there before calling the common attach
code.

For the PCI support, also set the dev->iobase before calling the
common code.

This allows removing the extra parameter from labpc_common_attach().

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>
7a1e1f9ae5f15026126f09311b158d6673ad8200 10-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup dev->board_name usage

The dev->board_name is initialized by the comedi core before calling
the (*attach) or (*auto_attach) functions. It only needs to be updated
if the driver does any additional probing and changes the dev->board_ptr.

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>
7c00782b1d4b9073ae38891d636302b1267285af 26-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix labpc_calib_insn_write()

The comedi core expects the (*insn_write) operations to write insn->n
values and return the number of values actually wrote.

Make this function work like the core expects.

As Ian Abbott pointed out for the eeprom writes, we really only need
to write the last value to the caldac. The preceding data would be
overwritten anyway.

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>
198ac9dc7f0d06cd760d376c6a6c6217c5968d4a 26-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix labpc_calib_insn_read()

The comedi core expects the (*insn_read) operations to read insn->n
values and return the number of values actually read.

Make this function work like the core expects.

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>
43d092c67740704c9a8d04da2ca070bfca34207a 26-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: simplify labpc_range_is_unipolar()

As Ian Abbott pointed out, this helper function can be simplified
by just checking if the 'min' value is >= 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>
e7a1aa62823d8cc861aaad078006e6742c114a0e 26-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix labpc_eeprom_insn_write()

The comedi core expects the (*insn_write) operations to write insn->n
values and return the number of values actually wrote.

Make this function work like the core expects.

As Ian Abbott pointed out, we really only need to write the last value
to the eeprom. The preceding data would be overwritten anyway.

Also, remove the noise about invalid channels.

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>
1330af4c7deedd0b6d1ba43734d7e4eb1a83a491 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix labpc_eeprom_insn_read()

The comedi core expects the (*insn_read) operations to read insn->n
values and return the number of values actually read.

Make this function work like the core expects.

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>
63a93381ef17902c1d8dd33506163c43cf2178be 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: return bool from labpc_use_continuous_mode()

This is a simple true/false test, return bool instead of int.

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>
58cd9b91f809196adb39b52d1c18069ca73c8103 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup trigger setting in labpc_ai_cmd()

The (*do_cmdtest) already validated the cmd sources so the default
cases in the switch() statements can never happen.

Preclear to trigger bits and change the switch() statements to simple
if() tests to set the bits.

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>
83d75effa74dc26f5c989f7a4385c345dff1e58f 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove board attach noise

Remove the kernel noise in labpc_common_attach() as well as a couple
obvious comments.

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>
290899082a4214b16537be64a6b7e3882bb5aeb1 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: dma requires an interrupt

DMA support only works if an interrupt is available.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19a40abf5ee320e8f0874116989773b7c071aa08 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: allow board to attach without dma

If the dma channel is not available this driver will still work
with interrupts for the analog input subdevice command support.

In addition, only dma channels 1 and 3 are valid for the ISA
devices.

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>
0229979a329e7354adb17d3ccb98bce82d73eb59 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: allow board to attach without interrupt

If the interrupt is not available this driver will still work
with command support disabled for the analog input subdevice.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f06563f0132b21ce4258f977c58f9eb01c90cdd3 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: return error from labpc_counter_set_mode()

Make sure labpc_counter_set_mode() was successfull and return any
errno back to the caller.

For the if/else conditions that either load the counter of just set
the mode, use a common error patch to check for the error.

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>
fbca05d601a94d16912613d119f5b672a75a587f 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup labpc_counter_load() usage

For aesthetic reasons, move the labpc_counter_load() function so
it's by the labpc_counter_set_mode() function.

Update all the labpc_counter_load() calls so that the I8254_MODE*
enums are used instead of the open coded values.

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>
463f930401024926eadf4c613a547f2eb41a2882 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: introduce labpc_counter_set_mode()

Introduce labpc_counter_set_mode() which is a wrapper around the
i8254_set_mode() helpers to program the 8254 timers. Use the new
function instead of directly writing to the timer mode register
with a "magic" number.

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>
161ce6fa4b6c3538f104e51e101771a2abc72677 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove inline from labpc_counter_load()

Let the compiler figure out if this function should be inlined.

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>
488ec9f12d8b9768798987b4660b82cbb6ed181b 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: move a couple of the #define's

For aesthetic reasons, move a couple of the #defines in this file
so that the register map defines are first.

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>
42cb6a82a9ed770a3fccc8fbbff54a0fff1e9881 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: clean up register map

Rename the register map defines to better match the National
Instruments Register-Level Programming Manual for the labpc.

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>
31922394179b5ddaaa4184642186285a519702a4 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: clean up multi-line comments

Clean up the multi-line comments at the beginning of the file
so that they follow the CodingStyle.

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>
d5c8d9c411f2a95d42c90dcdee754447a505d4d7 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix a > 80 char line issue

Fix a checkpatch.pl warning about a line over 80 characters.

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>
810c73c7e7d3892fb508e28ca774d69309c316a2 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: introduce labpc_ai_wait_for_data()

Introduce a helper function to wait for the a/d conversion to
complete.

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>
3c4dfac8f7d2504234d1b7e3108e401a882bb9e1 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: introduce labpc_read_adc_fifo()

Introduce a helper function to read the a/d conversion result
from the fifo.

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>
359553bb3b4d19207c5a7439eaae1b1ea186a859 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: introduce labpc_setup_cmd6_reg()

Introduce a helper function to set the COMMAND6_REG.

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>
8a498667b613387ee270bc0b49a375294e38a4f6 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc:use labpc_cancel() to remove some common code

The labpc_cancel() function can be used by the labpc_ai_insn_read() and
labpc_ai_cmd() functions to disable the ai subdevice.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8c2bc333af026bed05a0041b028c34ef9b5c9cab 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: introduce labpc_ai_set_chan_and_gain()

Introduce a helper function to set the channel and gain bits in the
COMMAND1_REG.

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>
73f2b1d26f3d97f7c34166d22b30f89dc9cf9402 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup local var declarations in labpc_ai_insn_read()

Determine the chan, range, and aref when the variables are declared.

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>
8a67a67f45b1393a4cf656b89afa99202adb041c 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup local var declarations in labpc_ai_cmd()

Determine the scan_mode early and get the proper chanspec so that
the chan, range, and aref can be determined when the variables are
declared.

labpc_ai_chanlist_invalid() checks that all the range and aref values
in the chanlist are the same so, for consistency, use the same chanspec
used to get the chan.

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>
9718e5dfd7e19a2fb0d98a9afdb0459ba6b5d41f 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove unnecessary test of dev->irq

The ai subdevice (*do_cmd) pointer is only initialized if the
driver has successfully requested the interrupt. The extra test
in labpc_ai_cmd() is not necessary.

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>
fe7fc72af7df7120e1897fc07a05e247364b3a50 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: move declaration of local var 'irq_flags'

In labpc_ai_cmd(), move the declaration of the local variable
'irq_flags' to remove the need for the extra #ifdef/#endif.

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>
147a85d7dbda7f672deddba46f7165e26036c4ab 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove DRV_NAME

Remove the DRV_NAME define and just open code the string in the
comedi_driver and pci_driver declarations.

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>
7b09c9f63d70cf9aa54455b22f3f9e0df596d8c2 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: use dev->board_name instead of DRV_NAME

In labpc_common_attach(), initialize the dev->board_name early and
use that instead of DRV_NAME when allocating the resources.

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>
cacedd0ce5f3482574dd18ce218a3f4440b4c828 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: move declaration of local var 'dma_flags'

In labpc_common_attach(), move the declaration of the local variable
'dma_flags' to remove the need for the extra #ifdef/#endif.

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>
7d47f0f4c6005b74cc73be01869051d2aee8102e 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: tidy up subdevice init

Add some whitespace to the subdevice init.

Remove the unnecessary comment about adding command support to
the analog input subdevice and change the 'maxdata' value to hex
as this is more common in comedi drivers.

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>
370c8e1f76a316ba698d3ef525dd95d83db7b097 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix 8255 dio subdevice init

The subdev_8255_init() function can fail. Check for failure and
return the errno.

Consolidate the mmio/ioport calls to subdev_8255_init(). The callback
function can be added with a simple ? : test and the cast of the iobase
is not necessary.

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>
9bffb75d7510c44ce227d940cd8663df911bc487 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: fix command support with analog input subdevice

An interrupt is required for command support to work with the
analog input subdevice. When used with the ISA driver, enabling
the interrupt is optional. Fix the subdevice init so that command
support is only enabled if the irq is available.

Add some whitespace to the subdevice init. Change the 'maxdata'
value to hex as this is more common in comedi drivers.

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>
28a10930e6af5585ade2ef23eb8ce370d1450488 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: rename subdevice (*insn_{read, write}) functions

For aesthetic reasons, and to make grepping easier, rename all the
subdevice (*insn_read) and (*insn_write) functions.

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>
43a9411a67509623ad8f9e9d3712dea449a488bf 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: introduce labpc_range_is_unipolar()

Introduce a helper function to determine if a range selection is
bipolar or unipolar.

This allows removing the static data 'labpc_range_is_unipolar' and
'labpc_plus_is_unipolar' as well as the boardinfo 'ai_range_is_unipolar'.

For consistency, also use the helper in labpc_ao_winsn() when
checking the range.

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>
4d3cc8ab551af2452705cbccd0165dcdf1862196 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: rename boardinfo 'memory_mapped_io'

Rename the boardinfo 'memory_mapped_io' to 'has_mmio'.

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>
d0baa0c11701ae0f813cbdf32cbe54e90f8f4958 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: rename local var 'thisboard'

For aesthetic reasons, rename the local variable 'thisboard' to
'board'.

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>
1b3e0c80ee2c678e645cf3e18dac9674f2e67496 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: tidy up range table declarations

Tidy up all the tables used to indicate the bipolar/unipolar
type of the range. the gain bits used to set the range, and the
comedi_lrange.

Remove a couple unnecessary #define's used to indicate the size
of the tables as well as some unnecessary comments.

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>
74df5760767333eb7e0fe267e1d460c463ee442c 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: rename some of the private data variables

For aesthetic reasons, rename the 'command*_bits' and 'status*_bits'
variables in the private data in order to shorten some of the long
lines.

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>
f2c447caf64fb13b111c151c92eae8115933539e 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: cleanup the boardinfo

For aesthetic reasons, add some whitespace to the boardinfo.

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>
d23370578a632f61ca2a6ef5656910cebc3d0850 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove "dummy" pci boardinfo entry

This driver uses the comedi auto config mechanism to attach to PCI
boards. The "dummy" entry in the boardinfo table is not needed.

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>
50b9dd9414fefdece46f568edb31b5ae7473dbe9 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove boardinfo data that is set to '0'

It's not necessary to initialize the boardinfo data that is set
to '0'.

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>
af81f093d026b4f61c89175a9b695f0488f13f1f 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove forward declarations 4

Move the analog input support functions to remove the need for the
remaining forward declarations.

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>
571e06c1978d79702f83c27802ccfce33f7e80bb 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove forward declarations 3

Move the interrupt/dma support functions to remove the need for
some of the forward declarations.

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>
8913491d9040f02b46f8766eacab5935a7fb9106 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: move the analog output support functions

For aesthetic reasons, move the analog output support functions.

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>
bc3fc446800aff41abf3af82f673590b6b39c642 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove forward declarations 2

Move the eeprom/caldac support functions to remove the need for
some of the forward declarations.

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>
dd2aef646c9cfcc2647cae52a5097ce70f1e13c3 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove forward declarations 1

Move the comedi_driver (*attach), (*auto_attach), and (*detach)
functions as well as a couple of the attach helper functions to
remove the need for a number of the forward declarations.

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>
6e8bddf281d5db0da34f919271b3966c14ed5de4 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: add some whitespace to the *_driver declarations

For aesthetic reasons, add some whitespace to the comedi_driver and
pci_driver as well as the pci device table declarations.

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>
d72da604afe9db30b1150a51734df3c25c15ed54 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: remove thisboard macro

The 'thisboard' macro relies on a local variable having a specific
name and yields a pointer derived from that local variable.

Replace the macro with a local variable and use the comedi_board()
helper to get the const pointer.

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>
f65d971dfb3cb85ef4534a9e4a45a170da5970d9 22-Mar-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ni_labpc: rename labpc_board_struct

For aesthetic reasons, rename labpc_board_struct to labpc_boardinfo.

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>
a14592896023adcab12307774c89284ce0744ce2 15-Mar-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: fix common detach

`labpc_common_detach()` calls `comedi_pci_disable()` unconditionally.
That's okay for PCI devices and harmless for ISA devices (as the
`hw_dev` member will be NULL so `comedi_to_pci_dev()` will return NULL
and `comedi_pci_disable()` checks for that), but it is disastrous for
PCMCIA devices. Those are managed by the "ni_labpc_cs" module but it
calls this `labpc_common_detach()` and the `hw_dev` member will be
pointing to the `struct device` embedded in a `struct pcmcia_device` in
that case. That's enough to confuse `comedi_pci_disable()` into
thinking it's a valid PCI device to be disabled.

Use the private board information (`thisboard`) to make sure it is a PCI
device before calling `comedi_pci_disable()`.

Signed-off-by: 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>
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>
78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b 11-Feb-2013 Joe Perches <joe@perches.com> staging: Remove unnecessary OOM messages

alloc failures already get standardized OOM
messages and a dump_stack.

For the affected mallocs around these OOM messages:

Converted kzallocs with multiplies to kcalloc.
Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/strlen/strncpy to kstrdup.
Moved a spin_lock below a removed OOM message and
removed a now unnecessary spin_unlock.
Neatened alignment and whitespace.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4c4bc25d0fa6beaf054c0b4c3b324487f266c820 01-Feb-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: correct differential channel sequence for AI commands

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds, but
AI insn reads gave correct readings. He tracked it down to two
problems, one of which is addressed by this patch.

It seems the setting of the channel bits for particular scanning modes
was incorrect for differential mode. (Only half the number of channels
are available in differential mode; comedi refers to them as channels 0,
1, 2 and 3, but the hardware documentation refers to them as channels 0,
2, 4 and 6.) In differential mode, the setting of the channel enable
bits in the command1 register should depend on whether the scan enable
bit is set. Effectively, we need to double the comedi channel number
when the scan enable bit is not set in differential mode. The scan
enable bit gets set when the AI scan mode is `MODE_MULT_CHAN_UP` or
`MODE_MULT_CHAN_DOWN`, and gets cleared when the AI scan mode is
`MODE_SINGLE_CHAN` or `MODE_SINGLE_CHAN_INTERVAL`. The existing test
for whether the comedi channel number needs to be doubled in
differential mode is incorrect in `labpc_ai_cmd()`. This patch corrects
the test.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.7.x, 3.8.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22056e2b46246d97ff0f7c6e21a77b8daa07f02c 01-Feb-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: set up command4 register *after* command3

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds, but
AI insn reads gave correct readings. He tracked it down to two
problems, one of which is addressed by this patch.

It seems that writing to the command3 register after writing to the
command4 register in `labpc_ai_cmd()` messes up the differential
reference bit setting in the command4 register. Set up the command4
register after the command3 register (as in `labpc_ai_rinsn()`) to avoid
the problem.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.7.x, 3.8.x
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>
88c793010bdeace47d6fc19f42bce00544280205 14-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_labpc: use cfc_check_trigger_arg_*() helpers

Use the new helpers in the step 3 tests of labpc_ai_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>
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>
922b67c1ac53014d80649a961a2fde700cd065d8 03-Oct-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: fix possible NULL deref during detach

`labpc_common_detach()` is called by the comedi core to clean up if
either `labpc_attach()` (including the one in the "ni_labpc_cs" module)
or `labpc_attach_pci()` returns an error. It assumes the `thisboard`
macro (expanding to `((struct labpc_board_struct *)dev->board_ptr)`) is
non-null. This is a valid assumption if `labpc_attach()` fails, but not
if `labpc_attach_pci()` fails, leading to a possible NULL pointer
dereference.

Check `thisboard` at the top of `labpc_common_detach()` and return early
if it is `NULL`. This is okay because the only other thing that could
have been allocated is `dev->private` and that is freed by the comedi
core, not by this function.

Cc: <stable@vger.kernel.org> # 3.6.x
Signed-off-by: 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>
62fea8c8f1bf5ca33ba55b3f421d9598a68297ee 19-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: don't pass struct comedi_cmd by value

`labpc_suggest_transfer_size()` has a parameter of type `struct
comedi_cmd` passed by value. Change it to pass by pointer reference.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6f73fbcec27be8b074555e18d9f50c3013e4d802 19-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: pass ai scan mode through various functions

Pass the `enum scan_mode` value calculated by `labpc_ai_scan_mode()` as
a parameter to various other functions so they don't have to call it
themselves. Amongst others, the affected functions include
`labpc_adc_timing()`, `labpc_ai_convert_period()` and
`labpc_ai_scan_period()`.

`labpc_adc_timing()` calls `labpc_ai_convert_period()` and
`labpc_ai_scan_period()` in several places, but the returned values are
the same each time, so change it to just call those functions once and
re-use the return values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5743aaac2938eb841e14879b0f73afb7fca6f0ad 20-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: 8253: mmio address is a void __iomem *

The inline functions for accessing a memory mapped 8254 device
are using a void * for the 'base_address' of the device. Memory
mapped io using the read/write functions should be using a
void __iomem * for the address.

Fixing these exposed a couple other void * / void __iomem *
issues in the ni_labpc driver.

This fixes a number of sparse warnings like:

warning: incorrect type in argument 2 (different address spaces)
expected void volatile [noderef] <asn:2>*addr
got void *

warning: incorrect type in argument 1 (different address spaces)
expected void const volatile [noderef] <asn:2>*addr
got void *<noident>

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>
e4ff75b58a2475c9aafe1d137aa81bcba90aa379 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: 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>
7e2716cdc34778ea989093b2308bf62fc12da810 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: 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. Remove support for
manual attachment of PCI boards supported by this driver. The `attach`
callback is still needed to manually attach ISA boards, but print an
error if an attempt is made to manually attach a PCI board.

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>
5e51f0db14b4a2013f4f64885191076475c5b86f 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: move labpc_driver and labpc_pci_table

Move the `labpc_driver` and `labpc_pci_table` variables nearer the
module initialization code near the bottom of the module for aesthetic
reasons and to avoid a forward declaration of `labpc_attach()`.

As a consequence, to avoid having to add a forward declaration of the
`labpc_driver` variable, change code that uses
`labpc_driver.driver_name` to use `DRV_NAME` instead, and change code
that uses `labpc_driver.num_names` to use `ARRAY_SIZE(labpc_boards)`
instead.

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>
3faeeecbc85c7f4a2867bcdc65b8a598e2f4aa83 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: use module_comedi_pci_driver()

Use the macro `module_comedi_pci_driver(comedi_driver, pci_driver)` to
register the module as a Comedi PCI driver if the module supports PCI
devices, otherwise use `module_comedi_driver(comedi_driver)` to register
it as an ordinary Comedi driver. Rename variables and functions that
have prefix `driver_` for consistency. Set the `name` member of the
`struct pci_driver` variable in its initializer instead of initializing
it in the module initialization function.

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>
1cabcd3164029da5f718f0c9807bcc108b63cb7b 14-Sep-2012 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: convert printk() to dev_...()

Convert the `printk()` calls in this driver to use the `dev_...()` calls
where possible, or the `pr_...()` calls otherwise. Remove the ifdefed
out code that prints the EEPROM contents.

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>
c65e3be19a9c256ce88f057241f5a168aa3bff70 06-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_labpc: 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>
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>
513e48f90a9d092ffcf8301b6ed10a8d8a5ebe77 05-Jun-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ni_labpc: unlock spinlock on command error

When starting the acquisition the labpc_ai_cmd function was
exiting without unlocking the spinlock. This results in a
sparse warning:

warning: context imbalance in 'labpc_ai_cmd' - different lock contexts for basic block

Add the missing spin_unlock_irqrestore calls.

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

1. Change the return type from int to void

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

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

The first check is:

if (!dev)
return -EFAULT;

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

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

And the second check:

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

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

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

2. Remove all the printk noise in the detach functions

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

Also, some of the messages are output using:

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

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

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

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

4. Remove a couple unnecessary braces for single statements.

5. Remove unnecessary comments.

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

6. Remove all the extra whitespace.

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

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

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

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>
c19cc78efe922e86da7ba694dbfc4be066dd7eb4 20-Sep-2011 Randy Dunlap <rdunlap@xenotime.net> staging: fix comedi build when ISA_DMA_API is enabled but COMEDI_PCI is not enabled

Fix build when CONFIG_ISA_DMA_API is enabled but
CONFIG_COMEDI_PCI[_DRIVERS] is not enabled.

Fixes these build errors:

drivers/staging/comedi/drivers/ni_labpc.c: In function 'labpc_ai_cmd':
drivers/staging/comedi/drivers/ni_labpc.c:1351: error: implicit declaration of function 'labpc_suggest_transfer_size'
drivers/staging/comedi/drivers/ni_labpc.c: At top level:
drivers/staging/comedi/drivers/ni_labpc.c:1802: error: conflicting types for 'labpc_suggest_transfer_size'
drivers/staging/comedi/drivers/ni_labpc.c:1351: note: previous implicit declaration of 'labpc_suggest_transfer_size' was here

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d6aa8366dde1656f859b6ebf5face1718793a467 09-Aug-2011 Randy Dunlap <rdunlap@xenotime.net> staging: fix comedi build errors

Fix build errors when CONFIG_COMEDI_PCI_DRIVERS is not enabled
and CONFIG_COMEDI_PCI_DRIVERS was used where CONFIG_ISA_DMA_API
should have been used.

drivers/staging/comedi/drivers/ni_labpc.c: In function 'labpc_ai_cmd':
drivers/staging/comedi/drivers/ni_labpc.c:1351: error: implicit declaration of function 'labpc_suggest_transfer_size'
drivers/staging/comedi/drivers/ni_labpc.c: At top level:
drivers/staging/comedi/drivers/ni_labpc.c:1802: error: conflicting types for 'labpc_suggest_transfer_size'
drivers/staging/comedi/drivers/ni_labpc.c:1351: note: previous implicit declaration of 'labpc_suggest_transfer_size' was here

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3297d6c7c84a2a3f62b41b703a2963759e822e96 02-Jul-2011 Randy Dunlap <randy.dunlap@oracle.com> staging: fix comedi NI labpc driver build when ISA_DMA_API is not enabled

Fix ni_labpc.c to build when CONFIG_ISA_DMA_API is not enabled.

This is a driver that supports both ISA and PCI devices.
It now builds when for PCI-only support or for both
ISA and PCI device support.
(It does not support ISA-only without PCI.)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
845d131e2b363717d8ac8db2c6b4417de8cf10b5 09-Jun-2011 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: add #include <linux/io.h> to a bunch of drivers

On some arches the function virt_to_bus() wasn't being pulled in due to
include chains being different. So, as we are explicitly calling this
function, explicitly include the proper header file so all will build
properly.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
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>
e4e1f289be88a75dc8b63d50ade1f9a2e6168021 13-Mar-2011 Ilia Mirkin <imirkin@alum.mit.edu> staging: comedi: Remove NULL check before kfree

This patch was generated by the following semantic patch:
// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);

@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d1ce318496f5943d2cc5e20171fc383a59a1421f 19-Jan-2011 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ni_labpc: Use shared IRQ for PCMCIA card

The ni_labpc driver module only requests a shared IRQ for PCI devices,
requesting a non-shared IRQ for non-PCI devices.
As this module is also used by the ni_labpc_cs module for certain
National Instruments PCMCIA cards, it also needs to request a shared IRQ
for PCMCIA devices, otherwise you get a IRQ mismatch with the CardBus
controller.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
631dd1a885b6d7e9f6f51b4e5b311c2bb04c323c 18-Oct-2010 Justin P. Mattock <justinmattock@gmail.com> Update broken web addresses in the kernel.

The patch below updates broken web addresses in the kernel

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Dimitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Acked-by: Ben Pfaff <blp@cs.stanford.edu>
Acked-by: Hans J. Koch <hjk@linutronix.de>
Reviewed-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
0656bb352080982f960bfff2b78602a5071c909f 28-Sep-2010 Maurice Dawson <mauricedawson2699@gmail.com> Staging: comedi: fix EXPORT SYMBOL coding style issue in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes up, EXPORT SYMBOL(foo)
should immediately follow its function/variable warnings, found by the
checkpatch.pl tool

Signed-off-by: Maurice Dawson <mauricedawson2699@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d6269644e1f8fc7931c4d6b86d58de7af63a5fc9 05-Sep-2010 Julia Lawall <julia@diku.dk> Staging: comedi: Fix unsigned return type

In each case, the function has an unsigned return type, but returns a
negative constant to indicate an error condition. For move_block_from_dma,
there is only one call and the return value is dropped, so it need not be
unsigned. For labpc_eeprom_write, there is only one call and the result is
stored in a signed variable, so again the unsigned return type is not
necessary.

A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@exists@
identifier f;
constant C;
@@

unsigned f(...)
{ <+...
* return -C;
...+> }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1309e617bc56f2f8af9a9c5aab1224a45539002a 26-Jun-2010 Maurice Dawson <mauricedawson2699@gmail.com> Staging: comedi: fix over 80 character coding style issue in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes up 80 character warnings found by the checkpatch.pl tool

Signed-off-by: Maurice Dawson <mauricedawson2699@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
727b286b44ea359d66f47d241cc2cdad36ed7bdc 06-Jun-2010 Arun Thomas <arun.thomas@gmail.com> Staging: comedi: Remove COMEDI_PCI_INITCLEANUP macro

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

Signed-off-by: Arun Thomas <arun.thomas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
7114a28011f9d5f3d981731ad341177c21f9d948 06-Jun-2010 Arun Thomas <arun.thomas@gmail.com> Staging: comedi: Remove COMEDI_INITCLEANUP macro

Move the init/exit routines to the respective C source files
instead of calling COMEDI_INITCLEANUP

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

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

Signed-off-by: Arun Thomas <arun.thomas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
88d8ed4b643d2064a663b2f07426963289def676 04-Jun-2010 Maurice Dawson <mauricedawson2699@gmail.com> Staging: comedi: fix printk() coding style issue in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes all, printk() should
include KERN-facility level, warnings found by the checkpatch.pl tool

Signed-off-by: Maurice Dawson <mauricedawson2699@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>
177d42821e2d662fda5bb57d31d33d215fb74fd0 09-Mar-2010 Aseem Sethi <aseemsethi@yahoo.com> Staging: comedi: fix missing KERN_facility level in ni_labpc.c

This is a patch to fix the "missing KERN_facility level" error found
when running the checkpatch.pl script

Signed-off-by: Aseem Sethi <aseemsethi@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
639b9f1ee5987270be2bca4bf8b7e6110d3b47ec 21-Feb-2010 Stewart Robertson <stewart_r@aliencamel.com> Staging: comedi: fix suspect code indent in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes suspect code indent for
conditional statements found by the checkpatch.pl tool

Signed-off-by: Stewart Robertson <stewart_r@aliencamel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
65d6d26c6bcd802ebe2b22a29d9b6bbebfd8d7f8 19-Feb-2010 Maurice Dawson <mauricedawson2699@googlemail.com> Staging: comedi: fix yet another brace coding style issue in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes up all the brace
warnings found by the checkpatch.pl tool

Signed-off-by: Maurice Dawson <mauricedawson2699@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2bb9c335902a5d59fc084170aaae0ccc9d9d4012 19-Feb-2010 Maurice Dawson <mauricedawson2699@googlemail.com> Staging: comedi: fix another brace coding style issues in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes up a brace warning
found by the checkpatch.pl tool

Signed-off-by: Maurice Dawson <mauricedawson2699@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
8377e813c75cf5aca46032fb780ca74c923dbe86 19-Feb-2010 Maurice Dawson <maurice2699@btinternet.com> Staging: comedi: fix brace coding style issue in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes up a brace warning
found by the checkpatch.pl tool.

Signed-off-by: Maurice Dawson <maurice2699@btinternet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
e41a6f6d9cb7404420d596f27609a3f4f55dcaf5 21-Feb-2010 Stewart Robertson <stewart_r@aliencamel.com> Staging: comedi: fix coding style issues in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes the brace warnings and
comments over 80 characters found by the checkpatch.pl tool. Some code
still goes over 80 characters because I didn't know what to do with it.

Signed-off-by: Stewart Robertson <stewart_r@aliencamel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
412bd046b0a1726f8b168d5056d21213932f9d84 02-Feb-2010 tony burrows <tony@tonyburrows.com> Staging: comedi: fix brace coding style issues in ni_labpc.c

This patch fixes all of the brace style warnings found by the
checkpatch.pl tool

Signed-off-by: Tony Burrows <tony@tonyburrows.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
9d220c6b54f3d0b141846321814ec1c4e4fbdc67 12-Jan-2010 Uwe Kleine-König <u.kleine-koenig@pengutronix.de> staging: fix typos "aquire" -> "acquire"

This patch was generated by

git grep -E -i -l '[Aa]quire' drivers/staging | xargs -r perl -p -i -e 's/([Aa])quire/$1cquire/'

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
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>
8629efa4cbf6f89a54a85af4b8bc31762af01800 23-Apr-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: make use of ARRAY_SIZE macro

Replace instances of computing number of elements in an array with
sizeof(foo)/sizeof(struct footype) with the ARRAY_SIZE macro.

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

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>
f6b49620a43ca661246d209009b849d7d3030cae 27-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: remove C99 comments in ni_labpc.c

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0a4eb4b6c7c12730254be53d93a67ed2955d5c66 25-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove labpc_private typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
9ad007403fa4326586060e443ee344697daa60ec 25-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove labpc_board_struct 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>
9ced1de69125b60f40127eddaa3be2a92bb0a1df 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_lrange typedef

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

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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>
124b13b26df5dab0236520de95e1cc1dea06e3c3 13-Feb-2009 Frank Mori Hess <fmhess@users.sourceforge.net> Staging: comedi: add ni_labpc drivers

This supports National Instruments Lab-PC and compatibles

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