openwrt/staging/blogic.git
10 years agostaging: lustre: fix function definition style
Spencer Baugh [Sun, 14 Sep 2014 15:21:10 +0000 (11:21 -0400)]
staging: lustre: fix function definition style

Fix errors reported by checkpatch of this kind:
ERROR: open brace '{' following function declarations go on the next line

Signed-off-by: Spencer Baugh <sbaugh@andrew.cmu.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: Fix address space mismatch in ksocknal_recv_iov()
Artemiy Volkov [Fri, 12 Sep 2014 16:31:33 +0000 (02:31 +1000)]
staging: lustre: Fix address space mismatch in ksocknal_recv_iov()

This patch fixes the following sparse warnings:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:51: warning:
cast removes address space of expression
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39: warning:
incorrect type in assignment (different address spaces)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39:    expected
void [noderef] <asn:1>*iov_base
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39:    got
void *<noident>

by simplifying an expression containing non-__user-attributed type names.

Signed-off-by: Artemiy Volkov <artemiyv@acm.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: lustre: Cleanup src/dst comparisons in obdo_cmp_md()
Greg Donald [Thu, 11 Sep 2014 23:38:25 +0000 (18:38 -0500)]
drivers: staging: lustre: Cleanup src/dst comparisons in obdo_cmp_md()

Cleanup obdo_cmp_md() src/dst comparisons using bitwise OR assignments

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agousb: dwc2: make the scheduler handle excessive NAKs better
Nick Hudson [Thu, 11 Sep 2014 22:22:48 +0000 (15:22 -0700)]
usb: dwc2: make the scheduler handle excessive NAKs better

I'm seeing problems with a d-link dwcl-g122 wifi dongle that
someone sent me. There are reports of other wifi dongles with the
same/similar problem. The devices appear to be NAKing to the point
of confusing the dwc2 driver completely.

The attached patch helps with my d-link dwl-g122 - it's adapted
from the Raspberry Pi dwc_otg driver, which is a modified version
of the Synopsys vendor driver. The error recovery is still valid
after the patch, I think.

Cc: Dom Cobley <popcornmix@gmail.com>
Signed-off-by: Nick Hudson <skrll@netbsd.org>
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: Remove unnecessary condition around include
Tobias Klauser [Wed, 10 Sep 2014 07:34:51 +0000 (09:34 +0200)]
staging: vt6655: Remove unnecessary condition around include

ethtool (and SIOCETHTOOL in particular) is part of Linux since the
pre-git era, it thus makes no sense no sense to make the include of
linux/ethtool.h conditional. Also remove the unused define
DEVICE_ETHTOOL_IOCTL_SUPPORT.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: Use net_device_stats from struct net_device
Tobias Klauser [Wed, 10 Sep 2014 07:34:50 +0000 (09:34 +0200)]
staging: vt6655: Use net_device_stats from struct net_device

Instead of using an own copy of struct net_device_stats in struct
vnt_private, use stats from struct net_device. Also remove the thus
unnecessary device_get_stats(), as it would now just return
netdev->stats, which is the default in dev_get_stats().

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: Remove unused member from struct vnt_private
Tobias Klauser [Wed, 10 Sep 2014 07:34:49 +0000 (09:34 +0200)]
staging: vt6655: Remove unused member from struct vnt_private

The pci_state member of struct vnt_private is used nowhere in the code,
so remove it. Supposedly it was used to save the PCI configuration space
which is now done using pci_save_state().

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging:rtl8188eu: Fix sparse warning cast to restricted __le16
Tobenna P. Igwe [Wed, 10 Sep 2014 19:45:16 +0000 (20:45 +0100)]
staging:rtl8188eu: Fix sparse warning cast to restricted __le16

This patch fixes the following sparse warnings:

  CHECK   drivers/staging/rtl8188eu/hal/fw.c
drivers/staging/rtl8188eu/hal/fw.c:219:13: warning: cast to restricted __le16
drivers/staging/rtl8188eu/hal/fw.c:219:13: warning: cast to restricted __le16
drivers/staging/rtl8188eu/hal/fw.c:219:13: warning: cast to restricted __le16
drivers/staging/rtl8188eu/hal/fw.c:219:13: warning: cast to restricted __le16

by changing the signature from 'u16' to '__le16'.

