]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
8 years agostaging: lustre: libcfs: allocate memory in cfs_crypto_performance_test()
Andreas Dilger [Sat, 26 Mar 2016 19:40:53 +0000 (15:40 -0400)]
staging: lustre: libcfs: allocate memory in cfs_crypto_performance_test()

Move memory allocation from cfs_crypto_test_hashes() into the
function cfs_crypto_performance_test().

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: return proper error code for cfs_crypto_hash_speed()
Andreas Dilger [Sat, 26 Mar 2016 19:40:52 +0000 (15:40 -0400)]
staging: lustre: libcfs: return proper error code for cfs_crypto_hash_speed()

Return a real error code, -ENOENT, instead of a -1.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: bug fixes for cfs_crypto_hash_final()
Andreas Dilger [Sat, 26 Mar 2016 19:40:51 +0000 (15:40 -0400)]
staging: lustre: libcfs: bug fixes for cfs_crypto_hash_final()

Change cfs_crypto_hash_final() to always clean up the hash descrptor
instead of not doing this in error cases.  All of the callers were
just calling cfs_crypto_hash_final() immediately to clean up the
descriptor anyway, and the old behaviour is unlike other init/fini
functions, and prone to memory leaks and other incorrect usage.  The
callers can call cfs_crypto_digest_size() to determine the hash size
in advance if needed, and avoid complexity in cfs_crypto_hash_final().

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: start using enum cfs_crypto_hash_alg
Andreas Dilger [Sat, 26 Mar 2016 19:40:50 +0000 (15:40 -0400)]
staging: lustre: libcfs: start using enum cfs_crypto_hash_alg

Fix the cfs_crypto_hash_* functions to take enum cfs_crypto_hash_alg
as the algorithm type, instead of an unsigned char.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: small alignment change for cfs_crypto_hash_*()
Andreas Dilger [Sat, 26 Mar 2016 19:40:49 +0000 (15:40 -0400)]
staging: lustre: libcfs: small alignment change for cfs_crypto_hash_*()

Change the aligment of some of the functions.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: add new definitions for cfs_crypto api
Andreas Dilger [Sat, 26 Mar 2016 19:40:48 +0000 (15:40 -0400)]
staging: lustre: libcfs: add new definitions for cfs_crypto api

Add CFS_HASH_ALG_UNKOWN for unknown hash names instead of
using "0xFF" directly. Define the max digestsize the cfs
crypto api can handle.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: rename some variables for crypto handling
Andreas Dilger [Sat, 26 Mar 2016 19:40:47 +0000 (15:40 -0400)]
staging: lustre: libcfs: rename some variables for crypto handling

For the crypto algorthim type use the same name hash_alg everywhere.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: add documentation for cfs_crypto_hash_*()
Andreas Dilger [Sat, 26 Mar 2016 19:40:46 +0000 (15:40 -0400)]
staging: lustre: libcfs: add documentation for cfs_crypto_hash_*()

Add comment blocks for cfs_crypto_hash_*() in linux-crypto.c and
libcfs_crypto.h. Delete obsolete comment about shash handling in
cfs_crypto_hash_alloc().

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: libcfs: limit scope of libcfs_crypto.h
Andreas Dilger [Sat, 26 Mar 2016 19:40:45 +0000 (15:40 -0400)]
staging: lustre: libcfs: limit scope of libcfs_crypto.h

Remove <libcfs/libcfs_crypto.h> from <libcfs/libcfs.h> and only
include it into the places where it is actually needed.  This
works out to be the same places as <obd_cksum.h>, so put it there.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053
Reviewed-on: http://review.whamcloud.com/9990
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: fix Logical continuations should be on the
Daeseok Youn [Fri, 25 Mar 2016 02:44:34 +0000 (11:44 +0900)]
staging: dgnc: fix Logical continuations should be on the

fix checkpatch.pl warning about 'Logical continuations
should be on the previous line' in dgnc_neo.c file.

I think the 'force' need to check first, because if the 'force' is true,
it doesn't need to call another function call.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: fix 'line over 80 characters'
Daeseok Youn [Fri, 25 Mar 2016 02:44:06 +0000 (11:44 +0900)]
staging: dgnc: fix 'line over 80 characters'

