Граф коммитов

5153 Коммитов

Автор SHA1 Сообщение Дата
H Hartley Sweeten 2704f807f9 staging: comedi: usbdux: bug fix for accessing 'ao_chanlist' in private data
In usbdux_ao_cmd(), the channels for the command are transfered from the
cmd->chanlist and stored in the private data 'ao_chanlist'. The channel
numbers are bit-shifted when stored so that they become the "command"
that is transfered to the device. The channel to command conversion
results in the 'ao_chanlist' having these values for the channels:

  channel 0 -> ao_chanlist = 0x00
  channel 1 -> ao_chanlist = 0x40
  channel 2 -> ao_chanlist = 0x80
  channel 3 -> ao_chanlist = 0xc0

The problem is, the usbduxsub_ao_isoc_irq() function uses the 'chan' value
from 'ao_chanlist' to access the 'ao_readback' array in the private data.
So instead of accessing the array as 0, 1, 2, 3, it accesses it as 0x00,
0x40, 0x80, 0xc0.

Fix this by storing the raw channel number in 'ao_chanlist' and doing the
bit-shift when creating the command.

Fixes: a998a3db53 "staging: comedi: usbdux: cleanup the private data 'outBuffer'"
Cc: stable <stable@vger.kernel.org> # 3.12
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Acked-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-23 16:20:15 -07:00
Ian Abbott b34aa86f12 staging: comedi: fix circular locking dependency in comedi_mmap()
Mmapping a comedi data buffer with lockdep checking enabled produced the
following kernel debug messages:

======================================================
[ INFO: possible circular locking dependency detected ]
3.5.0-rc3-ija1+ #9 Tainted: G         C
-------------------------------------------------------
comedi_test/4160 is trying to acquire lock:
 (&dev->mutex#2){+.+.+.}, at: [<ffffffffa00313f4>] comedi_mmap+0x57/0x1d9 [comedi]

but task is already holding lock:
 (&mm->mmap_sem){++++++}, at: [<ffffffff810c96fe>] vm_mmap_pgoff+0x41/0x76

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (&mm->mmap_sem){++++++}:
       [<ffffffff8106d0e8>] lock_acquire+0x97/0x105
       [<ffffffff810ce3bc>] might_fault+0x6d/0x90
       [<ffffffffa0031ffb>] do_devinfo_ioctl.isra.7+0x11e/0x14c [comedi]
       [<ffffffffa003227f>] comedi_unlocked_ioctl+0x256/0xe48 [comedi]
       [<ffffffff810f7fcd>] vfs_ioctl+0x18/0x34
       [<ffffffff810f87fd>] do_vfs_ioctl+0x382/0x43c
       [<ffffffff810f88f9>] sys_ioctl+0x42/0x65
       [<ffffffff81415c62>] system_call_fastpath+0x16/0x1b

-> #0 (&dev->mutex#2){+.+.+.}:
       [<ffffffff8106c528>] __lock_acquire+0x101d/0x1591
       [<ffffffff8106d0e8>] lock_acquire+0x97/0x105
       [<ffffffff8140c894>] mutex_lock_nested+0x46/0x2a4
       [<ffffffffa00313f4>] comedi_mmap+0x57/0x1d9 [comedi]
       [<ffffffff810d5816>] mmap_region+0x281/0x492
       [<ffffffff810d5c92>] do_mmap_pgoff+0x26b/0x2a7
       [<ffffffff810c971a>] vm_mmap_pgoff+0x5d/0x76
       [<ffffffff810d493f>] sys_mmap_pgoff+0xc7/0x10d
       [<ffffffff81004d36>] sys_mmap+0x16/0x20
       [<ffffffff81415c62>] system_call_fastpath+0x16/0x1b

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&mm->mmap_sem);
                               lock(&dev->mutex#2);
                               lock(&mm->mmap_sem);
  lock(&dev->mutex#2);

 *** DEADLOCK ***

To avoid the circular dependency, just try to get the lock in
`comedi_mmap()` instead of blocking.  Since the comedi device's main mutex
is heavily used, do a down-read of its `attach_lock` rwsemaphore
instead.  Trying to down-read `attach_lock` should only fail if
some task has down-write locked it, and that is only done while the
comedi device is being attached to or detached from a low-level hardware
device.

Unfortunately, acquiring the `attach_lock` doesn't prevent another
task replacing the comedi data buffer we are trying to mmap.  The
details of the buffer are held in a `struct comedi_buf_map` and pointed
to by `s->async->buf_map` where `s` is the comedi subdevice whose buffer
we are trying to map.  The `struct comedi_buf_map` is already reference
counted with a `struct kref`, so we can stop it being freed prematurely.

Modify `comedi_mmap()` to call new function
`comedi_buf_map_from_subdev_get()` to read the subdevice's current
buffer map pointer and increment its reference instead of accessing
`async->buf_map` directly.  Call `comedi_buf_map_put()` to decrement the
reference once the buffer map structure has been dealt with.  (Note that
`comedi_buf_map_put()` does nothing if passed a NULL pointer.)

`comedi_buf_map_from_subdev_get()` checks the subdevice's buffer map
pointer has been set and the buffer map has been initialized enough for
`comedi_mmap()` to deal with it (specifically, check the `n_pages`
member has been set to a non-zero value).  If all is well, the buffer
map's reference is incremented and a pointer to it is returned.  The
comedi subdevice's spin-lock is used to protect the checks.  Also use
the spin-lock in `__comedi_buf_alloc()` and `__comedi_buf_free()` to
protect changes to the subdevice's buffer map structure pointer and the
buffer map structure's `n_pages` member.  (This checking of `n_pages` is
a bit clunky and I [Ian Abbott] plan to deal with it in the future.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.14.x, 3.15.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16 11:41:45 -07:00
H Hartley Sweeten b6512cfcd2 staging: comedi: poc: remove obsolete driver
The DAC02 board, which is the only board supported by this driver, now
has its own comedi driver (dac02).

Remove this obsolete 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>
2014-03-20 01:57:01 +00:00
Ebru Akagunduz 3df1d9bddf Staging: comedi: Fix line over 80 characters in s626.c
Fix checkpatch.pl issues line over 80 characters
in s626.c

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-19 09:14:22 -07:00
Ebru Akagunduz fbdc4001e3 Staging: comedi: Fix missing space after return type in s626.c
Fix checkpatch.pl issues with missing space after
return type in s626.c

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-19 09:14:22 -07:00
Michael Welling 89509814dc Staging: comedi: proc: title block update
Follow up patch for "STAGING: comedi: style and checkpatch fixes".
Removes the file name in the comment block per suggestions.

Signed-off-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-19 04:41:04 +00:00
Michael Welling 6f2c9efa66 STAGING: comedi: style and checkpatch fixes
Updates block comment per Documentation/CodingStyle.
Also updated due to checkpatch warnings about qouted string
after Lindent modified the spacing slightly.

Signed-off-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-18 13:04:19 -07:00
H Hartley Sweeten 79e5e6addb staging: comedi: das6402: rewrite broken driver
This driver is _really_ broken.

It initializes an analog input subdevice that only has a (*cancel)
function. It also does a request_irq() to hookup an interrupt handler
using it->options[0] as the IRQ. This option is actually the base
address of the I/O region used by the board. If the interrupt handler
actually did get hooked up, the rest of the code assumes that IRQ 10
is being used.

Rewrite the driver to properly support the hardware.

The DAS6402-12/16 boards have 64 single-ended / 32 differential analog
inputs, 2 analog outputs, 8 digital inputs, and 8 digital outputs. Add
proper support for these subdevices.

Stub in the analog input async command support.

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>
2014-03-17 14:20:10 -07:00
H Hartley Sweeten 2925cc8637 staging: comedi: rti802: update the MODULE_DESCRIPTION
Change the generic MODULE_DESCRIPTION text to something more
specific for this driver.

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>
2014-03-17 14:20:10 -07:00
H Hartley Sweeten 8f3367af3d staging: comedi: rti802: tidy up the multi-line comments
Tidy up the milti-line comments so they follow the CodingStyle.

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>
2014-03-17 14:20:10 -07:00
H Hartley Sweeten 6938dd289d staging: comedi: rti802: tidy up the register map defines
For aesthetics, add some whitespace to the register map defines and
convert the offsets to hex.

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>
2014-03-17 14:20:09 -07:00
H Hartley Sweeten 052c198b6e staging: comedi: rti802: tidy up the subdevice init
For aesthetics, add some whitespace to the subdevice 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>
2014-03-17 14:20:09 -07:00
H Hartley Sweeten 57450d9036 staging: comedi: rti802: tidy up rti802_ao_insn_write()
Use comedi_offset_munge() to handle munging the offset binary to two's
complement.

Tidy up the function a bit.

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>
2014-03-17 14:20:09 -07:00
H Hartley Sweeten c0c6ae260a staging: comedi: rti802: tidy up rti802_ao_insn_read()
To clarify the function a bit, add a local variable for the 'chan'
that is being read and change the final return to 'insn->n'.

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>
2014-03-17 14:20:09 -07:00
H Hartley Sweeten df8f09bb44 staging: comedi: rti802: remove RTI802_SIZE define
This define is only used in the attach to specify the I/O region size
passed to comedi_request_region(). Remove the define and just open
code the value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 14:20:09 -07:00
H Hartley Sweeten f0571cb440 staging: comedi: gsc_hpdi: tidy up multi-line comment
Tidy up the comment to follow the CodingStyle.

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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten 63810f3b55 staging: comedi: gsc_hpdi: remove pr_fmt() define
This driver no longer has any pr_{level} messages. Remove the pr_fmt().

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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten 47266aaf35 staging: comedi: gsc_hpdi: convert comedi_error() messages to dev_err()
For aesthetics, convert the comedi_error() messages to dev_err().

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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten d67107fe91 staging: comedi: gsc_hpdi: tidy up the boardinfo
Remove the unnecessary comments in the boardinfo definition and
tidy up the declaration.

FWIW, I'm not sure this boardinfo is really needed...

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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten fce0ff523a staging: comedi: gsc_hpdi: tidy up the register map
For aesthetics, convert the various enums into simple defines to
describe the register map for the board. Group the bit defines with
the associated register define. Convert the helper functions for
the register bit/shift/mask stuff into simple 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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten 4cbbacb285 staging: comedi: gsc_hpdi: rename 'hpdi_iobase' in private data
This member in the private data holds the ioremaped PCI BAR2 address
which is the primary base address for the boards registers.

For aesthetics, rename this member simply 'mmio'.

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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten 139740370c staging: comedi: gsc_hpdi: rename 'plx9080_iobase' in private data
Rename this member to fix two checkpatch.pl warnings about lines > 80
characters.

Also remove the unnecessary comment.

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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten d213563198 staging: comedi: gsc_hpdi: tidy up gsc_hpdi_drain_dma()
Refactor this function to clarify the loop that reads all the full
buffers.

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>
2014-03-17 14:19:51 -07:00
H Hartley Sweeten 2a5a3d0c8f staging: comedi: gsc_hpdi: remove 'volatile' from the private data members
As reported by checkpatch.pl, the private data members do not need
the volatile tag. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 14:19:50 -07:00
H Hartley Sweeten ab5cf49317 staging: comedi: gsc_hpdi: remove hpdi_writel()
This helper function is used to OR bits with a software copy of a
register value then writel() the new value to the register. The
software copies are never updated in the driver so they are always
0 due to the kzalloc.

Remove the unnecessary 'bits' from the private data and replace
the hpdi_writel() calls with writel().

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>
2014-03-17 14:19:50 -07:00
H Hartley Sweeten 42ea78126c staging: comedi: gsc_hpdi: remove disable_plx_interrupts()
This helper function is just a simple writel(). 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>
2014-03-17 14:19:50 -07:00
H Hartley Sweeten 63da0d087c staging: comedi: gsc_hpdi: rename init_hpdi()
For aesthetics, rename this function so it has namespace associated
with the driver.

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>
2014-03-17 14:19:50 -07:00
H Hartley Sweeten 201a81437c staging: comedi: gsc_hpdi: rename init_plx9080()
For aesthetics, rename this function so it has namespace associated
with the driver.

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>
2014-03-17 14:19:50 -07:00
H Hartley Sweeten 6a23558b34 staging: comedi: gsc_hpdi: rename hpdi_find_board()
For aesthetics, rename this function so it has namespace associated
with the driver.

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>
2014-03-17 14:19:50 -07:00
H Hartley Sweeten 1335cee5d2 staging: comedi: gsc_hpdi: rename the (*auto_attach) and (*detach) functions
For aesthetics, rename these functions so they have namespace associated
with the driver.

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>
2014-03-17 14:19:49 -07:00
H Hartley Sweeten 9fe635cd86 staging: comedi: gsc_hpdi: rename drain_dma_buffers()
For aesthetics, rename this function so it has namespace associated
with the driver.

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>
2014-03-17 14:19:49 -07:00
H Hartley Sweeten 3521d454d2 staging: comedi: gsc_hpdi: rename handle_interrupt()
For aesthetics, rename this function so it has namespace associated
with the driver.

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>
2014-03-17 14:19:49 -07:00
H Hartley Sweeten 9cbf669737 staging: comedi: gsc_hpdi: rename abort_dma()
For aesthetics, rename this function so it has namespace associated
with the driver.

Also, remove the unnecessary forward declaration.

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>
2014-03-17 14:19:49 -07:00
H Hartley Sweeten 3547473931 staging: comedi: gsc_hpdi: rename hpdi_cancel()
For aesthetics, rename this function so it has namespace associated
with the driver.

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>
2014-03-17 14:19:49 -07:00
H Hartley Sweeten 6b0cca01ac staging: comedi: gsc_hpdi: tidy up hpdi_cmd_test()
For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
interrupt support code.

Absorb the di_cmd_test() helper and tidy up the function a bit.

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>
2014-03-17 14:19:49 -07:00
H Hartley Sweeten 627e52f741 staging: comedi: gsc_hpdi: tidy up hpdi_cmd()
For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
interrupt support code.

Absorb the di_cmd() helper and tidy up the function a bit.

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>
2014-03-17 14:19:49 -07:00
H Hartley Sweeten 66951e0588 staging: comedi: gsc_hpdi: tidy up setup_dma_descriptors()
For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
async command support code.

Tidy up the function a bit.

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>
2014-03-17 14:19:48 -07:00
H Hartley Sweeten b0360a989d staging: comedi: gsc_hpdi: tidy up dio_config_insn()
For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
async command support code.

Absorb the dio_config_block_size() helper function and remove the
forward declaration.

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>
2014-03-17 14:19:48 -07:00
H Hartley Sweeten d987d372eb staging: comedi: gsc_hpdi: move the (*auto_attach) helper functions
For aesthetics, move a couple helper functions that are only called
by the (*auto_attach) closer to that 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>
2014-03-17 14:19:48 -07:00
H Hartley Sweeten 7de0b0dfac staging: comedi: gsc_hpdi: absorb setup_subdevices()
This function is only called by the (*auto_attach). Absorb it into that
function to clarify the attach and remove the need for some of the forward
declarations.

For aesthetics, add some whitespace to the subdevice 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>
2014-03-17 14:19:48 -07:00
H Hartley Sweeten 4ddc6ba41d staging: comedi: gsc_hpdi: move the (*auto_attach) and (*detach) functions
Move these functions closer to the comedi_driver declaration. This removes
the need for one of the forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 14:19:48 -07:00
H Hartley Sweeten 884c015f3a staging: comedi: fl512: tidy up the multi-line comments
Tidy up the multi-line comments to follow the CodingStyle.

Add the GPL boilerplate comment found in other comedi 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>
2014-03-17 14:16:16 -07:00
H Hartley Sweeten 6632d65e34 staging: comedi: fl512: tidy up fl512_ao_insn_read()
Tidy up this 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>
2014-03-17 14:16:16 -07:00
H Hartley Sweeten 3ecbbb56cb staging: comedi: fl512: tidy up fl512_ao_insn_write()
Tidy up this function. Only save the last value written for readback.

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>
2014-03-17 14:16:16 -07:00
H Hartley Sweeten 96653ed60e staging: comedi: fl512: define the register map
Define the register map and remove the magic values and some unnecessary
comments.

For aesthetics, remove the 'iobase' local variable and use dev->iobase
directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 14:16:15 -07:00
H Hartley Sweeten 18c4110eb4 staging: comedi: fl512: tidy up fl512_ao_insn_read()
For aesthetics, tidy up this function to match the style used in most
of the comedi drivers for analog output (*insn_read) 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>
2014-03-17 14:16:15 -07:00
H Hartley Sweeten 8f28c9d978 staging: comedi: fl512: remove Fl512_SIZE define
This define is only used in the comedi_request_region() call to specify
the size of the I/O region to request. Remove the define and just open
code the value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 14:16:15 -07:00
H Hartley Sweeten 6a083a685c staging: comedi: fl512: rename the subdevice (*insn_{read, write}) functions
For aesthetics, rename these functions and remove the unnecessary comments.

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>
2014-03-17 14:16:15 -07:00
H Hartley Sweeten 638622a265 staging: comedi: fl512: tidy up subdevice init
Remove the obvious comments and add some whitespace to the subdevice
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>
2014-03-17 14:16:15 -07:00
Ian Abbott 268d1e7996 staging: comedi: 8255_pci: initialize MITE data window
According to National Instruments' PCI-DIO-96/PXI-6508/PCI-6503 User
Manual, the physical address in PCI BAR1 needs to be OR'ed with 0x80 and
written to register offset 0xC0 in the "MITE" registers (BAR0).  Do so
during initialization of the National Instruments boards handled by the
"8255_pci" driver.  The boards were previously handled by the
"ni_pcidio" driver, where the initialization was done by `mite_setup()`
in the "mite" module.  The "mite" module comes with too much extra
baggage for the "8255_pci" driver to deal with so use a local, simpler
initialization function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.10.y, 3.11.y, 3.12.y, 3.13.y, 3.14.y
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 14:14:22 -07:00