Signed-off-by: Tobenna P. Igwe <ptigwe@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: emxx_udc: fix style warnings: const strings should be const char
Vincenzo Scotti [Tue, 9 Sep 2014 21:06:27 +0000 (23:06 +0200)]
staging: emxx_udc: fix style warnings: const strings should be const char

Signed-off-by: Vincenzo Scotti <vinc94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: emxx_udc: fix style warnings: return in void functions
Vincenzo Scotti [Tue, 9 Sep 2014 21:06:26 +0000 (23:06 +0200)]
staging: emxx_udc: fix style warnings: return in void functions

Signed-off-by: Vincenzo Scotti <vinc94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: emxx_udc: fix style warnings: blank line after declarations
Vincenzo Scotti [Tue, 9 Sep 2014 21:06:25 +0000 (23:06 +0200)]
staging: emxx_udc: fix style warnings: blank line after declarations

Signed-off-by: Vincenzo Scotti <vinc94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: speakup: fix missing blank lines after declarations
Domagoj Trsan [Tue, 9 Sep 2014 18:04:34 +0000 (20:04 +0200)]
staging: speakup: fix missing blank lines after declarations

Signed-off-by: Domagoj Trsan <domagoj.trsan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: speakup: fix line indentations
Domagoj Trsan [Tue, 9 Sep 2014 18:04:33 +0000 (20:04 +0200)]
staging: speakup: fix line indentations

Signed-off-by: Domagoj Trsan <domagoj.trsan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: speakup: fix redundant return in void functions
Domagoj Trsan [Tue, 9 Sep 2014 18:04:32 +0000 (20:04 +0200)]
staging: speakup: fix redundant return in void functions

Signed-off-by: Domagoj Trsan <domagoj.trsan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: speakup: fix warnings: line over 80 characters
Domagoj Trsan [Tue, 9 Sep 2014 18:04:31 +0000 (20:04 +0200)]
staging: speakup: fix warnings: line over 80 characters

Signed-off-by: Domagoj Trsan <domagoj.trsan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: uislib: uislib.c: sparse warning of context imbalance
Sudip Mukherjee [Tue, 9 Sep 2014 10:41:09 +0000 (16:11 +0530)]
staging: unisys: uislib: uislib.c: sparse warning of context imbalance

fixed sparse warning : context imbalance in 'resume_device'
                        unexpected unlock
this patch will generate warning from checkpatch for
lines over 80 character , but since those are user-visible strings
so it was not modified.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Benjamin Romer <benjamin.romer@unisys.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: octeon-hcd: removed dummy label
Nitin Kuppelur [Wed, 10 Sep 2014 01:36:24 +0000 (03:36 +0200)]
Staging: octeon-hcd: removed dummy label

This is a patch to the octeon-hcd.c file that fixes
removes dummy label i.e. label followed by return of
void function

Signed-off-by: Nitin Kuppelur <nitinkuppelur@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging:r8190_rtl8256: coding style: Fixed commenting style
Sanjeev Sharma [Tue, 9 Sep 2014 04:28:48 +0000 (09:58 +0530)]
staging:r8190_rtl8256: coding style: Fixed commenting style

This is a patch to the r8190_rtl8256.c file that fixes
commenting style Error

Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8723au: Fix 'code indent should use tabs where possible' errors
Greg Donald [Tue, 9 Sep 2014 01:50:23 +0000 (20:50 -0500)]
drivers: staging: rtl8723au: Fix 'code indent should use tabs where possible' errors

Fix checkpatch.pl 'code indent should use tabs where possible' errors

Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove lvfs.h
John L. Hammond [Tue, 9 Sep 2014 18:39:08 +0000 (13:39 -0500)]
staging/lustre: remove lvfs.h

Move the definition of struct lvfs_run_ctxt to the one file that
needed it (lustre/include/obd.h). Remove the then unneeded headers
lustre/include/lvfs.h and lustre/include/linux/lvfs.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/libcfs: remove upcall cache
John L. Hammond [Tue, 9 Sep 2014 18:39:07 +0000 (13:39 -0500)]
staging/lustre/libcfs: remove upcall cache

The upcall cache is unused so remove include/linux/libcfs/lucache.h
and lustre/libcfs/upcall_cache.c.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove unused lvfs code
John L. Hammond [Tue, 9 Sep 2014 18:39:06 +0000 (13:39 -0500)]
staging/lustre: remove unused lvfs code

