GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
9 years agostaging: comedi: das16: introduce das16_ai_range()
H Hartley Sweeten [Mon, 26 Jan 2015 23:17:16 +0000 (16:17 -0700)]
staging: comedi: das16: introduce das16_ai_range()

Clarify the (*attach) a bit by introducing a helper function to handle the
setup of the analog input 'range_table'.

Some of the boards supported by this driver do not have programmable ranges.
The analog input subdevice can use optional range information provided by
the user during the attach of the driver. Currently this range data is
allocated and stored in the private data.

Use the subdevice private data member instead and allocate the memory with
comedi_alloc_spriv(). The comedi core will automatically free this memory
when the driver is detached. If the allocation fails set the 'range_table'
to 'range_unknown' instead of failing the driver attach.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: das16: absorb das16_ai_disable()
H Hartley Sweeten [Mon, 26 Jan 2015 23:17:15 +0000 (16:17 -0700)]
staging: comedi: das16: absorb das16_ai_disable()

This function is only called by das16_cancel(). Absorb it to clarify 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>
9 years agostaging: comedi: das16: remove unnecessary das16_ai_disable()
H Hartley Sweeten [Mon, 26 Jan 2015 23:17:14 +0000 (16:17 -0700)]
staging: comedi: das16: remove unnecessary das16_ai_disable()

The das16_ai_disable() function disables interrupts and the pacer clock. This
function is called by the subdevice (*cancel) operation.

The comedi core will not call a subdevice (*insn_read) operation while an
async command is running due to the s->busy check in parse_insn(). Since all
async commands are terminated by a (*cancel), the das16_ai_disable() is not
necessary in das16_ai_insn_read(). 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>
9 years agostaging: comedi: das16: absorb das16_ai_enable()
H Hartley Sweeten [Mon, 26 Jan 2015 23:17:13 +0000 (16:17 -0700)]
staging: comedi: das16: absorb das16_ai_enable()

This function is only called by das16_cmd_exec(). Absorb it to clarify 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>
9 years agoStaging: rtl8192u: Use put_unaligned_le16 in rtl819x_BAProc.c
Vaishali Thakkar [Tue, 27 Jan 2015 18:11:13 +0000 (23:41 +0530)]
Staging: rtl8192u: Use put_unaligned_le16 in rtl819x_BAProc.c

This patch introduces the use of function put_unaligned_le16.

This is done using Coccinelle and semantic patch used is as follows:

@a@
typedef u16, __le16, uint16_t;
{u16,__le16,uint16_t} e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
type T;
@@

- tmp = cpu_to_le16(y);

<+... when != tmp
(
- memcpy(ptr, (T)&tmp, \(2\|sizeof(u16)\|sizeof(__le16)\|sizeof(uint16_t)\|sizeof(e16)\));
+ put_unaligned_le16(y,ptr);
|
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le16(y,ptr);
)
...+>
? tmp = e

@@ type T; identifier a.tmp; @@

- T tmp;
...when != tmp

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: Refactor heavy nesting
Lorenzo Stoakes [Sat, 24 Jan 2015 15:45:24 +0000 (15:45 +0000)]
staging: rtl8192u: Refactor heavy nesting

This patch fixes warnings raised by checkpatch.pl relating to heavily indented
lines in r8192U_dm.c by refactoring code to achieve the same outcome indented by
one less tab.

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: remove redundant code
Lorenzo Stoakes [Sat, 24 Jan 2015 15:45:23 +0000 (15:45 +0000)]
staging: rtl8192u: remove redundant code

This patch fixes warnings/errors raised by checkpatch.pl relating to redundant
code in r8192U_dm.c.

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: fix whitespace and alignment
Lorenzo Stoakes [Sat, 24 Jan 2015 15:45:22 +0000 (15:45 +0000)]
staging: rtl8192u: fix whitespace and alignment

This patch fixes warnings/errors raised by checkpatch.pl relating to whitespace
in r8192U_dm.c, removes inconsistent whitespace, and additionally fixes some
vertical alignment issues.

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: fix comments
Lorenzo Stoakes [Sat, 24 Jan 2015 15:45:21 +0000 (15:45 +0000)]
staging: rtl8192u: fix comments

This patch fixes errors raised by checkpatch.pl relating to use of C99 comments
in r8192U_dm.c, and cleans up existing ANSI C comments.

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8188eu: core: rtw_wlan_util.c: Fix for NULL dereference
Kumar Amit Mehta [Mon, 26 Jan 2015 15:39:14 +0000 (16:39 +0100)]
staging: rtl8188eu: core: rtw_wlan_util.c: Fix for NULL dereference

In rtw_check_bcn_info(), check the return value of kzalloc() before
dereferencing it, to avoid NULL pointer dereference.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8712: remove useless printing line
Heba Aamer [Wed, 28 Jan 2015 10:00:22 +0000 (12:00 +0200)]
staging: rtl8712: remove useless printing line

This patch removes an unneeded call to printk.

Signed-off-by: Heba Aamer <heba93aamer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: rework signal remove/insert to avoid sparse lock warnings
Zachary Warren [Sat, 17 Jan 2015 11:39:53 +0000 (22:39 +1100)]
staging: unisys: rework signal remove/insert to avoid sparse lock warnings

