platform/kernel/linux-rpi.git
9 years agostaging: lustre: Fix minor style error in libcfs_string.c
Matthew Tyler [Mon, 15 Dec 2014 14:37:27 +0000 (22:37 +0800)]
staging: lustre: Fix minor style error in libcfs_string.c

Signed-off-by: Matthew Tyler <matt.tyler@flashics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agolustre: don't use iovec instead of kvec
Al Viro [Tue, 2 Dec 2014 17:15:37 +0000 (17:15 +0000)]
lustre: don't use iovec instead of kvec

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: obd: Fix a coding style issue
Dean Ancajas [Mon, 8 Dec 2014 18:36:33 +0000 (11:36 -0700)]
Staging: lustre: obd: Fix a coding style issue

Fixed a brace coding style issue for functions.

Signed-off-by: Dean Michael Ancajas <dbancajas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging:lustre:lustre:ptlrpc: fix sparse warnings in lproc_ptlrpc.c
Fred Chou [Mon, 8 Dec 2014 09:52:07 +0000 (17:52 +0800)]
staging:lustre:lustre:ptlrpc: fix sparse warnings in lproc_ptlrpc.c

Fixed the below warning in sparse:

drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:184:6:
warning: symbol 'ptlrpc_lprocfs_register' was not declared.
Should it be static?

Signed-off-by: Fred Chou <fred.chou.nd@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: replace static value with define
Tristan Lelong [Sun, 7 Dec 2014 00:00:30 +0000 (16:00 -0800)]
staging: lustre: replace static value with define

This patch replace the value '80' used in several files in the lustre source code
with a define LUSTRE_MDT_MAXNAMELEN.

This value is used in 4 different structures as the maximum len for a service name.
According to the comments, these names follow a convention which make it possible
to use the same define for LCS, LSS, LCF, and LSF.

Signed-off-by: Tristan Lelong <tristan@lelong.xyz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fix sparse warning on LPROC_SEQ_FOPS macros
Tristan Lelong [Sat, 6 Dec 2014 06:43:20 +0000 (22:43 -0800)]
staging: lustre: fix sparse warning on LPROC_SEQ_FOPS macros

This patch fix a sparse warning in lustre sources

warning: incorrect type in argument 1 (different address spaces)
    expected void [noderef] <asn:1>*to
    got char *<noident>

This is done by adding the missing __user attribute on userland pointers inside the LPROC_SEQ_FOPS like macros:
- LPROC_SEQ_FOPS
- LPROC_SEQ_FOPS_RW_TYPE
- LPROC_SEQ_FOPS_WR_ONLY
- LDLM_POOL_PROC_WRITER

The patch also updates all the functions that are used by this macro:
- lprocfs_wr_*
- *_seq_write

as well as some helpers used by the previously modified functions (otherwise fixing the sparse warning add some new ones):
- lprocfs_write_frac_helper
- lprocfs_write_helper
- lprocfs_write_u64_helper

The patch also fixes one __user pointer direct dereference by strncmp in function fld_proc_hash_seq_write.

Signed-off-by: Tristan Lelong <tristan@lelong.xyz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fld: fixed symbol was not declared
Brian Vandre [Thu, 4 Dec 2014 04:06:55 +0000 (22:06 -0600)]
staging: lustre: fld: fixed symbol was not declared

Fixes the sparse warning:
"warning: symbol 'fld_type_proc_dir' was not declared. Should it be static?"

Also removes initialization to NULL.

Signed-off-by: Brian Vandre <bvandre@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: ft1000-pcmcia: fix else close brace style
Austin Kerbow [Fri, 2 Jan 2015 04:29:56 +0000 (20:29 -0800)]
Staging: ft1000-pcmcia: fix else close brace style

Fix the following checkpatch.pl errors

