openwrt/staging/blogic.git
10 years agostaging: rtl8188eu: refactor led related structures.
navin patidar [Sun, 20 Apr 2014 08:47:15 +0000 (14:17 +0530)]
staging: rtl8188eu: refactor led related structures.

struct led_priv contains two variables SwLed0 and SwLed1 but only
SwLed0 is being used by SwLedControlModel1() function.

SwLedControlModel1() function performs led operations.

This patch removes SwLed1 and code which uses SwLed1.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove enum LED_STRATEGY_871x .
navin patidar [Sun, 20 Apr 2014 08:47:14 +0000 (14:17 +0530)]
staging: rtl8188eu: Remove enum LED_STRATEGY_871x .

 Now driver has only one type of led blinking strategy, so we don't
 need enum LED_STRATEGY_871x variable to store led blinking strategy
 type.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Simplify led blinking strategy code.
navin patidar [Sun, 20 Apr 2014 08:47:13 +0000 (14:17 +0530)]
staging: rtl8188eu: Simplify led blinking strategy code.

driver has code to blink the led in 7 different ways.
struct led_priv contains an enum LED_STRATEGY_871x variable which is
initialized to SW_LED_MODE1 inside rtl8188eu_InitSwLeds() function.
it means driver is hard coded to use only SW_LED_MODE1 blinking strategy.
so we can remove the code related to other blinking strategies
e.g. SW_LED_MODE[0|2|3|4|5|6].

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove _InitHWLed() function.
navin patidar [Sun, 20 Apr 2014 08:47:12 +0000 (14:17 +0530)]
staging: rtl8188eu: Remove _InitHWLed() function.

_InitHWLed() function does nothing.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove _ReadLEDSetting() function.
navin patidar [Sun, 20 Apr 2014 08:47:11 +0000 (14:17 +0530)]
staging: rtl8188eu: Remove _ReadLEDSetting() function.

_ReadLEDSetting() doesn't read led settings this function actually
initialize  member variables of struct led_priv, we should do that
inside rtl8188eu_InitSwLeds().

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove rtw_led_blink_cmd() function.
navin patidar [Sun, 20 Apr 2014 08:47:10 +0000 (14:17 +0530)]
staging: rtl8188eu: Remove rtw_led_blink_cmd() function.

rtw_led_blink_cmd() isn't being used by driver.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove empty header file
navin patidar [Sun, 20 Apr 2014 08:47:09 +0000 (14:17 +0530)]
staging: rtl8188eu: Remove empty header file

drv_types_linux.h is empty, so remove the header file and its
reference.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: fix spaces instead of tabs for rtw_recv.c
Konrad Zapalowicz [Sat, 19 Apr 2014 16:21:28 +0000 (18:21 +0200)]
staging: rtl8188eu: fix spaces instead of tabs for rtw_recv.c

This commit fixes the following checkpatch errors:

rtl8188eu/core/rtw_recv.c
    - 1874: ERROR: code indent should use tabs where possible

Signed-off-by: Konrad Zapalowicz <bergo.torino@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: fix spaces instead of tabs for rtw_p2p.c
Konrad Zapalowicz [Sat, 19 Apr 2014 16:21:27 +0000 (18:21 +0200)]
staging: rtl8188eu: fix spaces instead of tabs for rtw_p2p.c

This commit fixes the following checkpatch errors:

rtl8188eu/core/rtw_p2p.c
    - 1508: ERROR: code indent should use tabs where possible
    - 1509: ERROR: code indent should use tabs where possible
    - 1510: ERROR: code indent should use tabs where possible

Signed-off-by: Konrad Zapalowicz <bergo.torino@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: don't initialise statics to 0 or NULL in halbtc8192e2ant.c
Mark Einon [Sat, 19 Apr 2014 14:35:50 +0000 (15:35 +0100)]
staging: rtl8821ae: don't initialise statics to 0 or NULL in halbtc8192e2ant.c

Fixes all checkpatch errors reporting that statics shouldn't be initialised
to their defualt values.

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Fix indetentation of switch case statements
Mark Einon [Sat, 19 Apr 2014 14:35:49 +0000 (15:35 +0100)]
staging: rtl8821ae: Fix indetentation of switch case statements

Fixes checkpatch error:

ERROR: switch and case should be at the same indent
+               switch (coex_dm->cur_retrylimit_type) {
+                       case 0: /* normal mode */
[...]
+                       case 1: /* retry limit=8 */
[...]
+                       default:

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: halbtc8192e2ant.c fix checkpatch leading spaces/tabs issues
Mark Einon [Sat, 19 Apr 2014 14:35:48 +0000 (15:35 +0100)]
staging: rtl8821ae: halbtc8192e2ant.c fix checkpatch leading spaces/tabs issues

Fix checkpatch issues relating to using leading spaces instead of tabs.
Whitespace changes only.

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Fix checkpatch whitespace issues
Mark Einon [Sat, 19 Apr 2014 14:35:47 +0000 (15:35 +0100)]
staging: rtl8821ae: Fix checkpatch whitespace issues

Whitespace changes only to appease checkpatch warnings.

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Remove declaration assignment to zero
Mark Einon [Sat, 19 Apr 2014 14:35:46 +0000 (15:35 +0100)]
staging: rtl8821ae: Remove declaration assignment to zero

We set btrssi to zero and then immediately assign it. Assign it
on declaration instead.

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Fix halbtc8192e2ant.c 'defined but not used' sparse warnings
Mark Einon [Sat, 19 Apr 2014 14:35:45 +0000 (15:35 +0100)]
staging: rtl8821ae: Fix halbtc8192e2ant.c 'defined but not used' sparse warnings

Sparse complains about halbtc8192e2ant_low_penalty_ra() not being used,
and subsequently halbtc8192e2ant_set_sw_penalty_tx_rateadaptive() when
this is removed. remove both functions.

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Fix halbtc8192e2ant.c 'should it be static?' sparse warnings
Mark Einon [Sat, 19 Apr 2014 14:35:44 +0000 (15:35 +0100)]
staging: rtl8821ae: Fix halbtc8192e2ant.c 'should it be static?' sparse warnings

In halbtc8192e2ant.c, fix all instances of the sparse warning:

warning: symbol 'xxx' was not declared. Should it be static?

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Remove unused functions
Mark Einon [Sat, 19 Apr 2014 14:35:43 +0000 (15:35 +0100)]
staging: rtl8821ae: Remove unused functions

Remove functions not being called from anywhere:

halbtc8192e2ant_set_adc_backoff()
halbtc8192e2ant_adc_backoff()

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Remove file #if 1
Mark Einon [Sat, 19 Apr 2014 14:35:42 +0000 (15:35 +0100)]
staging: rtl8821ae: Remove file #if 1

All code in this file is encapsulated in a useless #if 1
declaration, remove it.

Signed-off-by: Mark Einon <mark@einon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8192e: Fix declaration of symbols
Joel Pelaez Jorge [Sun, 20 Apr 2014 03:32:32 +0000 (22:32 -0500)]
Staging: rtl8192e: Fix declaration of symbols

The two declarations with issues in rtl_wx.h:

  * function: struct iw_statistics *r8192_get_wireless_stats();
  * variable: extern struct iw_handler_def r8192_wx_handlers_def;

The symbol 'r8192_get_wireless_stats' is declared as 'extern'
but it is only used in the local scope. The declaration is deleted
of rtl_wx.h, fixing the conflict with the 'extern' and 'static' scope.

The symbol 'r8192_wx_handlers_def' was fixed of some issues related
to variable declaration marked as 'extern' implicitly,
causing this sparse warning:

drivers/staging/rtl8192e/rtl8192e/rtl_wx.c:1323:24: warning: symbol
'r8192_wx_handlers_def' was not declared. Should it be static?

Resolved incluing the fixed header to rtl_wx.c

Also, isn't declared as constant variable, so it declared as such.
And delete unnecessary cast in rtl_core.c.

Signed-off-by: Joel Pelaez Jorge <joelpelaez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging:rtl8192e:rtl819x_BAProc:Remove whitespaces
Paul McQuade [Wed, 9 Apr 2014 20:01:29 +0000 (21:01 +0100)]
Staging:rtl8192e:rtl819x_BAProc:Remove whitespaces

ERROR: spaces required around that '=' (ctx:OxW)

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8188eu: overflow in update_sta_support_rate()
Dan Carpenter [Mon, 7 Apr 2014 06:31:21 +0000 (09:31 +0300)]
Staging: rtl8188eu: overflow in update_sta_support_rate()

The ->SupportedRates[] array has NDIS_802_11_LENGTH_RATES_EX (16)
elements.  Since "ie_len" comes from then network and can go up to 255
then it means we should add a range check to prevent memory corruption.

Fixes: d6846af679e0 ('staging: r8188eu: Add files for new driver - part 7')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8192u: Fix indentation problems
Loïc Pellegrino [Sun, 6 Apr 2014 13:03:39 +0000 (14:03 +0100)]
staging: rtl8192u: Fix indentation problems

Fix coding style problems (incorrect indentation).

Signed-off-by: Loïc Pellegrino <oort10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging rtl8188eu: add a blank line after declarations
huanqi chi [Sat, 5 Apr 2014 05:53:27 +0000 (13:53 +0800)]
staging rtl8188eu: add a blank line after declarations

fix a coding style issue: Missing a blank line after declarations

Signed-off-by: huanqi chi <chihuanqi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: silicom: remove redundant pci_get_drvdata() call
Daeseok Youn [Wed, 23 Apr 2014 08:18:42 +0000 (17:18 +0900)]
staging: silicom: remove redundant pci_get_drvdata() call

The pci_get_drvdata() and checking NULL for dev are
called twice in while loop in is_bypass_dev().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: silicom: fix dangerous if condition in bpctl_mod.c
Neil Armstrong [Tue, 1 Apr 2014 13:03:44 +0000 (15:03 +0200)]
Staging: silicom: fix dangerous if condition in bpctl_mod.c

checkpatch script returns the following warning:
ERROR: do not use assignment in if condition
+                       if (((dev_num = get_dev_idx(dev->ifindex)) ==
            -1) |

This patch fixes the if condition by splitting it.

Signed-off-by: Neil Armstrong <superna9999@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: silicom: remove BP_PROC_SUPPORT dependant code
SeongJae Park [Wed, 26 Mar 2014 14:24:06 +0000 (23:24 +0900)]
staging: silicom: remove BP_PROC_SUPPORT dependant code

Some code is hide inside #ifdef BP_PROC_SUPPORT and it never defined
anywhere. And, it made defined but not used function which calling
code was hide inside #ifdef BP_PROC_SUPPORT and caused following
build warning:

drivers/staging/silicom/bpctl_mod.c:6786:12: warning:
‘bp_proc_create’ defined but not used [-Wunused-function]
 static int bp_proc_create(void)
            ^

Fix the warning and remove code complexity by remove whole code
inside #ifdef BP_PROC_SUPPORT.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: unisys: virthba: add MODULE_DEVICE_TABLE
Ken Cox [Thu, 24 Apr 2014 18:57:11 +0000 (13:57 -0500)]
Staging: unisys: virthba: add MODULE_DEVICE_TABLE

Add x86_cpu_id struct and call to MODULE_DEVICE_TABLE so this module
will be auto loaded on boot.

Signed-off-by: Ken Cox <jkc@redhat.com>
Tested-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: fix copyright notices
Benjamin Romer [Wed, 23 Apr 2014 18:58:34 +0000 (14:58 -0400)]
staging: unisys: fix copyright notices

This patch changes all of the various representations of the copyright symbol
to (C).

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: Fix typo in comment and printk
Masanari Iida [Mon, 14 Apr 2014 16:56:33 +0000 (01:56 +0900)]
staging: unisys: Fix typo in comment and printk

Fix spelling typo in comments and printk within unisys.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: Fix format string mismatch in virthba.c
Masanari Iida [Mon, 14 Apr 2014 16:56:32 +0000 (01:56 +0900)]
staging: unisys: Fix format string mismatch in virthba.c

Fix format string mismatch in info_proc_read() within virthba.c.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: keucr: fix sparse warning
Rui Miguel Silva [Sat, 12 Apr 2014 00:33:11 +0000 (01:33 +0100)]
staging: keucr: fix sparse warning

fix sparse warning:
drivers/staging/keucr/smilmain.c:163:5: warning: symbol 'Check_D_MediaFmt' was not declared. Should it be static?

by declaring it in the right header. And remove duplication of definition of
SM_INIT

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: keucr: Fix warning about missing blank lines after declarations
Jonas Hahnfeld [Wed, 26 Mar 2014 19:56:53 +0000 (20:56 +0100)]
staging: keucr: Fix warning about missing blank lines after declarations

This patches fixes two warnings of checkpatch.pl, both of the type
WARNING: Missing a blank line after declarations

Signed-off-by: Jonas Hahnfeld <hahnjo@hahnjo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: android: ion: duplicated clearing of sg_table
Gioh Kim [Thu, 24 Apr 2014 23:24:24 +0000 (08:24 +0900)]
Staging: android: ion: duplicated clearing of sg_table

Because sg_table is cleared in sg_alloc_table via memset we don't need to use
kzalloc to allocate sg_table.

Signed-off-by: Gioh Kim <gioh.kim@lge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/android: Remove ram_console.h
Bintian Wang [Tue, 22 Apr 2014 09:22:58 +0000 (17:22 +0800)]
staging/android: Remove ram_console.h

ram_console is replaced by pstore and pstore_ram drivers,
and there is no code to use this head file, so remove it.

Signed-off-by: Bintian Wang <bintian.wang@huawei.com>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: gfp_mask should be of gfp_t type
Fabio Falzoi [Fri, 25 Apr 2014 09:41:43 +0000 (11:41 +0200)]
Staging: lustre: gfp_mask should be of gfp_t type

Fixed the following sparse complaints:

drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1039:61:
warning: restricted gfp_t degrades to integer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1092:61:
warning: restricted gfp_t degrades to integer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1136:58:
warning: incorrect type in argument 2 (different base types)
expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_mask
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1142:34:
warning: incorrect type in argument 3 (different base types)
expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_mask
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1147:58:
warning: incorrect type in argument 2 (different base types)
expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_mask
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1153:34:
warning: incorrect type in argument 3 (different base types)
expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_mask

Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: ops structs should be declared static
Fabio Falzoi [Fri, 25 Apr 2014 09:41:42 +0000 (11:41 +0200)]
Staging: lustre: ops structs should be declared static

Fixed the following sparse complaints:

drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:549:22:
warning: symbol 'ldlm_srv_pool_ops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:555:22:
warning: symbol 'ldlm_cli_pool_ops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:681:1:
warning: symbol 'lprocfs_pool_state_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:697:1:
warning: symbol 'lprocfs_grant_plan_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:700:1:
warning: symbol 'lprocfs_wr_recalc_period' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:708:1:
warning: symbol 'lprocfs_recalc_period_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:710:1:
warning: symbol 'ldlm_pool_u64_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:711:1:
warning: symbol 'ldlm_pool_atomic_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:712:1:
warning: symbol 'ldlm_pool_rw_atomic_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:714:1:
warning: symbol 'lprocfs_grant_speed_fops' was not declared. Should it be static?

Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: Avoid using 0 instead of NULL
Fabio Falzoi [Fri, 25 Apr 2014 09:41:41 +0000 (11:41 +0200)]
Staging: lustre: Avoid using 0 instead of NULL

Fixed the following sparse complaints:

drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:755:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:757:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:758:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:759:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:760:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:762:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:764:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:765:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:766:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:768:9:
warning: Using plain integer as NULL pointer

Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: improve length checks in ioctls
Dan Carpenter [Thu, 24 Apr 2014 21:49:13 +0000 (00:49 +0300)]
staging: lustre: improve length checks in ioctls

We copy "hdr->ioc_len" from the user twice but we only verify that it's
within the limit on the first copy.  Otherwise we could read unmapped
memory and Oops.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging:lustre: use gfp_t instead of int
Vitaly Osipov [Tue, 22 Apr 2014 13:25:21 +0000 (23:25 +1000)]
staging:lustre: use gfp_t instead of int

Fixed several sparse "warning: incorrect type" by replacing int
declarations with gfp_t

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: rename check_channel_list()
H Hartley Sweeten [Wed, 23 Apr 2014 23:07:01 +0000 (16:07 -0700)]
staging: comedi: adv_pci1710: rename check_channel_list()

For aesthetics, rename this function so it has namespace associated
with the driver.

Also, change it's parameters. The cmd->chanlist and cmd->chanlist_len
are always passed, just pass the comedi_cmd pointer instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: remove 'ai_do' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:07:00 +0000 (16:07 -0700)]
staging: comedi: adv_pci1710: remove 'ai_do' from private data

This member of the private data is set to the "mode" that the ai command
is operating in but nothing uses it. 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: adv_pci1710: absorb pci171x_ai_docmd_and_mode()
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:59 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: absorb pci171x_ai_docmd_and_mode()

This helper function is called by the ai (*do_cmd) to setup and
start the async command based on the "mode" of operation. This
"mode" is determined by the cmd convert_src and start_src.

Move this "mode" determination and combine the functions.

Signed-off-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: adv_pci1710: cmd->scan_begin_src can only be TRIG_FOLLOW
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:58 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: cmd->scan_begin_src can only be TRIG_FOLLOW

In Step 1 of the (*do_cmdtest), the cmd->scan_begin_src is checked to
only allow TRIG_FOLLOW. The (*do_cmd) does not need to recheck 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: adv_pci1710: remove 'ai_data_len' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:57 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: remove 'ai_data_len' from private data

This member of the private data is just a copy of the s->async->prealloc_bufsz.
Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: remove 'ai_scans' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:56 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: remove 'ai_scans' from private data

This member of the private data is just a copy of the cmd->stop_arg.
Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: remove 'ai_n_chan' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:55 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: remove 'ai_n_chan' from private data

This member of the private data is just a copy of the cmd->chanlist_len.
Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: remove 'ai_chanlist' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:54 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: remove 'ai_chanlist' from private data

This member of the private data is just a copy of the cmd->chanlist.
Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: remove 'ai_flags' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:53 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: remove 'ai_flags' from private data

This member of the private data is just a copy of the cmd->flags. Use
that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: remove 'ai_timer1' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:52 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: remove 'ai_timer1' from private data

This member of the private data is just a copy of the cmd->convert_arg.
Use that instead and remove the unnecessary sanity checking since it
was already validated in the (*do_cmdtest).

Signed-off-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: adv_pci1710: remove 'ai_timer2' from private data
H Hartley Sweeten [Wed, 23 Apr 2014 23:06:51 +0000 (16:06 -0700)]
staging: comedi: adv_pci1710: remove 'ai_timer2' from private data

This member of the private data is set to 0 but it is 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: addi_apci_1564: board does not have analog outputs
Chase Southwood [Fri, 25 Apr 2014 08:18:10 +0000 (03:18 -0500)]
staging: comedi: addi_apci_1564: board does not have analog outputs

The board supported by this driver does not have analog outputs.  Remove
the subdevice init for it.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-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_1564: board does not have analog inputs
Chase Southwood [Fri, 25 Apr 2014 08:17:06 +0000 (03:17 -0500)]
staging: comedi: addi_apci_1564: board does not have analog inputs

This board does not have analog inputs.  Remove the subdevice init for
them.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-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_1564: separate from addi_common.c
Chase Southwood [Thu, 24 Apr 2014 07:19:01 +0000 (02:19 -0500)]
staging: comedi: addi_apci_1564: separate from addi_common.c

Using the addi-data "common" code in addi_apci_1564 introduces a lot of
bloat.  By separating this driver off from addi_common.c, a lot of the
common code can be stripped out.  This patch copies the code over from
addi_common.c, and removes the #include of the file.  The auto_attach
function from the common code replaces the one that was previously in this
driver, though renamed to that it stays within the namespace associated
with this driver, and the detach function has been renamed for this reason
as well.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-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: only calc the pacer divisors once
H Hartley Sweeten [Wed, 23 Apr 2014 22:57:19 +0000 (15:57 -0700)]
staging: comedi: amplc_pci224: only calc the pacer divisors once

When the cmd->scan_begin_src == TRIG_TIMER the divisors needed to
generate the pacer time are calculated in the (*do_cmdtest) to
validate the cmd->scan_begin_arg. The core always does the
(*do_cmdtest) before the (*do_cmd) so there is no reason to recalc
the divisors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci224: always cascade the 8254 timers
H Hartley Sweeten [Wed, 23 Apr 2014 22:57:18 +0000 (15:57 -0700)]
staging: comedi: amplc_pci224: always cascade the 8254 timers

The 8254 timers are only used in this driver to generate the analog
output pacer. To simplify the driver, always cascade the timers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci224: factor out the 'start pacer' code
H Hartley Sweeten [Wed, 23 Apr 2014 22:57:17 +0000 (15:57 -0700)]
staging: comedi: amplc_pci224: factor out the 'start pacer' code

To clarify the analog output (*do_cmd) function, factor out the
code that starts the pacer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci224: remove pci224_cascade_ns_to_timer()
H Hartley Sweeten [Wed, 23 Apr 2014 22:57:16 +0000 (15:57 -0700)]
staging: comedi: amplc_pci224: remove pci224_cascade_ns_to_timer()

This function is just a wrapper around i8253_cascade_ns_to_timer().
Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1564: tidy up apci1564_reset()
Chase Southwood [Thu, 17 Apr 2014 06:33:03 +0000 (01:33 -0500)]
staging: comedi: addi_apci_1564: tidy up apci1564_reset()

The reset function for this driver is a bit of a mess; clean it up to
ensure that it is functioning properly.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: me4000: remove unnecessary Step 2b test in (*do_cmdtest)
H Hartley Sweeten [Wed, 23 Apr 2014 22:52:32 +0000 (15:52 -0700)]
staging: comedi: me4000: remove unnecessary Step 2b test in (*do_cmdtest)

This test is unnecessary. It covers all the possible combinations of the
scan_end_src and stop_src triggers so the final else can never be reached.

Signed-off-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_pcidas64: remove unnecessary Step 2b test in (*do_cmdtest)
H Hartley Sweeten [Wed, 23 Apr 2014 22:52:31 +0000 (15:52 -0700)]
staging: comedi: cb_pcidas64: remove unnecessary Step 2b test in (*do_cmdtest)

This test is unnecessary. The cfc_check_trigger_src() in Step 1 ensures that
the trigger source is one of these values and Step 2 makes sure it's only one
of these values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9111: clarify Step 2b of the (*do_cmdtest)
H Hartley Sweeten [Wed, 23 Apr 2014 22:52:30 +0000 (15:52 -0700)]
staging: comedi: adl_pci9111: clarify Step 2b of the (*do_cmdtest)

This step of the (*do_cmdtest) verifies that the selected trigger sources
are mutually compatible.

For this driver the scan_begin_src must be TRIG_FOLLOW or the same source
as the convert_src.

Simplify the logic 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 agodrivers/staging: Use RCU_INIT_POINTER(x, NULL) in fwserial/fwserial.c
Monam Agarwal [Sun, 23 Mar 2014 18:38:22 +0000 (00:08 +0530)]
drivers/staging: Use RCU_INIT_POINTER(x, NULL) in fwserial/fwserial.c

This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL)

