]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
10 years agoiio:adc: Add Xilinx XADC driver
Lars-Peter Clausen [Mon, 17 Feb 2014 14:10:00 +0000 (14:10 +0000)]
iio:adc: Add Xilinx XADC driver

The Xilinx XADC is a ADC that can be found in the series 7 FPGAs from Xilinx.
The XADC has a DRP interface for communication. Currently two different
frontends for the DRP interface exist. One that is only available on the ZYNQ
family as a hardmacro in the SoC portion of the ZYNQ. The other one is available
on all series 7 platforms and is a softmacro with a AXI interface. This driver
supports both interfaces and internally has a small abstraction layer that hides
the specifics of these interfaces from the main driver logic.

The ADC has a couple of internal channels which are used for voltage and
temperature monitoring of the FPGA as well as one primary and up to 16 channels
auxiliary channels for measuring external voltages. The external auxiliary
channels can either be directly connected each to one physical pin on the FPGA
or they can make use of an external multiplexer which is responsible for
multiplexing the external signals onto one pair of physical pins.

The voltage and temperature monitoring channels also have an event capability
which allows to generate a interrupt when their value falls below or raises
above a set threshold.

Buffered sampling mode is supported by the driver, but only for AXI-XADC since
the ZYNQ XADC interface does not have capabilities for supporting buffer mode
(no end-of-conversion interrupt). If buffered mode is supported the driver will
register two triggers. One "xadc-samplerate" trigger which will generate samples
with the configured samplerate. And one "xadc-convst" trigger which will
generate one sample each time the CONVST (conversion start) signal is asserted.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agodevicetree: Add Xilinx XADC binding documentation
Lars-Peter Clausen [Mon, 17 Feb 2014 14:10:00 +0000 (14:10 +0000)]
devicetree: Add Xilinx XADC binding documentation

The Xilinx XADC is a ADC that can be found in the series 7 FPGAs from Xilinx.
The XADC has a DRP interface for communication. Currently two different
frontends for the DRP interface exist. One that is only available on the ZYNQ
family as a hardmacro in the SoC portion of the ZYNQ. The other one is available
on all series 7 platforms and is a softmacro with a AXI interface. This binding
document describes the bindings for both of them since the bindings are very
similar.

Each of them needs:
* A address range where the registers are mapped
* An interrupt number for the device interrupt
* A clock. For the the ZYNQ hardmacro interface this is the modules PCAP
  clock, for the AXI softmacro it is the AXI bus interface clock.

Additionally the bindings specify whether an external multiplexer is used and in
which mode it is used. The devicetree bindings also describe which external
channels are connected and in which configuration.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio:magnetometer:mag3110: Fix unreachable code
Peter Meerwald [Tue, 25 Feb 2014 19:53:00 +0000 (19:53 +0000)]
iio:magnetometer:mag3110: Fix unreachable code

        drivers/iio/magnetometer/mag3110.c:197 mag3110_read_raw()
        info: ignoring unreachable code.

drivers/iio/magnetometer/mag3110.c
   185          case IIO_CHAN_INFO_SCALE:
   186                  switch (chan->type) {
   187                  case IIO_MAGN:
   188                          *val = 0;
   189                          *val2 = 1000;
   190                          return IIO_VAL_INT_PLUS_MICRO;
   191                  case IIO_TEMP:
   192                          *val = 1000;
   193                          return IIO_VAL_INT;
   194                  default:
   195                          return -EINVAL;
   196                  }
   197                  return IIO_VAL_INT_PLUS_MICRO;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

introduced by f9279d3a, mag3110: Scale factor missing

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoMerge tag 'iio-for-3.15b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Sun, 23 Feb 2014 17:08:34 +0000 (09:08 -0800)]
Merge tag 'iio-for-3.15b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second round of IIO new driver, functionality and cleanups for the 3.15 series.

There are a few fixes in here that might, earlier in a cycle, have gone
to Greg as fixes. Given they are either minor or have never actually
been observed as causing trouble (the locking bug in the event code) and
are invasive, I have included them in this pull request, targeting the
3.15 merge window instead.

The rest are pretty uncontroversial new drivers, a handy little tool for
the example code in our documentation and little cleanups.

New drivers
* Freescale Vybrid and i.MX6SLX ADC driver.
* HID Sensor hub proximity sensors.
* HID Sensor hub pressure sensors.
* LPS25H Pressure sensors added to the ST micro pressure sensor driver.

New functionality
* lsiio tool.  This is added to the staging tree as we haven't yet moved
  the example code it sits with out.  Moving this code out is now a reasonably
  high priority but holding up this tool in the meantime did not seem
  worthwhile.
* mag3110 - add missing scale factor for temperature output to userspace.