fix checkpatch.pl warning about 'line over 80 characters'
in dgnc_neo.c

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: remove unused variable in dgnc_board
Daeseok Youn [Thu, 24 Mar 2016 06:11:08 +0000 (15:11 +0900)]
staging: dgnc: remove unused variable in dgnc_board

TtyRefCnt was not used anywhere in dgnc.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: fix CamelCase in dgnc_drvier.h and
Daeseok Youn [Thu, 24 Mar 2016 06:10:43 +0000 (15:10 +0900)]
staging: dgnc: fix CamelCase in dgnc_drvier.h and

fix checkpatch.pl warning about CamelCase

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: xgifb: remove extra braces from if stmt (single branch)
Nicholas Sim [Wed, 23 Mar 2016 23:02:59 +0000 (23:02 +0000)]
staging: xgifb: remove extra braces from if stmt (single branch)

Remove braces from one branch of if statement where both branches only
have a single line of code, as suggested in Documentation/CodingStyle

Signed-off-by: Nicholas Sim <nicholassimws@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: xgifb: ensure braces on all arms of if stmt
Nicholas Sim [Wed, 23 Mar 2016 23:02:24 +0000 (23:02 +0000)]
staging: xgifb: ensure braces on all arms of if stmt

Added braces on else arm of if statement where if arm already has braces
as suggested for clarity in Documentation/CodingStyle

Signed-off-by: Nicholas Sim <nicholassimws@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove return at end of void function call
Nicholas Sim [Wed, 23 Mar 2016 22:35:39 +0000 (22:35 +0000)]
staging: rtl8188eu: remove return at end of void function call

Remove unnecessary return statements from last lines of void function call
(several)

Signed-off-by: Nicholas Sim <nicholassimws@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6656: Fixed multiple logical comparisions warnings in main_usb.c
Parth Sane [Wed, 23 Mar 2016 19:38:29 +0000 (01:08 +0530)]
staging: vt6656: Fixed multiple logical comparisions warnings in main_usb.c

Using comparison to false and true is error prone. Fixed multiple warnings as
per checkpatch guidelines.

Signed-off-by: Parth Sane <laerdevstudios@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: wlan-ng: wiphy_free() is not called in case wiphy_register() fails
Claudiu Beznea [Wed, 23 Mar 2016 18:37:26 +0000 (20:37 +0200)]
Staging: wlan-ng: wiphy_free() is not called in case wiphy_register() fails

This patch covers wiphy_register() failures in wlan_create_wiphy()
from cfg80211.c by calling wiphy_free() for the correspondent
struct wiphy allocated structure.

Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: fix CamelCase in dgnc_driver.c
Daeseok Youn [Wed, 23 Mar 2016 11:54:36 +0000 (20:54 +0900)]
staging: dgnc: fix CamelCase in dgnc_driver.c

fix checkpatch.pl warning about CamelCase.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: iio: Fix sparse endian warning
Ksenija Stanojevic [Wed, 23 Mar 2016 11:06:34 +0000 (12:06 +0100)]
Staging: iio: Fix sparse endian warning

Fix following sparse warning:
warning: cast to restricted __be16

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: most: Remove __cplusplus check in header files
PrasannaKumar Muralidharan [Wed, 23 Mar 2016 07:28:28 +0000 (12:58 +0530)]
Staging: most: Remove __cplusplus check in header files

Remove unnecessary __cplusplus check in header files as it is not
required.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: speakup: fix type mismatch warnings
Okash Khawaja [Thu, 10 Mar 2016 20:21:35 +0000 (20:21 +0000)]
staging: speakup: fix type mismatch warnings

Compiling speakup driver with sparse produces following warning:

drivers/staging/speakup/serialio.c:22:9: warning: incorrect type in
initializer (different base types)
drivers/staging/speakup/serialio.c:22:9:    expected unsigned int
[unsigned] flags
drivers/staging/speakup/serialio.c:22:9:    got restricted upf_t

This patch fixes it.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: remove BUG() checks for ni_tio_get_clock_src()
H Hartley Sweeten [Wed, 23 Mar 2016 22:37:04 +0000 (15:37 -0700)]
staging: comedi: ni_tio: remove BUG() checks for ni_tio_get_clock_src()