The rcu_assign_pointer() ensures that the initialization of a structure
is carried out before storing a pointer to that structure.
And in the case of the NULL pointer, there is no structure to initialize.
So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL)

Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agofwserial: (coding style) removing FSF postal address
Dominique van den Broeck [Sat, 12 Apr 2014 13:18:15 +0000 (15:18 +0200)]
fwserial: (coding style) removing FSF postal address

Style-only modifications to make checkpatch.pl --file --strict a bit happier.
Removing FSF postal address from file top comment since it has changed in the
past, as stated by checkpatch.pl.

Signed-off-by: Dominique van den Broeck <domdevlin@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agofwserial: (coding style) useless "extern" & space
Dominique van den Broeck [Sat, 12 Apr 2014 13:18:14 +0000 (15:18 +0200)]
fwserial: (coding style) useless "extern" & space

Style-only modifications to make checkpatch.pl --file --strict a bit happier.
Removed useless "extern" in dma_fifo.h ;
Removed one supernumerary space.

Signed-off-by: Dominique van den Broeck <domdevlin@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agofwserial: (coding style) if/else bracket matching
Dominique van den Broeck [Sat, 12 Apr 2014 13:18:13 +0000 (15:18 +0200)]
fwserial: (coding style) if/else bracket matching

Style-only modifications to make checkpatch.pl --file --strict a bit happier.
if/else bracket matching (either none or both options should be bracketed).