Remove the unused "lvfs" functions obd_lvfs_fid2dentry(),
ll_lookup_one_len(), l_dput(), lustre_rename(), push_ctxt(), and
pop_ctxt(). Remove the unused members of struct lvfs_run_ctxt.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove lvfs_linux.h
John L. Hammond [Tue, 9 Sep 2014 18:39:05 +0000 (13:39 -0500)]
staging/lustre: remove lvfs_linux.h

The definitions in lustre/include/linux/lvfs_linux.h are not used so
remove that header.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove portals_compat25.h
James Simmons [Tue, 9 Sep 2014 18:39:04 +0000 (13:39 -0500)]
staging/lustre: remove portals_compat25.h

Remove include/linux/libcfs/linux/portals_compat25.h.

. remove some unused/unnecessary macros such as smp_num_cpus /
  SIGNAL_MASK_ASSERT etc.

. replace some macros with direct kernel API calls such as
  RECALC_SIGPENDING/CLEAR_SIGPENDING/CURRENT_SECONDS,
  cfs_wait_event_interruptible/_exclusive etc.

Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/4778
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove linux/lustre_common.h
John L. Hammond [Tue, 9 Sep 2014 18:39:03 +0000 (13:39 -0500)]
staging/lustre: remove linux/lustre_common.h

Expand the two uses of ll_inode_blksize() and remove the then
unnecessary header lustre/include/linux/lustre_common.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/11495
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/lvfs: remove the lvfs layer
James Simmons [Tue, 9 Sep 2014 18:39:02 +0000 (13:39 -0500)]
staging/lustre/lvfs: remove the lvfs layer

The lvfs layer is obsolete and unused by Lustre clients. So remove it
and integrate the last of the procfs code into the obdclass layer.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/5512
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: fix coding style of function's pointer
Hugues Morisset [Tue, 9 Sep 2014 14:36:27 +0000 (16:36 +0200)]
staging: lustre: fix coding style of function's pointer

Signed-off-by: Hugues Morisset <morisset.hugues@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: fix inappropriate enums declarations.
Hugues Morisset [Tue, 9 Sep 2014 14:36:26 +0000 (16:36 +0200)]
staging: lustre: fix inappropriate enums declarations.

Signed-off-by: Hugues Morisset <morisset.hugues@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: fix coding style on long lines
Hugues Morisset [Tue, 9 Sep 2014 14:36:25 +0000 (16:36 +0200)]
staging: lustre: fix coding style on long lines

Signed-off-by: Hugues Morisset <morisset.hugues@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: lov: expand the GOTO macro
Julia Lawall [Tue, 9 Sep 2014 13:44:08 +0000 (15:44 +0200)]
staging: lustre: lov: expand the GOTO macro

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove unused function is_osp_on_mdt
Oleg Drokin [Tue, 9 Sep 2014 01:41:28 +0000 (21:41 -0400)]
staging/lustre: remove unused function is_osp_on_mdt

This function is no longer used anywhere.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: use osc_reply_portal for OUT services
Mikhail Pershin [Tue, 9 Sep 2014 01:41:27 +0000 (21:41 -0400)]
staging/lustre: use osc_reply_portal for OUT services

OUT service is used to server both MDS-MDS updates and MDS-OST
therefore services on MDT and OST are set to use the same request
and reply portals to be fully unified and able to serve any type
of requests.

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Reviewed-on: http://review.whamcloud.com/8390
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: lustre: Fix 'code indent should use tabs where possible' errors
Greg Donald [Tue, 9 Sep 2014 01:13:13 +0000 (20:13 -0500)]
drivers: staging: lustre: Fix 'code indent should use tabs where possible' errors

Fix checkpatch.pl 'code indent should use tabs where possible' errors

Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: lustre: Fix "space prohibited after that open parenthesis '('"...
Greg Donald [Mon, 8 Sep 2014 22:32:08 +0000 (17:32 -0500)]
drivers: staging: lustre: Fix "space prohibited after that open parenthesis '('" errors

Fix checkpatch.pl "space prohibited after that open parenthesis '('" errors

Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9118: replace comedi_board() calls
Ian Abbott [Tue, 9 Sep 2014 10:26:15 +0000 (11:26 +0100)]
staging: comedi: adl_pci9118: replace comedi_board() calls

The `comedi_board(dev)` inline function calls just return
`dev->board_ptr`.  Expand the inline function calls.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_dio200_common: replace comedi_board() calls
Ian Abbott [Tue, 9 Sep 2014 10:26:19 +0000 (11:26 +0100)]
staging: comedi: amplc_dio200_common: replace comedi_board() calls

