firefly-linux-kernel-4.4.55.git
10 years agostaging: comedi: usbdux: move and rename the bulk transfer commands
H Hartley Sweeten [Thu, 25 Jul 2013 23:12:05 +0000 (16:12 -0700)]
staging: comedi: usbdux: move and rename the bulk transfer commands

For aesthetic reasons, move the defines used for the bulk transfer
commands out of the middle of the code and rename them so they are
a bit more readable.

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>
10 years agostaging: comedi: usbdux: remove unused define
H Hartley Sweeten [Thu, 25 Jul 2013 23:11:46 +0000 (16:11 -0700)]
staging: comedi: usbdux: remove unused define

This define is not used, and it's actually incorrect. The usbdux device
only has 4 analog output channels.

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>
10 years agostaging: comedi: usbdux: 'dac_commands' does not need to be kzalloc()'d
H Hartley Sweeten [Thu, 25 Jul 2013 23:11:28 +0000 (16:11 -0700)]
staging: comedi: usbdux: 'dac_commands' does not need to be kzalloc()'d

The 'dac_commands' buffer is used to pass the ao channel list from
usbdux_ao_cmd() to the urb callback, usbduxsub_ao_isoc_irq(). This
buffer does not need to be allocated.

Change it into a simple array of the correct size. Rename the variable
to 'ao_chanlist' to clarify what it actually is.

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>
10 years agostaging: comedi: usbdux: remove unnecessary check in usbdux_ao_cmd()
H Hartley Sweeten [Thu, 25 Jul 2013 23:11:10 +0000 (16:11 -0700)]
staging: comedi: usbdux: remove unnecessary check in usbdux_ao_cmd()

This check is not necessary. The cmd->chanlist_len will always be
less than or equal to the subdevice len_chanlist that was setup
during the attach of the device.

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>
10 years agostaging: comedi: usbdux: remove unnecessary check in usbdux_ai_cmd()
H Hartley Sweeten [Thu, 25 Jul 2013 23:10:43 +0000 (16:10 -0700)]
staging: comedi: usbdux: remove unnecessary check in usbdux_ai_cmd()

This check is not necessary. The cmd->chanlist_len will always be
less than or equal to the subdevice len_chanlist that was setup
during the attach of the device.

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>
10 years agostaging: comedi: usbdux: simplify initializing the ao urb transfer_buffer
H Hartley Sweeten [Thu, 25 Jul 2013 23:10:25 +0000 (16:10 -0700)]
staging: comedi: usbdux: simplify initializing the ao urb transfer_buffer

Remove the ugly casting of datap to the ao urb->transfer_buffer. The format
of the data in the buffer is simply.

  [0] = # of channels to update (s->async->cmd.chanlist.len)
  [1] = lsb of value for 1st channel to update
  [2] = msb of value for 1st channel to update
  [3] = 1st channel to update (depvriv->dac_commands[0])

If more than 1 channel is to be updated they are simply added to the buffer:

  [4] = lsb of value for 2st channel to update
  [5] = msb of value for 2st channel to update
  [6] = 1st channel to update (depvriv->dac_commands[1])

etc.

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>
10 years agostaging: comedi: usbdux: cleanup the private data 'outBuffer'
H Hartley Sweeten [Thu, 25 Jul 2013 23:10:07 +0000 (16:10 -0700)]
staging: comedi: usbdux: cleanup the private data 'outBuffer'

This buffer is used to cache the values that are written to the
analog output channels. Currently it only caches the single writes
to the channels using the (*insn_write) callback. The async command
writes are not cached. The buffer is also being kzalloc'ed during
the attach of the driver to a size much larger that required.

Rename the CamelCase buffer and change it to an array in the private
data of the correct size to cache the analog output channel values.

Modify the analog output urb callback so it updates the cached values
with those used for the asynchronous command to allow readback after
the command completes.

The sanity check of the index to dac_commands[] (i.e. the 'chan' being
written) is not needed. The chanlist_len will always be less than the
number of channels.

Also, fix the dev_err() message so it uses the proper device 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>
10 years agostaging: comedi: usbdux: rename private data variables
H Hartley Sweeten [Thu, 25 Jul 2013 23:09:48 +0000 (16:09 -0700)]
staging: comedi: usbdux: rename private data variables

The usbdux and usbduxsigma drivers are _very_ similar. For aesthetic
reasons, rename the private data variables in this driver to match
the names in the usbduxsigma driver so we can start sharing the
common code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: clarify bipolar ai data in usbduxsub_ai_isoc_irq()
H Hartley Sweeten [Thu, 25 Jul 2013 23:09:30 +0000 (16:09 -0700)]
staging: comedi: usbdux: clarify bipolar ai data in usbduxsub_ai_isoc_irq()

Use the comedi_range_is_bipolar() helper instead of checking the
'range' index against a magic number.