ERROR: else should follow close brace '}'
+                       }
+                       else {

ERROR: else should follow close brace '}'
+                       }
+                       else {

ERROR: else should follow close brace '}'
+                       }
+                       else {

ERROR: else should follow close brace '}'
+       }
+       else {

ERROR: else should follow close brace '}'
+                       }
+                       else {

Signed-off-by: Austin Kerbow <amkerbow@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: ft1000: ft1000-usb: ft1000_hw.c: Fix a potential memory leak.
Rickard Strandqvist [Mon, 29 Dec 2014 12:41:33 +0000 (13:41 +0100)]
staging: ft1000: ft1000-usb: ft1000_hw.c: Fix a potential memory leak.

Avoid allocate memory if we will exit the function.

Was found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: ft1000: ft1000-pcmcia: Fixed a coding style issue
Dean Michael Ancajas [Mon, 8 Dec 2014 21:23:01 +0000 (14:23 -0700)]
Staging: ft1000: ft1000-pcmcia: Fixed a coding style issue

Fixed a coding style issue for braces.

Signed-off-by: Dean Michael Ancajas <dbancajas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: gs_fpgaboot: io.c: Remove unused function
Rickard Strandqvist [Thu, 1 Jan 2015 16:23:13 +0000 (17:23 +0100)]
staging: gs_fpgaboot: io.c: Remove unused function

Remove the function bitswap() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-by: Insop Song <Insop.Song@gainspeed.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: nvec: Fixed a typo
Gustavo A. R. Silva [Sun, 11 Jan 2015 21:49:13 +0000 (15:49 -0600)]
Staging: nvec: Fixed a typo

Fixed a typo in nvec.c file

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: olpc_dcon: fix sparse symbol not declared warning
Murilo Opsfelder Araujo [Fri, 16 Jan 2015 01:55:00 +0000 (23:55 -0200)]
staging: olpc_dcon: fix sparse symbol not declared warning

This patch gets rid of the following sparse warning:

drivers/staging/olpc_dcon/olpc_dcon.c:787:19: warning: symbol 'dcon_driver' was not declared. Should it be static?

Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: NetLogic: Coding style correction
tolga ceylan [Sat, 17 Jan 2015 06:16:13 +0000 (22:16 -0800)]
Staging: NetLogic: Coding style correction

Misspelled comment corrected

Signed-off-by: tolga ceylan <tolga.ceylan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: olpc_dcon: Fixed a typo
Gustavo A. R. Silva [Sun, 11 Jan 2015 22:00:33 +0000 (16:00 -0600)]
Staging: olpc_dcon: Fixed a typo

Fixed a typo in olpc_dcon_xo_1.c file.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: skein: Fixing single statement macro checkpatch warning
Mathieu Poirier [Mon, 22 Dec 2014 15:20:39 +0000 (08:20 -0700)]
staging: skein: Fixing single statement macro checkpatch warning

WARNING: Single statement macros should not use a do {} while (0) loop

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: skein: Fixing trailing whitespace error
Mathieu Poirier [Mon, 22 Dec 2014 15:20:38 +0000 (08:20 -0700)]
staging: skein: Fixing trailing whitespace error

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: dgnc: implement proper error handling in dgnc_start()
Alexey Khoroshilov [Fri, 19 Dec 2014 21:51:26 +0000 (00:51 +0300)]
staging: dgnc: implement proper error handling in dgnc_start()

dgnc_start() ignores errors in class_create() and device_create()
and it does not deallocate resources if dgnc_tty_preinit() fails.

The patch implements proper error handling.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: octeon-usb: Fixed a typo
Gustavo A. R. Silva [Sun, 11 Jan 2015 21:50:37 +0000 (15:50 -0600)]
Staging: octeon-usb: Fixed a typo

Fixed a typo in octeon-hcd.c file

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: octeon: Fixed a typo
Gustavo A. R. Silva [Sun, 11 Jan 2015 21:44:39 +0000 (15:44 -0600)]
Staging: octeon: Fixed a typo

Fixed a typo in ethernet.c file.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: octeon: Add blank lines after declarations
Jamie Lawler [Thu, 4 Dec 2014 13:02:23 +0000 (13:02 +0000)]
Staging: octeon: Add blank lines after declarations

There are 2 missing blank lines after variable declarations in
octeon/ethernet-rx.c. They have been added per the coding style.

Signed-off-by: Jamie Lawler <jamie.lawler@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: gdm724x: fix line limit coding style issue in gdm_lte.c
Ning Zhou [Sun, 4 Jan 2015 09:06:17 +0000 (10:06 +0100)]
staging: gdm724x: fix line limit coding style issue in gdm_lte.c

This is a patch to fix "WARNING: line over 80 characters" found by
checkpatch.pl in gdm_lte.c.

Signed-off-by: Ning Zhou <zhou.ning.gd@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: gdm724x: fix space before comma coding style issue in gdm_mux.c
Robert Nachlinger [Thu, 18 Dec 2014 16:57:06 +0000 (17:57 +0100)]
Staging: gdm724x: fix space before comma coding style issue in gdm_mux.c

This is a patch to the gdm_mux.c file that fixes a space before comma
coding style issue found by the checkpatch.pl tool.

Signed-off-by: Robert Nachlinger <robert.nachlinger@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: vt6655: Checkpatch fix: c99 comment headings
Emrys Bayliss [Thu, 15 Jan 2015 16:29:27 +0000 (03:29 +1100)]
Staging: vt6655: Checkpatch fix: c99 comment headings

This patch fixes some of the following checkpatch.pl errors in mac.h
ERROR: do not use C99 // comments

This patch reformats all single line c99 style comments to the
preferred style.

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: vt6655: comment headings formatting
Emrys Bayliss [Thu, 15 Jan 2015 16:29:26 +0000 (03:29 +1100)]
Staging: vt6655: comment headings formatting

This patch makes the formatting of the comments in mac.h more
consistent.

* Where a heading takes up three comment lines it is reduced to one.
* A newline always separates column headings

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: vt6655: Checkpatch fix: lines longer than 80 columns
Emrys Bayliss [Thu, 15 Jan 2015 16:29:25 +0000 (03:29 +1100)]
Staging: vt6655: Checkpatch fix: lines longer than 80 columns

This patch fixes the following checkpatch.pl errors in mac.h:
WARNING: line over 80 characters

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: vt6655: Checkpatch fix: c99 comments after statements
Emrys Bayliss [Thu, 15 Jan 2015 16:29:24 +0000 (03:29 +1100)]
Staging: vt6655: Checkpatch fix: c99 comments after statements

This patch fixes some c99 errors in mac.h:
ERROR: do not use C99 // comments

All instances where the c99 comment occurs after a statement.

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: vt6655: comment after statement formatting
Emrys Bayliss [Thu, 15 Jan 2015 16:29:23 +0000 (03:29 +1100)]
Staging: vt6655: comment after statement formatting

This patch makes the formatting of the comments in mac.h more
consistent.

* Where a comment follows a statement, it is separated by a single
  space.

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: vt6655: Checkpatch fix: empty c99 comments
Emrys Bayliss [Thu, 15 Jan 2015 16:29:22 +0000 (03:29 +1100)]
Staging: vt6655: Checkpatch fix: empty c99 comments

This patch fixes some of the following checkpatch.pl errors in mac.h:
ERROR: do not use C99 // comments

This patch truncates statements which are followed by empty c99
comments.

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: vt6655: Checkpatch fix: unnecessary whitespace
Emrys Bayliss [Thu, 15 Jan 2015 16:29:21 +0000 (03:29 +1100)]
Staging: vt6655: Checkpatch fix: unnecessary whitespace

This patch fixes the following checkpatch.pl errors in mac.h:
ERROR: space prohibited before that ',' (ctx:WxW)

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: kcomedilib: Fixed a typo
Gustavo A. R. Silva [Sun, 11 Jan 2015 21:46:26 +0000 (15:46 -0600)]
Staging: comedi: kcomedilib: Fixed a typo

Fixed a typo in kcomedilib_main.c file.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: use common function to setup dma
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:16 +0000 (10:05 -0700)]
staging: comedi: pcl812: use common function to setup dma