Cleanups
* Fix a bug in the event reporting in which a spin lock might be held over
  when a sleep occured.  A similar bug was found by Lars in the buffer code.
  It has not to our knowledge been observed as actually occuring and is
  a little too invasive to push out as a fix.
* Drop the IIO_ST macro after clearing out all users.  This macro was a very
  bad idea leading to a number of bugs after it stopped covering all elements
  of the structure being assigned and people started making assumptions about
  what it did cover.  Glad to see it go!
* Avoid applying extended name to shared attributes as it makes no sense.
  No in tree drivers were using the combination, hence not pushed out as
  a fix.
* ad799x - move to devm_request_threaded_irq to reduce boilerplate clean up.
* bma180 - make the low_pass_filter_3db_frequency info element shared rather
  than per attribute.  The old approach was valid but not as clean as it might
  be and was setting a bad example.  Hence the cleanup.
* mxs-lradc - propogate the error code form a platform_get_irq call rather than
  eating it up by returning -EINVAL on all errors.
* ad799x - typo fix in the copyright message. Either that or Michael was
  asserting a copyright that moved backwards in time by about a thousand years.
* ad799x - use a regulator for vref rather than platform data.  The driver
  dates from just as the regulator framework was coming into common use so
  provides an alternative way of specifying the reference voltage.  We no
  longer need that approach so drop it in favour of a regulator only approach.
* max1363 - some internal vref values were out by a small amount.  The effect
  would have been tiny and no one noticed hence not pushing this through as
  a fix.
* core - replace some pointless goto error_ret (with no clean up) lines with
  direct returns.  This is my bad coding style so I'm glad to see it cleaned
  up.
* core - avoid a kasprintf that just directly prints a string with no
  formatting elements.  This has always been there but Lars just noticed it.
  Oops.

10 years agoiio:event: Fix and cleanup locking
Lars-Peter Clausen [Fri, 14 Feb 2014 18:49:00 +0000 (18:49 +0000)]
iio:event: Fix and cleanup locking

The event code currently holds a spinlock with IRQs disabled while calling
kfifo_to_user(). kfifo_to_user() can generate a page fault though, which means
we have to be able to sleep, which is not possible if the interrupts are
disabled. The good thing is that kfifo handles concurrent read and write access
just fine as long as there is only one reader and one writer, so we do not any
locking to protect against concurrent access from the read and writer thread. It
is possible though that userspace is trying to read from the event FIFO from
multiple concurrent threads, so we need to add locking to protect against this.
This is done using a mutex. The mutex will only protect the kfifo_to_user()
call, it will not protect the waitqueue. This means that multiple threads can be
waiting for new data and once a new event is added to the FIFO all waiting
threads will be woken up. If one of those threads is unable to read any data
(because another thread already read all the data) it will go back to sleep. The
only remaining issue is that now that the clearing of the BUSY flag and the
emptying of the FIFO does no longer happen in one atomic step it is possible
that a event is added to the FIFO after it has been emptied and this sample will
be visible the next time a new event file descriptor is created. To avoid this
rather move the emptying of the FIFO from iio_event_chrdev_release to
iio_event_getfd().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio:pressure: Add support for LPS25H pressure sensor
Denis CIOCCA [Thu, 20 Feb 2014 17:49:00 +0000 (17:49 +0000)]
iio:pressure: Add support for LPS25H pressure sensor

This patch adds support for the new barometer sensor: LPS25H.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Added Pressure Sensor driver
Archana Patni [Thu, 20 Feb 2014 06:30:00 +0000 (06:30 +0000)]
iio: hid-sensors: Added Pressure Sensor driver

Added usage id processing for Pressure Sensor. This uses IIO
interfaces for triggered buffer to present data to user
mode. This uses HID sensor framework for registering callback
events from the sensor hub.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Added Proximity Sensor Driver
Archana Patni [Thu, 20 Feb 2014 06:29:00 +0000 (06:29 +0000)]
iio: hid-sensors: Added Proximity Sensor Driver

Added usage id processing for Proximity (Human Presence).
This uses IIO interfaces for triggered buffer to present data
to user mode. This uses HID sensor framework for registering
callback events from the sensor hub.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agostaging: comedi: pcl816: tidy up pcl818_check()
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:31 +0000 (10:11 -0700)]
staging: comedi: pcl816: tidy up pcl818_check()

This function probes a number of the boards registers during the
(*attach) to verify that it is actually a PCL-816 compatible board.
For aesthetics, move the function closer to the (*attach).

To better match the pcl818 driver, allocate the private data before
calling pcl816_check().

Refactor the function to return an errno if fails. Change the errno
from -EIO to -ENODEV and remove the unnecessary dev_err() noise.