Also, use the s->maxdata to calculate the value needed to munge the
value for bipolar data instead of the magic number.

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>
10 years agostaging: comedi: usbdux: move usbdux_firmware_upload()
H Hartley Sweeten [Thu, 25 Jul 2013 23:09:13 +0000 (16:09 -0700)]
staging: comedi: usbdux: move usbdux_firmware_upload()

For aesthetics, move this function closer to the (*auto_attach).

Also, rename some of the defined constants that are used by the
firmware upload.

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>
10 years agostaging: comedi: usbdux: remove some unused defines
H Hartley Sweeten [Thu, 25 Jul 2013 23:08:52 +0000 (16:08 -0700)]
staging: comedi: usbdux: remove some unused defines

These defines are not used by the driver. 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>
10 years agostaging: comedi: usbdux: remove the usb endpoint defines
H Hartley Sweeten [Thu, 25 Jul 2013 23:08:35 +0000 (16:08 -0700)]
staging: comedi: usbdux: remove the usb endpoint defines

The endpoint defines are each only used in one place and don't help
clarify the code. Remove the defines and just open code the values.

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>
10 years agostaging: comedi: usbdux: use the stop helpers in the detach
H Hartley Sweeten [Thu, 25 Jul 2013 23:08:16 +0000 (16:08 -0700)]
staging: comedi: usbdux: use the stop helpers in the detach

Use the stop helpers instead of duplicating the code in the detach.

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>
10 years agostaging: comedi: usbdux: tidy up unlink and stop helpers
H Hartley Sweeten [Thu, 25 Jul 2013 23:07:57 +0000 (16:07 -0700)]
staging: comedi: usbdux: tidy up unlink and stop helpers

For aesthetic reasons, pass the comedi_device pointer to the unlink
helpers instead of the private data pointer.

All the unlink helpers simply call usb_kill_urb() to cancel any pending
transfer requests. The usb passed to usb_kill_urb() can be NULL so the
extra sanity check is not required.

The unlink helpers will always return success so just make them void
functions.

Since the stop helpers will also always return success, make them void
functions as well.

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>
10 years agostaging: comedi: usbdux: fix usbdux_pwm_start()
H Hartley Sweeten [Thu, 25 Jul 2013 23:07:39 +0000 (16:07 -0700)]
staging: comedi: usbdux: fix usbdux_pwm_start()

Add the missing down/up of the semaphore to prevent other commands
from being issued to the usb device while the pwn is being stopped.

Rename the local variable used for the private data pointer to the
comedi "norm".

Use memset() to initialize the urb transfer buffer.

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>
10 years agostaging: comedi: usbdux: fix usbdux_pwm_cancel()
H Hartley Sweeten [Thu, 25 Jul 2013 23:07:20 +0000 (16:07 -0700)]
staging: comedi: usbdux: fix usbdux_pwm_cancel()

Add the missing down/up of the semaphore to prevent other commands
from being issued to the usb device while the pwn is being stopped.

Rename the local variable used for the private data pointer to the
comedi "norm".

Make sure to check that usbdux_pwm_stop() was successful before
sending command to the usb device to stop the pwm.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_pwm_stop()
H Hartley Sweeten [Thu, 25 Jul 2013 23:07:04 +0000 (16:07 -0700)]
staging: comedi: usbdux: tidy up usbdux_pwm_stop()

For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the 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>
10 years agostaging: comedi: usbdux: fix usbdux_counter_write()
H Hartley Sweeten [Thu, 25 Jul 2013 23:06:47 +0000 (16:06 -0700)]
staging: comedi: usbdux: fix usbdux_counter_write()

Comedi (*insn_write) operations are supposed to write insn->n values.
Fix this function to work like the core expects.

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the 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>
10 years agostaging: comedi: usbdux: fix usbdux_counter_read()
H Hartley Sweeten [Thu, 25 Jul 2013 23:06:30 +0000 (16:06 -0700)]
staging: comedi: usbdux: fix usbdux_counter_read()

Comedi (*insn_read) operations are supposed to read and return insn->n
values. Fix this function to work like the core expects.

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Tidy up the exit path using goto to ensure that the semaphore is
released.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_dio_insn_bits()
H Hartley Sweeten [Thu, 25 Jul 2013 23:06:11 +0000 (16:06 -0700)]
staging: comedi: usbdux: tidy up usbdux_dio_insn_bits()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Tidy up the exit path using goto to ensure that the semaphore is
released.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_dio_insn_config()
H Hartley Sweeten [Thu, 25 Jul 2013 23:05:53 +0000 (16:05 -0700)]
staging: comedi: usbdux: tidy up usbdux_dio_insn_config()

Tidy up this 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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ao_cmd()
H Hartley Sweeten [Thu, 25 Jul 2013 23:05:35 +0000 (16:05 -0700)]
staging: comedi: usbdux: tidy up usbdux_ao_cmd()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Make sure an ao command is not already running and return -EBUSY.