This function calls some helper functions to convert the counter variant
specific clock select bits into the generic enum ni_gpct_clock_source_bits
equivelent. These helper functions currently BUG() if the clock select
bits are invalid.

It then calls ni_tio_clock_period_ps() to figure out the clock period
based on the generic clock source. This function could also BUG() if
the prescale bits are invalid.

In reality this should never happen but refactor the code to return
-EINVAL instead and remove the BUG() checks.

These functions are also called by ni_tio_set_sync_mode(). When this
function is called by ni_tio_set_clock_src() the counter select bits
have already been validated.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: remove BUG() in ni_tio_set_gate_src()
H Hartley Sweeten [Wed, 23 Mar 2016 22:37:03 +0000 (15:37 -0700)]
staging: comedi: ni_tio: remove BUG() in ni_tio_set_gate_src()

This BUG() can never happen. The previous ni_tio_has_gate2_registers()
check will have already caused the function to return -EINVAL.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: fix ni_tio_insn_config()
H Hartley Sweeten [Wed, 23 Mar 2016 22:37:02 +0000 (15:37 -0700)]
staging: comedi: ni_tio: fix ni_tio_insn_config()

The (*insn_config) functions are supposed to return an errno or the number
of 'data' values used for the instruction (insn->n). Currently this function
returns an errno or 0. Fix the function to work like the core expects.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: remove BUG() checks for ni_tio_get_gate_src()
H Hartley Sweeten [Wed, 23 Mar 2016 22:37:01 +0000 (15:37 -0700)]
staging: comedi: ni_tio: remove BUG() checks for ni_tio_get_gate_src()

This function calls some helper functions to convert the counter variant
specific gate select bits into the generic enum ni_gpct_clock_source_bits
equivelent. These helper functions currently BUG() if the gate select
bits are invalid.

This should never happen but refactor the code to return -EINVAL instead
and remove the BUG() 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>
8 years agostaging: comedi: ni_tio: validate clock source
H Hartley Sweeten [Wed, 23 Mar 2016 22:37:00 +0000 (15:37 -0700)]
staging: comedi: ni_tio: validate clock source

Refactor the functions that determine the clock source bits so that they
return -EINVAL if the clock source is invalid. Pass the errno back to
ni_tio_insn_config().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tiocmd: remove BUG() which can never occur
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:59 +0000 (15:36 -0700)]
staging: comedi: ni_tiocmd: remove BUG() which can never occur

All the counter_dev->variant options are handled by the switch.
Remove the BUG() which can never occur.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tiocmd: remove unsed param from ni_tio_acknowledge_and_confirm()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:58 +0000 (15:36 -0700)]
staging: comedi: ni_tiocmd: remove unsed param from ni_tio_acknowledge_and_confirm()

The 'stale_data' pointer is always NULL. 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>
8 years agostaging: comedi: ni_tiocmd: fix block comments
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:57 +0000 (15:36 -0700)]
staging: comedi: ni_tiocmd: fix block comments

Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tiocmd: Prefer 'unsigned int' to bare use of 'unsigned'
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:56 +0000 (15:36 -0700)]
staging: comedi: ni_tiocmd: Prefer 'unsigned int' to bare use of 'unsigned'

Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: tidy up ni_tio_arm()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:55 +0000 (15:36 -0700)]
staging: comedi: ni_tio: tidy up ni_tio_arm()

Make this function a bit more consise by absorbing the GI_HW_ARM_SEL_MASK()
inline helper and combine the two switch (start_trigger) code paths.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: tidy up ni_tio_set_sync_mode()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:54 +0000 (15:36 -0700)]
staging: comedi: ni_tio: tidy up ni_tio_set_sync_mode()

The 'force_alt_sync' paramater is always 0. Remove it.

Absorb the GI_ALT_SYNC() inline helper and use some local variables
to clarify 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>
8 years agostaging: comedi: ni_tio: tidy up ni_tio_get_gate_src()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:53 +0000 (15:36 -0700)]
staging: comedi: ni_tio: tidy up ni_tio_get_gate_src()