Signed-off-by: Dominique van den Broeck <domdevlin@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agofwserial: (coding style) open parenthesis alignments
Dominique van den Broeck [Sat, 12 Apr 2014 13:18:12 +0000 (15:18 +0200)]
fwserial: (coding style) open parenthesis alignments

Style-only modifications to make checkpatch.pl --file --strict a bit happier.
Open parenthesis alignments.

Signed-off-by: Dominique van den Broeck <domdevlin@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: remove sbe-2t3e3 driver.
Greg Kroah-Hartman [Fri, 25 Apr 2014 20:59:57 +0000 (13:59 -0700)]
staging: remove sbe-2t3e3 driver.

It never really got cleaned up properly, and no one is working on it, so
remove it.  If someone wants to pick it up, this can be easily reverted.

Cc: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_mio_common: clarify the cmd->start_arg validation and use
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:11 +0000 (10:08 -0700)]
staging: comedi: ni_mio_common: clarify the cmd->start_arg validation and use

Clarify the cmd->start_arg validation in Step 3 of the (*do_cmdtest)
functions.

For a TRIG_INT source, the cmd->start_arg is actually the valid
trig_num that is used by the async (*inttrig) callbacks.

Refactor the (*inttrig) functions so that the cmd->start_arg is used
to check the trig_num instead of the open coded values.