Tidy up the exit path using goto to ensure that the semaphore is
released.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ao_inttrig()
H Hartley Sweeten [Thu, 25 Jul 2013 23:05:17 +0000 (16:05 -0700)]
staging: comedi: usbdux: tidy up usbdux_ao_inttrig()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Tidy up the exit path using goto to ensure that the semaphore is
released.

Return -EBUSY instead if an ao command is already running.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ao_insn_write()
H Hartley Sweeten [Thu, 25 Jul 2013 23:05:00 +0000 (16:05 -0700)]
staging: comedi: usbdux: tidy up usbdux_ao_insn_write()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Tidy up the exit path using goto to ensure that the semaphore is
released.

Return -EBUSY instead of 0 if the (*insn_write) cannot be done because
a command is running.

Tidy up the for() loop that writes the data. The dux_commands[1] and [4]
can be set outside the loop since they are constant. Use a local pointer
for dux_commands[2] to load the value to write. Only the last value needs
to be cached in the private data for read back.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ao_insn_read()
H Hartley Sweeten [Thu, 25 Jul 2013 23:04:34 +0000 (16:04 -0700)]
staging: comedi: usbdux: tidy up usbdux_ao_insn_read()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the 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>
10 years agostaging: comedi: usbdux: clarify bipolar ai data
H Hartley Sweeten [Thu, 25 Jul 2013 23:04:17 +0000 (16:04 -0700)]
staging: comedi: usbdux: clarify bipolar ai data

Use the comedi_range_is_bipolar() helper instead of checking the
'range' index against a magic number.

Also, use the s->maxdata to calculate the value needed to munge the
value for bipolar data instead of the magic number.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ai_insn_read()
H Hartley Sweeten [Thu, 25 Jul 2013 23:03:53 +0000 (16:03 -0700)]
staging: comedi: usbdux: tidy up usbdux_ai_insn_read()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Tidy up the exit path using goto to ensure that the semaphore is
released.

Return -EBUSY instead of 0 if the (*insn_read) cannot be done because
a command is running.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ai_cmd()
H Hartley Sweeten [Thu, 25 Jul 2013 23:03:34 +0000 (16:03 -0700)]
staging: comedi: usbdux: tidy up usbdux_ai_cmd()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Tidy up the exit path using goto to ensure that the semaphore is
released.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ai_inttrig()
H Hartley Sweeten [Thu, 25 Jul 2013 23:03:15 +0000 (16:03 -0700)]
staging: comedi: usbdux: tidy up usbdux_ai_inttrig()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Tidy up the exit path using goto to ensure that the semaphore is
released.

Return -EBUSY if an ai command is already running.

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>
10 years agostaging: comedi: usbduxsigma: set *_cmd_running flags before submitting urbs
H Hartley Sweeten [Thu, 25 Jul 2013 23:21:13 +0000 (16:21 -0700)]
staging: comedi: usbduxsigma: set *_cmd_running flags before submitting urbs

As pointed out by Ian Abbott, the *_cmd_running flags should be set
before submitting the urbs. There is a possible race condition where
an urb could complete and the flag is checked in the completion
routine before it's set.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Acked-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: gdm724x: use GFP_ATOMIC under spin lock
Wei Yongjun [Fri, 26 Jul 2013 02:15:55 +0000 (10:15 +0800)]
staging: gdm724x: use GFP_ATOMIC under spin lock

A spin lock is taken here so we should use GFP_ATOMIC.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: Kconfig: COMEDI_NI_ATMIO doesn't need to depend on ISAPNP
Ian Abbott [Fri, 26 Jul 2013 11:03:20 +0000 (12:03 +0100)]
staging: comedi: Kconfig: COMEDI_NI_ATMIO doesn't need to depend on ISAPNP

The COMEDI_NI_ATMIO configuration option causes the "ni_atmio" module to
be built, which handles various National Instruments ISA-PNP data
acquisition cards.  The configuration option currently depends on
ISAPNP.

The "ni_atmio" module is a "legacy" comedi driver with no
auto-configuration support and it doesn't register as a PNP card driver.
The only difference in initialization from the other comedi ISA card
drivers is that it will use the ISA-PNP functions to find, attach and
activate the card if no I/O base address has been specified by the user
in the COMEDI_DEVCONFIG ioctl.

The module compiles fine without the ISAPNP configuration option as the
<linux/isapnp.h> and <linux/pnp.h> headers provide dummy inline
functions if the ISAPNP and PNP options, respectively, are not enabled.

Remove the dependancy on the ISAPNP option since the module builds
without it and can be used without it.