Clarify the code a bit by handling the NI_GPCT_DISABLED_GATE_SELECT source
in the common code path.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: fix block comments
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:52 +0000 (15:36 -0700)]
staging: comedi: ni_tio: fix block comments

Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: Prefer kernel type 'u64' over 'uint64_t'
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:51 +0000 (15:36 -0700)]
staging: comedi: ni_tio: Prefer kernel type 'u64' over 'uint64_t'

Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: Prefer 'unsigned int' to bare use of 'unsigned'
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:50 +0000 (15:36 -0700)]
staging: comedi: ni_tio: Prefer 'unsigned int' to bare use of 'unsigned'

Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio.h: remove unnecessary forward declarations
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:49 +0000 (15:36 -0700)]
staging: comedi: ni_tio.h: remove unnecessary forward declarations

These struct forward declarations are not needed. 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>
8 years agostaging: comedi: ni_tio.h: fix block comment
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:48 +0000 (15:36 -0700)]
staging: comedi: ni_tio.h: fix block comment

Fix the checkpatch.pl issue:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio.h: tidy up struct ni_gpct
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:47 +0000 (15:36 -0700)]
staging: comedi: ni_tio.h: tidy up struct ni_gpct

Fix the checkpatch.pl issues:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
CHECK: Prefer kernel type 'u64' over 'uint64_t'
CHECK: spinlock_t definition without comment

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio.h: tidy up struct ni_gpct_device
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:46 +0000 (15:36 -0700)]
staging: comedi: ni_tio.h: tidy up struct ni_gpct_device

Fix the checkpatch.pl issues:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
CHECK: spinlock_t definition without comment

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: tidy up struct ni_gpct_device (*{write, read}_register)
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:45 +0000 (15:36 -0700)]
staging: comedi: ni_tio: tidy up struct ni_gpct_device (*{write, read}_register)

For aesthetics, rename these callbacks to simply read/write. Change the
'unsigned' parameters to 'unsigned int'.

This fixes a number of checkpatch.pl issues:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio_internal: export {read, write)_register()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:44 +0000 (15:36 -0700)]
staging: comedi: ni_tio_internal: export {read, write)_register()

Move these inline functions out of the header and export them instead.
These functions have pretty generic names, rename them.

Fix the checkpatch.pl issues:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
CHECK: Avoid crashing the kernel - try using WARN_ON & recovery code
       rather than BUG() or BUG_ON()

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio_internal: simplify ni_tio_counting_mode_registers_present()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:43 +0000 (15:36 -0700)]
staging: comedi: ni_tio_internal: simplify ni_tio_counting_mode_registers_present()

Only the e series gpct variant does not have counting mode registers.
Simplfy this function. For aesthetics, return bool instead of int.

This fixes the checkpatch.pl issues:
CHECK: spaces preferred around that '*' (ctx:ExV)
CHECK: Avoid crashing the kernel - try using WARN_ON & recovery code
       rather than BUG() or BUG_ON()

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: export and fix ni_tio_set_bits()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:42 +0000 (15:36 -0700)]
staging: comedi: ni_tio: export and fix ni_tio_set_bits()

Move the inline function from the header and export it instead.

Fix the checkpatch.pl issue:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

The 'unsigned' vars can safely be changed to 'unsigned int'.

This allows moving ni_tio_set_bits_transient() into the driver and
making it static.

Fix the checkpatch.pl issue:
CHECK: Avoid crashing the kernel - try using WARN_ON & recovery code
       rather than BUG() or BUG_ON()

The BUG_ON() is overkill. All the drivers that call this function pass
'register_index' values that are valid. Just check the 'register_index'
before updating the software copy and writing the register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: export and fix ni_tio_get_soft_copy()
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:41 +0000 (15:36 -0700)]
staging: comedi: ni_tio: export and fix ni_tio_get_soft_copy()

Move the inline function from the header and export it instead.

For the checkpatch.pl issues:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
CHECK: Avoid crashing the kernel - try using WARN_ON & recovery code
       rather than BUG() or BUG_ON()

The 'unsigned' vars can safely be changed to 'unsigned int'.