Avoids the following warnings from sparse:
visorchannel_funcs.c:457:9: warning:
 context imbalance in 'visorchannel_signalremove' - different lock contexts for basic block
visorchannel_funcs.c:512:9: warning:
 context imbalance in 'visorchannel_signalinsert' - different lock contexts for basic

These warnings are false positives. Sparse can't track conditional contexts. The change
puts the lock/unlock into the same context by splitting the insert/remove functions each
into a wrapper function that does locking if necessary and an inner function that does the
insert/remove operation.

Signed-off-by: Zachary Warren <conflatulence@gmail.com>
Acked-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lustre: mdc: lproc_mdc.c: Fix for potential NULL pointer dereference
Kumar Amit Mehta [Mon, 26 Jan 2015 15:44:53 +0000 (16:44 +0100)]
staging: lustre: lustre: mdc: lproc_mdc.c: Fix for potential NULL pointer dereference

In mdc_kuc_write(), OBD_ALLOC(lh, len) may leave 'lh' to NULL as kmalloc
may fail to allocate memory. This fix adds a check to avoid, dereferencing
a NULL pointer.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lustre: obdclass: obd_mount.c: Fix NULL dereference
Kumar Amit Mehta [Mon, 26 Jan 2015 16:52:22 +0000 (17:52 +0100)]
staging: lustre: lustre: obdclass: obd_mount.c: Fix NULL dereference

OBD_ALLOC_PTR(uuid) invokes kmalloc, which may return NULL. This fix
adds a check before dereferencing such pointer.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: libcfs: nidstrings: Change type in printf format string
Rickard Strandqvist [Tue, 27 Jan 2015 21:29:59 +0000 (22:29 +0100)]
staging: lustre: libcfs: nidstrings: Change type in printf format string

Wrong type in printf format string, requires 'unsigned int'
but the argument type is 'int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm7xxfb: fix alignment
Sudip Mukherjee [Mon, 19 Jan 2015 08:11:06 +0000 (13:41 +0530)]
staging: sm7xxfb: fix alignment

checkpatch cleanup: alignment should match open parenthesis

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm7xxfb: remove unnecessary blank lines
Sudip Mukherjee [Mon, 19 Jan 2015 08:11:05 +0000 (13:41 +0530)]
staging: sm7xxfb: remove unnecessary blank lines

checkpatch cleanup: blank lines are not necessary before closing brace
and after opening brace.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm7xxfb: no space is necessary after a cast
Sudip Mukherjee [Mon, 19 Jan 2015 08:11:04 +0000 (13:41 +0530)]
staging: sm7xxfb: no space is necessary after a cast

checkpatch cleanup: space is not necessary after cast

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm7xxfb: add missing blank line
Sudip Mukherjee [Mon, 19 Jan 2015 08:11:03 +0000 (13:41 +0530)]
staging: sm7xxfb: add missing blank line

checkpatch cleanup to add missing blank line after declaration

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMAINTAINERS: update for SM7XX driver
Sudip Mukherjee [Mon, 19 Jan 2015 08:11:02 +0000 (13:41 +0530)]
MAINTAINERS: update for SM7XX driver

add myself and Teddy Wang as the Maintainer of the
SM7XX FRAME BUFFER DRIVER.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm7xxfb: update TODO file
Sudip Mukherjee [Mon, 19 Jan 2015 08:11:01 +0000 (13:41 +0530)]
staging: sm7xxfb: update TODO file

update the email addresses in the TODO file, also update the final
destination of this driver.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoRevert "staging: sm7xxfb: remove driver"
Sudip Mukherjee [Mon, 19 Jan 2015 08:11:00 +0000 (13:41 +0530)]
Revert "staging: sm7xxfb: remove driver"

This reverts commit "dc93c85235efa5201e9a3c116bc3fbd1afc1a182"

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: Remove the Android alarm-dev driver
John Stultz [Tue, 20 Jan 2015 21:42:34 +0000 (13:42 -0800)]
staging: Remove the Android alarm-dev driver

The functionality provided by the Android alarm-dev driver
should now be present in the timerfd interface (thanks to
Greg Hackmann and Todd Poynor).

As of Lollipop, AOSP can make use of the timerfd if
alarm-dev is not present (though a fixup for setting the
rtc time if rtc0 isn't the backing for _ALARM clockids has
been applied post-Lollipop).

Thus, we should be able to remove alarm-dev from staging.

Cc: Greg Hackmann <ghackmann@google.com>
Cc: Elliott Hughes <enh@google.com>
Cc: Todd Poynor <toddpoynor@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Mark Salyzyn <salyzyn@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: dgap: fix "if" statement that always evaluates to true
Daeseok Youn [Fri, 23 Jan 2015 11:44:28 +0000 (20:44 +0900)]
staging: dgap: fix "if" statement that always evaluates to true

cppcheck warning:
(warnning) Logical disjunction always evaluates to true

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fbtft-core mark functions static
Krzysztof Adamski [Thu, 22 Jan 2015 18:08:58 +0000 (19:08 +0100)]
staging: fbtft: fbtft-core mark functions static

This fixes sparse warnings like:
     warning: symbol XXX was not declared. Should it be static?