The `comedi_board(dev)` inline function calls just return
`dev->board_ptr`.  Expand the inline function calls.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: hwdrv_apci3120: remove void function return statement
Chase Southwood [Wed, 10 Sep 2014 06:04:42 +0000 (01:04 -0500)]
staging: comedi: hwdrv_apci3120: remove void function return statement

Returns at the end of void functions are useless.  Remove this one.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: hwdrv_apci3120: else is not useful after return
Chase Southwood [Wed, 10 Sep 2014 06:04:28 +0000 (01:04 -0500)]
staging: comedi: hwdrv_apci3120: else is not useful after return

The statement nested in an else after a return may be brought out one
indent level, the else is useless.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: hwdrv_apci3120: add a blank line after declarations
Chase Southwood [Wed, 10 Sep 2014 06:04:10 +0000 (01:04 -0500)]
staging: comedi: hwdrv_apci3120: add a blank line after declarations

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: hwdrv_apci3120: clean up comments
Chase Southwood [Wed, 10 Sep 2014 06:03:44 +0000 (01:03 -0500)]
staging: comedi: hwdrv_apci3120: clean up comments

This patch fixes improper comment indentation, removes dead code and
obsolete comments, and conforms remaining comments to a consistent kernel
commenting style.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxsigma: prevent "empty acquisition" async commands
H Hartley Sweeten [Tue, 9 Sep 2014 23:16:06 +0000 (16:16 -0700)]
staging: comedi: usbduxsigma: prevent "empty acquisition" async commands

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0 for both the analog input and output async commands. The (*do_cmd) for
both subdevices sets up and starts the command without handling the "empty
acquisition". This results in the interrupt functions trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: prevent "empty acquisition" async commands
H Hartley Sweeten [Tue, 9 Sep 2014 23:16:05 +0000 (16:16 -0700)]
staging: comedi: usbdux: prevent "empty acquisition" async commands

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0 for both the analog input and output async commands. The (*do_cmd) for
both subdevices sets up and starts the command without handling the "empty
acquisition". This results in the interrupt functions trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: s626: fix cmd->stop_arg validation for stop_src == TRIG_COUNT
H Hartley Sweeten [Tue, 9 Sep 2014 23:16:04 +0000 (16:16 -0700)]
staging: comedi: s626: fix cmd->stop_arg validation for stop_src == TRIG_COUNT

The only limit for the stop_arg with a stop_src == TRIG_COUNT is that there is at
least 1 scan in order to prevent an empty acquisition. The max test is bogus.

Fix the validation.

Signed-off-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: s626: 'ai_sample_count' is always 'stop_arg'
H Hartley Sweeten [Tue, 9 Sep 2014 23:16:03 +0000 (16:16 -0700)]
staging: comedi: s626: 'ai_sample_count' is always 'stop_arg'

When the cmd->stop_src == TRIG_COUNT, the 'ai_sample_count' is the cmd->stop_arg.
For a stop_src == TRIG_NONE the 'ai_sample_count' is currently set to 1 but the
driver never actually uses the value.

Simplify the 'stop_count' initialization by just setting it to 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: s626: clarify COMEDI_CB_EOA code
H Hartley Sweeten [Tue, 9 Sep 2014 23:16:02 +0000 (16:16 -0700)]
staging: comedi: s626: clarify COMEDI_CB_EOA code

The end-of-acquisition only applies when the cmd->stop_src == TRIG_COUNT.

Refactor the code in s626_handle_eos_interrupt() that detects the end-of-
acquisition to clarify this.

Signed-off-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: s626: remove 'ai_continuous' from private data
H Hartley Sweeten [Tue, 9 Sep 2014 23:16:01 +0000 (16:16 -0700)]
staging: comedi: s626: remove 'ai_continuous' from private data

This member of the private data is set based on the cmd->stop_src. Just use the
cmd->stop_src directly and remove the 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: rtd520: prevent "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:16:00 +0000 (16:16 -0700)]
staging: comedi: rtd520: prevent "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. The (*do_cmd) then sets up and starts the command without handling the "empty
acquisition". This results in the interrupt function trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: pcmuio: return void from pcmuio_start_intr()
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:59 +0000 (16:15 -0700)]
staging: comedi: pcmuio: return void from pcmuio_start_intr()