The BUG_ON() is overkill. All the drivers that call this function pass
'register_index' values that are valid. Just check the 'register_index'
and return 0 if it's not valid.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: fix ni_tio_arm() params/vars
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:40 +0000 (15:36 -0700)]
staging: comedi: ni_tio: fix ni_tio_arm() params/vars

As suggested by checkpatch.pl:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

The 'arm' parameter is really a true/false flag. For aesthetics,
change it to a bool.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: fix ni_tio_set_gate_src() params/vars
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:39 +0000 (15:36 -0700)]
staging: comedi: ni_tio: fix ni_tio_set_gate_src() params/vars

As suggested by checkpatch.pl:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio_internal.h: fix block comment issues
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:38 +0000 (15:36 -0700)]
staging: comedi: ni_tio_internal.h: fix block comment issues

Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio_internal.h: tidy up bit defines
H Hartley Sweeten [Wed, 23 Mar 2016 22:36:37 +0000 (15:36 -0700)]
staging: comedi: ni_tio_internal.h: tidy up bit defines

Fix the checkpatch.pl issues:
CHECK: Prefer using the BIT macro

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: plx9052.h: fix block comment issues
H Hartley Sweeten [Tue, 22 Mar 2016 18:51:55 +0000 (11:51 -0700)]
staging: comedi: plx9052.h: fix block comment issues

Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: plx9052.h: tidy up bit defines
H Hartley Sweeten [Tue, 22 Mar 2016 18:51:54 +0000 (11:51 -0700)]
staging: comedi: plx9052.h: tidy up bit defines

Fix the checkpatch.pl issues:
CHECK: Prefer using the BIT macro

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: z8536: tidy up bit defines
H Hartley Sweeten [Tue, 22 Mar 2016 18:29:27 +0000 (11:29 -0700)]
staging: comedi: z8536: tidy up bit defines

Fix the checkpatch.pl issues:
CHECK: Prefer using the BIT macro

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_mio_common: ni_gpct_device_destroy() can handle a NULL pointer
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:42 +0000 (11:10 -0700)]
staging: comedi: ni_mio_common: ni_gpct_device_destroy() can handle a NULL pointer

Remove the unnecessary NULL pointer check.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: make ni_gpct_device_destroy() NULL pointer safe
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:40 +0000 (11:10 -0700)]
staging: comedi: ni_tio: make ni_gpct_device_destroy() NULL pointer safe

Modify the pointer check to make this function NULL pointer safe.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_labpc.h: fix block comment issues
H Hartley Sweeten [Tue, 22 Mar 2016 18:21:40 +0000 (11:21 -0700)]
staging: comedi: ni_labpc.h: fix block comment issues

Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_labpc_pci: tidy up bit define
H Hartley Sweeten [Tue, 22 Mar 2016 18:21:39 +0000 (11:21 -0700)]
staging: comedi: ni_labpc_pci: tidy up bit define

As suggested by checkpatch.pl:
CHECK: Prefer using the BIT macro

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_labpc_cs: fix block comment issues
H Hartley Sweeten [Tue, 22 Mar 2016 18:21:38 +0000 (11:21 -0700)]
staging: comedi: ni_labpc_cs: fix block comment issues

Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_labpc_common: tidy up block comments
H Hartley Sweeten [Tue, 22 Mar 2016 18:21:37 +0000 (11:21 -0700)]
staging: comedi: ni_labpc_common: tidy up block comments

Fix the checkpatch.pl issues:
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_labpc_regs.h: tidy up bit defines
H Hartley Sweeten [Tue, 22 Mar 2016 18:21:36 +0000 (11:21 -0700)]
staging: comedi: ni_labpc_regs.h: tidy up bit defines

As suggested by checkpatch.pl:
CHECK: Prefer using the BIT macro

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_labpc: remove some unnecessary defines
H Hartley Sweeten [Tue, 22 Mar 2016 18:21:35 +0000 (11:21 -0700)]
staging: comedi: ni_labpc: remove some unnecessary defines

The EEPROM_SIZE and NUM_AO_CHAN defines are only used once and they
don't add any significant clarity to the driver. They are also pretty
generic symbol names. Remove them and just open code the values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt282x: remove unnecessary comment
H Hartley Sweeten [Wed, 23 Mar 2016 19:24:31 +0000 (12:24 -0700)]
staging: comedi: dt282x: remove unnecessary comment