The pcl812_ai_setup_dma() and pcl812_ai_setup_next_dma() functions are similar
other than the buffer switch and the inclusion of the "unread_samples" in
pcl818_ai_setup_next_dma() when calculating the dma size.

Merge these two functions by initializing the 'dma->cur_dma' in the callers
and passing '0' for the "unread_samples" when first starting the DMA.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: simplify the dma->size calculations
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:15 +0000 (10:05 -0700)]
staging: comedi: pcl812: simplify the dma->size calculations

The dma->size calculations are overly complicated in this driver and the
'prealloc_bufsz' sanity checks are unnecessary.

Currently this driver determines the number of DMA "runs" needed and the size
of the "last" DMA transfer in order to perform a command. As long as there are
more "runs" required, the dma->size is set to the buffer maxsize. On the last
"run" the buffer is set to the "last" size.

Refactor the driver to use the comedi core helpers to determine the DMA size
based on the buffer maxsize and the number of samples remaining in the command.

This allows removing the 'dma_runs_to_end' and 'last_dma_run' mamebers 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>
9 years agostaging: comedi: pcl816: use common function to setup dma
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:14 +0000 (10:05 -0700)]
staging: comedi: pcl816: use common function to setup dma

THe pcl816_ai_setup_dma() and pcl816_ai_setup_next_dma() functions are similar
other than the buffer switch and the inclusion of the "unread_samples" in
pcl818_ai_setup_next_dma() when calculating the dma size.