This function always returns '0' so the comedi_event() is never done by the
callers.

Change the return type to void and remove the comedi_event() dead 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: pcmuio: 'stop_count' is always 'stop_arg'
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:58 +0000 (16:15 -0700)]
staging: comedi: pcmuio: 'stop_count' is always 'stop_arg'

When the cmd->stop_src == TRIG_COUNT, the 'stop_count' is the cmd->stop_arg.
For any other stop_src the 'stop_count' is 0, which is also the cmd->stop_arg.

Simplify the 'stop_count' 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: pcmuio: remove 'continuous' from private data
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:57 +0000 (16:15 -0700)]
staging: comedi: pcmuio: remove 'continuous' from private data

This member of the private data is set based on the cmd->stop_src. Just use the
cmd->stop_src directly and remove the 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: pcmuio: remove "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:56 +0000 (16:15 -0700)]
staging: comedi: pcmuio: remove "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: pcmmio: return void from pcmmio_start_intr()
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:55 +0000 (16:15 -0700)]
staging: comedi: pcmmio: return void from pcmmio_start_intr()

This function always returns '0' so the comedi_event() is never done by the
callers.

Change the return type to void and remove the comedi_event() dead 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: pcmmio: 'stop_count' is always 'stop_arg'
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:54 +0000 (16:15 -0700)]
staging: comedi: pcmmio: 'stop_count' is always 'stop_arg'

When the cmd->stop_src == TRIG_COUNT, the 'stop_count' is the cmd->stop_arg.
For any other stop_src the 'stop_count' is 0, which is also the cmd->stop_arg.

Simplify the 'stop_count' 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: pcmmio: remove "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:53 +0000 (16:15 -0700)]
staging: comedi: pcmmio: remove "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: pcl711: remove "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:52 +0000 (16:15 -0700)]
staging: comedi: pcl711: remove "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: ni_pcidio: prevent "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:51 +0000 (16:15 -0700)]
staging: comedi: ni_pcidio: prevent "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. The (*do_cmd) then sets up and starts the command without handling the "empty
acquisition". This results in the interrupt function trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: ni_atmio16d: prevent "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:50 +0000 (16:15 -0700)]
staging: comedi: ni_atmio16d: prevent "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. The (*do_cmd) then sets up and starts the command without handling the "empty
acquisition". This results in the interrupt function trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: me4000: validate cmd->stop_arg in step 3 of (*do_cmdtest)
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:49 +0000 (16:15 -0700)]
staging: comedi: me4000: validate cmd->stop_arg in step 3 of (*do_cmdtest)

The async command arguments are supposed to be trivially validated in step 3
of the (*do_cmdtest). Fix the validation of the 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: dt282x: prevent "empty acquisition" async commands
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:48 +0000 (16:15 -0700)]
staging: comedi: dt282x: prevent "empty acquisition" async commands

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0 for both the analog input and output async commands. The (*do_cmd) for
both subdevices sets up and starts the command without handling the "empty
acquisition". This results in the interrupt functions trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: das16m1: prevent "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:47 +0000 (16:15 -0700)]
staging: comedi: das16m1: prevent "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. The (*do_cmd) then sets up and starts the command without handling the "empty
acquisition". This results in the interrupt function trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: das16: prevent "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:46 +0000 (16:15 -0700)]
staging: comedi: das16: prevent "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. The (*do_cmd) then sets up and starts the command without handling the "empty
acquisition". This results in the interrupt function trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: cb_pcidas: prevent "empty acquisition" async commands
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:45 +0000 (16:15 -0700)]
staging: comedi: cb_pcidas: prevent "empty acquisition" async commands

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0 for both the analog input and output async commands. The (*do_cmd) for
both subdevices sets up and starts the command without handling the "empty
acquisition". This results in the interrupt functions trying to transfer 0 data
samples.

Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) to prevent the
"empty acquisition".

Signed-off-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: amplc_pci230: 'ai_scan_count' is always 'stop_arg'
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:44 +0000 (16:15 -0700)]
staging: comedi: amplc_pci230: 'ai_scan_count' is always 'stop_arg'

When the cmd->stop_src == TRIG_COUNT, the 'ai_scan_count' is the cmd->stop_arg.
For any other stop_src the 'ai_scan_count' is 0, which is also the cmd->stop_arg.