The "Configuration options" are documented in the comedi driver comment
block. Remove the redundant comment before the drivers (*attach) 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>
8 years agostaging: comedi: dt282x: remove redundant comedi_check_trigger_arg_min()
H Hartley Sweeten [Wed, 23 Mar 2016 19:24:30 +0000 (12:24 -0700)]
staging: comedi: dt282x: remove redundant comedi_check_trigger_arg_min()

The 'convert_arg' sets the acquisition timing of the analog input command.
The maximum speed (the minimum timing) depends on the board 'ai_speed' which
if always >= 4000. Remove the redundant 'min' check,

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt282x: refactor dt282x_ns_to_timer()
H Hartley Sweeten [Wed, 23 Mar 2016 19:24:29 +0000 (12:24 -0700)]
staging: comedi: dt282x: refactor dt282x_ns_to_timer()

Define the pacer clock limits and remove the magic numbers. Refactor
the code to use a common path to return the actual 'ns' timing and
the timer divisor value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: update the MODULE_DESCRIPTION
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:53 +0000 (11:10 -0700)]
staging: comedi: ni_660x: update the MODULE_DESCRIPTION

Change the generic MODULE_DESCRIPTION text to something more useful.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: refactor GPCT_OFFSET
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:52 +0000 (11:10 -0700)]
staging: comedi: ni_660x: refactor GPCT_OFFSET

This driver supports boards that have 1 or 2 TIO chips with base
addresses 0x800 apart. Replace the static const array 'GPCT_OFFSET'
with a define and calculate the base address based on the chip index.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: remove spinlock 'dma_cfg_lock'
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:51 +0000 (11:10 -0700)]
staging: comedi: ni_660x: remove spinlock 'dma_cfg_lock'

This spinlock is only used to protect changes to the private data 'dma_cfg'.

Before calling any function that would change the 'dma_cfg' the spinlock
'mite_channel_lock' is also locked. That spinlock is not unlocked until
after the 'dma_cfg' change.

Remove the redundant spinlock.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: remove ni_gpct_to_660x_register[]
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:50 +0000 (11:10 -0700)]
staging: comedi: ni_660x: remove ni_gpct_to_660x_register[]

enum ni_gpct_register and enum ni_660x_register now have a 1:1
relationship for the NITIO_* registers. The static const array
is no longer necessary to find the proper NI660X_* register for
a given NITIO_*. Remove it and refactor the register read/write
functions.

Use the NITIO_* values to init the ni_660x_reg_data[] array and
remove the unnecessary NI660X_* enum values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: sort enum ni_660x_register
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:49 +0000 (11:10 -0700)]
staging: comedi: ni_660x: sort enum ni_660x_register

Sort this enum so that it has a 1:1 relationship with the ni_tio.h
enum ni_gpct_register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: remove inline mite_ring()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:48 +0000 (11:10 -0700)]
staging: comedi: ni_660x: remove inline mite_ring()

This fuction just returns a pointer from the private data. The name
might provide some confusion since it appears to be an exported
function from the mite driver.

Just remove it and get the pointer directly where needed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: default DIO channels with subdevice init
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:47 +0000 (11:10 -0700)]
staging: comedi: ni_660x: default DIO channels with subdevice init

For aesthetics, move the initialization of the default routing for the
DIO channels so it happens when the subdevice is initialized.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: initialize the counter with the subdevice init
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:46 +0000 (11:10 -0700)]
staging: comedi: ni_660x: initialize the counter with the subdevice init

Remove the extra for loop and just initialize the counter as the subdevices
are created.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: allocate counters early in (*auto_attach)
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:45 +0000 (11:10 -0700)]
staging: comedi: ni_660x: allocate counters early in (*auto_attach)

The ni_gpct_device_construct() could fail allocating the memory for
device and its counters. For aesthetics, call the function before
initializing the subdevices.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: init TIO chips before subdevice init
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:44 +0000 (11:10 -0700)]
staging: comedi: ni_660x: init TIO chips before subdevice init