Merge these two functions by initializing the 'dma->cur_dma' in the callers
and passing '0' for the "unread_samples" when first starting the DMA.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: simplify the dma->size calculations
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:13 +0000 (10:05 -0700)]
staging: comedi: pcl816: simplify the dma->size calculations

Currently this driver determines the number of DMA "runs" needed and the size
of the "last" DMA transfer in order to perform a command. As long as there are
more "runs" required, the dma->size is set to the buffer maxsize. On the last
"run" the buffer is set to the "last" size.

Refactor the driver to use the comedi core helpers to determine the DMA size
based on the buffer maxsize and the number of samples remaining in the command.

This allows removing the 'dma_runs_to_end' and 'last_dma_run' mamebers 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>
9 years agostaging: comedi: pcl818: use common function to setup dma
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:12 +0000 (10:05 -0700)]
staging: comedi: pcl818: use common function to setup dma

THe pcl818_ai_setup_dma() and pcl818_ai_setup_next_dma() functions are similar
other than the buffer switch and the inclusion of the "unread_samples" in
pcl818_ai_setup_next_dma() when calculating the dma size.

Merge these two functions by initializing the 'dma->cur_dma' in the callers
and passing '0' for the "unread_samples" when first starting the DMA.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: simplify the dma->size calculations
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:11 +0000 (10:05 -0700)]
staging: comedi: pcl818: simplify the dma->size calculations

Currently this driver determines the number of DMA "runs" needed and the size
of the "last" DMA transfer in order to perform a command. As long as there are
more "runs" required, the dma->size is set to the buffer maxsize. On the last
"run" the buffer is set to the "last" size.

Refactor the driver to use the comedi core helpers to determine the DMA size
based on the buffer maxsize and the number of samples remaining in the command.

This allows removing the 'dma_runs_to_end' and 'last_dma_run' mamebers from
the private data. Also remove the 'ai_data_len' member which is set but never
used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_isadma: use comedi_isdma module
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:10 +0000 (10:05 -0700)]
staging: comedi: ni_labpc_isadma: use comedi_isdma module

The labpc driver has already had the depends on ISA_DMA_API limitation removed
by moving all the DMA support code into the labpc_isadma module.