Simplify the 'ai_scan_count' 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: amplc_pci230: remove analog input "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:43 +0000 (16:15 -0700)]
staging: comedi: amplc_pci230: remove analog input "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: amplc_pci230: 'ao_scan_count' is always 'stop_arg'
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:42 +0000 (16:15 -0700)]
staging: comedi: amplc_pci230: 'ao_scan_count' is always 'stop_arg'

When the cmd->stop_src == TRIG_COUNT, the 'ao_scan_count' is the cmd->stop_arg.
For any other stop_src the 'ao_scan_count' is 0, which is also the cmd->stop_arg.

Simplify the 'ao_scan_count' 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: amplc_pci230: remove analog output "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:41 +0000 (16:15 -0700)]
staging: comedi: amplc_pci230: remove analog output "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: amplc_pci224: remove "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:38 +0000 (16:15 -0700)]
staging: comedi: amplc_pci224: remove "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: amplc_dio200_common: return void from dio200_start_intr()
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:37 +0000 (16:15 -0700)]
staging: comedi: amplc_dio200_common: return void from dio200_start_intr()

This function always returns '0' so the comedi_event() is never done by the
callers.

Change the return type to void and remove the comedi_event() dead 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: amplc_dio200_common: 'stopcount' is always 'stop_arg'
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:36 +0000 (16:15 -0700)]
staging: comedi: amplc_dio200_common: 'stopcount' is always 'stop_arg'

When the cmd->stop_src == TRIG_COUNT, the 'stopcount' is the cmd->stop_arg. When
the stop_src == TRIG_NONE the 'stopcount' is 0, which is also the cmd->stop_arg.

Simplify the 'stopcount' 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: amplc_dio200_common: remove "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:35 +0000 (16:15 -0700)]
staging: comedi: amplc_dio200_common: remove "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediatelt generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: addi_apci_2032: absorb apci2032_int_start()
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:34 +0000 (16:15 -0700)]
staging: comedi: addi_apci_2032: absorb apci2032_int_start()

This function always returns 'false' so the caller never does the comedi_event().

Absorb the function into the caller and remove the 'do_event' dead 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: addi_apci_2032: remove "empty acquisition" async command
H Hartley Sweeten [Tue, 9 Sep 2014 23:15:33 +0000 (16:15 -0700)]
staging: comedi: addi_apci_2032: remove "empty acquisition" async command

This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg
of 0. This causes the (*do_cmd) to immediatelt generate a COMEDI_CB_EOA event
without acquiring any data.

This "empty acquisition" async command is not really useful. Validate that the
cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition"
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: adl_pci9118: move pci9118_ai_cmdtest()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:55 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: move pci9118_ai_cmdtest()

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

Signed-off-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: adl_pci9118: absorb DMA and non-DMA helpers
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:54 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: absorb DMA and non-DMA helpers

Currently the pci9118_ai_docmd_dma() or pci9118_ai_docmd_sampl() helper
is called by the (*do_cmd) to do the final setup for the command. Most
of this invloves setting various bits in 'ai_ctrl' and 'int_ctrl' to
setup the acquisition based on the 'ai_do' mode. Most of this is the
same for the DMA and non-DMA setup. The differences are easily handled
by either checking the cmd trigger sources or if DMA is used.

Absorb the helper functions into the (*do_cmd) to clarify 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: adl_pci9118: clarify async command start
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:53 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: clarify async command start

The async command can start immediately (TRIG_NOW), from an internal
trigger (TRIG_INT), or from an external trigger (TRIG_EXT). Currently
the start of the command is scattered in the DMA and non-DMA helper
functions.

Consolidate the start of the async command at the end of the (*do_cmd)
function. For aesthetics, use the 'cmd->start_src' directly instead
of the 'ai12_startstop' in the private data to determine how to start
the command. This also fixes a minor bug where the external trigger
gets enabled for a start_src == TRIG_INT.

Signed-off-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: adl_pci9118: introduce pci9118_ai_cmd_start()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:52 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: introduce pci9118_ai_cmd_start()

Introduce a helper function to start the async 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>
10 years agostaging: comedi: adl_pci9118: enable DMA in common code path
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:51 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: enable DMA in common code path

The pci9118_ai_docmd_dma() function enables the DMA bit in the ai control
register for all acquisition modes. For aesthetics, move the enable of
this bit into the (*do_cmd).

Signed-off-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: adl_pci9118: tidy up 'ai_cfg' in pci9118_ai_docmd_dma()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:50 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: tidy up 'ai_cfg' in pci9118_ai_docmd_dma()