Make sure the CONTROL register is reset to a known state after the
check. The 0x18 value actually defines an invalid interrupt selection
and sets an undefined bit.

Add a couple comments to clarify the magic 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: pcl816: remove unnecessary function separation comments
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:30 +0000 (10:11 -0700)]
staging: comedi: pcl816: remove unnecessary function separation comments

These comments are just added cruft. 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: pcl816: remove unnecessary 'dev->irq' check
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:29 +0000 (10:11 -0700)]
staging: comedi: pcl816: remove unnecessary 'dev->irq' check

If the dev->irq is not valid the interrupt function will not be hooked
up during the attach. Remove the unnecessary check.

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: pcl816: rename 'irq_blocked' in private data
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:28 +0000 (10:11 -0700)]
staging: comedi: pcl816: rename 'irq_blocked' in private data

This member in the private data is a flag that indicates that an analog
input async command is currently running. Rename it to make this clear.

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: pcl816: kzalloc'ed memory does not need to be cleared
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:27 +0000 (10:11 -0700)]
staging: comedi: pcl816: kzalloc'ed memory does not need to be cleared

The private data is kzalloc'ed in the (*attach). There is no need to
initialize any of the members to 0.

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: pcl816: convert private data flags to bit-fields
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:26 +0000 (10:11 -0700)]
staging: comedi: pcl816: convert private data flags to bit-fields

The 'irq_was_now_closed' member is actually a flag, devpriv->int816_mode
will always be > 0 when it's used to set irq_was_now_closed in the cancel
function.

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

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: pcl816: remove 'ai_act_chanlist_{len, pos}' from private data
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:25 +0000 (10:11 -0700)]
staging: comedi: pcl816: remove 'ai_act_chanlist_{len, pos}' from private data

These members of the private data don't do anything usefull. Just 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: pcl816: use subdevice (*cancel)
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:24 +0000 (10:11 -0700)]
staging: comedi: pcl816: use subdevice (*cancel)

Use the subdevice (*cancel) operation to remove the need for a 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>
10 years agostaging: comedi: pcl816: don't calc the timer divisors twice
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:23 +0000 (10:11 -0700)]
staging: comedi: pcl816: don't calc the timer divisors twice

The timer divisors are calculated in the (*do_cmdtest) before the (*do_cmd)
is called by the comedi core. The extra sanity checks in the (*do_cmd) are
not necessary, the values returned from i8253_cascade_ns_to_timer() will be
greater than 1. Save the values in the private data so they don't need to be
recalced.

Refactor pcl816_start_pacer() to use the values from the private 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>
10 years agostaging: comedi: pcl816: clarify irq request in pcl816_attach()
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:22 +0000 (10:11 -0700)]
staging: comedi: pcl816: clarify irq request in pcl816_attach()

All the board types can use IRQ 2-7 for async command support. Remove
the 'IRQbits', which is a mask of the valid IRQs, from the boardinfo
and refactor pcl816_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: pcl816: remove 'n_aochan' from boardinfo
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:21 +0000 (10:11 -0700)]
staging: comedi: pcl816: remove 'n_aochan' from boardinfo

This member of the boardinfo is the same for all board types. Remove this
data from the boardinfo.

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: pcl816: remove 'ai_ns_min' from boardinfo
H Hartley Sweeten [Wed, 19 Feb 2014 17:11:20 +0000 (10:11 -0700)]
staging: comedi: pcl816: remove 'ai_ns_min' from boardinfo

This member of the boardinfo is the same for all board types. Remove this
data from the boardinfo.

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-data: don't initialize a static variable to 0
Chase Southwood [Wed, 19 Feb 2014 07:38:10 +0000 (01:38 -0600)]
Staging: comedi: addi-data: don't initialize a static variable to 0

In hwdrv_apci1564.c, one static variable is zero initialized.  This is
unneeded and redundant, so we remove the initialization.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: replace printk() with dev_err() in hwdrv_apci1564.c
Chase Southwood [Wed, 19 Feb 2014 07:37:54 +0000 (01:37 -0600)]
Staging: comedi: addi-data: replace printk() with dev_err() in hwdrv_apci1564.c

There were a small handful of printk() calls in hwdrv_apci1564.c.  It is
generally better to use dev_err() for error messages instead, so I
switched all the printk() calls out, as well as cleaned up the error
strings.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: cleanup brace usage in hwdrv_apci1564.c
Chase Southwood [Wed, 19 Feb 2014 07:37:42 +0000 (01:37 -0600)]
Staging: comedi: addi-data: cleanup brace usage in hwdrv_apci1564.c