For aesthetics, refactor the (*do_cmd) functions to use if/else instead
of the switch to handle the cmd->start_src.

Signed-off-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: fix the cmd->start_arg use
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:10 +0000 (10:08 -0700)]
staging: comedi: usbdux: fix the cmd->start_arg use

For all cmd->start_src values this driver trivially validates that the
cmd->start_arg is 0.

For a TRIG_INT source, the cmd->start_arg is actually the valid trig_num
that is used by the async (*inttrig) callback.

Refactor the (*inttrig) functions so that the cmd->start_arg is used to
check the trig_num instead of the open coded values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxfast: fix the cmd->start_arg validation and use
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:09 +0000 (10:08 -0700)]
staging: comedi: usbduxfast: fix the cmd->start_arg validation and use

This driver supports cmd->start_src values of TRIG_NOW, TRIG_EXT, and
TRIG_INT. Currently the cmd->start_arg is only validated for TRIG_NOW.

For TRIG_EXT sources, the cmd->start_src is driver specific. For a
TRIG_INT source, the cmd->start_arg is actually the valid trig_num
that is used by the async (*inttrig) callback.

The cmd->start_arg is currently not use in the driver. Just trivially
validate it to be 0 for all cmd->start_src values.

Refactor the (*inttrig) function so that the cmd->start_arg is used
to check the trig_num instead of the open coded value.