For aesthetics, use the comedi_isadma module to provide the actual ISA DMA
support.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_at_a2150: remove depends on ISA_DMA_API limitation
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:09 +0000 (10:05 -0700)]
staging: comedi: ni_at_a2150: remove depends on ISA_DMA_API limitation

Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: dt282x: remove depends on ISA_DMA_API limitation
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:08 +0000 (10:05 -0700)]
staging: comedi: dt282x: remove depends on ISA_DMA_API limitation

Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das1800: remove depends on ISA_DMA_API limitation
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:07 +0000 (10:05 -0700)]
staging: comedi: das1800: remove depends on ISA_DMA_API limitation

Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: remove depends on ISA_DMA_API limitation
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:06 +0000 (10:05 -0700)]
staging: comedi: das16: remove depends on ISA_DMA_API limitation

Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: remove depends on ISA_DMA_API limitation
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:05 +0000 (10:05 -0700)]
staging: comedi: pcl812: remove depends on ISA_DMA_API limitation

Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: remove depends on ISA_DMA_API limitation
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:04 +0000 (10:05 -0700)]
staging: comedi: pcl816: remove depends on ISA_DMA_API limitation

Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: remove depends on ISA_DMA_API limitation
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:03 +0000 (10:05 -0700)]
staging: comedi: pcl818: remove depends on ISA_DMA_API limitation

Use the new comedi_isadma module to provide the ISA DMA support. This removes
all the ISA_DMA_API code from this driver and allows the driver to be used on
platforms that don't support the ISA_DMA_API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedi_isadma: introduce helper module for ISA DMA
H Hartley Sweeten [Wed, 14 Jan 2015 17:05:02 +0000 (10:05 -0700)]
staging: comedi: comedi_isadma: introduce helper module for ISA DMA

Introduce a new helper module to consolidate all the ISA DMA code. This will
allow removing the "depends on ISA_DMA_API" from the legacy drivers that can
use DMA for async command support.

This module is complete based on the various uses of ISA DMA in the comedi
drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das1800: tidy up das1800_ai_transfer_size()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:44 +0000 (10:16 -0700)]
staging: comedi: das1800: tidy up das1800_ai_transfer_size()

For aesthetics, pass the fill time 'ns' as a parameter to this function.

Refactor this function to calculate the transfer size in 'samples' instead
of 'bytes'. This removes the need to constantly multiply the values by the
'sample_size'. It also helps avoid any possible integer overflow issues.

Use the comedi_nsamples_left() helper to limit the samples when cmd->stop_src
is TRIG_COUNT.

Use comedi_samples_to_bytes() to return the final DMA size in bytes.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das1800: remove hard coded 'sample_size'
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:43 +0000 (10:16 -0700)]
staging: comedi: das1800: remove hard coded 'sample_size'

Use the comedi_bytes_per_sample() helper to remove the hard coded sample_size
in suggest_transfer_size().

The helper function needs to comedi_subdevice pointer. Change the parameters
passed to suggest_transfer_size() and setup_dma() so that this pointer is
available. Rename these functions so they have namespace associated with the
driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_isadma: introduce labpc_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:42 +0000 (10:16 -0700)]
staging: comedi: ni_labpc_isadma: introduce labpc_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_isadma: move dma programming out of labpc_drain_dma()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:41 +0000 (10:16 -0700)]
staging: comedi: ni_labpc_isadma: move dma programming out of labpc_drain_dma()

The external caller of labpc_drain_dma() does not enable the DMA transfer. Only
the call from handle_isa_dma() results in the programmed DMA operation getting
enabled.

For aesthetics, move the dma programming to handle_isa_dma(). Make sure the
DMA operation would actually do something (dma->size != 0) before programming
it to avoid enabling the DMA at the end of a stop_src == TRIG_COUNT command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_isadma: tidy up labpc_drain_dma()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:40 +0000 (10:16 -0700)]
staging: comedi: ni_labpc_isadma: tidy up labpc_drain_dma()

