[go: nahoru, domu]

History log of /drivers/staging/comedi/drivers/ii_pci20kc.c
Revision Date Author Comments
1fd142ce3d23ea5168b2c0eebca5c9fbdce632ef 26-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: use comedi_subdevice 'readback'

Use the new comedi_subdevice 'readback' member and the core provided
(*insn_read) for the readback of the analog output subdevice channels.

Remove the unused private data and its allocation.

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>
c3c17d2eadce4e497a88783a625e07acb31f1dfb 26-Aug-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: save unmunged data for ao readback

The unmunged data should be saved for readback not the munged data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27fc26f99e63bcbe42176f08eaf590bff81a2e1c 31-Jul-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: ii_pci20kc: request and ioremap memory

The "ii_pci20kc" module is a comedi driver for Intelligent Instruments
PCI-20001C carrier board and modules. Despite the name, this is
actually an ISA board and uses 1K of ISA memory space (below 1M) for the
main board plus up to three modules. The address is set by hardware
jumpers.

When the board is attached to Comedi via the `COMEDI_DEVCONFIG` ioctl
and the driver's legacy "attach" handler, the base address is passed in.
The driver currently uses that address as-is, which is a bad idea. It
doesn't even reserve the memory region.

Fix that by sanity checking the passed in address, reserving the memory
region and ioremapping it.

Replace the current "detach" handler `comedi_legacy_detach()` with a new
handler `ii20k_detach()` which unmaps the memory and releases the
region.

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

Use the new 'mmio' member in the comedi_device for the __iomem * base
address.

Since this was the only member in the private data, remove the struct
and its allocation.

This legacy driver is a bit strange. The base address of the board is
passed to the (*attach) using by the user using the comedi_config
utiltiy. This base address is currently not ioremap'ed and is simply
cast to a void __iomem *. I'm not sure if this is correct. Add a
comment so it will be addressed later.

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>
27a2234edd4a5c8b0ebdaaa3f6a5f00183f3154f 07-May-2014 Christian Engelmayer <cengelma@gmx.at> staging: comedi: ii_pci20kc: fix usage of uninit scalar in ii20k_attach()

This driver supports the PCI-20001C-1a and PCI-20001C-2a carrier boards.
The -2a version has 32 on-board DIO channels. In case this variant is
detected, local variable 'has_dio' is set accordingly. Otherwise it is
left uninitialized and the following subdevice instantiation depends on
the stack. Detected by Coverity - CID 1077830.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
83b4d991253dd764cfcb46fb10ef73bbff913e47 10-Feb-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: 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>
9b13bc1d4ab0c5abc1b29d4fa95a41bf02238d2a 30-Aug-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: use comedi_dio_update_state()

The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.

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

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

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

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

This reverts commit f21c53945cb95f66faa9636af5f23cb00ba73019.