by declaring all local functions static.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: dgnc: fixed some coding style errors
Andrew Milkovich [Sun, 18 Jan 2015 18:41:30 +0000 (10:41 -0800)]
Staging: dgnc: fixed some coding style errors

This patch fixes the following checkpatch.pl error:
ERROR: Macros with complex values should be enclosed in parentheses
Outer parentheses were added to macro definitions.

Signed-off-by: Andrew Milkovich <amilkovich@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: dgnc: fix long lines in PCI device table
Krzysztof Adamski [Thu, 22 Jan 2015 19:19:26 +0000 (20:19 +0100)]
staging: dgnc: fix long lines in PCI device table

This patch fixes coding style of PCI device table declaration.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rts5208: use msecs_to_jiffies for timeouts
Nicholas Mc Guire [Fri, 23 Jan 2015 07:15:53 +0000 (08:15 +0100)]
staging: rts5208: use msecs_to_jiffies for timeouts

This is only an API consolidation and should make things more readable

Converting milliseconds to jiffies by val * HZ / 1000 is technically
not wrong but msecs_to_jiffies(val) is the cleaner solution and handles
corner cases correctly.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wlan-ng: hfa384x_usb: fix sparse endianness warnings
Asaf Vertz [Sun, 18 Jan 2015 07:11:39 +0000 (09:11 +0200)]
staging: wlan-ng: hfa384x_usb: fix sparse endianness warnings

Fixed the following warnings (reported by sparse):
drivers/staging/wlan-ng/hfa384x_usb.c:3828:36: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:3229:16: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:3430:18: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:3349:51: warning: restricted __le16 degrades to integer
drivers/staging/wlan-ng/hfa384x_usb.c:3357:37: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:3358:37: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:3393:36: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:3102:28: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:3004:28: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:1308:37: warning: cast to restricted __le16
drivers/staging/wlan-ng/hfa384x_usb.c:2713:25: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:2713:25:    expected unsigned short [unsigned] [usertype] type
drivers/staging/wlan-ng/hfa384x_usb.c:2713:25:    got restricted __le16 [usertype] <noident>

Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8712: remove unused function
Sudip Mukherjee [Thu, 22 Jan 2015 06:39:16 +0000 (12:09 +0530)]
staging: rtl8712: remove unused function

mp_query_drv_var() was only being used by
oid_rt_pro_query_dr_variable_hdl() but after commit
<f4f5a59ff2e746885be3c1c06c1d0e8861a10ce8> mp_query_drv_var() became
unused. so it is safe to remove it.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8723au: fix space coding style issue in os_intfs.c
Peter Poklop [Mon, 19 Jan 2015 17:26:53 +0000 (18:26 +0100)]
Staging: rtl8723au: fix space coding style issue in os_intfs.c

This patch fixes the checkpatch.pl warning:

WARNING: space prohibited before semicolon

Signed-off-by: Peter Poklop <peter.poklop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8712: recv_linux: Remove unused function
Rickard Strandqvist [Sun, 18 Jan 2015 01:07:23 +0000 (02:07 +0100)]
staging: rtl8712: recv_linux: Remove unused function

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

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

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8723au: core: rtw_cmd: Remove unused functions
Rickard Strandqvist [Sun, 18 Jan 2015 00:59:09 +0000 (01:59 +0100)]
staging: rtl8723au: core: rtw_cmd: Remove unused functions

Removes some functions that are not used anywhere:
rtw_set_ch_cmd23a() rtw_cmd_clr_isr23a()

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

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8723au: os_dep: usb_intf: Remove unused functions
Rickard Strandqvist [Sun, 18 Jan 2015 00:41:23 +0000 (01:41 +0100)]
staging: rtl8723au: os_dep: usb_intf: Remove unused functions

Removes some functions that are not used anywhere:
rtw_hw_resume23a() rtw_hw_suspend23a()

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

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: fix CamelCase in enable_ints_write()
Benjamin Romer [Tue, 20 Jan 2015 15:01:21 +0000 (10:01 -0500)]
staging: unisys: fix CamelCase in enable_ints_write()

Fix CamelCase variable name:

Features_addr => features_addr

Update references to use the new name.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: fix CamelCase name in virthba_probe()
Benjamin Romer [Tue, 20 Jan 2015 15:01:20 +0000 (10:01 -0500)]
staging: unisys: fix CamelCase name in virthba_probe()

Fix CamelCase local variable name:

pChannelHeader => channel_header

Update references to use the new name.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: refactor virthba_ISR()
Benjamin Romer [Tue, 20 Jan 2015 15:01:19 +0000 (10:01 -0500)]
staging: unisys: refactor virthba_ISR()

Fix CamelCase names:

virthba_ISR => virthba_isr
pChannelHeader => channel_header

Update all references to the modified names.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix CamelCase for function names in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:18 +0000 (10:01 -0500)]
staging: unisys: Fix CamelCase for function names in virthba.c

This patch fixes CamelCase function names in virthba.c, reported by the
checkpatch script:
  doDiskAddRemove --> do_disk_add_remove
  SendDiskAddRemove --> send_disk_add_remove

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix remaining CamelCase global variables in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:17 +0000 (10:01 -0500)]
staging: unisys: Fix remaining CamelCase global variables in virthba.c