Tidy up the code that determines the number of samples to read for the
current DMA transfer and how many samples are needed for the next DMA,

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_isadma: introduce labpc_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:39 +0000 (10:16 -0700)]
staging: comedi: ni_labpc_isadma: introduce labpc_isadma_disable()

Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

The DMA will always be disabled when labpc_setup_dma() is called. Remove
the unnecessary disable in that function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_isadma: convert 'dma_buffer_size' to a define
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:38 +0000 (10:16 -0700)]
staging: comedi: ni_labpc_isadma: convert 'dma_buffer_size' to a define

For aesthetics, convert this statis const global variable to a define.

Cleanup the maximum 'size' calc in labpc_suggest_transfer_size(). The modulo
operation will always result in '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>
9 years agostaging: comedi: ni_labpc_isadma: remove hard coded samples size
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:37 +0000 (10:16 -0700)]
staging: comedi: ni_labpc_isadma: remove hard coded samples size

Use the comedi_bytes_per_sample() helper and remove the hard coded sample
size.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_at_a2150: introduce a2150_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:36 +0000 (10:16 -0700)]
staging: comedi: ni_at_a2150: introduce a2150_isadma_disable()

Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_at_a2150: introduce a2150_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:35 +0000 (10:16 -0700)]
staging: comedi: ni_at_a2150: introduce a2150_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: introduce pcl812_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:34 +0000 (10:16 -0700)]
staging: comedi: pcl812: introduce pcl812_isadma_disable()

According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: introduce pcl812_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:33 +0000 (10:16 -0700)]
staging: comedi: pcl812: introduce pcl812_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: introduce das16_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:32 +0000 (10:16 -0700)]
staging: comedi: das16: introduce das16_isadma_disable()

Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: introduce das16_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:31 +0000 (10:16 -0700)]
staging: comedi: das16: introduce das16_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: move dma transfer 'size' to dma descriptor
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:30 +0000 (10:16 -0700)]
staging: comedi: das16: move dma transfer 'size' to dma descriptor

For asethetics, move the variable that holds the dma transfer 'size' into
the dma descriptor.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das1800: introduce das1800_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:29 +0000 (10:16 -0700)]
staging: comedi: das1800: introduce das1800_isadma_disable()

Introduce a helper function to disable and the ISA DMA controller and
return the residue as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das1800: introduce das1800_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:28 +0000 (10:16 -0700)]
staging: comedi: das1800: introduce das1800_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das1800: move dma transfer 'size' to dma descriptor
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:27 +0000 (10:16 -0700)]
staging: comedi: das1800: move dma transfer 'size' to dma descriptor

For asethetics, move the variable that holds the dma transfer 'size' into
the dma descriptor.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das1800: pass dma descriptor to das1800_flush_dma_channel()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:26 +0000 (10:16 -0700)]
staging: comedi: das1800: pass dma descriptor to das1800_flush_dma_channel()

Instead of passing the dma descriptor 'chan' and 'virt_addr' just pass the
dma descriptor.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: dt282x: introduce dt282x_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:25 +0000 (10:16 -0700)]
staging: comedi: dt282x: introduce dt282x_isadma_disable()

According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: dt282x: introduce dt282x_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:24 +0000 (10:16 -0700)]
staging: comedi: dt282x: introduce dt282x_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: introduce pcl816_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:23 +0000 (10:16 -0700)]
staging: comedi: pcl816: introduce pcl816_isadma_disable()

According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: introduce pcl816_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:22 +0000 (10:16 -0700)]
staging: comedi: pcl816: introduce pcl816_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: introduce pcl818_isadma_disable()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:21 +0000 (10:16 -0700)]
staging: comedi: pcl818: introduce pcl818_isadma_disable()

According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: introduce pcl818_isadma_program()
H Hartley Sweeten [Tue, 13 Jan 2015 17:16:20 +0000 (10:16 -0700)]
staging: comedi: pcl818: introduce pcl818_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: board is not a PCI device
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:15 +0000 (10:56 -0700)]
staging: comedi: das16: board is not a PCI device

