Commit Graph

427062 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
aa256f8d0d 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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTCht4AAoJEFSFNJnE9BaIsssQALHkJOTts8eAMy+N8JQkUcWE
 JhDEbu689OoR9NtVc2o/4nfFaVwzWk6MBtLY1wxpsNFi4IxL/utVBv4iP4pPCBZ1
 g3VFiHgREPOxgup8MDXhmwx+n0tRyLJd+vX6uBFDMF/+MNqXMUy/38eWZCYMXz87
 icdxk9Ircr+ud7q0JVcpeNGjMUNHo+yEORFSKbdnTfKCuRJe7xdSqNpRQBQEr6y9
 ohRJ6CXf9FNsoDuInk3VNEo6HtbZmVi215fy8nGknP5t6/q6exl0utPihoNpWJNZ
 aP1qjUrS1XEAIozQAoJi9Q2hJSxIRNXwuVz1modcPEeattKGajGWJggHZJxk27Sf
 fiSeRbbw1vJ8hLN7mRcg1FIF2m79cA7pkhUWwKO2m7Dp/sJQ/eKnhh/JJML6sZB5
 3/zKFlvpgANfSZTmqDGCQ/hVBNUcJ7xJA1Vbh1t2FIYctZlkh9ogfX/T2wHEJTfg
 Mpg7BoDgOaicUyiZBFADsHxTDuhlhx6en9JfYqR6YZHd1eMU7SR1IHzGpo4mDxkB
 fUUmu0bWnEwslmzek7CaGMVZ00WcSlsP6mpQzfk/R98bIZJb1MmKWyuefVMKyr4K
 JxNbPIBwR70A6j8qh/lh3egQsUpuamsXoO7Y68RxylYOf1XL7zYWo/1xoOh4Jl4Q
 +gihFn6B6ggHjv1wup2G
 =Dg3R
 -----END PGP SIGNATURE-----

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.
2014-02-23 09:08:34 -08:00
Lars-Peter Clausen
b91accafbb 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>
2014-02-23 15:53:25 +00:00
Denis CIOCCA
931878405b 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>
2014-02-22 13:09:53 +00:00
Archana Patni
f64a799b8a 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>
2014-02-22 13:07:06 +00:00
Archana Patni
39a3a0138f 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>
2014-02-22 13:07:01 +00:00
H Hartley Sweeten
c36d44ace6 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
f51eb4f4b9 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
bf6e48e87c 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
94349cb9cb 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
efd5b7b5d7 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
ab3c44fa38 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
0f9c4c7e38 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
a3ab029e83 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
f23068ec57 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
e5f376df8b 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
31baee58a6 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>
2014-02-21 12:39:38 -08:00
H Hartley Sweeten
d39c5ed7cb 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>
2014-02-21 12:39:38 -08:00
Chase Southwood
6777877c4f 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>
2014-02-21 12:38:09 -08:00
Chase Southwood
614bd02fc0 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>
2014-02-21 12:38:09 -08:00
Chase Southwood
988bcffd26 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>
2014-02-21 12:38:09 -08:00
Chase Southwood
11975225a2 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>
2014-02-21 12:38:09 -08:00
Alan
a9f488831c 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>
2014-02-18 12:15:19 -08:00
H Hartley Sweeten
53693d9068 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>
2014-02-18 11:56:51 -08:00
H Hartley Sweeten
c9968ed9fe 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>
2014-02-18 11:56:51 -08:00
H Hartley Sweeten
243e7146c8 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>
2014-02-18 11:56:51 -08:00
H Hartley Sweeten
18c7a6df49 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>
2014-02-18 11:56:51 -08:00
H Hartley Sweeten
d4b6e550b6 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
c8bc43ec67 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
e5143adb18 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
f9d78e00f3 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
1784f30556 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
4e2008616f 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
7b822d011b 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
00f921c7b9 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
6c42119d3d 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
81272ba124 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>
2014-02-18 11:56:50 -08:00
H Hartley Sweeten
f4985a79ca 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
f8d863e4a9 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
7440df0222 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
833b458a01 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
15e222c106 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
f78b7bc100 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
da7c36a51e 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
b14ec4bd3f 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
f5cc425afe 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
55b95f1430 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
00ebe61736 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>
2014-02-18 11:55:32 -08:00
H Hartley Sweeten
0f536336e4 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>
2014-02-18 11:55:31 -08:00
H Hartley Sweeten
7c2686b5a5 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>
2014-02-18 11:55:31 -08:00
H Hartley Sweeten
41bbe835f1 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>
2014-02-18 11:55:31 -08:00