This patch fixes the remaining CamelCase global variables in virthba.c reported
by the checkpatch script:
  MaxBuffLen --> max_buff_len
  VirtHbasOpen --> virthbas_open

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix CamelCase for Disk Add/Remove global variables in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:16 +0000 (10:01 -0500)]
staging: unisys: Fix CamelCase for Disk Add/Remove global variables in virthba.c

This patch fixes the Disk Add/Remove (DAR) related CamelCase global
variables in virthba.c, reported by the checkpatch script:
  DARWorkQ --> dar_work_queue
  DARWorkQHead --> dar_work_queue_head
  DARWorkQLock --> dar_work_queue_lock
  DARWorkQSched --> dar_work_queue_sched

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix open parenthesis alignment issues in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:15 +0000 (10:01 -0500)]
staging: unisys: Fix open parenthesis alignment issues in virthba.c

This patch fixes a couple checkpatch checks where alignment of the parameters
did not match the open parenthesis of the function.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix warnings regarding lines over 80 characters in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:14 +0000 (10:01 -0500)]
staging: unisys: Fix warnings regarding lines over 80 characters in virthba.c

This patch fixes warnings generated by checkpatch script regarding lines
over 80 characters long.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix "else not useful after return" warning in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:13 +0000 (10:01 -0500)]
staging: unisys: Fix "else not useful after return" warning in virthba.c

This patch fixes a warning generated during the checkpatch script that stated
"else not useful after return".  I modified the code to return a designated
status at the end of the function, and replaced the return statement in the
"else if" to set the status accordingly.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: fix checkpatch checks for structs in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:12 +0000 (10:01 -0500)]
staging: unisys: fix checkpatch checks for structs in virthba.c

This patch fixes a couple small issues reported by the checkpatch script:
  Adds a blank line after a struct definition.
  Removes unnecessary parentheses surrounding a dereference of a struct member.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Change alloc calls to use var name instead of type in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:11 +0000 (10:01 -0500)]
staging: unisys: Change alloc calls to use var name instead of type in virthba.c

This patch changes a couple of kzalloc calls to pass the variable name to the
call, rather than the variable struct type.  This is a result of checks
generated during the checkpatch script.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Remove blank lines before/after braces in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:10 +0000 (10:01 -0500)]
staging: unisys: Remove blank lines before/after braces in virthba.c

This patch removes unnecessary blank lines either before opening braces or
after closing braces, as reported by the checkpatch script.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix logical continuation checks in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:09 +0000 (10:01 -0500)]
staging: unisys: Fix logical continuation checks in virthba.c

This patch fixes checkpatch checks where the logical operator should be at the
end of the line above, not beginning the next line.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Fix open parenthesis alignment checks in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:08 +0000 (10:01 -0500)]
staging: unisys: Fix open parenthesis alignment checks in virthba.c

This patch fixes the "alignment should match open parenthesis" checks from the
checkpatch script.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Remove unneeded spaces after casts in virthba.c
Ken Depro [Tue, 20 Jan 2015 15:01:07 +0000 (10:01 -0500)]
staging: unisys: Remove unneeded spaces after casts in virthba.c

This patch removes all unnecessary spaces after casts, as reported by the
checkpatch script.

Signed-off-by: Ken Depro <kenneth.depro@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6656: fix Prefer ether_addr_copy() over memcpy() if the Ethernet addresses...
Heba Aamer [Wed, 21 Jan 2015 11:08:48 +0000 (13:08 +0200)]
staging: vt6656: fix Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

This patch fixes the following checkpatch.pl warning:
fix Prefer ether_addr_copy() over memcpy()
if the Ethernet addresses are __aligned(2)

Pahole showed that the 2 structs are aligned to u16

struct vnt_mic_hdr {
        u8                         id;                   /*     0     1 */
        u8                         tx_priority;          /*     1     1 */
        u8                         mic_addr2[6];         /*     2     6 */
        u8                         ccmp_pn[6];           /*     8     6 */
        __be16                     payload_len;          /*    14     2 */
        __be16                     hlen;                 /*    16     2 */
        __le16                     frame_control;        /*    18     2 */
        u8                         addr1[6];             /*    20     6 */
        u8                         addr2[6];             /*    26     6 */
        u8                         addr3[6];             /*    32     6 */
        __le16                     seq_ctrl;             /*    38     2 */
        u8                         addr4[6];             /*    40     6 */
        u16                        packing;              /*    46     2 */

        /* size: 48, cachelines: 1, members: 13 */
        /* last cacheline: 48 bytes */
};

struct ieee80211_hdr {
        __le16                     frame_control;        /*     0     2 */
        __le16                     duration_id;          /*     2     2 */
        u8                         addr1[6];             /*     4     6 */
        u8                         addr2[6];             /*    10     6 */
        u8                         addr3[6];             /*    16     6 */
        __le16                     seq_ctrl;             /*    22     2 */
        u8                         addr4[6];             /*    24     6 */

        /* size: 30, cachelines: 1, members: 7 */
        /* last cacheline: 30 bytes */
};