hwdrv_apci1564.c had many single statments wrapped in braces, so we can
delete these.  Also, some else statements were improperly placed, fix
these too.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: cleanup comments in hwdrv_apci1564.c
Chase Southwood [Wed, 19 Feb 2014 07:36:46 +0000 (01:36 -0600)]
Staging: comedi: addi-data: cleanup comments in hwdrv_apci1564.c

hwdrv_apci1564.c had a lot of commented out conditional statements that
were often identical to other un-commented out statements nearby, so it
should be safe to just delete all of these commented out lines.  This
patch also converts the remaining comments to the preferred kernel style
for comments.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: fix allocation failures
Alan [Mon, 17 Feb 2014 14:13:08 +0000 (14:13 +0000)]
staging: et131x: fix allocation failures

We should check the ring allocations don't fail.
If we get a fail we need to clean up properly. The allocator assumes the
deallocator will be used on failure, but it isn't. Make sure the
right deallocator is always called and add a missing check against
fbr allocation failure.

[v2]: Correct check logic

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: kzalloc'ed memory does not need to be cleared
H Hartley Sweeten [Mon, 17 Feb 2014 21:28:01 +0000 (14:28 -0700)]
staging: comedi: pcl818: kzalloc'ed memory does not need to be cleared

The private data is kzalloc'ed in the (*attach). There is no need to
initialize and the members to 0.

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: pcl812: allocate private data before requesting the I/O region
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:59 +0000 (14:27 -0700)]
staging: comedi: pcl812: allocate private data before requesting the I/O region

To better match the pcl818 and pcl816 drivers, allocate the private data before
calling comedi_request_region().

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: pcl818: tidy up pcl818_check()
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:57 +0000 (14:27 -0700)]
staging: comedi: pcl818: tidy up pcl818_check()

This function probes a number of the boards registers during the
(*attach) to verify that it is actually a PCL-818 compatible board.
For aesthetics, move the function closer to the (*attach).

Refactor the function to return an errno if fails. Change the errno
from -EIO to -ENODEV and remove the unnecessary comedi_error() noise.

Make sure the CONTROL register is reset to a known state after the
check. The 0x18 value actually defines an invalid interrupt selection
and sets an undefined bit.

Add a couple comments to clarify the magic 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: pcl818: remove unnecessary function separation comments
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:56 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove unnecessary function separation comments

These comments are just added cruft. 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: pcl812: remove unnecessary function separation comments
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:54 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove unnecessary function separation comments

These comments are just added cruft. 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: pcl818: rename 'irq_blocked' in private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:52 +0000 (14:27 -0700)]
staging: comedi: pcl818: rename 'irq_blocked' in private data

This member in the private data is a flag that indicates that an analog
input async command is currently running. Rename it to make this clear.

The private data is kzalloc'ed in the attach so remove the unnecessary
clearing of this flag.

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: pcl818: convert private data flags to bit-fields
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:50 +0000 (14:27 -0700)]
staging: comedi: pcl818: convert private data flags to bit-fields

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

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: pcl812: convert private data flags to bit-fields
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:48 +0000 (14:27 -0700)]
staging: comedi: pcl812: convert private data flags to bit-fields

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

Rename the CamelCase 'use_MPC' member.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: remove 'ai_chanlist' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:46 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'ai_chanlist' from private data

This member of the private data is just a pointer to the cmd->chanlist.
Use that instead.

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: pcl812: remove 'ai_chanlist' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:45 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove 'ai_chanlist' from private data

This member of the private data is just a copy of the cmd->chanlist. Use
that instead.

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: pcl818: remove 'ai_timer[12]' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:44 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'ai_timer[12]' from private data

These members of the private data are set but never used. 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: pcl818: remove analog output interrupt code
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:43 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove analog output interrupt code

The hardware does not have any analog output interrupt support. Remove the
stubbed in 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: pcl818: use subdevice (*cancel)
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:42 +0000 (14:27 -0700)]
staging: comedi: pcl818: use subdevice (*cancel)

Use the subdevice (*cancel) operation to remove the need for a 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>
10 years agostaging: comedi: pcl812: use subdevice (*cancel)
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:40 +0000 (14:27 -0700)]
staging: comedi: pcl812: use subdevice (*cancel)

Use the subdevice (*cancel) operation to remove the need for a 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>
10 years agostaging: comedi: pcl818: don't calc the timer divisors twice
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:39 +0000 (14:27 -0700)]
staging: comedi: pcl818: don't calc the timer divisors twice

The timer divisors are calculated in the (*do_cmdtest) before the (*do_cmd)
is called by the comedi core. The extra sanity checks in the (*do_cmd) are
not necessary, the values returned from i8253_cascade_ns_to_timer() will be
greater than 1. Save the values in the private data so they don't need to be
recalced.

