GitHub/moto-9609/android_kernel_motorola_exynos9610.git
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>
10 years agostaging/bcm: two information leaks in ioctl
Dan Carpenter [Mon, 17 Feb 2014 19:56:06 +0000 (22:56 +0300)]
staging/bcm: two information leaks in ioctl

There are a couple paths where we don't check how much data we copy back
to the user.

Cc: Dave Jones <davej@redhat.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: wlan-ng: replace function ieee80211_dsss_chan_to_freq()
Zhao, Gang [Tue, 18 Feb 2014 15:03:27 +0000 (23:03 +0800)]
staging: wlan-ng: replace function ieee80211_dsss_chan_to_freq()

Replace ieee80211_dsss_chan_to_freq() with more generic
ieee80211_channel_to_frequency(), and add a variable to deal with 80
characters problem.

File cfg80211.c is included by p80211netdev.c, p80211netdev.c includes
<net/cfg80211.h>, both ieee80211_channel_to_frequency() and
IEEE80211_BAND_2GHZ is defined / declared in <net/cfg80211.h>. So this
change is safe.

This change is a preparation for the removal of function
ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: gdm724x: cleanup alloc_tx_sdu_struct()
Dan Carpenter [Tue, 18 Feb 2014 12:18:10 +0000 (15:18 +0300)]
staging: gdm724x: cleanup alloc_tx_sdu_struct()

The kfree(t_sdu->buf) sets off a private static checker warning because
"t_sdu->buf" is always NULL.

This function just allocates two pointers so we can re-write it to be
simpler.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: bcm: DDRInit: fix up indentation issues.
Gary Rookard [Sun, 16 Feb 2014 16:16:41 +0000 (11:16 -0500)]
Staging: bcm: DDRInit: fix up indentation issues.

fixed up a couple of indentation issues.

Signed-off-by: Gary Alan Rookard <garyrookard@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: do not initialize statics to 0 in hwdrv_apci035.c
Chase Southwood [Sun, 16 Feb 2014 08:41:32 +0000 (02:41 -0600)]
Staging: comedi: addi-data: do not initialize statics to 0 in hwdrv_apci035.c

This patch for hwdrv_apci035.c removes a zero initialization from two
static variables.  Static variables are initialized to zero by default,
so doing so explicitly is not necessary.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: convert printk() to dev_err()
Chase Southwood [Tue, 18 Feb 2014 06:34:39 +0000 (00:34 -0600)]
Staging: comedi: addi-data: convert printk() to dev_err()

This patch for hwdrv_apci035.c changes a printk() call to a dev_err() call
since this is generally preferred.  It also removes a newline from the start
of the error message.

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_apci035.c
Chase Southwood [Sun, 16 Feb 2014 08:41:09 +0000 (02:41 -0600)]
Staging: comedi: addi-data: cleanup comments in hwdrv_apci035.c

This patch for hwdrv_apci035.c aligns comment blocks and makes indentation
of comments consistent.  Removed all "spaces before tabs" in comment
indentation as well.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: fix brace-related coding style issues in hwdrv_apci035.c
Chase Southwood [Sun, 16 Feb 2014 08:40:06 +0000 (02:40 -0600)]
Staging: comedi: addi-data: fix brace-related coding style issues in hwdrv_apci035.c

This patch for hwdrv_apci035 removes some unneeded braces, and moves some
improperly placed braces to the correct position, as found by checkpatch.
It also removes a commented out if-statement that I found whilst cleaning
braces that is identical to another un-commented if-statement directly
above it, so it is just added clutter and so we can delete it to clean up
further.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ion: ion_cma_heap: Remove '0x' when using %pa format
Fabio Estevam [Tue, 18 Feb 2014 12:46:33 +0000 (09:46 -0300)]
staging: ion: ion_cma_heap: Remove '0x' when using %pa format

%pa format already prints in hexadecimal format, so remove the '0x' annotation
to avoid a double '0x0x' pattern.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ion: Add private buffer flag to skip page pooling on free
Mitchel Humpherys [Mon, 17 Feb 2014 21:58:39 +0000 (13:58 -0800)]
staging: ion: Add private buffer flag to skip page pooling on free

Currently, when we free a buffer it might actually just go back into a
heap-specific page pool rather than going back to the system. This poses
a problem because sometimes (like when we're running a shrinker in low
memory conditions) we need to force the memory associated with the
buffer to truly be relinquished to the system rather than just going
back into a page pool.

There isn't a use case for this flag by Ion clients, so make it a
private flag. The main use case right now is to provide a mechanism for
the deferred free code to force stale buffers to bypass page pooling.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
[jstultz: Minor commit subject tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ion: Move shrinker out of heaps
Colin Cross [Mon, 17 Feb 2014 21:58:38 +0000 (13:58 -0800)]
staging: ion: Move shrinker out of heaps

Every heap that uses deferred frees is going to need a shrinker
to shrink the freelist under memory pressure.  Rather than
requiring each heap to implement a shrinker, automatically
register a shrinker if the deferred free flag is set.
The system heap also needs to shrink its page pools, so add
a shrink function to the heap ops that will be called after
shrinking the freelists.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Resolved big conflicts with the shrinker api change.
Also minor commit subject tweak.]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>