The 'ai_cfg' was already set to PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG.
Don't bother setting those bits in pci9118_ai_docmd_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>
10 years agostaging: comedi: adl_pci9118: clarify acquisition mode (ai_do) determination
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:49 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: clarify acquisition mode (ai_do) determination

The async command can operation in 4 modes in this driver.

Modes 1 and 4 use timers 1 and 2 as a cascaded timer to trigger each conversion.
Mode 1 begins the acquisitions immediately (scan_begin_src == TRIG_FOLLOW) and
Mode 4 begins after an external trigger (scan_begin_src == TRIG_EXT). Both modes
use a convert_src == TRIG_TIMER.

Mode 2 uses timers 1 and 2 in a double timed action (scan_begin_src == TRIG_TIMER
and convert_src != TRIG_EXT (TRIG_TIMER and TRIG_NOW are valid)).

Mode 3 does not use the timers. Each acquisition is triggered by an external
signal (scan_begin_src == TRIG_FOLLOW and convert_src == TRIG_EXT.

The (*do_cmdtest) validates the scan_begin_src as TRIG_FOLLOW, TRIG_TIMER,
or TRIG_EXT. Remove the invalid check for TRIG_INT in the (*do_cmd).

Clarify the logic used to determine the mode in the (*do_cmd).

Also, simplify pci9118_calc_divisors(). Call i8253_cascade_ns_to_timer() directly
in the (*do_cmd) for the mode 1 and mode 4 cases. Call pci9118_calc_divisors()
only for mode 2 acquisitions.

Signed-off-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: adl_pci9118: TRIG_INT is not a valid scan_begin_src
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:48 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: TRIG_INT is not a valid scan_begin_src

The (*do_cmdtest) validates the scan_begin_src as TRIG_FOLLOW, TRIG_TIMER,
or TRIG_EXT. Remove the invalid check for TRIG_INT in the (*do_cmd).

Signed-off-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: adl_pci9118: remove sanity checks in pci9118_calc_divisors()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:47 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: remove sanity checks in pci9118_calc_divisors()

The 'tim2' parameter to this function is actually the cmd->convert_arg which
was validated in the (*do_cmdtest) as:

err |= cfc_check_trigger_arg_min(&cmd->convert_arg,
 devprivriv->ai_ns_min);

The sanity checks in this function are just repeating that validation. The
'min_pacer' sanity check is simply not needed.

Remove these unnecessary checks.

Signed-off-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: adl_pci9118: tidy up pci9118_set_chanlist()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:46 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: tidy up pci9118_set_chanlist()

Define some macros to set the 'chan' and 'range' bits in the chanlist
register. Use them to tidy up this 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>
10 years agostaging: comedi: adl_pci9118: absorb pci9118_ai_set_range_aref()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:45 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: absorb pci9118_ai_set_range_aref()

This function is called by the analog input (*insn_read) and (*do_cmd)
operations. The pci9118_set_chanlist() function is also called by those
operations. Setting the range and aref logically belongs with setting
the chanlist. To clarify the code, absorb pci9118_ai_set_range_aref()
into pci9118_set_chanlist().

Signed-off-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: adl_pci9118: rename setup_channel_list()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:44 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: rename setup_channel_list()

Rename this function so it has namespace associated with the driver.

Also, this function always succeeds. Change the return type to void
and remove the unnecessary error handling by the callers.

Signed-off-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: adl_pci9118: remove unused parameters from setup_channel_list()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:43 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: remove unused parameters from setup_channel_list()

The 'rot' and 'usedma' parameters are not used in this function. 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: adl_pci9118: merge pci9118_exttrg_{add,del}()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:42 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: merge pci9118_exttrg_{add,del}()

For aesthetics, merge these two helper functions and add a parameter,
'enable', to determine if the external trigger is being added (enabled)
or deleted (disabled).

Signed-off-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: adl_pci9118: exttrg source is always EXTTRG_AI
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:41 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: exttrg source is always EXTTRG_AI

The 'source'  passed to pci9118_exttrg_{add,del}() is always EXTTRG_AI.
Remove the parameter and unnecessary sanity checking. Also, since there
is only one vaild exttrg source, remove the unnecessary 'exttrg_users'
member from the private data.

The pci9118_exttrg_{add,del}() functions always succeed. For aesthetics
change the return type to void.

Signed-off-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: adl_pci9118: fix interrupt_pci9118_ai_mode4_switch()
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:40 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: fix interrupt_pci9118_ai_mode4_switch()

This function modifies the analog input acquistion programming after the first
DMA cycle to continue a "mode4" acqusition. Part of this programs timer 0 based
on the hardware address of the next buffer. When double buffering is not used
for DMA the "next" buffer is always the first, and only, buffer.

Add a parameter to this function to indicate what the "next" buffer actually is
and fix the callers.

Signed-off-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: adl_pci9118: change type of pci9118_dmabuf 'virt' member
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:39 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: change type of pci9118_dmabuf 'virt' member

For aesthetics, change the type of this member to avoid the casts when allocating
and freeing the DMA buffers. This does introduce a cast in move_block_from_dma()
but that cast is cleaner.

Signed-off-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: adl_pci9118: introduce struct pci9118_dmabuf
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:38 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: introduce struct pci9118_dmabuf

For aesthetics, wrap the DMA buffer information in a struct.

Signed-off-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: adl_pci9118: remove 'dmabuf_used_size' from private data
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:37 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: remove 'dmabuf_used_size' from private data

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

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9118: convert private data true/false flags to bit-fields
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:36 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: convert private data true/false flags to bit-fields

For aesthetics convert the private data true/false flags to bit-fields. The
'usemux' member is used in the driver as a flag. Refactor the analog input
subdevice init so this member can also be 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: adl_pci9118: remove 'dmabuf_panic_size' from private data
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:35 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: remove 'dmabuf_panic_size' from private data

This member of the private data is only used in some #if 0'ed code. Remove
it along with the unused 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: adl_pci9118: remove PCI9118_PARANOIDCHECK code
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:34 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: remove PCI9118_PARANOIDCHECK code

The comment states that paramoid checks are broken. They also would only
work for 12-bit analog input samples.

Instead of fixing the paranoid checking just remove it to simplify the
driver a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9118: do cfc_handle_events() at end of interrupt
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:33 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: do cfc_handle_events() at end of interrupt

Each of the error detections currently do a cfc_handle_events() and exits
the interrupt handler if the error is detected. The DMA and non-DMA handlers
also to a cfc_handle_events().

For aesthetics, use goto to exit the interrupt handler if an error is detected
and move the cfc_handle_events() call to the end of the interrupt.

Signed-off-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: adl_pci9118: handle hardware errors in interrupt handler
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:32 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: handle hardware errors in interrupt handler

Hardware errors will now always terminate an async command. For aesthetics,
absorb pci9118_decode_error_status() into the interrupt handler and use
the register map defines to remove the "magic" numbers. Refactor the code
to set the appropriate comedi event bits and handle the event.

Remove the unnecessary 'ai_maskerr' and 'ai_maskharderr' members 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: adl_pci9118: handle error detection in main interrupt handler
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:31 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: handle error detection in main interrupt handler

The DMA and non-DMA both check the analog input status value to detect
hardware errors. For aesthetics, move the this detection into the main
interrupt handler. This allows removing the unused 'int_adstat' parameter
from the  DMA and non-DMA handlers. In addition, the 'int_daq' parameter
is also not used so remove it also.

Signed-off-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: adl_pci9118: handle master/target abort in main interrupt handler
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:30 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: handle master/target abort in main interrupt handler

For aesthetics, move the master/target abort detection from the DMA handler to the
main interrupt handler. This allows removing the unused 'int_amcc' parameter from
the DMA and non-DMA handlers.

Signed-off-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: adl_pci9118: don't ignore hardware errors
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:29 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: don't ignore hardware errors

The legacy (*attach) currently allows the user to pass a mask of error conditions
to ignore when running async commands. Remove this support so that the async
command is always terminated if the hardware reports an error.

Signed-off-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: adl_pci9118: always try to use interrupt and DMA
H Hartley Sweeten [Tue, 9 Sep 2014 20:05:28 +0000 (13:05 -0700)]
staging: comedi: adl_pci9118: always try to use interrupt and DMA

This driver currently supports both the (*auto_attach) and legacy (*attach)
mechanisms. The (*auto_attach) always tries to use the interrupt and DMA to
support async commands with the analog input subdevice. The legacy (*attach)
only enables them depending on a user option that is passed to the (*attach).
The 'default' (i.e. option == 0) is to enable both the interrupt and DMA.

Simplify the attach by always trying to enable the interrupt and 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>