For aesthetics, remove some unnecessary comments in the (*do_cmd)
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: usbduxsigma: fix the ai/ao cmd->start_arg use for TRIG_INT
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:08 +0000 (10:08 -0700)]
staging: comedi: usbduxsigma: fix the ai/ao cmd->start_arg use for TRIG_INT

For both ai and ao commands this driver supports a cmd->start_src of
TRIG_NOW or TRIG_INT. The cmd->start_arg is trivially validated for
both sources to be 0.

For a TRIG_INT source, the cmd->start_arg is actually the valid
trig_num that is used by the async (*inttrig) callback.

Refactor the (*inttrig) functions so that the cmd->start_arg is used
to check the trig_num instead of the open coded values.

For aesthetics, remove some unnecessary comments in the (*do_cmd)
functions.

Signed-off-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 the cmd->start_arg validation and use
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:07 +0000 (10:08 -0700)]
staging: comedi: s626: clarify the cmd->start_arg validation and use

This driver supports a cmd->start_src of TRIG_NOW, TRIG_INT or TRIG_EXT.

Clarify the cmd->start_arg validation in Step 3 of the (*do_cmdtest).

For a TRIG_INT source, the cmd->start_arg is actually the valid
trig_num that is used by the async (*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used
to check the trig_num instead of the open coded 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>
10 years agostaging: comedi: pcmuio: fix the cmd->start_arg use for TRIG_INT
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:06 +0000 (10:08 -0700)]
staging: comedi: pcmuio: fix the cmd->start_arg use for TRIG_INT

This driver supports a cmd->start_src of TRIG_NOW or TRIG_INT. The
cmd->start_arg is trivially validated for both sources to be 0.

For a TRIG_INT source, the cmd->start_arg is actually the valid
trig_num that is used by the async (*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used
to check the trig_num instead of the open coded value.

For aesthetics, refactor the (*do_cmd) to use if/else instead if the
switch when handling the cmd->start_src.

Signed-off-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: fix the cmd->start_arg use for TRIG_INT
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:05 +0000 (10:08 -0700)]
staging: comedi: pcmmio: fix the cmd->start_arg use for TRIG_INT

This driver supports a cmd->start_src of TRIG_NOW or TRIG_INT. The
cmd->start_arg is trivially validated for both sources to be 0.

For a TRIG_INT source, the cmd->start_arg is actually the valid
trig_num that is used by the async (*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used
to check the trig_num instead of the open coded value.

For aesthetics, refactor the (*do_cmd) to use if/else instead if the
switch when handling the cmd->start_src.

Signed-off-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_labpc: clarify the cmd->start_arg validation
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:04 +0000 (10:08 -0700)]
staging: comedi: ni_labpc: clarify the cmd->start_arg validation

This driver supports cmd->start_src sources of TRIG_NOW and TRIG_EXT.
Refactor the (*do_cmdtest) to clarify the trivial validation of the
cmd->start_arg.

This also fixes a bug, the cmd->start_src has the trigger not the
cmd->start_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: ni_tiocmd: clarify the cmd->start_arg validation and use
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:03 +0000 (10:08 -0700)]
staging: comedi: ni_tiocmd: clarify the cmd->start_arg validation and use

This driver supportes cmd->start_src sources of TRIG_NOW, TRIG_INT, TRIG_OTHER,
and TRIG_EXT. Refactor the (*do_cmdtest) to clarify the trivial validation of
the cmd->start_arg. For a TRIG_INT source, the cmd->start_arg is actually the
valid trig_num that is passed to the async (*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used to check
the trig_num instead of the open coded 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>
10 years agostaging: comedi: ni_pcidio: fix the cmd->start_arg use for TRIG_INT
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:02 +0000 (10:08 -0700)]
staging: comedi: ni_pcidio: fix the cmd->start_arg use for TRIG_INT

This driver only a cmd->start_src of TRIG_NOW or TRIG_INT. The cmd->start_arg
is trivially validated for both sources to be 0. For a TRIG_INT source, the
cmd->start_arg is actually the valid trig_num that is passed to the async
(*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used to check
the trig_num instead of the open coded 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>
10 years agostaging: comedi: me4000: validate the cmd->start_arg
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:01 +0000 (10:08 -0700)]
staging: comedi: me4000: validate the cmd->start_arg

The cmd->start_arg should be trivially validated in Step 3 of the
(*do_cmdtest) functions. Add the necessary 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: gsc_hpdi: validate the cmd->start_arg
H Hartley Sweeten [Thu, 17 Apr 2014 17:08:00 +0000 (10:08 -0700)]
staging: comedi: gsc_hpdi: validate the cmd->start_arg

The cmd->start_arg should be trivially validated in Step 3 of the
(*do_cmdtest) functions. Add the necessary 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: dt282x: fix the ao cmd->start_arg use for TRIG_INT
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:59 +0000 (10:07 -0700)]
staging: comedi: dt282x: fix the ao cmd->start_arg use for TRIG_INT

This driver only supports a cmd->start_src of TRIG_INT for ao commands. The
cmd->start_arg is trivially validated to be 0. For TRIG_INT source, the
cmd->start_arg is actually the valid trig_num that is passed to the async
(*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used to check
the trig_num instead of the open coded 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>
10 years agostaging: comedi: cb_pcidas64: validate the ai/ao cmd->start_arg
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:58 +0000 (10:07 -0700)]
staging: comedi: cb_pcidas64: validate the ai/ao cmd->start_arg

The cmd->start_arg should be trivially validated in Step 3 of the
(*do_cmdtest) functions. Add the necessary code.