Signed-off-by: Heba Aamer <heba93aamer@gmail.com>
Reviewed-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: RFbSetPower remove unused variable byPwrdBm
Malcolm Priestley [Mon, 19 Jan 2015 18:24:15 +0000 (18:24 +0000)]
staging: vt6655: RFbSetPower remove unused variable byPwrdBm

byPwrdBm is set but never used.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: Fix RFbSetPower() error: buffer overflow 'priv->abyCCKPwrTbl' 15...
Malcolm Priestley [Mon, 19 Jan 2015 18:24:14 +0000 (18:24 +0000)]
staging: vt6655: Fix RFbSetPower() error: buffer overflow 'priv->abyCCKPwrTbl' 15 <= 56

Check uCH is not more than CB_MAX_CHANNEL_24G(14) on rates RATE_1M to RATE_11M

Return false as the call is invalid as these rates do not exist
above channel 14.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: device_init_registers alway set initial antenna mode
Malcolm Priestley [Mon, 19 Jan 2015 18:24:13 +0000 (18:24 +0000)]
staging: vt6655: device_init_registers alway set initial antenna mode

BBvSetTxAntennaMode and BBvSetRxAntennaMode need to be set correcty
on start up

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: remove antenna diversity functions
Malcolm Priestley [Mon, 19 Jan 2015 18:24:12 +0000 (18:24 +0000)]
staging: vt6655: remove antenna diversity functions

The vendor had disabled these functions in their last version.

On test this can be troublesome, so remove this from the driver along
with its macros and timers.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: common variable size channel numbers to ieee80211_channel->hw_value
Malcolm Priestley [Mon, 19 Jan 2015 18:24:11 +0000 (18:24 +0000)]
staging: vt6655: common variable size channel numbers to ieee80211_channel->hw_value

hw_value is u16 so fix all to the same size.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: set_channel replace parameter with ieee80211_channel
Malcolm Priestley [Mon, 19 Jan 2015 18:24:10 +0000 (18:24 +0000)]
staging: vt6655: set_channel replace parameter with ieee80211_channel

replacing uConnectionChannel for hw_value as set in vnt_init_bands.

This allows other signaling of ieee80211_channel to move deeper into
driver.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: fix space prohibted before that ','
Ahmad Hassan [Mon, 19 Jan 2015 22:13:58 +0000 (13:13 -0900)]
staging: vt6655: fix space prohibted before that ','

This patch fixes the following checkpatch.pl error:
fix space prohibited before that ','

Signed-off-by: Ahmad Hassan <ahmad.hassan612@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: fix space prohibited before that ','
Heba Aamer [Mon, 19 Jan 2015 10:16:30 +0000 (12:16 +0200)]
staging: vt6655: fix space prohibited before that ','

This patch fixes the following checkpatch.pl error:
fix space prohibited before that ','

Signed-off-by: Heba Aamer <heba93aamer@gmail.com>
Reviewed-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fix allyesconfig build
Dan Carpenter [Fri, 23 Jan 2015 14:20:25 +0000 (17:20 +0300)]
staging: fbtft: fix allyesconfig build

There are two functions call reset() so the allyesconfig breaks.  Let's
make this one static.

Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ptlrpc: fix lproc_ptlrpc static declarations
Jon Bernard [Tue, 20 Jan 2015 19:55:28 +0000 (14:55 -0500)]
staging: lustre: ptlrpc: fix lproc_ptlrpc static declarations

This patch fixes the following sparse warnings:

drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:51:3:warning:
 symbol 'll_rpc_opcode_table' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:142:3: warning:
 symbol 'll_eopcode_table' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:178:12: warning:
 symbol 'll_eopcode2str' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:731:1: warning:
 symbol 'ptlrpc_lprocfs_svc_req_history_seek' was not declared. Should it be static?

Signed-off-by: Jon Bernard <jbernard@tuxion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: remove the CFS_HOP() macro
Dan Carpenter [Thu, 22 Jan 2015 07:49:54 +0000 (10:49 +0300)]
staging: lustre: remove the CFS_HOP() macro

CFS_HOP() is a terrible macro.  It chops the struct member name in half
so that it's not possible to use tools like grep or to search for how
a function pointer is used.

I removed a couple calls to:

LASSERT(CFS_HOP(hs, put_locked) != NULL);

because they isn't a need for them.  Anyway dereferencing a NULL pointer
generates a pretty good stack trace already without adding extra debug
code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fix sparse warnings related to lock context imbalance
Loic Pefferkorn [Tue, 20 Jan 2015 19:39:11 +0000 (20:39 +0100)]
staging: lustre: fix sparse warnings related to lock context imbalance

Applies against next-20150120.

Add __acquires() and __releases() function annotations, to fix sparse warnings related to lock context imbalance.

This patch fixes the following warnings:

drivers/staging/lustre//lustre/libcfs/linux/linux-tracefile.c:153:5: warning: context imbalance in 'cfs_trace_lock_tcd' - wrong count at exit
drivers/staging/lustre//lustre/libcfs/linux/linux-tracefile.c:171:39: warning: context imbalance in 'cfs_trace_unlock_tcd' - unexpected unlock
drivers/staging/lustre//lustre/libcfs/hash.c:128:1: warning: context imbalance in 'cfs_hash_spin_lock' - wrong count at exit
drivers/staging/lustre//lustre/libcfs/hash.c:134:1: warning: context imbalance in 'cfs_hash_spin_unlock' - unexpected unlock
drivers/staging/lustre//lustre/libcfs/hash.c:142:9: warning: context imbalance in 'cfs_hash_rw_lock' - wrong count at exit
include/linux/rwlock_api_smp.h:219:9: warning: context imbalance in 'cfs_hash_rw_unlock' - unexpected unlock
drivers/staging/lustre//lustre/obdclass/cl_object.c:195:6: warning: context imbalance in 'cl_object_attr_lock' - wrong count at exit
drivers/staging/lustre//lustre/obdclass/cl_object.c:204:6: warning: context imbalance in 'cl_object_attr_unlock' - unexpected unlock

Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lnet: declare internal symbols as static
Luca Ceresoli [Sun, 18 Jan 2015 14:06:52 +0000 (15:06 +0100)]
staging: lustre: lnet: declare internal symbols as static

Fixes sparse warnings like:
  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Peng Tao <bergwolf@gmail.com>
Cc: Jinshan Xiong <jinshan.xiong@intel.com>
Cc: Srikrishan Malik <srikrishanmalik@gmail.com>
Cc: HPDD-discuss@lists.01.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fld: declare internal symbols as static
Luca Ceresoli [Sun, 18 Jan 2015 14:06:51 +0000 (15:06 +0100)]
staging: lustre: fld: declare internal symbols as static

Fixes sparse warnings like:
  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Peng Tao <bergwolf@gmail.com>
Cc: Jinshan Xiong <jinshan.xiong@intel.com>
Cc: Srikrishan Malik <srikrishanmalik@gmail.com>
Cc: HPDD-discuss@lists.01.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: declare internal symbols as static
Luca Ceresoli [Sun, 18 Jan 2015 14:06:50 +0000 (15:06 +0100)]
staging: lustre: llite: declare internal symbols as static

Fixes sparse warnings like:
  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Peng Tao <bergwolf@gmail.com>
Cc: Jinshan Xiong <jinshan.xiong@intel.com>
Cc: Srikrishan Malik <srikrishanmalik@gmail.com>
Cc: HPDD-discuss@lists.01.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: libcfs: declare internal symbols as static
Luca Ceresoli [Sun, 18 Jan 2015 14:06:49 +0000 (15:06 +0100)]
staging: lustre: libcfs: declare internal symbols as static

Fixes sparse warnings like:
  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Peng Tao <bergwolf@gmail.com>
Cc: Jinshan Xiong <jinshan.xiong@intel.com>
Cc: Srikrishan Malik <srikrishanmalik@gmail.com>
Cc: HPDD-discuss@lists.01.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lmv: declare internal symbols as static
Luca Ceresoli [Sun, 18 Jan 2015 14:06:48 +0000 (15:06 +0100)]
staging: lustre: lmv: declare internal symbols as static

Fixes sparse warnings like:
  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Peng Tao <bergwolf@gmail.com>
Cc: Jinshan Xiong <jinshan.xiong@intel.com>
Cc: Srikrishan Malik <srikrishanmalik@gmail.com>
Cc: HPDD-discuss@lists.01.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: mdc: declare internal symbols as static
Luca Ceresoli [Sun, 18 Jan 2015 14:06:47 +0000 (15:06 +0100)]
staging: lustre: mdc: declare internal symbols as static

Fixes sparse warnings like:
  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Peng Tao <bergwolf@gmail.com>
Cc: Jinshan Xiong <jinshan.xiong@intel.com>
Cc: Srikrishan Malik <srikrishanmalik@gmail.com>
Cc: HPDD-discuss@lists.01.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fix min() comparison types lacks cast build warning
Jeremiah Mahler [Sun, 18 Jan 2015 11:17:52 +0000 (03:17 -0800)]
staging: lustre: fix min() comparison types lacks cast build warning

Recent changes to use the builtin min functions [1] introduced
type checking which wasn't present before.  This resulted in
"comparision of distinct pointer types lacks a cast" build
warnings on non X86 architectures [2,3].

  [1]: https://lkml.org/lkml/2014/12/25/145
  [2]: https://lists.01.org/pipermail/kbuild-all/2015-January/008588.html
  [3]: https://lists.01.org/pipermail/kbuild-all/2015-January/008589.html

The call to min() which resulted in this warning took the result
of kiblnd_rd_frag_size(), which returned a __u32, and the
variable 'resid', which is an int.  'resid' is inside a while
loop which is only entered if it is positive.  Casting it as a
__u32 can be perormed without a loss of data or change in
functionality.

Fix the warning by casting 'resid' as a __u32.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: remove kmalloc from fld_proc_hash_seq_write
Tristan Lelong [Sun, 18 Jan 2015 07:44:49 +0000 (23:44 -0800)]
staging: lustre: remove kmalloc from fld_proc_hash_seq_write

This patch simplifies the fld_proc_hash_seq_write function
by removing the dynamic memory allocation.
The longest fh_name used so far in lustre is 4 characters.
We use a 8 bytes variable to be on the safe side.