Refactor pcl818_start_pacer() to use the values from the private 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>
10 years agostaging: comedi: pcl812: don't calc the timer divisors twice
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:37 +0000 (14:27 -0700)]
staging: comedi: pcl812: don't calc the timer divisors twice

The timer divisors are calculated in the (*do_cmdtest) before the (*do_cmd)
is called by the comedi core. Save the values in the private data so they
don't need to be recalced.

Refactor pcl812_start_pacer() to use the values from the private 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>
10 years agostaging: comedi: pcl816: remove unneeded forward declarations
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:36 +0000 (14:27 -0700)]
staging: comedi: pcl816: remove unneeded forward declarations

These forward declarations are not 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>
10 years agostaging: comedi: pcl818: use 8253.h helpers
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:35 +0000 (14:27 -0700)]
staging: comedi: pcl818: use 8253.h helpers

Use the helper functions in 8253.h to clarify the timer programming.

Move start_pacer() to remove the need for the forward declarations.
Rename the function so it has namespace associated with the driver.

Change the 'mode' parameter. This parameter is really a flag to the
function indicating if the divisors should be loaded into the timers.

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: pcl816: use 8253.h helpers
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:34 +0000 (14:27 -0700)]
staging: comedi: pcl816: use 8253.h helpers

Use the helper functions in 8253.h to clarify the timer programming.

Move start_pacer() to remove the need for the forward declarations.
Rename the function so it has namespace associated with the driver.

Change the 'mode' parameter. This parameter is really a flag to the
function indicating if the divisors should be loaded into the timers.

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: pcl812: use 8253.h helpers
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:33 +0000 (14:27 -0700)]
staging: comedi: pcl812: use 8253.h helpers

Use the helper functions in 8253.h to clarify the timer programming.

Move start_pacer() to remove the need for the forward declarations.
Rename the function so it has namespace associated with the driver.

Change the 'mode' parameter. This parameter is really a flag to the
function indicating if the divisors should be loaded into the timers.

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: pcl818: remove 'last_int_sub' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:32 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'last_int_sub' from private data

THis member of the private data is set but never used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: remove 'last_int_sub' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:31 +0000 (14:27 -0700)]
staging: comedi: pcl816: remove 'last_int_sub' from private data

THis member of the private data is set but never used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: tidy up dma buffer allocation
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:30 +0000 (14:27 -0700)]
staging: comedi: pcl818: tidy up dma buffer allocation

This driver uses 2 buffers for DMA. Refactor the buffer allocation to
use a for loop to remove code duplication. Remove the dev_err() messages
when __get_dma_pages() fails and change the errno returned from -EBUSY
to -ENOMEM.

Both buffers are the same size so replace the 'dmapages' and 'hwdmasize'
arrays in the private data with variables to save a bit of space.

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: pcl816: tidy up dma buffer allocation
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:29 +0000 (14:27 -0700)]
staging: comedi: pcl816: tidy up dma buffer allocation

This driver uses 2 buffers for DMA. Refactor the buffer allocation to
use a for loop to remove code duplication. Remove the dev_err() messages
when __get_dma_pages() fails and change the errno returned from -EBUSY
to -ENOMEM.

Both buffers are the same size so replace the 'dmapages' and 'hwdmasize'
arrays in the private data with variables to save a bit of space.

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: pcl812: tidy up dma buffer allocation
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:28 +0000 (14:27 -0700)]
staging: comedi: pcl812: tidy up dma buffer allocation

This driver uses 2 buffers for DMA. Refactor the buffer allocation to
use a for loop to remove code duplication. Remove the dev_err() messages
when __get_dma_pages() fails and change the errno returned from -EBUSY
to -ENOMEM.

Both buffers are the same size so replace the 'dmapages' and 'hwdmasize'
arrays in the private data with variables to save a bit of space.

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: pcl818: remove 'ai_flags' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:27 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'ai_flags' from private data

This member of the private data is not used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: remove 'ai_flags' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:26 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove 'ai_flags' from private data

This member of the private data is just a copy of the cmd->flags.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: remove 'ai_n_chan' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:25 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'ai_n_chan' from private data

This member of the private data is just a copy of the cmd->chanlist_len.

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: pcl816: remove 'ai_n_chan' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:24 +0000 (14:27 -0700)]
staging: comedi: pcl816: remove 'ai_n_chan' from private data

This member of the private data is just a copy of the cmd->chanlist_len.

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: pcl812: remove 'ai_n_chan' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:23 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove 'ai_n_chan' from private data

This member of the private data is just a copy of the cmd->chanlist_len.

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: pcl818: remove 'ai_scans' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:22 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'ai_scans' from private data