For aesthetics, initialize the TIO chips before the subdevices are
allocated and initialized.

Refactor the function to initialize all the TIO chips and move it
to a better place in 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>
8 years agostaging: comedi: ni_660x: disable interrupts when detaching driver
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:43 +0000 (11:10 -0700)]
staging: comedi: ni_660x: disable interrupts when detaching driver

Make sure the interrupts are disabled before freeing the irq.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: ni_gpct_device_destroy() can handle a NULL pointer
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:41 +0000 (11:10 -0700)]
staging: comedi: ni_660x: ni_gpct_device_destroy() can handle a NULL pointer

Remove the unnecessary NULL pointer check.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up the counter subdevices init
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:39 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up the counter subdevices init

For aesthetics, add some whitespace to the subdevice init and use
a couple local variables to make the code easier to follow.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up the misc. constants
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:38 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up the misc. constants

Remove enum ni_660x_constants and just #define the value.

Move all the constant #defines so they are in one place and rename
them so they are more conesistent.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: fix memory barrier without comment
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:37 +0000 (11:10 -0700)]
staging: comedi: ni_660x: fix memory barrier without comment

Fix the checkpatch.pl issue. Move the memory barrier to a better place.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: add comments for the spinlock_t definitions
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:36 +0000 (11:10 -0700)]
staging: comedi: ni_660x: add comments for the spinlock_t definitions

Fix the checkpatch.pl issues:

CHECK: spinlock_t definition without comment

For aesthetics, rename the 'soft_reg_copy_lock' to clarify what it's
used for.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: refactor ni_gpct_to_660x_register()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:35 +0000 (11:10 -0700)]
staging: comedi: ni_660x: refactor ni_gpct_to_660x_register()

Convert this big switch into an array and refactor ni_660x_gpct_{write,read}()
functions to use the array to find the register offset.

All the TIO (GPCT) registers are included in the array except for NITIO_G0_ABZ
and NITIO_G1_ABZ. These registers only exist on the ni_pcimio m-series boards
and this driver will never read/write them.

Just in case someone adds a new entry to the enum ni_gpct_register in ni_tio.h,
add a dev_warn() for any unhandled registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: add a comment about the initial DIO state
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:34 +0000 (11:10 -0700)]
staging: comedi: ni_660x: add a comment about the initial DIO state

The (*auto_attach) initializes all the DIO channels to a default state.
Add a comment for clarity.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up ni_660x_set_pfi_routing()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:33 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up ni_660x_set_pfi_routing()

Use the comedi.h provided constants (enum ni_660x_pfi_routing) instead
of defining new ones for the output sources.

Use a switch to clarify the channel/source validation.

For aesthetics, rename the private data members 'pfi_output_selects' and
'pfi_direction_bits'.

Remove the 'min_counter_pfi_chan' and 'max_dio_pfi_chan' from
enum ni_660x_constants. The open coded values make the code easier
to follow.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up ni_660x_dio_insn_bits()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:32 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up ni_660x_dio_insn_bits()

Use some local variables to clarify this function.

This (*insn_bits) function is a bit different from most comedi drivers.
Add some comments to clarify why the shifts are 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>
8 years agostaging: comedi: ni_660x: tidy up Digital I/O subdevice init
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:31 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up Digital I/O subdevice init

Add some whitespace to the Digital I/O subdevice init and add a
comment about the channels. This driver is a bit goofy, only 32 of
the 40 channels can actually be used for Digital I/Os and 32 of
them can be routed to the counters for alternate use.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: Prefer kernel type 'u64' over 'uint64_t'
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:30 +0000 (11:10 -0700)]
staging: comedi: ni_660x: Prefer kernel type 'u64' over 'uint64_t'

Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: Prefer 'unsigned int' to bare use of 'unsigned'
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:29 +0000 (11:10 -0700)]
staging: comedi: ni_660x: Prefer 'unsigned int' to bare use of 'unsigned'

Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: remove ni_660x_num_counters()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:28 +0000 (11:10 -0700)]
staging: comedi: ni_660x: remove ni_660x_num_counters()