Signed-off-by: Tristan Lelong <tristan@lelong.xyz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: fix line over 80 characters warning
jitendra kumar khasdev [Fri, 23 Jan 2015 19:11:19 +0000 (00:41 +0530)]
Staging: comedi: fix line over 80 characters warning

This is patch to file jr3_pci.h that fix up warning line
over 80 character which is found by checkpatch tool.

Signed-off-by: Jitendra Kumar Khasdev <jkhasdev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: vmk80xx: tidy up vmk80xx_cnt_insn_config()
H Hartley Sweeten [Thu, 22 Jan 2015 00:22:14 +0000 (17:22 -0700)]
staging: comedi: vmk80xx: tidy up vmk80xx_cnt_insn_config()

Tidy up this (*insn_config) function to follow the normal format in
comedi drivers.

INSN_CONFIG_RESET instructions do not have any extra parameters (insn->n is
always 1) so the for loop used to write the packet doesn't make any sense.
Remove it and just write the single packet.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: vmk80xx: GPCT_RESET is not an (*insn_config) instruction
H Hartley Sweeten [Thu, 22 Jan 2015 00:22:13 +0000 (17:22 -0700)]
staging: comedi: vmk80xx: GPCT_RESET is not an (*insn_config) instruction

The data[0] parameter to (*insn_config) functions is the "configuration instruction"
that should be handled. These are defined by the enum configuration_ids in comedi.h.

This driver is currently checking the data[0] value to be INSN_CONFIG_RESET or
GPCT_RESET in order to reset a counter channel. GPCT_RESET is defined as 0x0001
which would match the configuration instruction INSN_CONFIG_DIO_OUTPUT. That doesn't
make any sense for a counter.

Remove GPCT_RESET from the insn_cmd test.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_common: use the cfc_check_trigger_arg_*() helpers
H Hartley Sweeten [Wed, 21 Jan 2015 22:11:49 +0000 (15:11 -0700)]
staging: comedi: ni_labpc_common: use the cfc_check_trigger_arg_*() helpers

For aesthetics, use the helper functions to check the min/max divisor values.
Remove the const int local variables and 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>
9 years agostaging: comedi: ni_labpc_common: use DIV_ROUND_CLOSEST to round divisor values
H Hartley Sweeten [Wed, 21 Jan 2015 22:11:48 +0000 (15:11 -0700)]
staging: comedi: ni_labpc_common: use DIV_ROUND_CLOSEST to round divisor values

Use the DIV_ROUND_CLOSEST macro to clarify the (((x) + ((divisor) / 2)) / (divisor))
calculations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_common: use DIV_ROUND_UP to round divisor values
H Hartley Sweeten [Wed, 21 Jan 2015 22:11:47 +0000 (15:11 -0700)]
staging: comedi: ni_labpc_common: use DIV_ROUND_UP to round divisor values

Use the DIV_ROUND_UP macro to clarify the (((n) + (d) - 1) / (d)) calculations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc: remove unnecessary private data validation
H Hartley Sweeten [Wed, 21 Jan 2015 22:11:46 +0000 (15:11 -0700)]
staging: comedi: ni_labpc: remove unnecessary private data validation

The labpc_free_dma_chan() function validates the private data. Remove the
unnecessary validation in labpc_datach().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_labpc_cs: remove unnecessary includes
H Hartley Sweeten [Wed, 21 Jan 2015 22:11:45 +0000 (15:11 -0700)]
staging: comedi: ni_labpc_cs: remove unnecessary includes

This driver includes a number of unnecessary headers. 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>
9 years agostaging: comedi: ni_labpc_common: move comedi_alloc_devpriv() to common code
H Hartley Sweeten [Wed, 21 Jan 2015 22:11:44 +0000 (15:11 -0700)]
staging: comedi: ni_labpc_common: move comedi_alloc_devpriv() to common code

The ni_labpc_common module is used by the ni_labpc, ni_labpc_pci, and ni_labpc_cs
drivers to provide the common code support. Those drivers currently all call
comedi_alloc_devpriv() to allocate the private data before calling the common
attach function.

For aesthetics, move the private data allocation into the common 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>
9 years agostaging: comedi: adv_pci1710: absorb move_block_from_fifo()
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:26 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: absorb move_block_from_fifo()

This function is only called by pci1710_handle_fifo(). Absorb it and clean up
pci1710_handle_fifo().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: transfer all ai samples in one step
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:25 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: transfer all ai samples in one step

The two step process to transfer the ai samples in pci1710_handle_fifo() doesn't
make any sense. If the async buffer does not have enough room for the samples the
core will set the async event COMEDI_CB_OVERFLOW which will cause the async command
to cancel. Splitting the transfer doesn't add any value.

Transfer all the samples in one step to simplify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: remove 'turn' param from move_block_from_fifo()
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:24 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: remove 'turn' param from move_block_from_fifo()

This parameter is not used in the function. It was only used in some debug
messages that were previously removed. Remove the parameter.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: do comedi_handle_events() in common code patch
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:23 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: do comedi_handle_events() in common code patch

The pci1710_handle_every_sample() and pci1710_handle_fifo() helpers, called by
the interrupt handler, both have multiple comedi_handle_events() calls. Remove
these and just do a single comedi_handle_events() at the end of the interrupt
handler.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:22 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()