This member of the private data is just a copy of the cmd->stop_arg.

Refactor the code to follow the style of pcl812 and pcl816 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>
10 years agostaging: comedi: pcl816: remove 'ai_scans' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:21 +0000 (14:27 -0700)]
staging: comedi: pcl816: remove 'ai_scans' from private data

This member of the private data is just a copy of the cmd->stop_arg.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: remove 'ai_scans' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:20 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove 'ai_scans' from private data

This member of the private data is just a copy of the cmd->stop_arg.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: remove 'valid' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:19 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove 'valid' from private data

This member of the private data is set but never used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: remove acl8216_ai_insn_read()
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:18 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove acl8216_ai_insn_read()

This (*insn_read) function was used to read 16-bit analog input data
from the boardACL8216 boardtypes. The 12/16-bit differences are now
handled by the pcl812_ai_eoc() and pcl812_ai_get_sample() helpers.

Remove this function and use pcl812_ai_insn_read() for all boardtypes.

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: pcl812: remove 'ai_is16b' from private data
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:17 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove 'ai_is16b' from private data

We can check the subdevice 'maxdata' to determine if the analog input
data is 12 or 16-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: pcl818: introduce pcl818_ai_get_sample()
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:16 +0000 (14:27 -0700)]
staging: comedi: pcl818: introduce pcl818_ai_get_sample()

Introduce a helper function to read the 12-bit analog input data
sample and optionally return the channel that the sample was for.
The channel is only used in the interrupt routine to check for
dropped samples.

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: pcl816: introduce pcl816_ai_get_sample()
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:15 +0000 (14:27 -0700)]
staging: comedi: pcl816: introduce pcl816_ai_get_sample()

Introduce a helper function to read the 14/16-bit analog input data
sample.

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: pcl812: introduce pcl812_ai_get_sample()
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:14 +0000 (14:27 -0700)]
staging: comedi: pcl812: introduce pcl812_ai_get_sample()

Introduce a helper function to read the 12/16-bit analog input data
sample.

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: pcl812: remove 'ai_maxdata' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:13 +0000 (14:27 -0700)]
staging: comedi: pcl812: remove 'ai_maxdata' from boardinfo

Most of the board types supported by this driver have 12-bit analog
inputs. Two of them, the acl8216 and a826pg, have 16-bit analog inputs.

Remove the 'ai_maxdata' member from the boardinfo and replace it with
a bit-field flag 'has_16bit_ai'. Refactor pcl812_attach() to use this
new boardinfo.

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: pcl818: remove 'ao_maxdata' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:12 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'ao_maxdata' from boardinfo

All the board types have 12-bit analog outputs. Remove this data from
the boardinfo.

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: pcl818: remove 'ai_maxdata' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:11 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'ai_maxdata' from boardinfo

All the board types have 12-bit analog inputs. Remove this data from
the boardinfo.

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: pcl818: clarify irq request in pcl818_attach()
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:10 +0000 (14:27 -0700)]
staging: comedi: pcl818: clarify irq request in pcl818_attach()

All the board types can use IRQ 2-7 for async command support. Remove
the 'IRQbits', which is a mask of the valid IRQs, from the boardinfo
and refactor pcl818_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: pcl816: remove 'ai_range_type' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:06 +0000 (14:27 -0700)]
staging: comedi: pcl816: remove 'ai_range_type' from boardinfo

All the board types use the same analog input range_table. Remove this
data from the boardinfo.

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: pcl816: remove 'ao_chanlist' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:04 +0000 (14:27 -0700)]
staging: comedi: pcl816: remove 'ao_chanlist' from boardinfo

This member in the boardinfo is the same for all board types. Remove
it.

The comedi core will initalize the subdevice len_chanlist to 1 if it
is not set by the driver so remove the unnecessary initialization.

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: pcl818: remove 'n_ranges' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:03 +0000 (14:27 -0700)]
staging: comedi: pcl818: remove 'n_ranges' from boardinfo

This member in the boardinfo is not used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: remove 'n_ranges' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:02 +0000 (14:27 -0700)]
staging: comedi: pcl816: remove 'n_ranges' from boardinfo

This member in the boardinfo is not used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: tidy up differential ai user option
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:01 +0000 (14:27 -0700)]
staging: comedi: pcl812: tidy up differential ai user option

Some of the boards supported by this driver can do differential analog
input when configureg with jumpers on the board. When diff. ai is used
the number of input channels is half the single-ended number of channels.
The user specifies the analog input mode for these boards when attaching
to the driver by using a configuration option.

Remove the unnecessary 'n_aichan_diff' member from the boardinfo. Add a
comment for the boards that can do differential ai.