This inline function is only used by the (*auto_attach). Remove it
and just use a local variable for the calculation.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: remove enum ni_660x_subdevices
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:27 +0000 (11:10 -0700)]
staging: comedi: ni_660x: remove enum ni_660x_subdevices

Hard-coding the subdevice order is normally a bad idea. If a new subdevice
is added, or removed, it could potentially break pretty badly.

Remove the enum and associated NI_660X_GPCT_SUBDEV() helper that hard-code
the subdevice order.

Fix the (*auto_attach) so it initializes all the subdevices without depending
on the hard-coded order.

Change the interrupt handler so that all the counter subdevices are handled
without depending on the hard-coded order.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: fix block comment issues
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:26 +0000 (11:10 -0700)]
staging: comedi: ni_660x: fix block comment issues

Fix the checkpatch.pl issues about:

WARNING: Block comments use * on subsequent lines
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: remove BUG_ON() in ni_660x_request_mite_channel()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:25 +0000 (11:10 -0700)]
staging: comedi: ni_660x: remove BUG_ON() in ni_660x_request_mite_channel()

This BUG_ON() happens if a mite DMA channel is already requested when an
ansynchronous command is started for one of the counter subdevices.

The comedi core will only call the (*do_cmd) if the subdevice is not busy.
In this driver, the (*cancel) for the subdevice will always release any
requested mite DMA channel.

Remove the BUG_ON() which can never occur.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up ni_660x_select_pfi_output()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:24 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up ni_660x_select_pfi_output()

Tidy up this function to fix the checkpatch.pl issues:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

For aesthetics, remove the static const local variables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up ni_gpct_{write, read}_register()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:23 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up ni_gpct_{write, read}_register()

Rename these functions so they have namespace associated with the
driver.

Fix the checkpatch.pl issues:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up ni_660x_read_register()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:22 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up ni_660x_read_register()

Rename this function to help shorten some of the long lines.

Remove the inline, let the compiler figure it out.

Change the 'unsigned' parameters to 'unsigned int' to fix the
checkpatch.pl issues:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: tidy up ni_660x_write_register()
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:21 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up ni_660x_write_register()

Rename this function to help shorten some of the long lines.

Remove the inline, let the compiler figure it out.

Change the 'unsigned' parameters to 'unsigned int' to fix the
checkpatch.pl issues:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: cleanup the NI660X_GLOBAL_INT_{STATUS, CFG}
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:20 +0000 (11:10 -0700)]
staging: comedi: ni_660x: cleanup the NI660X_GLOBAL_INT_{STATUS, CFG}

Remove the enums global_interrupt_{status,config}_register_bits and
add defines for the CamelCase values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: cleanup the NI660X_DMA_CFG register helpers
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:19 +0000 (11:10 -0700)]
staging: comedi: ni_660x: cleanup the NI660X_DMA_CFG register helpers

The BUG_ON() checks in the helper functions are not necessary. The mite
driver quiries the PCI chip to determine the number of DMA channels.
This is then used when a DMA channel is requested so the channel will
always be in range.

Convert the inline functions used to set the bits in the NI600X_DMA_CFG
register into macros. Also convert the associated enum dma_selection.
This clarifies the association with the register.

Rename the associated 'dma_configuration_soft_copies' member of the
private data to allow shorting some of the ugly long lines in the
driver.

This also fixes a number of checkpatch.pl issues about:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: remove enum clock_config_register_bits
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:18 +0000 (11:10 -0700)]
staging: comedi: ni_660x: remove enum clock_config_register_bits

Remove this enum and add a define for the 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>
8 years agostaging: comedi: ni_660x: tidy up multi-line comment
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:17 +0000 (11:10 -0700)]
staging: comedi: ni_660x: tidy up multi-line comment

Reformat the multi-line comment in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_660x: cleanup the NI660X_IO_CFG register helpers
H Hartley Sweeten [Tue, 22 Mar 2016 18:10:16 +0000 (11:10 -0700)]
staging: comedi: ni_660x: cleanup the NI660X_IO_CFG register helpers

Convert the inline functions used to set the bits in the NI600X_IO_CFG
registers into macros. Also convert the enum ni_660x_pfi_output_select
into defines. This clarifies the association with the register.

This also fixes a number of checkpatch.pl issues about:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

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