Introduce a helper function to read an analog input sample, check for
channel dropout, and mask the sample to the maxdata of the subdevice.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: tidy up setup_channel_list()
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:21 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: tidy up setup_channel_list()

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

Tidy up the code to clarify the function. Remove the unnecessary static const
array muxonechan[].

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: clarify the 'act_chanlist'
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:20 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: clarify the 'act_chanlist'

This driver saves the channel list of a scan in the private data and uses
that list to check analog input samples for data dropout.

Currently the channel numbers are shifted 12 bits so that they match the
channel number in the samples that are read from the board. All of the
shifts make the driver a bit harder to follow.

Store the channel numbers directly to the 'act_chanlist' and shift the
sample value instead when checking for the dropout. 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>
9 years agostaging: comedi: adv_pci1710: refactor boardinfo 'cardtype'
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:19 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: refactor boardinfo 'cardtype'

The 'cardtype' in the boardinfo is only used to:

 1) determine if the board is a pci1720 during the attach of the driver
    and when reseting the board
 2) determine is the board is not a pci1713 when checking for analog input
    data dropout

There is also an unnecessary use of the 'cardtype' when canceling an analog
input async command.

Remove the 'cardtype' member and add two bit-field flags, 'is_pci1713' and
'is_pci1720'. Refactor the driver to use the new flags.

Remove the unnecessary cardtype handling in pci171x_ai_cancel().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: remove boardinfo 'rangelist_ao'
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:18 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: remove boardinfo 'rangelist_ao'

This boardinfo is not necessary. All the boards with analog outputs have
the same range options except for the pci1720 board. That board type is
already handled specially during the driver attach.

Remove the boardinfo and add the subdevice range_table initialization in
the cardtype switch.

Rename the range tables to clarify that they are "analog output" ranges.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: update the MODULE_DESCRIPTION
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:17 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: update the MODULE_DESCRIPTION

Change the MODULE_DESCRIPTION to something more useful than the generic
"Comedi low-level driver".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: remove function separation comments
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:16 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: remove function separation comments

Remove the remaining, unnecessary, function separation comments.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: rename 'this_board' local variables
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:15 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: rename 'this_board' local variables

For aesthetics, rename all the 'this_board' local variables to simply
'board'. That's more common in comed drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: tidy up analog input subdevice init
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:14 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: tidy up analog input subdevice init

For aesthetics, add some whitespace to the analog input subdevice init and
rename the (*insn_read) support function. Also remove the unnecessary comments.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: tidy up analog output subdevice init
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:13 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: tidy up analog output subdevice init

For aesthetics, add some whitespace to the analog output subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: tidy up digital input and output subdevice init
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:12 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: tidy up digital input and output subdevice init

For aesthetics, add some whitespace to the digital input and output subdevice
init and rename the support functions. Also remove the unnecessary 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>
9 years agostaging: comedi: adv_pci1710: tidy up counter subdevice init
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:11 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: tidy up counter subdevice init

For aesthetics, add some whitespace to the counter subdevice init and
rename the support functions. Also remove the unnecessary comments.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: tidy up pci171x_insn_write_ao()
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:10 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: tidy up pci171x_insn_write_ao()

For aesthetics, rename this function and tidy it up.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: tidy up pci1720_insn_write_ao()
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:09 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: tidy up pci1720_insn_write_ao()

For aesthetics, rename this function and tidy it up.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: use comedi_subdevice 'readback'
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:08 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: use comedi_subdevice 'readback'

Use the new comedi_subdevice 'readback' member and the core provided
(*insn_read) for the readback of the analog output subdevice channels.

The board is "reset" prior to the subdevice init. Part of this reset
sets all the analog output channels to 0V. Move the initialization of
the 'readback' values after the 'readback' member has been allocated.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: change boardinfo 'n_aochan' to 'has_ao'
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:07 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: change boardinfo 'n_aochan' to 'has_ao'

Some of the boards supported by this driver have analog outputs. The pci1720
board has 4 analog output channels and the others have 2.

For aesthetics, change the 'n_aochan' member to a bit-field flag 'has_ao' and
refactor the board attach accordingly. Remove the unnecessary initialization
of the subdevice 'len_chanlist'. That member is only used by subdevices that
support async commands.

Also, remove the unnecessary 'number of channels' check in pci171x_reset().
The boards that used this function, and have analog outputs, always have 2
channels.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: change boardinfo 'fifo_half_size' to 'has_large_fifo'
H Hartley Sweeten [Tue, 20 Jan 2015 21:53:06 +0000 (14:53 -0700)]
staging: comedi: adv_pci1710: change boardinfo 'fifo_half_size' to 'has_large_fifo'

The boards supported by this driver have a 4K or 1K FIFO that is used when reading
analog input samples when running an async command. The maximum number of samples
in the FIFO is half the FIFO size due to the 2 bytes/sample (12-bit resolution).

For aesthetics, change the 'fifo_half_size' member to a bit-field flag 'has_large_fifo'
and add a new member to the private data to hold the 'max_samples' available in the
FIFO. Refactor the board attach and pci1710_handle_fifo() accordingly.

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