(There is a very slim chance that comedi will support proper ISA PNP
drivers one day, in which case the ni_atmio driver could be converted to
use this support and not support manual configuration.  However, not all
the PnP IDs of boards supported by this driver are currently known to
us.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: Kconfig: COMEDI_NI_ATMIO16D should not depend on ISAPNP
Ian Abbott [Fri, 26 Jul 2013 11:03:19 +0000 (12:03 +0100)]
staging: comedi: Kconfig: COMEDI_NI_ATMIO16D should not depend on ISAPNP

The COMEDI_NI_ATMIO16D configuration option causes the "ni_atmio16d"
module to be built, which handles the National Instruments AT-MIO-16 and
AT-MIO-16D cards.  The configuration option currently depends on ISAPNP,
but the module doesn't use any ISAPNP functions and the cards are legacy
ISA cards with base I/O port, IRQ and DMA channel configured by jumpers.
(The driver doesn't use DMA though.)

Remove the ISADNP dependancy from COMEDI_NI_ATMIO16D and fix up the help
text - the card names are missing a dash and they're not ISA-PNP.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dt9812: Resolves sparse endian warnings.
Shaun Laing [Fri, 26 Jul 2013 14:25:34 +0000 (08:25 -0600)]
staging: comedi: dt9812: Resolves sparse endian warnings.

Resolves warnings from the "sparse" checker of the form "warning: cast to
restricted __le??".

Signed-off-by: Shaun Laing <shaun@xresource.ca>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: xillybus: Multiple definition of xillyname resolved (bug fix)
Eli Billauer [Fri, 26 Jul 2013 21:24:00 +0000 (00:24 +0300)]
staging: xillybus: Multiple definition of xillyname resolved (bug fix)

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: xillybus: force to be a module
Greg Kroah-Hartman [Fri, 26 Jul 2013 21:20:39 +0000 (14:20 -0700)]
staging: xillybus: force to be a module

As reported, this driver causes problems when built into the kernel, so
force it to be a module until those issues are fixed.

Also delete the "default n" lines in the Kconfig, as they are not
needed.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: New driver: Xillybus generic interface for FPGA
Eli Billauer [Mon, 24 Jun 2013 15:55:47 +0000 (18:55 +0300)]
staging: New driver: Xillybus generic interface for FPGA

This is the driver for Xillybus, which is a general-purpose interface for
data communication with FPGAs (programmable logic). Please refer to the
README included in this patch for a detailed explanation.

It was previously submitted for misc-devices, but it appears like noone's
willing to review the code (which I can understand, given its magnitude).
Hence submitted as a staging driver.

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ozwpan: Fix coding style.
Rupesh Gujare [Wed, 24 Jul 2013 14:06:46 +0000 (15:06 +0100)]
staging: ozwpan: Fix coding style.

This patch fixes coding style issues reported by Dan here:-
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2012-June/027767.html

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: remove dead code DBG_PORT80/VIAWET_DEBUG
Malcolm Priestley [Tue, 23 Jul 2013 22:10:59 +0000 (23:10 +0100)]
staging: vt6656: remove dead code DBG_PORT80/VIAWET_DEBUG

DBG_PORT80 is always defined as empty macro
because VIAWET_DEBUG is never defined. Remove
it and VIAWET_DEBUG.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: Remove dead code macro ASSERT
Malcolm Priestley [Tue, 23 Jul 2013 22:07:02 +0000 (23:07 +0100)]
staging: vt6656: Remove dead code macro ASSERT

ASSERT is always defined as empty macro
because VIAWET_DEBUG is never defined.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: zram: Add auto loading of module if user opens /dev/zram.
Konrad Rzeszutek Wilk [Fri, 12 Jul 2013 18:20:52 +0000 (14:20 -0400)]
staging: zram: Add auto loading of module if user opens /dev/zram.

Greg spotted that said driver is not subscribing to the automagic
mechanism of auto-loading if a user tries to open /dev/zram.

This fixes it.

CC: Minchan Kim <minchan@kernel.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: olpc_dcon: change to msleep to usleep_range
Jens Frederich [Thu, 25 Jul 2013 20:06:32 +0000 (22:06 +0200)]
Staging: olpc_dcon: change to msleep to usleep_range

The resolution of msleep is related to HZ, so with HZ set to
100 any msleep of less then 10ms will become ~10ms. This is
not what we want. Use usleep_range to get more control of
what is happening here.

Signed-off-by: Jens Frederich <jfrederich@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dwc2: Don't touch the dma_mask when dma is disabled
Matthijs Kooijman [Wed, 24 Jul 2013 11:29:22 +0000 (13:29 +0200)]
staging: dwc2: Don't touch the dma_mask when dma is disabled

There was some code that cleared the dma_mask when dma was disabled in
the driver. Given that clearing the mask doesn't actually tell the usb
core we're not using dma, and a previous commit explicitely sets the
hcd->self.uses_dma value, it seems these values are unneeded and can
only potentially cause problems (when reloading a module, for example).

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <Paul.Zimmerman@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrm/imx: kill firstopen callback
Daniel Vetter [Wed, 10 Jul 2013 12:11:45 +0000 (14:11 +0200)]
drm/imx: kill firstopen callback

This thing seems to do some kind of delayed setup. Really, real kms
drivers shouldn't do that at all. Either stuff needs to be dynamically
hotplugged or the driver setup sequence needs to be fixed.

This patch here just moves the setup at the very end of the driver
load callback, with the locking adjusted accordingly.

v2: Also move the corresponding put from ->lastclose to ->unload.

Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: ipu-common: Add MODULE_ALIAS
Fabio Estevam [Sat, 20 Jul 2013 21:22:11 +0000 (18:22 -0300)]
imx-drm: ipu-common: Add MODULE_ALIAS

Add MODULE_ALIAS, so that auto module loading can work.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: ipu-common: Check the return value from clk_prepare_enable()
Fabio Estevam [Sat, 20 Jul 2013 21:22:10 +0000 (18:22 -0300)]
imx-drm: ipu-common: Check the return value from clk_prepare_enable()

clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: ipu-common: Simplify the error path
Fabio Estevam [Sat, 20 Jul 2013 21:22:09 +0000 (18:22 -0300)]
imx-drm: ipu-common: Simplify the error path

Instead of jumping to goto labels, just return the error code directly.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: imx-tve: Remove unneeded check for platform_get_resource()
Fabio Estevam [Mon, 22 Jul 2013 01:19:42 +0000 (22:19 -0300)]
imx-drm: imx-tve: Remove unneeded check for platform_get_resource()

As devm_ioremap_resource() is used on probe, there is no need to explicitly
check the return value from platform_get_resource(), as this is something that
devm_ioremap_resource() takes care by itself.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: TODO: Remove LVDS support from missing features list.
Fabio Estevam [Tue, 23 Jul 2013 17:15:32 +0000 (14:15 -0300)]
imx-drm: TODO: Remove LVDS support from missing features list.

LVDS Display Bridge is currently supported, so remove it from the missing
features list.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: imx-tve: Provide __acquires/__releases annotation
Fabio Estevam [Tue, 16 Jul 2013 05:16:14 +0000 (02:16 -0300)]
imx-drm: imx-tve: Provide __acquires/__releases annotation

Fix the following sparse warnings:

drivers/staging/imx-drm/imx-tve.c:133:13: warning: context imbalance in 'tve_lock' - wrong count at exit
drivers/staging/imx-drm/imx-tve.c:139:13: warning: context imbalance in 'tve_unlock' - unexpected unlock

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: ipu-dp: Introduce IPUV3_NUM_FLOWS
Fabio Estevam [Fri, 28 Jun 2013 16:55:30 +0000 (13:55 -0300)]
imx-drm: ipu-dp: Introduce IPUV3_NUM_FLOWS

IPUv3 has a total of 3 flows (one synchronous flow and 2 asynchronous flows).

Let's add a definition for such number in order to let the code easier to
understand.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: ipu-dp: Remove unneeded braces
Fabio Estevam [Fri, 28 Jun 2013 16:55:29 +0000 (13:55 -0300)]
imx-drm: ipu-dp: Remove unneeded braces

No need to have braces for a single line 'if' block

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: ipu-dp: Check the return value of devm_kzalloc()
Fabio Estevam [Fri, 28 Jun 2013 16:55:28 +0000 (13:55 -0300)]
imx-drm: ipu-dp: Check the return value of devm_kzalloc()

devm_kzalloc() may fail, so let's check its return value.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoimx-drm: imx-drm-core: Export imx_drm_encoder_get_mux_id
Fabio Estevam [Fri, 28 Jun 2013 16:55:27 +0000 (13:55 -0300)]
imx-drm: imx-drm-core: Export imx_drm_encoder_get_mux_id

When building imx_v6_v7_defconfig with imx-drm drivers selected as modules, we
get the following build error:

ERROR: "imx_drm_encoder_get_mux_id" [drivers/staging/imx-drm/imx-ldb.ko] undefined!

Export the required function to avoid this problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: Add missing #include <linux/slab.h>
Geert Uytterhoeven [Thu, 25 Jul 2013 20:02:48 +0000 (22:02 +0200)]
staging: comedi: Add missing #include <linux/slab.h>

sparc64 allmodconfig:

drivers/staging/comedi/drivers/addi_apci_2032.c: In function 'apci2032_auto_attach':
drivers/staging/comedi/drivers/addi_apci_2032.c:328:3: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
drivers/staging/comedi/drivers/addi_apci_2032.c:328:11: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/addi_apci_2032.c: In function 'apci2032_detach':
drivers/staging/comedi/drivers/addi_apci_2032.c:350:3: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]

drivers/staging/comedi/drivers/amplc_pci224.c: In function 'pci224_attach_common':
drivers/staging/comedi/drivers/amplc_pci224.c:1289:2: error: implicit declaration of function 'kmalloc' [-Werror=implicit-function-declaration]
drivers/staging/comedi/drivers/amplc_pci224.c:1289:23: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c:1296:24: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c:1303:25: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c:1348:42: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c: In function 'pci224_detach':
drivers/staging/comedi/drivers/amplc_pci224.c:1474:3: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]