For the analog output, a cmd->start_src of TRIG_NOW and TRIG_INT is
supported. For both sources the cmd->start_arg is validated to be 0.
For a TRIG_INT source, the cmd->start_Arg is actually the valid trig_num
that is passed to the async (*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used to
check the trig_num instead of the open coded 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>
10 years agostaging: comedi: cb_pcidas: fix the ao cmd->start_arg use for TRIG_INT
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:57 +0000 (10:07 -0700)]
staging: comedi: cb_pcidas: fix the ao cmd->start_arg use for TRIG_INT

This driver only supports a cmd->start_src of TRIG_INT for ai commands. The
cmd->start_arg is trivially validated to be 0. For TRIG_INT source, the
cmd->start_arg is actually the valid trig_num that is passed to the async
(*inttrig) callback.

Refactor the (*inttrig) function so that the cmd->start_arg is used to check
the trig_num instead of the open coded 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>
10 years agostaging: comedi: cb_pcidas: clarify the ai cmd->start_arg validation
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:56 +0000 (10:07 -0700)]
staging: comedi: cb_pcidas: clarify the ai cmd->start_arg validation

This driver supports two cmd->start_src values, TRIG_NOW and TRIG_EXT.

For aesthetics, replace the default case when validating the cmd->start_arg
with the proper case statement.

Signed-off-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: fix the ai/ao cmd->start_arg use for TRIG_INT
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:55 +0000 (10:07 -0700)]
staging: comedi: amplc_pci230: fix the ai/ao cmd->start_arg use for TRIG_INT

This driver trivially validates the cmd->start_arg for all cmd->start_src values
to be 0. For TRIG_INT source, the cmd->start_arg is actually the valid trig_num
that is passed to the async (*inttrig) callback.

Refactor the (*inttrig) functions so that the cmd->start_arg is used to check the
trig_num instead of the open coded values.

For aesthetics, refactor the ai (*do_cmd) to remove some unnecessary {}.

Signed-off-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: fix the ao cmd->start_arg use
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:54 +0000 (10:07 -0700)]
staging: comedi: amplc_pci224: fix the ao cmd->start_arg use

This driver supports two cmd->start_src values, TRIG_INT and TRIG_EXT. For
TRIG_INT sources, the cmd->start_arg is actually the valid trig_num that is
passed to the async (*inttrig) callback. This driver trivially validates the
arg for this source to be 0.

Refactor the (*inttrig) so that the cmd->start_arg is used to check the trig_num
instead of the open coded value.

For aesthetics, refactor the (*do_cmd) to use if/else instead of the switch when
handling the cmd->start_src. All code paths do the spin lock/unlock so move those
out of the if/else.

Signed-off-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: fix the cmd->start_arg use
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:53 +0000 (10:07 -0700)]
staging: comedi: amplc_dio200_common: fix the cmd->start_arg use

This driver supports two cmd->start_src values, TRIG_NOW and TRIG_INT. TRIG_NOW
sources should always have an arg of 0. For TRIG_INT sources, the cmd->start_arg
is actually the valid trig_num that is passed to the async (*inttrig) callback.
This driver trivially validates the arg for both sources to be 0.

Refactor the (*inttrig) so that the cmd->start_arg is used to check the trig_num
instead of the open coded value.

For aesthetics, refactor the (*do_cmd) to use if/else instead of the switch when
handling the cmd->start_src.

Signed-off-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 the ai cmd->start_arg validation and use
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:52 +0000 (10:07 -0700)]
staging: comedi: adl_pci9118: fix the ai cmd->start_arg validation and use

This driver supports three cmd->start_src values, TRIG_NOW, TRIG_EXT, and
TRIG_INT. TRIG_NOW sources should always have an arg of 0 and arg for TRIG_EXT
sources is driver specific. This driver does not use the cmd->start_arg with
the TRIG_EXT source so a trivial value of 0 is good.

When the cmd->start_src is TRIG_INT the cmd->start_arg is actually the valid
trig_num that is passed to the async (*inttrig) callback. This driver allows
any value to be used and currently carries that value in the private data.

Refactor the (*do_cmdtest) so that the trivial validation of the cmd->start_arg
is clear.

Refactor the (*inttrig) so that the cmd->start_arg is used directly to check
the trig_num and remove the then unused 'ai_inttrig_start' member 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: hwdrv_apci3200: properly validata the ai cmd->start_arg
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:51 +0000 (10:07 -0700)]
staging: comedi: hwdrv_apci3200: properly validata the ai cmd->start_arg

The async command 'arguments' should be trivially validated in Step 3 of
the (*do_cmdtest) not Step 2b. Move the validataion in this driver to the
proper place.

This driver supports two cmd->start_src values, TRIG_NOW and TRIG_EXT.
TRIG_NOW sources should always have an arg of 0. The arg for TRIG_EXT
sources is driver specific.

Properly validate the cmd->start_arg based on the cmd->start_src. Remove
the noise when the arg is invalid and modify the cmd->start_arg so that
a valid value is returned to the user.

Signed-off-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: comedi_test: ao subdevice does not support async commands
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:50 +0000 (10:07 -0700)]
staging: comedi: comedi_test: ao subdevice does not support async commands

The comedi_subdevices array is kzalloc()'d so the async command callbacks do
not need to be set to NULL when the analog output subdevice is initialized.

Also, remove the initialzation of the subdevice 'len_chanlist' since this
value is only used by the async commands. The core will default it to 1.

Signed-off-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_pci9111: rename local var in pci9111_ai_do_cmd_test()
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:49 +0000 (10:07 -0700)]
staging: comedi: adl_pci9111: rename local var in pci9111_ai_do_cmd_test()

For aesthetics, rename the local variable 'error' to 'err'. This is the
normal name for this local variable in (*do_cmdtest) functions.