Refactor pcl812_attach() to parse the user option before setting up the
subdevices. We can then use the 'use_diff' flag to determine if the ai
is single-ended or differential and set the subdev_flags and n_chan.

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: pcl818: all board types have analog inputs
H Hartley Sweeten [Mon, 17 Feb 2014 21:27:00 +0000 (14:27 -0700)]
staging: comedi: pcl818: all board types have analog inputs

All the boards supported by this driver have 16 single-ended analog input
channels. The boards can also be configued to give 8 differential inputs.

Remove the 'n_aichan_se' and 'n_aichan_diff' members from the boardinfo and
refactor pcl818_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: pcl816: all board types have 16 analog inputs
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:59 +0000 (14:26 -0700)]
staging: comedi: pcl816: all board types have 16 analog inputs

All the boards supported by this driver have 16 analog input channels.

Remove the 'n_aichan' member from the boardinfo and refactor pcl816_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: pcl812: all board types have analog inputs
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:58 +0000 (14:26 -0700)]
staging: comedi: pcl812: all board types have analog inputs

All the boards supported by this driver have 16 or 32 analog input
channels.

Remove the unnecessary check in pcl812_attach() to reduce the indent
level of the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: factor analog input range selection out of (*attach)
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:57 +0000 (14:26 -0700)]
staging: comedi: pcl818: factor analog input range selection out of (*attach)

The analog input subdevice range is setup in this driver based on a config
option passed by the user. Factor the code that sets the range_table out
of pcl818_attach() to clarify 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: pcl812: factor analog input range selection out of (*attach)
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:56 +0000 (14:26 -0700)]
staging: comedi: pcl812: factor analog input range selection out of (*attach)

The analog input subdevice range is setup in this driver based on a config
option passed by the user. Factor the code that sets the range_table out
of pcl812_attach() to clarify 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: pcl816: all board types have digital inputs and outputs
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:55 +0000 (14:26 -0700)]
staging: comedi: pcl816: all board types have digital inputs and outputs

All the board types have 16 digital inputs and 16 digital outputs.

Remove the 'n_dichan' and 'n_dochan' members in the boardinfo.

The subdevice support code is currently incomplete in this driver. For
now just tidy up the incomplete subdevice code in pcl816_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: pcl818: all board types have digital inputs and outputs
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:54 +0000 (14:26 -0700)]
staging: comedi: pcl818: all board types have digital inputs and outputs

All the board types have 16 digital inputs and 16 digital outputs.

Remove the 'n_dichan' and 'n_dochan' members in the boardinfo. Refactor
pcl818_attach() to always setup these subdevices.

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: pcl812: tidy up digital subdevice boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:53 +0000 (14:26 -0700)]
staging: comedi: pcl812: tidy up digital subdevice boardinfo

For the board types that have digital inputs and outputs there are always
16 input channels and 16 output channels.

Remove the 'n_dichan' and 'n_dochan' members in the boardinfo and replace
them with a bit-field flag 'has_dio'. Refactor pcl812_attach() to use the
new boardinfo.

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: pcl818: change 'is_818' in boardinfo to a bit-field
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:52 +0000 (14:26 -0700)]
staging: comedi: pcl818: change 'is_818' in boardinfo to a bit-field

Change this flag in the boardinfo into a bit-field.

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: pcl812: rename 'haveMPC508' in boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:51 +0000 (14:26 -0700)]
staging: comedi: pcl812: rename 'haveMPC508' in boardinfo

Rename this CamelCase member in the boardinfo and change it to a bit-
field flag.

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: pcl818: clarify dma channel request in pcl818_attach()
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:50 +0000 (14:26 -0700)]
staging: comedi: pcl818: clarify dma channel request in pcl818_attach()

All the board types that can do DMA can use DMA channels 3 or 1. Remove
the 'DMAbits', which is a mask of the valid channels, from the boardinfo
and replace it with a bit-field flag 'has_dma'.

Refactor pcl818_attach() to use the new flag and remove the need for the
goto.

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: pcl816: clarify dma channel request in pcl816_attach()
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:49 +0000 (14:26 -0700)]
staging: comedi: pcl816: clarify dma channel request in pcl816_attach()

All the board types can do DMA using DMA channels 3 or 1. Remove the 'DMAbits',
which is a mask of the valid channels, from the boardinfo.

Refactor pcl816_attach() to remove the need for the goto.

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: pcl812: clarify dma channel request in pcl812_attach()
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:48 +0000 (14:26 -0700)]
staging: comedi: pcl812: clarify dma channel request in pcl812_attach()

All the board types that can do DMA can use DMA channels 3 or 1. Remove
the 'DMAbits', which is a mask of the valid channels, from the boardinfo
and replace it with a bit-field flag 'has_dma'.