The DAS16 board is an ISA device not a PCI device. For aesthetics, use
dma_{alloc,free}_coherent() to allocate and free the DMA buffers instead
of the PCI versions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: introduce das16_free_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:14 +0000 (10:56 -0700)]
staging: comedi: das16: introduce das16_free_dma()

For aesthetics, move the freeing of the DMA channel and the buffers to
a helper function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16 introduce das16_alloc_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:13 +0000 (10:56 -0700)]
staging: comedi: das16 introduce das16_alloc_dma()

DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: introduce struct das16_dma_desc
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:12 +0000 (10:56 -0700)]
staging: comedi: das16: introduce struct das16_dma_desc

For aesthetics, introduce a struct to hold the DMA descriptor 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>
9 years agostaging: comedi: dt282x: remove VIRT_TO_BUS dependancy
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:11 +0000 (10:56 -0700)]
staging: comedi: dt282x: remove VIRT_TO_BUS dependancy

Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: dt282x: introduce struct dt282x_dma_desc
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:10 +0000 (10:56 -0700)]
staging: comedi: dt282x: introduce struct dt282x_dma_desc

For aesthetics, introduce a struct to hold the DMA descriptor 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>
9 years agostaging: comedi: dt282x: introduce dt282x_alloc_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:09 +0000 (10:56 -0700)]
staging: comedi: dt282x: introduce dt282x_alloc_dma()

The IRA and DMA are optional with this driver but both are required to
support async commands. Introduce a helper function to request the IRQ
and DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid IRQ or DMA channel or they cannot be
requested.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: remove VIRT_TO_BUS dependancy
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:08 +0000 (10:56 -0700)]
staging: comedi: pcl812: remove VIRT_TO_BUS dependancy

Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: introduce struct pcl812_dma_desc
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:07 +0000 (10:56 -0700)]
staging: comedi: pcl812: introduce struct pcl812_dma_desc

For aesthetics, introduce a struct to hold the DMA descriptor 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>
9 years agostaging: comedi: pcl812: introduce pcl812_free_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:06 +0000 (10:56 -0700)]
staging: comedi: pcl812: introduce pcl812_free_dma()

For aesthetics, move the freeing of the DMA channel and the buffers to
a helper function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl812: introduce pcl812_alloc_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:05 +0000 (10:56 -0700)]
staging: comedi: pcl812: introduce pcl812_alloc_dma()

DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: fix short DMA transactions
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:04 +0000 (10:56 -0700)]
staging: comedi: pcl816: fix short DMA transactions

When the cmd->stop_src == TRIG_COUNT the last DMA transfer might be smaller
than the buffer size. This results in invalid data being added to the async
buffer.

Add a 'size' member to the DMA descriptor and initialize it with the
actual size of the DMA transfer. Use that in interrupt and ai subdevice
(*poll) function to return the proper number of samples. Use the
comedi_bytes_to_samples() helper to convert the byte size to comedi
samples in the interrupt handler.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: remove VIRT_TO_BUS dependancy
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:03 +0000 (10:56 -0700)]
staging: comedi: pcl816: remove VIRT_TO_BUS dependancy

Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: introduce struct pcl816_dma_desc
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:02 +0000 (10:56 -0700)]
staging: comedi: pcl816: introduce struct pcl816_dma_desc

For aesthetics, introduce a struct to hold the DMA descriptor 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>
9 years agostaging: comedi: pcl816: introduce pcl816_free_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:01 +0000 (10:56 -0700)]
staging: comedi: pcl816: introduce pcl816_free_dma()

For aesthetics, move the freeing of the DMA channel and the buffers to
a helper function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl816: introduce pcl816_alloc_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:56:00 +0000 (10:56 -0700)]
staging: comedi: pcl816: introduce pcl816_alloc_dma()