I applied the wrong patch :(

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

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

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

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c325f9a9edf24dfc13145b5fce792aec577fe381 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: cleanup final pieces

Tidy up the multi-line comments at the beginning of the file and
remove any irrelevant information.

Fix the II20K_ID_PCI200341M_1 define, there are one to many 0's.

Rename all the remaining pci20xxx_* to ii20k_*. The "pci" just adds
confusion, this is not a PCI board.

Remove the private (*detach) function. It's safe to call the comedi
core provided comedi_legacy_detach() even if there is nothing to
cleanup.

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>
3aa5e81177bd8bf235d2b506659a3ecd05d67634 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: cleanup the ai subdevice

The PCI-200341M-1 module can both provide an analog input subdevice
in this driver. The module provides four differential input channels
with four programmable gains.

Currently the gain is configured as an option passed when the board
is attached. Rewrite the ai subdevice support functions to properly
handle the programmable gain.

For aesthetics, redefine the memory map for the module.

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>
87a61614e3cd841cb6d73878b46d8e858418e536 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: cleanup the ao subdevice

The PCI-20006M-1 and PCI-20006M-2 modules can both provide an
analog output subdevice in this driver. Fix the module init code
to detect both of them.

The analog output can support +/-5, 0-10, or +/-10 volt ranges
depending on jumpers on the board. Report all the ranges to the
user instead of relying on the configuration options to set the
range. The user can then select the appropriate range depending
on how they have configured the hardware.

Tidy up the (*insn_{read,write})() functions to work like the
comedi 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>
04815a4b5e2d1b3a741326f75c500382a55f7968 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc.c: break up the subdevice private data union

The union used for the subdevice private data just adds confusion.
Split the union into two separate private data structs.

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>
57b2161f021c26f56574edfaaaa9503f877fc1a2 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc.c: remove 'iobase' from the subdevice private data

The 'iobase' can be calculated when needed. Remove it from the
subdevice private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f0e32df3d21f048ee35c07e523e918015845d95f 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc.c: tidy up the subdevice module init

Use the carrier board id to determine if a module is installed for
a given subdevice.

Consolidate the module init code into ii20k_init_module().

For aesthetic reasons, rename the subdevice functions to remove
'pci' from them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9abeb196a740bd52401a24108df27e20576da036 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc.c: cleanup the dio subdevice

For asethetics, redefine the register map for the carrier board.
The 'PCI*' names lead one to think this is a PCI board not a
legacy ISA board.

Remove the #if 0'd out pci20xxx_{do,di}() functions. They are not
needed.

Rename, and fix, the pci20xxx_dio_config() function. The control
and direction registers are not readable. Use the new register map
defines instead of the crazy bit shifts.

Rename, and fix, the pci20xxx_dio_insn_config() function. This
function should treat data[0] as the 'instruction' to handle not
just use it to determine if the port is an input or output.

Rename, and tix, the pci20xxx_dio_insn_bits() function. The 'state'
only needs to be updated if the 'mask' indicates.

For aesthetics, abosrb the pci20xxx_dio_init() into the (*attach)
function.

Fix the carrier board id detect in the (*attach). There are two carrier
board types, one with 32 dio channels and one without. Use this info
when setting up the dio 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>
6d305f89529f1c4400e3d04fedfb8411041f1387 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: remove CHAN macro

This macro is not used, and it looks to much like the comedi CR_CHAN
macro. Just remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3366244718f5c95b25cc96318cf448dafa1dcd00 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: move comedi_lrange tables

For aesthetic reasons, move the static const data to the head of
the file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
842525c6c1efa0bfefb7fb96838ef6ec588ce95e 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: remove forward declarations 3

Move a couple functions to remove the need for the last forward
declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
63d6e8ff0d25256d57453959c4d192b950a417ce 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: remove forward declarations 2

Move the pci20xxx_dio_*() 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0f8409dc057935900a53d4781bcbb77149348267 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: remove forward declarations 1

Move the pci20xxx_attach() and pci20xxx_detach() 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2b00f54b248144acc393740e4c4679b6aa531193 24-Jul-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: use comedi_alloc_spriv()

For aesthetic reasons, use the helper function to allocate the
subdevice private data instead of hanging it on the device
private data. The core will free the memory during the detach.

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>
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>
b5d5b58da828bd3f3f5eb073daaf842702bf4a19 10-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: ii_pci20kc: remove comment about 2.4 kernels

This comment about using ioremap() for 2.4 kernels is not necessary.

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

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

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>
e209939f31736b00e816e10d4a93af5c5fefb0e0 08-Oct-2012 YAMANE Toshiaki <yamanetoshi@gmail.com> staging/comedi: Use dev_ printks in drivers/ii_pci20kc.c

fixed below checkpatch warnings.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...
- WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
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>
35fcaeb87d14c2385dac6ef1520e136f288d1bd6 06-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ii_pci20kc: remove subdevice pointer math

Convert the comedi_subdevice access from pointer math to array
access.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a2714e3e42e746d6c8525c35fdcc58fb60c2830d 18-Jun-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: fix return value for insn_bits functions

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

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>
4aa7419e082ef5ca38f8934d38fda5909a27962b 22-May-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: ii_pci20kc: iobase and ioaddr are void __iomem *

The iobase variables in struct pci20xxx_subdev_private and ioaddr
variable in struct pci20xxx_private should be void __iomem * not
void *.

This quiets a lot of sparse warings for the writeb and readb calls
like:

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

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

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>
2396472f2aed86884a446109c5b51a3702028339 16-May-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: refactor ii_pci20kc driver and use module_comedi_driver

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

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

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3555a4c35e59c0217983f5df0cfe39a9fa65c2df 14-Dec-2010 Xenofon Foukas <foukas.xenofon@gmail.com> Staging: comedi: Fix coding style issues in ii_pci20kc.c

This patch fixes the following issues in file ii_pci20kc.c:

WARNING: please, no space before tabs
WARNING: unnecessary whitespace before a quoted newline
WARNING: line over 80 characters

Signed-off-by: Xenofon Foukas <foukas.xenofon@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>
13ccea3ff07cabcc48eb5e953eec24141b7be9d6 21-Oct-2009 Dirk Hohndel <hohndel@infradead.org> Staging: comedi: ii_pci_20kc: fix style printk

add KERN_ facility to printk (mostly KERN_INFO, some KERN_WARNING)
I think I found a bug - commented on it but didn't change as it's just
in a printk (off by 1 error in output)

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
dc1fe479413996629df9ab10b9f4749ba60ae637 21-Oct-2009 Dirk Hohndel <hohndel@infradead.org> Staging: comedi: ii_pci20kc: white space fixes

No code changes - left some 80 char violations alone as
folding those lines would have made code less readable

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
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>
68c3dbff9fc9f25872408d0e95980d41733d48d0 23-Apr-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: fix the way structs are initialized.

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
eb3a3c1b7c92a129f43541c6ceb0e277fc61e354 18-Feb-2009 Markus Kempf <kempf@matsci.uni-sb.de> Staging: comedi: add ii_pci20kc driver

Driver for Intelligent Instruments PCI-20001C carrier board
and modules.

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