Refactor pcl812_attach() to use the new flag and remove the need for the
goto.

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: pcl818: remove 'rangelist_ao' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:47 +0000 (14:26 -0700)]
staging: comedi: pcl818: remove 'rangelist_ao' from boardinfo

The 'rangelist_ao' is the same for all board types. Remove this data
from the boardinfo.

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: pcl816: remove 'rangelist_ao' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:46 +0000 (14:26 -0700)]
staging: comedi: pcl816: remove 'rangelist_ao' from boardinfo

The 'rangelist_ao' is the same for all board types. Remove this data
from the boardinfo.

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: pcl812: remove 'rangelist_ao' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:45 +0000 (14:26 -0700)]
staging: comedi: pcl812: remove 'rangelist_ao' from boardinfo

The 'rangelist_ao' is the same for all board types. Remove this data
from the boardinfo.

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: pcl816: remove 'i8254_osc_base' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:44 +0000 (14:26 -0700)]
staging: comedi: pcl816: remove 'i8254_osc_base' from boardinfo

The 'i8254_osc_base' is the same for all board types. Remove this data
from the boardinfo.

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: pcl812: remove 'i8254_osc_base' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:43 +0000 (14:26 -0700)]
staging: comedi: pcl812: remove 'i8254_osc_base' from boardinfo

The 'i8254_osc_base' is the same for all board types. Remove this data
from the boardinfo.

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: pcl818: remove 'io_range' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:42 +0000 (14:26 -0700)]
staging: comedi: pcl818: remove 'io_range' from boardinfo

The 'io_range' is the same for all board types. Remove this data from
the boardinfo.

The i/o resource size is larger for board types that have a FIFO but this
larger region is only requested if the user wants to use the fifo.

Modify the pcl818_attach() to remove the need for the 'io_range' in the
private data.

For aesthetics, rename the 'fifo' member in the boardinfo to 'has_fifo'
and change it to a bit-field.

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: pcl816: remove 'io_range' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:41 +0000 (14:26 -0700)]
staging: comedi: pcl816: remove 'io_range' from boardinfo

The 'io_range' is the same for all board types. Remove this data from
the boardinfo.

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: pcl812: remove 'io_range' from boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:40 +0000 (14:26 -0700)]
staging: comedi: pcl812: remove 'io_range' from boardinfo

The 'io_range' is the same for all board types. Remove this data from
the boardinfo.

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: pcl818: remove 0/NULL initialzation in boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:39 +0000 (14:26 -0700)]
staging: comedi: pcl818: remove 0/NULL initialzation in boardinfo

The unlisted members in the boardinfo declaration will default to 0/NULL.

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: pcl812: remove 0/NULL initialzation in boardinfo
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:38 +0000 (14:26 -0700)]
staging: comedi: pcl812: remove 0/NULL initialzation in boardinfo

The unlisted members in the boardinfo declaration will default to 0/NULL.

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: pcl818: convert boardinfo declaration to C99 format
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:37 +0000 (14:26 -0700)]
staging: comedi: pcl818: convert boardinfo declaration to C99 format

To reduce editing errors and make the data more maintainable, convert
the boardinfo declaration to C99 format.

For aesthetics, move the declaration closer to the definition and remove
the unnecessary comments in the definition.

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: pcl816: convert boardinfo declaration to C99 format
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:36 +0000 (14:26 -0700)]
staging: comedi: pcl816: convert boardinfo declaration to C99 format

To reduce editing errors and make the data more maintainable, convert
the boardinfo declaration to C99 format.

For aesthetics, move the declaration closer to the definition and remove
the unnecessary comments in the definition.

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: pcl812: convert boardinfo declaration to C99 format
H Hartley Sweeten [Mon, 17 Feb 2014 21:26:35 +0000 (14:26 -0700)]
staging: comedi: pcl812: convert boardinfo declaration to C99 format

To reduce editing errors and make the data more maintainable, convert
the boardinfo declaration to C99 format.

For aesthetics, move the declaration closer to the definition and remove
the unnecessary comments in the definition.

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/bcm: integer underflow leads to Oom
Dan Carpenter [Mon, 17 Feb 2014 19:57:31 +0000 (22:57 +0300)]
staging/bcm: integer underflow leads to Oom

We do:

        if (NOB > DEFAULT_BUFF_SIZE)
                BuffSize = DEFAULT_BUFF_SIZE;
        else
                BuffSize = NOB;

Since NOB can be negative it results in a larger than intended BuffSize
and makes kzalloc() fail.

The code is still a bit crap because it lets the users read as much as
they want from nvram, but I don't know what a sensible upper limit
should be.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>