The IRA and DMA are optional with this driver but both are required to
support async commands. Introduce a helper function to request the IRQ
and DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid IRQ or DMA channel or they cannot be
requested.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: fix pcl818_handle_dma() for short DMA transaction
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:59 +0000 (10:55 -0700)]
staging: comedi: pcl818: fix pcl818_handle_dma() for short DMA transaction

Currently this function always transfers the full DMA buffer to the comedi
async buffer. When the cmd->stop_src == TRIG_COUNT the last DMA transfer
might be smaller than the buffer size. This results in invalid data being
added to the asunc buffer.

Add a 'size' member to the DMA descriptor and initialize it with the
actual size of the DMA transfer. Use that in pcl818_handle_dma() to
return the proper number of samples. Use the comedi_bytes_to_samples()
helper to convert the byte size to comedi samples. Remove the unnecessary
'bufptr' local variable.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: remove VIRT_TO_BUS dependancy
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:58 +0000 (10:55 -0700)]
staging: comedi: pcl818: remove VIRT_TO_BUS dependancy

Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: introduce struct pcl818_dma_desc
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:57 +0000 (10:55 -0700)]
staging: comedi: pcl818: introduce struct pcl818_dma_desc

For aesthetics, introduce a struct to hold the DMA descriptor 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>
9 years agostaging: comedi: pcl818: introduce pcl818_dma_free()
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:56 +0000 (10:55 -0700)]
staging: comedi: pcl818: introduce pcl818_dma_free()

For aesthetics, move the freeing of the DMA channel and the buffers to
a helper function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: pcl818: introduce pcl818_alloc_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:55 +0000 (10:55 -0700)]
staging: comedi: pcl818: introduce pcl818_alloc_dma()

DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc: remove VIRT_TO_BUS dependancy
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:54 +0000 (10:55 -0700)]
staging: comedi: ni_labpc: remove VIRT_TO_BUS dependancy

Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_isadma: tidy up labpc_init_dma_chan()
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:53 +0000 (10:55 -0700)]
staging: comedi: ni_labpc_isadma: tidy up labpc_init_dma_chan()

DMA support is optional for the labpc driver. The return value from
labpc_init_dma_chan() is not even checked by the caller.

Change the return type to void and tidy up the function a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc: introduce struct labpc_dma_desc
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:52 +0000 (10:55 -0700)]
staging: comedi: ni_labpc: introduce struct labpc_dma_desc

For aesthetics, introduce a struct to hold the DMA descriptor 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>
9 years agostaging: comedi: ni_at_a2150: remove VIRT_TO_BUS dependancy
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:51 +0000 (10:55 -0700)]
staging: comedi: ni_at_a2150: remove VIRT_TO_BUS dependancy

Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers.
This removes the dependancy on VIRT_TO_BUS.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_at_a2150: introduce struct a2150_dma_desc
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:50 +0000 (10:55 -0700)]
staging: comedi: ni_at_a2150: introduce struct a2150_dma_desc

For aesthetics, introduce a struct to hold the DMA descriptor 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>
9 years agostaging: comedi: ni_at_a2150: introduce a2150_free_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:49 +0000 (10:55 -0700)]
staging: comedi: ni_at_a2150: introduce a2150_free_dma()

For aesthetics, introduce a helper function to free the DMA channel and
buffer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_at_a2150: introduce a2150_alloc_irq_dma()
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:48 +0000 (10:55 -0700)]
staging: comedi: ni_at_a2150: introduce a2150_alloc_irq_dma()

This driver requires an IRQ and DMA in order to support async commands.

For aesthetics, introduce a helper function to request the IRQ and DMA
channels and allocate the DMA buffer. Since the async command support
is optional, make the helper function handle any request/allocation
errors and allow the driver to still attach without async command support.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_at_a2150: use comedi_bytes_per_sample()
H Hartley Sweeten [Mon, 12 Jan 2015 17:55:47 +0000 (10:55 -0700)]
staging: comedi: ni_at_a2150: use comedi_bytes_per_sample()

For aesthetics, use the helper function to get the byte size of each sample
instead of using sizeof() the first buffer element.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>