Signed-off-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_3xxx: fix ai subdevice 'len_chanlist'
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:48 +0000 (10:07 -0700)]
staging: comedi: addi_apci_3xxx: fix ai subdevice 'len_chanlist'

Due to a driver limitation, the (*do_cmdtest) for the analog input subdevice
overrides the cmd->chanlist_len to force single channel chanlists. But, the
cmd->scan_end_arg was already validated before this happens. Instead of
fixing the (*do_cmdtest) just set the subdevice len_chanlist to 1 to limit
the chanlist size. Move the comment 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: drivers: properly validate cmd->scan_end_arg
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:47 +0000 (10:07 -0700)]
staging: comedi: drivers: properly validate cmd->scan_end_arg

When the async command 'scan_end_src' is TRIG_COUNT the 'scan_end_arg'
is the cmd->chanlist_len. Fix a couple open-coded drivers. Add the
check to the drivers that do not validate this command argument.

The core validates that the cmd->chanlist_len is <= s->len_chanlist.
During the post config after the attach the core also make sure that
the s->len_chanlist is initialized. For clarity, initialize the
s->len_chanlist in a couple drivers that are relying on the core to
initialize it to '1'.

Signed-off-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: drivers: core validates chanlist_len max
H Hartley Sweeten [Thu, 17 Apr 2014 17:07:46 +0000 (10:07 -0700)]
staging: comedi: drivers: core validates chanlist_len max

The comedi core checks if the (cmd->chanlist_len > s->len_chanlist) when the
comedi_cmd is copied from user to kernel space by __comedi_get_user_cmd().
If so, the core returns -EINVAL and will not call the subdevice (*do_cmdtest)
and (*do_cmd).

Remove the unnecessary "max" checks in the comedi driver (*do_cmdtest) and
helper functions.

Signed-off-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_labpc: tidy up the chanlist checking
H Hartley Sweeten [Wed, 16 Apr 2014 21:19:21 +0000 (14:19 -0700)]
staging: comedi: ni_labpc: tidy up the chanlist checking

The labpc_ai_chanlist_invalid() function validates that the cmd->chanlist
is compatible with the hardware. This is step 5 of the (*do_cmdtest).

For aesthetics, rename this function and tidy up the code.

To minimize the noise, change the comedi_error(), which is a wrapper around
dev_err(), to dev_dbg().

Signed-off-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: tidy up the chanlist checking
H Hartley Sweeten [Wed, 16 Apr 2014 21:19:20 +0000 (14:19 -0700)]
staging: comedi: me4000: tidy up the chanlist checking

The ai_check_chanlist() function validates that the cmd->chanlist is compatible
with the hardware. This is step 5 of the (*do_cmdtest).

For aesthetics, rename this function so it has namespace associated with the
driver and tidy up the code.

To minimize the noise, change the dev_err() to dev_dbg().

Signed-off-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_mio_common: factor out chanlist checking from (*do_cmdtest)
H Hartley Sweeten [Wed, 16 Apr 2014 21:19:19 +0000 (14:19 -0700)]
staging: comedi: ni_mio_common: factor out chanlist checking from (*do_cmdtest)

Step 5 of the (*do_cmdtest) validates that the cmd->chanlist is compatible
with the hardware.

Remove the unnecessary step 5 code in the analog output async command support.

For aesthetics, factor out the step 5 code for the "cdio" async command support.
Tidy up the factored out 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_at_a2150: factor out chanlist checking from (*do_cmdtest)
H Hartley Sweeten [Wed, 16 Apr 2014 21:19:18 +0000 (14:19 -0700)]
staging: comedi: ni_at_a2150: factor out chanlist checking from (*do_cmdtest)

Step 5 of the (*do_cmdtest) validates that the cmd->chanlist is compatible
with the hardware.

For aesthetics, factor out the step 5 code for the analog input async command
support. Tidy up the factored out code.

To minimize the noise, change the comedi_error(), which is a wrapper around
dev_err(), to dev_dbg().

Signed-off-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: gsc_hpdi: factor out chanlist checking from (*do_cmdtest)
H Hartley Sweeten [Wed, 16 Apr 2014 21:19:17 +0000 (14:19 -0700)]
staging: comedi: gsc_hpdi: factor out chanlist checking from (*do_cmdtest)

Step 5 of the (*do_cmdtest) validates that the cmd->chanlist is compatible
with the hardware.

For aesthetics, factor out the step 5 code for the async command support. Tidy
up the factored out code.

To minimize the noise, change the dev_err() to dev_dbg().

Signed-off-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: dmm32at: factor out chanlist checking from (*do_cmdtest)
H Hartley Sweeten [Wed, 16 Apr 2014 21:19:16 +0000 (14:19 -0700)]
staging: comedi: dmm32at: factor out chanlist checking from (*do_cmdtest)

Step 5 of the (*do_cmdtest) validates that the cmd->chanlist is compatible
with the hardware.

For aesthetics, factor out the step 5 code for the analog input async command
support. Tidy up the factored out code.

To minimize the noise, change the comedi_error(), which is a wrapper around
dev_err(), to dev_dbg().

Signed-off-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: das800: factor out chanlist checking from (*do_cmdtest)
H Hartley Sweeten [Wed, 16 Apr 2014 21:19:15 +0000 (14:19 -0700)]
staging: comedi: das800: factor out chanlist checking from (*do_cmdtest)

Step 5 of the (*do_cmdtest) validates that the cmd->chanlist is compatible
with the hardware.

For aesthetics, factor out the step 5 code for the analog input async command
support. Tidy up the factored out code.

To minimize the noise, change the dev_err() to dev_dbg().

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