Introduced by commit 0bdab509bf9c6d838dc0a3b1d68bbf841fc20b5a ("staging:
comedi: use comedi_alloc_devpriv()"), which removed some inclusions of
<linux/slab.h>.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ii_pci20kc: cleanup final pieces
H Hartley Sweeten [Wed, 24 Jul 2013 19:14:11 +0000 (12:14 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: cleanup the ai subdevice
H Hartley Sweeten [Wed, 24 Jul 2013 19:13:51 +0000 (12:13 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: cleanup the ao subdevice
H Hartley Sweeten [Wed, 24 Jul 2013 19:13:04 +0000 (12:13 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc.c: break up the subdevice private data union
H Hartley Sweeten [Wed, 24 Jul 2013 19:12:30 +0000 (12:12 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc.c: remove 'iobase' from the subdevice private data
H Hartley Sweeten [Wed, 24 Jul 2013 19:12:09 +0000 (12:12 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc.c: tidy up the subdevice module init
H Hartley Sweeten [Wed, 24 Jul 2013 19:11:47 +0000 (12:11 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc.c: cleanup the dio subdevice
H Hartley Sweeten [Wed, 24 Jul 2013 19:11:25 +0000 (12:11 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: remove CHAN macro
H Hartley Sweeten [Wed, 24 Jul 2013 19:11:00 +0000 (12:11 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: move comedi_lrange tables
H Hartley Sweeten [Wed, 24 Jul 2013 19:10:41 +0000 (12:10 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: remove forward declarations 3
H Hartley Sweeten [Wed, 24 Jul 2013 19:10:18 +0000 (12:10 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: remove forward declarations 2
H Hartley Sweeten [Wed, 24 Jul 2013 19:09:53 +0000 (12:09 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: remove forward declarations 1
H Hartley Sweeten [Wed, 24 Jul 2013 19:09:25 +0000 (12:09 -0700)]
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>
10 years agostaging: comedi: ii_pci20kc: use comedi_alloc_spriv()
H Hartley Sweeten [Wed, 24 Jul 2013 19:08:58 +0000 (12:08 -0700)]
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>
10 years agostaging: comedi: addi_common.h: cleanup after removal of addi_apci_1710
H Hartley Sweeten [Wed, 24 Jul 2013 18:14:43 +0000 (11:14 -0700)]
staging: comedi: addi_common.h: cleanup after removal of addi_apci_1710

Now that the addi_apci_1710 driver has been removed, get rid of all the
unnecessary stuff in addi_common.h.

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>
10 years agostaging: comedi: addi_apci_1710: delete driver
H Hartley Sweeten [Wed, 24 Jul 2013 18:13:53 +0000 (11:13 -0700)]
staging: comedi: addi_apci_1710: delete driver

This driver is seriously broken and most of it does not "work" with
the comedi API. Just remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1710: separate from addi_common.h
H Hartley Sweeten [Wed, 24 Jul 2013 18:12:35 +0000 (11:12 -0700)]
staging: comedi: addi_apci_1710: separate from addi_common.h

Move the necessary bits from addi_common.h to remove it's dependency
and make this driver standalone.

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>
10 years agostaging: comedi: addi_apci_1710: fix some compile errors/warnings
H Hartley Sweeten [Wed, 24 Jul 2013 18:11:51 +0000 (11:11 -0700)]
staging: comedi: addi_apci_1710: fix some compile errors/warnings

Fix a couple comments within comments errors.

Remove the #include of eddi_eeprom.c. This driver does not use it.

Remove an unused local variable.

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>
10 years agostaging: comedi: adv_pci1724: remove ao_range_list_1724
H Hartley Sweeten [Wed, 24 Jul 2013 17:03:50 +0000 (10:03 -0700)]
staging: comedi: adv_pci1724: remove ao_range_list_1724

All the AO channels have the same ranges. Remove the subdevice
s->range_table_list and just use the s->range_table to setup the
ranges.

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>
10 years agostaging: comedi: range: tidy up comedi_check_chanlist()
H Hartley Sweeten [Wed, 24 Jul 2013 17:00:45 +0000 (10:00 -0700)]
staging: comedi: range: tidy up comedi_check_chanlist()

The only difference in the if() and else if() check of the chanlist
is the source of the range table length. Consolidate the checks to
make the function a bit more concise.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ao_cancel()
H Hartley Sweeten [Wed, 24 Jul 2013 21:18:36 +0000 (14:18 -0700)]
staging: comedi: usbdux: tidy up usbdux_ao_cancel()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ao_stop()
H Hartley Sweeten [Wed, 24 Jul 2013 21:18:15 +0000 (14:18 -0700)]
staging: comedi: usbdux: tidy up usbdux_ao_stop()

For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ai_cancel()
H Hartley Sweeten [Wed, 24 Jul 2013 21:17:50 +0000 (14:17 -0700)]
staging: comedi: usbdux: tidy up usbdux_ai_cancel()

Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
10 years agostaging: comedi: usbdux: tidy up usbdux_ai_stop()
H Hartley Sweeten [Wed, 24 Jul 2013 21:17:23 +0000 (14:17 -0700)]
staging: comedi: usbdux: tidy up usbdux_ai_stop()

For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
10 years agostaging: comedi: usbdux: make private data flags bit-fields
H Hartley Sweeten [Wed, 24 Jul 2013 21:17:05 +0000 (14:17 -0700)]
staging: comedi: usbdux: make private data flags bit-fields

Change the flags in the private data to bit-fields to save a bit of
space.

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>
10 years agostaging: comedi: usbdux: remove 'ifnum' from the private data
H Hartley Sweeten [Wed, 24 Jul 2013 21:16:44 +0000 (14:16 -0700)]
staging: comedi: usbdux: remove 'ifnum' from the private data

The 'ifnum' is only used during the attach of the device. Remove it
from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: remove usb_device back pointer from private data
H Hartley Sweeten [Wed, 24 Jul 2013 21:16:24 +0000 (14:16 -0700)]
staging: comedi: usbdux: remove usb_device back pointer from private data

The usb_device can be found when needed using the comedi_to_usb_dev()
helper. Use that instead the remove the back pointer from the private
data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: pass comedi_device pointer to usbdux_alloc_usb_buffers()
H Hartley Sweeten [Wed, 24 Jul 2013 21:16:04 +0000 (14:16 -0700)]
staging: comedi: usbdux: pass comedi_device pointer to usbdux_alloc_usb_buffers()

For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer.

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>
10 years agostaging: comedi: usbdux: tidy up receive_dux_commands()
H Hartley Sweeten [Wed, 24 Jul 2013 21:15:43 +0000 (14:15 -0700)]
staging: comedi: usbdux: tidy up receive_dux_commands()

For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Add a local variable for the usb_device pointer to tidy up the
usb_bulk_msg() call.

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>
10 years agostaging: comedi: usbdux: tidy up send_dux_commands()
H Hartley Sweeten [Wed, 24 Jul 2013 21:15:22 +0000 (14:15 -0700)]
staging: comedi: usbdux: tidy up send_dux_commands()

For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Add a local variable for the usb_device pointer to tidy up the
usb_bulk_msg() call.

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>
10 years agostaging: comedi: usbdux: remove 'interface' from private data
H Hartley Sweeten [Wed, 24 Jul 2013 21:15:04 +0000 (14:15 -0700)]
staging: comedi: usbdux: remove 'interface' from private data

This back pointer is only used for a couple dev_printk() messages and
during the detach.

For the dev_printk() we can use the dev->class_dev. In the detach we
can get the usb_interface from the comedi_device.

Do that and remove the back pointer from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: remove 'comedidev' from private data
H Hartley Sweeten [Wed, 24 Jul 2013 21:14:42 +0000 (14:14 -0700)]
staging: comedi: usbdux: remove 'comedidev' from private data

This back pointer is no longer needed by the driver. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: tidy up usbduxsub_submit_pwm_urbs()
H Hartley Sweeten [Wed, 24 Jul 2013 21:13:34 +0000 (14:13 -0700)]
staging: comedi: usbdux: tidy up usbduxsub_submit_pwm_urbs()

Pass the comedi_device pointer (the urb context) to this function
instead of the private data pointer.

Use a local variable for the urb pointer that is setup and submitted.

Remove the sanity check of the private data. This function can only
get called if the allocation was successful during the attach.

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>
10 years agostaging: comedi: usbdux: tidy up usbduxsub_submit_outurbs()
H Hartley Sweeten [Wed, 24 Jul 2013 21:13:15 +0000 (14:13 -0700)]
staging: comedi: usbdux: tidy up usbduxsub_submit_outurbs()

Pass the comedi_device pointer (the urb context) to this function
instead of the private data pointer.

Use a local variable for the urb pointers that are setup and submitted.

Remove the sanity check of the private data. This function can only
get called if the allocation was successful during the attach.

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>
10 years agostaging: comedi: usbdux: tidy up usbduxsub_submit_inurbs()
H Hartley Sweeten [Wed, 24 Jul 2013 21:12:35 +0000 (14:12 -0700)]
staging: comedi: usbdux: tidy up usbduxsub_submit_inurbs()

Pass the comedi_device pointer (the urb context) to this function
instead of the private data pointer.

Use a local variable for the urb pointers that are setup and submitted.

Remove the sanity check of the private data. This function can only
get called if the allocation was successful during the attach.

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>
10 years agostaging: comedi: usbdux: remove dev_printk() noise
H Hartley Sweeten [Wed, 24 Jul 2013 21:12:14 +0000 (14:12 -0700)]
staging: comedi: usbdux: remove dev_printk() noise

Most of these are just function trace noise. The rest report errors
that the user can't do anything about so they amount to added noise.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: tidy up the comedi_lrange tables
H Hartley Sweeten [Wed, 24 Jul 2013 21:11:53 +0000 (14:11 -0700)]
staging: comedi: usbdux: tidy up the comedi_lrange tables

Cleanup the whitespace in the tables.

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>
10 years agostaging: comedi: usbdux: remove the SUBDEV_* defines
H Hartley Sweeten [Wed, 24 Jul 2013 21:11:33 +0000 (14:11 -0700)]
staging: comedi: usbdux: remove the SUBDEV_* defines

These defines are only used to index the dev->subdevices array
during the attach. It's cleaner to just open-code the 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>
10 years agostaging: comedi: usbdux: tidy up usbduxsub_pwm_irq()
H Hartley Sweeten [Wed, 24 Jul 2013 21:11:14 +0000 (14:11 -0700)]
staging: comedi: usbdux: tidy up usbduxsub_pwm_irq()

Rename the local variables to the comedi "norm".

Use dev->class_dev as the device for all dev_printk() messages.

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>
10 years agostaging: comedi: usbdux: tidy up usbduxsub_ao_isoc_irq()
H Hartley Sweeten [Wed, 24 Jul 2013 21:10:54 +0000 (14:10 -0700)]
staging: comedi: usbdux: tidy up usbduxsub_ao_isoc_irq()

Rename the local variables to the comedi "norm".

The comedi_subdevice in this function is actually the dev->write_subdev
that was initialized in the attach. Use that instead of accessing the
dev->subdevices array directly.

Use dev->class_dev as the device for all dev_printk() messages.

Instead of using the 'comedidev' back pointer in the private data, use
the comedi_device 'dev' that we already have.

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>
10 years agostaging: comedi: usbdux: tidy up usbduxsub_ai_isoc_irq()
H Hartley Sweeten [Wed, 24 Jul 2013 21:10:32 +0000 (14:10 -0700)]
staging: comedi: usbdux: tidy up usbduxsub_ai_isoc_irq()

Rename the local variables to the comedi "norm".

The comedi_subdevice in this function is actually the dev->read_subdev
that was initialized in the attach. Use that instead of accessing the
dev->subdevices array directly.

Use dev->class_dev as the device for all dev_printk() messages.

Instead of using the 'comedidev' back pointer in the private data, use
the comedi_device 'dev' that we already have.

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>
10 years agostaging: comedi: usbdux: absorb usbdux_attach_common into caller
H Hartley Sweeten [Wed, 24 Jul 2013 21:10:11 +0000 (14:10 -0700)]
staging: comedi: usbdux: absorb usbdux_attach_common into caller

This function is only called by usbdux_auto_attach(), absorb it.

Also, there is no reason to down/up the semaphore during the attach.
None of the subdevices are functioning yet so there are no commands
being sent to the usb device.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: tidy up usbdux_attach_common()
H Hartley Sweeten [Wed, 24 Jul 2013 21:09:51 +0000 (14:09 -0700)]
staging: comedi: usbdux: tidy up usbdux_attach_common()

Rename the local variable used for the device private data.

Move the setting of the device private data 'comedidev' to the
(*auto_attach) where the other back pointers are set.

Tidy up the subdevice init by removing the unnecessary comments
and adding some whitespace.

Remove the unnecessary dev_info() after a sucessful attach.

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>
10 years agostaging: comedi: usbdux: remove NOISY_DUX_DEBUGBUG
H Hartley Sweeten [Wed, 24 Jul 2013 21:09:24 +0000 (14:09 -0700)]
staging: comedi: usbdux: remove NOISY_DUX_DEBUGBUG

This define enables printing of the 'dux_commands' that is sent to
the usb device in send_dux_commands(). This type of development
debug should not be left in the final 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>
10 years agostaging: comedi: usbdux: cleanup the (*detach)
H Hartley Sweeten [Wed, 24 Jul 2013 21:09:04 +0000 (14:09 -0700)]
staging: comedi: usbdux: cleanup the (*detach)

The tidy_up() function is only called by the (*detach). That function
unlinks any running urbs and frees all the allocated urbs and buffers
used by the driver.

Rename tidy_up() to usbdux_free_usb_buffers() and move all the parts
that don't deal with the freeing of the buffers directly into the
(*detach).

Also, remove all the unnecessary clearing of the pointers. The comedi
core will kfree() the private data after calling the (*detach).

Foe aesthetic reasons, do the kfree()'ing of the buffers and urbs in
the reverse order that they were allocated.

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>
10 years agostaging: comedi: usbdux: remove unnecessary tidy_up() calls
H Hartley Sweeten [Wed, 24 Jul 2013 21:08:43 +0000 (14:08 -0700)]
staging: comedi: usbdux: remove unnecessary tidy_up() calls

If the comedi_driver (*auto_attach) fails, the comedi core will call
the (*detach) function to do any cleanup. It's not necessary to do
the cleanup in the (*auto_attach).

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>