GitHub/LineageOS/android_kernel_motorola_exynos9610.git
9 years agostaging: wilc1000: rename variable hSemHostIntDeinit
Leo Kim [Thu, 15 Oct 2015 04:24:57 +0000 (13:24 +0900)]
staging: wilc1000: rename variable hSemHostIntDeinit

This patch renames variable hSemHostIntDeinit to hif_sema_deinit
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename variable hWaitResponse
Leo Kim [Thu, 15 Oct 2015 04:24:56 +0000 (13:24 +0900)]
staging: wilc1000: rename variable hWaitResponse

This patch renames variable hWaitResponse to hif_sema_wait_response
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: hif_sema_driver can be static
kbuild test robot [Thu, 15 Oct 2015 06:07:41 +0000 (14:07 +0800)]
staging: wilc1000: hif_sema_driver can be static

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename variable hSemDeinitDrvHandle
Leo Kim [Thu, 15 Oct 2015 04:24:55 +0000 (13:24 +0900)]
staging: wilc1000: rename variable hSemDeinitDrvHandle

This patch renames variable hSemDeinitDrvHandle to hif_sema_driver
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename variable hSemHostIFthrdEnd
Leo Kim [Thu, 15 Oct 2015 04:24:54 +0000 (13:24 +0900)]
staging: wilc1000: rename variable hSemHostIFthrdEnd

This patch renames variable hSemHostIFthrdEnd to hif_sema_thread
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename variable gMsgQHostIF
Leo Kim [Thu, 15 Oct 2015 04:24:53 +0000 (13:24 +0900)]
staging: wilc1000: rename variable gMsgQHostIF

This patch renames variable gMsgQHostIF to hif_msg_q
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename variable HostIFthreadHandler
Leo Kim [Thu, 15 Oct 2015 04:24:52 +0000 (13:24 +0900)]
staging: wilc1000: rename variable HostIFthreadHandler

This patch renames variable HostIFthreadHandler to hif_thread_handler
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: remove unused variable gWFiDrvHandle
Leo Kim [Thu, 15 Oct 2015 04:24:51 +0000 (13:24 +0900)]
staging: wilc1000: remove unused variable gWFiDrvHandle

This patch removes unused the variable gWFiDrvHandle.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename au8Interval of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:49 +0000 (13:24 +0900)]
staging: wilc1000: rename au8Interval of struct join_bss_param

This patch renames au8Interval of struct join_bss_param to interval
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename au8Duration of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:48 +0000 (13:24 +0900)]
staging: wilc1000: rename au8Duration of struct join_bss_param

This patch renames au8Duration of struct join_bss_param to duration
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename u8Index of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:47 +0000 (13:24 +0900)]
staging: wilc1000: rename u8Index of struct join_bss_param

This patch renames u8Index of struct join_bss_param to idx
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename u8Count of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:46 +0000 (13:24 +0900)]
staging: wilc1000: rename u8Count of struct join_bss_param

This patch renames u8Count of struct join_bss_param to cnt
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename u8CtWindow of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:45 +0000 (13:24 +0900)]
staging: wilc1000: rename u8CtWindow of struct join_bss_param

This patch renames u8CtWindow of struct join_bss_param to ct_window
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename u8OppEnable of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:44 +0000 (13:24 +0900)]
staging: wilc1000: rename u8OppEnable of struct join_bss_param

This patch renames u8OppEnable of struct join_bss_param to opp_enabled
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename u8NoaEnbaled of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:43 +0000 (13:24 +0900)]
staging: wilc1000: rename u8NoaEnbaled of struct join_bss_param

This patch renames u8NoaEnbaled of struct join_bss_param to noa_enabled
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename ssidLen of struct join_bss_param
Leo Kim [Thu, 15 Oct 2015 04:24:42 +0000 (13:24 +0900)]
staging: wilc1000: rename ssidLen of struct join_bss_param

This patch renames ssidLen of struct join_bss_param to ssid_len
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: remove typedef from the tstrInterfaceInfo
Tony Cho [Wed, 14 Oct 2015 11:46:32 +0000 (20:46 +0900)]
staging: wilc1000: remove typedef from the tstrInterfaceInfo

This patch removes typedef from the tstrInterfaceInfo and renames it to
the wilc_vif.

Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: remove typedef from the linux_wlan_t
Tony Cho [Wed, 14 Oct 2015 11:46:30 +0000 (20:46 +0900)]
staging: wilc1000: remove typedef from the linux_wlan_t

This patch removes typedef from the struct linux_wlan_t and renames it
to the wilc. In addition, all of linux_wlan_t is replaced with struct wilc
and memory allocation style is changed with preferred form as well like the
following:
p = kmalloc(sizeof(*p), ...) where "struct wilc" is used

Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: remove extern declarations of g_linux_wlan
Tony Cho [Wed, 14 Oct 2015 11:46:29 +0000 (20:46 +0900)]
staging: wilc1000: remove extern declarations of g_linux_wlan

This patch removes extern declaration of g_linux_wlan from the
followings because it is declared as extern in the wilc_wfi_netdevice.h
file.

- linux_mon.c
- linux_wlan_sdio.c
- wilc_wfi_cfgoperations.c

Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: wilc1000: Remove null check before kfree
Shraddha Barke [Wed, 14 Oct 2015 01:59:19 +0000 (07:29 +0530)]
Staging: wilc1000: Remove null check before kfree

kfree on NULL pointer is a no-op.
The semantic patch used to find such an instance where NULL check is
present before kfree-

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>smpl>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: wilc1000: host_interface: Remove unnecessary enum
Shivani Bhardwaj [Tue, 13 Oct 2015 21:59:58 +0000 (03:29 +0530)]
Staging: wilc1000: host_interface: Remove unnecessary enum

enum scan_conn_timer and its instances are never used anywhere
in the code so, remove it.
Semantic patch used:

@@
type T;
identifier i;
constant C;
position p != e.p;
@@

- T i@p;
  <+... when != i
- i = C;
  ...+>

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMerge tag 'iio-for-4.4b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Sat, 17 Oct 2015 04:28:55 +0000 (21:28 -0700)]
Merge tag 'iio-for-4.4b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of new drivers, functionality and cleanups for IIO in the 4.4 cycle.

Core stuff
* adjust resistance documentation to allow for output devices.

New device support:
* bmc150
 - split the i2c driver up into a core and i2c_regmap part including regmap
   conversion.
 - add spi support.
* mcp4531 digitial potentiometer driver.
* Measurement Specialties set of drivers with a core library module providing
  common functionality.  Note that the htu21 has a driver in hwmon, but the
  view from that side was that, given the range of devices the same silicon
  turns up in are not all typical hwmon material, that driver would be
  deprecated in favour of this new support.
 - ms8607 temperature, pressure and humidty sensor
 - ms5637 temperature and pressure sensor
 - htu21 temperature and humidity sensor
 - tsys02d temperature sensor
 - tsys01 temperature sensor

Cleanups
* tree wide.
 - squish cases where irq 0 is still considered valid.
* apds9960
 - sparse endian warning cleanups by making endianness explicit.
* ad5504
 - leave group naming to the core.
* ad7746
 - cleanup comment style.
 - drop an unnecessary bit of dev_info
 - add some appropriate uses of the BIT macro.
* ad799x
 - leave group naming to the core.
* hdc100x - introduced this cycle,.
 - fix a wrong offset value.
* lidar
 - add missing MODULE_DEVICE_TABLE for dt.
* max1363
 - leave sysfs group naming to the core.
* m62332 got the Harmut treatment and as ever he found a 'few' bits the
  rest of us had missed!
 - Share scale and offset attributes across channels.
 - Shutdown the device on driver remove
 - Use ARRAY_SIZE rather than a hard coded count for channels.
 - Return more directly in the write_raw callback dropping a local variable
   along the way.
 - a few style issues
 - move to reading the regulator voltage for each use allowing for dynamic
   regulators.  This is a common feature across drivers so we might end
   up with more fixes throughout the tree for this.
* mlx96014 - introduced this cycle.
 - fixed up a spot of error handling.
* vz89x - introduced this cycle.
 - work around a hardware quirk.

9 years agoStaging: skein: Remove NULL comparison
Aybuke Ozdemir [Tue, 13 Oct 2015 20:55:07 +0000 (23:55 +0300)]
Staging: skein: Remove NULL comparison

Problem found using checkpatch.pl
CHECK: Comparison to NULL could be written "key"

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: wilc1000: wilc_wlan_cfg: Remove unnecessary cast
Shivani Bhardwaj [Tue, 13 Oct 2015 20:53:40 +0000 (02:23 +0530)]
Staging: wilc1000: wilc_wlan_cfg: Remove unnecessary cast

Remove a cast which is not required.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: wilc1000: host_interface: Remove extra NULL test
Shivani Bhardwaj [Tue, 13 Oct 2015 20:32:11 +0000 (02:02 +0530)]
Staging: wilc1000: host_interface: Remove extra NULL test

Remove a NULL test on variable hif_drv as it is already preceded by one.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: wilc1000: Use kzalloc instead of kmalloc and memset
Shraddha Barke [Tue, 13 Oct 2015 17:37:00 +0000 (23:07 +0530)]
Staging: wilc1000: Use kzalloc instead of kmalloc and memset

Replace kmalloc and memset with a single call to kzalloc.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years ago"drivers/staging: mark android/ion fcns with EXPORT_SYMBOL for tristate
Paul Gortmaker [Tue, 13 Oct 2015 20:46:53 +0000 (16:46 -0400)]
"drivers/staging: mark android/ion fcns with EXPORT_SYMBOL for tristate

In a recent change, we made a bool into a tristate in:
"drivers/staging: make android tegra_ion.c properly tristate", since it
was self evident that was the original intention.  However on the final
link phase we'll see an allmodconfig fail with:

ERROR: "ion_device_add_heap" [drivers/staging/android/ion/tegra/tegra_ion.ko] undefined!
ERROR: "ion_heap_create" [drivers/staging/android/ion/tegra/tegra_ion.ko] undefined!
ERROR: "ion_device_create" [drivers/staging/android/ion/tegra/tegra_ion.ko] undefined!
ERROR: "ion_heap_destroy" [drivers/staging/android/ion/tegra/tegra_ion.ko] undefined!
ERROR: "ion_device_destroy" [drivers/staging/android/ion/tegra/tegra_ion.ko] undefined!

Export the above using the non GPL specific export, since that is what
the rest of the ion code base does.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Markus Elfring <elfring@users.sourceforge.net>
Cc: devel@driverdev.osuosl.org
Cc: linux-tegra@vger.kernel.org
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: access screen buffer directly
Lars Svensson [Wed, 7 Oct 2015 07:20:14 +0000 (09:20 +0200)]
staging: fbtft: access screen buffer directly

In fbtft-bus.c:fbtft_write_vmem16_bus9(), ioread8() is used for
accessing the provided screen array. Since screen_buffer actually
points to an ordinary buffer, instead access it directly.

Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: use alternate screen pointer
Lars Svensson [Wed, 7 Oct 2015 07:20:13 +0000 (09:20 +0200)]
staging: fbtft: use alternate screen pointer

Member screen_base in struct fb_info is declared with __iomem
qualifier causing sparse warnings when used as a regular ponter.
To avoid the warnings, instead use alternate non-__iomem pointer,
screen_buffer, troughout the driver.

Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agofb.h: Provide alternate screen_base pointer
Lars Svensson [Wed, 7 Oct 2015 07:20:12 +0000 (09:20 +0200)]
fb.h: Provide alternate screen_base pointer

Some drivers use member screen_base of struct fb_info to store non-
__iomem pointers, creating the need for ugly __force typecasts to
avoid sparse warnings. This adds an alternate pointer without the
__iomem qualifyer for this use.

Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: add support for C-Berry28 display
Dennis Menschel [Wed, 7 Oct 2015 20:15:46 +0000 (22:15 +0200)]
staging: fbtft: add support for C-Berry28 display

This patch adds support for the C-Berry28, a small 2.8" color display
with a resolution of 320x240 pixels from admatec for the Raspberry Pi.
It uses the Sitronix ST7789V display controller along with a custom
init sequence and custom gamma curves.

Signed-off-by: Dennis Menschel <menschel-d@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: add support for ST7789V display controller
Dennis Menschel [Wed, 7 Oct 2015 20:15:45 +0000 (22:15 +0200)]
staging: fbtft: add support for ST7789V display controller

This patch adds support for the Sitronix ST7789V display controller.
The controller is intended for small color displays with a resolution
of up to 320x240 pixels.

Signed-off-by: Dennis Menschel <menschel-d@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agortl8192u: BIT() macro cleanup
Anish Bhatt [Tue, 13 Oct 2015 04:02:36 +0000 (21:02 -0700)]
rtl8192u: BIT() macro cleanup

Use the BIT(x) macro directly instead using multiple
BITX defines.

Signed-off-by: Anish Bhatt <anish@gatech.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedidev.h: spaces preferred around that '*'
Ian Abbott [Mon, 12 Oct 2015 17:03:25 +0000 (18:03 +0100)]
staging: comedi: comedidev.h: spaces preferred around that '*'

Fix the checkpatch.pl issues:

CHECK: spaces preferred around that '*' (ctx:VxV)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedidev.h: add comments to spin-lock and mutex
Ian Abbott [Mon, 12 Oct 2015 17:03:24 +0000 (18:03 +0100)]
staging: comedi: comedidev.h: add comments to spin-lock and mutex

Fix the checkpatch.pl issues:

CHECK: spinlock_t definition without comment
CHECK: struct mutes definition withoug comment

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: check for more errors for zero-length read
Ian Abbott [Mon, 12 Oct 2015 16:21:29 +0000 (17:21 +0100)]
staging: comedi: check for more errors for zero-length read

If the "read" file operation handler, `comedi_read()` is passed 0 for
the amount to read, some error conditions are currently skipped and the
function just returns 0.  Change it to check those error conditions and
return an error value if appropriate.  The trickiest case is the check
for when the previously set up asynchronous command has terminated with
an error.  In that case, `-EPIPE` is returned (as it is for a read of
non-zero length) and the subdevice gets marked as non-busy.

A zero-length read that returns 0 has no other effects, in particular,
it does not cause the subdevice to be marked as non-busy, and the return
value does not indicate an "end-of-file" condition.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: simplify returned errors for comedi_read()
Ian Abbott [Mon, 12 Oct 2015 16:21:28 +0000 (17:21 +0100)]
staging: comedi: simplify returned errors for comedi_read()

In order to perform a "read" file operation, an asynchronous COMEDI
command in the "read" direction needs to have been set up by the current
file object on the COMEDI "read" subdevice associated with the file
object.  If there is a "read" subdevice, but a command has not been set
up by the file object (or is has been set-up in the wrong direction),
`comedi_read()` currently returns one of two error values `-EINVAL` or
`-EACCES`.  `-EACCES` is returned if the command was set up by a
different subdevice, or somewhat randomly, if a COMEDI "instruction" is
currently being processed.  `-EINVAL` is returned in other cases.
Simplify it by returning `-EINVAL` for all these cases.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: return error on "read" if no command set up
Ian Abbott [Mon, 12 Oct 2015 16:21:27 +0000 (17:21 +0100)]
staging: comedi: return error on "read" if no command set up

The "read" file operation handler, `comedi_read()` returns an error for
pretty much any condition that prevents a "read" going ahead.  One of
the conditions that prevents a "read" going ahead is that no
asynchronous command has been set up, but that currently results in a
return value of 0 (unless COMEDI instructions are being processed or an
asynchronous command has been set up by a different file object).
Change it to return `-EINVAL` in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: remove superfluous retval = 0 in comedi_read()
Ian Abbott [Mon, 12 Oct 2015 16:21:26 +0000 (17:21 +0100)]
staging: comedi: remove superfluous retval = 0 in comedi_read()

`comedi_read()` initializes `retval` to 0.  The other `retval = 0`
assignments are superfluous, so remove them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: allow buffer wraparound in comedi_read()
Ian Abbott [Mon, 12 Oct 2015 16:21:25 +0000 (17:21 +0100)]
staging: comedi: allow buffer wraparound in comedi_read()

`comedi_read()` copies data from the acquisition data buffer, which is
cyclic, to the user buffer using a single call to `copy_to_user()`.  It
currently avoids having to deal with wraparound of the cyclic buffer by
limiting the amount it copies (and the amount returned to the user).
Change it to deal with the wraparound using two calls to
`copy_to_user()` if necessary.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: avoid bad truncation of a size_t in comedi_read()
Ian Abbott [Mon, 12 Oct 2015 16:21:24 +0000 (17:21 +0100)]
staging: comedi: avoid bad truncation of a size_t in comedi_read()

At one point in `comedi_read()`, the variable `n` gets assigned to the
minimum of the parameter `nbytes` and the amount of readable buffer
space `m`.  The way that is done currently is unsafe in the unlikely
case that `nbytes` exceeds `UINT_MAX`, so fix it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: make some variables unsigned in comedi_read()
Ian Abbott [Mon, 12 Oct 2015 16:21:23 +0000 (17:21 +0100)]
staging: comedi: make some variables unsigned in comedi_read()

In `comedi_read()`, the `n` and `m` variables are of type `int`.  Change
them to `unsigned int` as they are used to measure a positive number of
bytes.  The `count` variable is also of type `int` and holds the
returned number of bytes.  Change it to type `ssize_t` to match the
function's return type.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: do extra checks for becoming non-busy for "read"
Ian Abbott [Mon, 12 Oct 2015 16:21:22 +0000 (17:21 +0100)]
staging: comedi: do extra checks for becoming non-busy for "read"

`comedi_read()` is the handler for the "read" file operation for COMEDI
devices.  It mostly runs without using the main mutex of the COMEDI
device, but uses the `attach_lock` rwsemaphore to protect against the
COMEDI device becoming "detached".  A file object can read data
resulting from a COMEDI asynchonous command if it initiated the command.
The COMEDI subdevice is marked as busy when the command is started.  At
some point, the "read" handler detects that the command has terminated
and all available data has been read and so marks the subdevice as
non-busy.

In order to mark the subdevice as non-busy, the "read" handler needs to
release the `attach_lock` rwsemaphore and `acquire the main `mutex`.
There is a vulnerable point between the two, so it checks that the
device is still attached after acquiring the mutex.  However, it does
not currently check that the conditions for becoming non-busy still
hold.  Add some more checks that the subdevice is still busy with a
command initiated by the same file object, that command is in the correct
direction (in case the subdevice supports both "read" and "write"), that
command has terminated, and has no data available to be read.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: don't consider "unmunged" data when becoming non-busy
Ian Abbott [Mon, 12 Oct 2015 16:21:21 +0000 (17:21 +0100)]
staging: comedi: don't consider "unmunged" data when becoming non-busy

If an asynchronous "read" command is no longer running but the subdevice
is still busy, it becomes non-busy once there is no more data available
in the buffer.  Some or all of the data written to the buffer might not
have been "munged" yet, and it cannot be read until it has been munged
by the writer.  However, since the command is no longer running, we
cannot expect any remaining unmunged data to get munged so we should
ignore it.  Call `comedi_buf_read_n_available()` to check the amount of
munged data available to be read, replacing the call to
`comedi_buf_n_bytes_ready()` which checked the amount of written (but
possibly not yet munged) data available to be read.  This affects both
the "read" file operation (done in `comedi_read()`) and the
`COMEDI_BUFINFO` ioctl handling (done in `do_bufinfo_ioctl()`).  (The
latter is used when data is transferred directly through the mmapped
buffer instead of via the "read" file operation.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: remain busy until read end-of-file
Ian Abbott [Mon, 12 Oct 2015 16:21:20 +0000 (17:21 +0100)]
staging: comedi: remain busy until read end-of-file

If a COMEDI subdevice is busy handling an asynchronous command in the
"read" direction, then after the command has terminated itself, the
"read" file operation handler, `comedi_read()` should keep the subdevice
busy until all available data has been read and it has returned 0 to
indicate an "end-of-file" condition.  Currently, it has a bug where it
can mark the subdevice as non-busy even when returning a non-zero count.
The bug is slightly hidden because the next "read" will return 0 because
the subdevice is no longer busy.  Fix it by checking the return count is
0 before deciding to mark the subdevice as non-busy.

The call to `comedi_is_subdevice_idle()` is superfluous as the
`become_nonbusy` variable will have been set to `true` when considering
becoming non-busy.  Strictly speaking, checking the return count is
superfluous too, as `become_nonbusy` doesn't get set to `true` unless
the count is 0, but check the return count anyway to make the intention
clearer.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: don't use mutex when polling file
Ian Abbott [Fri, 9 Oct 2015 11:26:52 +0000 (12:26 +0100)]
staging: comedi: don't use mutex when polling file

The main mutex in a comedi device can get held for quite a while when
processing comedi instructions, so for performance reasons, the "read"
and "write" file operations do not use it; they use use the
`attach_lock` rwsemaphore to protect against the comedi device becoming
detached at an inopportune moment.  Do the same for the "poll" file
operation.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: check command started by file being polled
Ian Abbott [Fri, 9 Oct 2015 11:26:51 +0000 (12:26 +0100)]
staging: comedi: check command started by file being polled

Currently, the "poll" file operation checks if an asynchronous "read"
(or "write" command is active on the "read" (or "write" subdevice, but
does not consider whether the command was started from the file object
being polled.  Since that is the only file object able to read (or
write) data, take it into consideration.

With this change, if no read (or write) command is running on the
subdevice, or it is started by a different file object, the file object
is marked as readable (or writeable) regardless, but the read (or write)
file operation will return an error.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: don't allocate buffer space when polling for write
Ian Abbott [Fri, 9 Oct 2015 11:26:50 +0000 (12:26 +0100)]
staging: comedi: don't allocate buffer space when polling for write

When handling the "poll" file operation and checking for `POLLOUT`,
don't allocate space from the buffer for writing, just check that space
is available for writing.  That check is done after checking that an
asynchronous "write" command is running on the subdevice.  Allocating
the buffer space before checking a "write" command is running can cause
problems if the subdevice supports commands in either direction and
currently has an active "read" command.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: add new comedi_buf_write_n_available()
Ian Abbott [Fri, 9 Oct 2015 11:26:49 +0000 (12:26 +0100)]
staging: comedi: add new comedi_buf_write_n_available()

Add a new function `comedi_buf_write_n_available()` to return the amount
of buffer space available for writing, including space already allocated
by `comedi_buf_write_alloc()` plus any unallocated space available.
This is currently just for internal use by the comedi core, so is not
exported.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: rename comedi_buf_write_n_available
Ian Abbott [Fri, 9 Oct 2015 11:26:48 +0000 (12:26 +0100)]
staging: comedi: rename comedi_buf_write_n_available

Rename the local function `comedi_buf_write_n_available()` to
`comedi_buf_write_n_unalloc()`.  It is the amount of unallocated space
available in the buffer that is available to be allocated for writing
and does not include the space that has already been allocated for
writing.  This is unlike the exported function
`comedi_buf_read_n_available()` which includes the space available to be
allocated for reading plus the space already allocated for reading.  The
new name breaks the unintentional naming symmetry (and also clears the
way for the old name to be reused for a new function).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: don't poll_wait on same subdevice twice
Ian Abbott [Fri, 9 Oct 2015 11:26:47 +0000 (12:26 +0100)]
staging: comedi: don't poll_wait on same subdevice twice

Comedi subdevices that support asynchronous acquisition commands have a
wait queue head used for blocking reads or writes and for the poll file
operation.  The comedi device may have several subdevices that support
"read" and/or "write" commands, but each open file object has at most
one "read" subdevice and one "write" subdevice.  It's possible (though
rare) for those to be the same subdevice if the subdevice supports
commands in either direction.  In that case, the "poll" file operation
doesn't really need to do a `poll_wait()` on the same subdevice twice.
Although harmless, it wastes a poll table entry.  Check for that, and
avoid it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: cb_das16_cs: rename private data member 'status[12]'
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:11 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: rename private data member 'status[12]'

For aesthetics, rename these private data members to match the registers
they are associated with.

Signed-off-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: cb_das16_cs: mode analog output comment
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:10 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: mode analog output comment

For aesthetics, move this comment to follow the format of the other
subdevices.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: cb_das16_cs: the DAC16/16-AO only has 4 digital I/O
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:09 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: the DAC16/16-AO only has 4 digital I/O

The PC-CARD DAS16/16-AO board only has 4 digital I/O channels. The other
boards supported by this driver have 8. Add the boardinfo to correctly
initialize 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: cb_das16_cs: hookup 8254 counter subdevice
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:08 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: hookup 8254 counter subdevice

The hardware has an 8254 counter/timer to provide a pacer clock using
counters 1 and 2. Counter 0 is available to the user.

Hook up the subdevice support to allow the user to use counter 0.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: cb_das16_cs: tidy up analog input subdevice init
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:07 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: tidy up analog input subdevice init

This driver currently code not support async commands. Remove the
SDF_CMD_READ subdev_flag and len_chanlist initialization from the
subdevice init.

For aesthetics, rename the (*insn_read) function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: cb_das16_cs: refactor 'n_ao_chans' boardinfo
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:06 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: refactor 'n_ao_chans' boardinfo

Only one of the boards supported by this driver has analog outputs.
For aesthetics, change the 'n_ao_chans' member of the boardinfo into
a bit-field flag 'has_ao'.

Signed-off-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: cb_das16_cs: define the misc1 and misc2 register bits
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:05 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: define the misc1 and misc2 register bits

Define the bits in these registers and use them to remove the "magic"
values in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: cb_das16_cs: fix ai mux register programming
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:04 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: fix ai mux register programming

The ai mux register is used program the hi/lo channels in a scan.
According to the user manual, the hi and lo channels should be
the same  to sample one channel.

Introduce some macros to set the appropriate bits in the ai mux
register and fix the ai (*insn_read).

Signed-off-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: cb_das16_cs: rename register map defines
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:03 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: rename register map defines

For aesthetics, add _REG to all the register map offsets and convert
the values to hex.

Signed-off-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: cb_das16_cs: tidy up multi-line comments
H Hartley Sweeten [Mon, 12 Oct 2015 23:07:02 +0000 (16:07 -0700)]
staging: comedi: cb_das16_cs: tidy up multi-line comments

Reformat the multi-line comments in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: aio_aio12_8: tidy up digital I/O subdevice init
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:38 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: tidy up digital I/O subdevice init

For aesthetics, move and reword the comment to follow the format of
the other subdevices.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
CC: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: aio_aio12_8: rename 'aio_ao12_8' boardinfo
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:37 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: rename 'aio_ao12_8' boardinfo

This board name is incorrect. The proper name is 104-AO12-4.

Change the boardinfo name to 'aio_aio12_4' to follow the format of
the other boardtypes.

Signed-off-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: aio_aio12_8: refactor boardininfo
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:36 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: refactor boardininfo

This driver supports three board types with these differences:
  104-AIO12-8 - eight 12-bit analog in, four 12-bit analog out
  104-AI12-8  - eight 12-bit analog in
  104-AO12-4  - four 12-bit analog out

Convert the boardinfo 'ai_nchan' and 'ao_nchan' into bit-field
flags 'has_ai' and 'has_ao' so save a bit of space.

Signed-off-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: aio_aio12_8: fix ai (*insn_read)
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:35 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: fix ai (*insn_read)

According to the user manual, analog input bipolar data is 2's
complement and unipolar is straight binry. Use the core helpers
to munge the data appropriately.

Signed-off-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: aio_aio12_8: analog outputs are single-ended
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:34 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: analog outputs are single-ended

The analog outputs are all single-ended. Remove the SDF_DIFF
subdev_flag from the subdevice initialization.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: aio_aio12_8: move comedi_lrange definition
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:33 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: move comedi_lrange definition

For aesthetics, move the comedi_lrange definition used in this driver
to the follow the norm in comedi drivers and rename the variable.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: aio_aio12_8: hookup 8254 counter/timer
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:32 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: hookup 8254 counter/timer

This board has an industry-standard 8254 chip with the gate, clock,
and output pins for each counter available on the connector.

Hookup the 8254 counter as a comedi subdevice.

Provice an (*insn_config) for the user to query the clock source
for each channel.

Signed-off-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: aio_aio12_8: update MODULE_DESCRIPTION
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:31 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: update 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: aio_aio12_8: tidy up multi-line comments
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:30 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: tidy up multi-line comments

Reformat the multi-line comments in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: aio_aio12_8: prefer using the BIT macro
H Hartley Sweeten [Mon, 12 Oct 2015 19:16:29 +0000 (12:16 -0700)]
staging: comedi: aio_aio12_8: prefer using the BIT macro

As suggested by checkpatch.pl, use the BIT macro to define the
register bits.

Signed-off-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 private data member 'ai_et_MuxVal'
H Hartley Sweeten [Mon, 12 Oct 2015 18:01:35 +0000 (11:01 -0700)]
staging: comedi: adv_pci1710: rename private data member 'ai_et_MuxVal'

Rename thie CamelCase member of the private data. Add a comment in
the interrupt handler to clarify why the channel interval is updated
again.

Signed-off-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_* register defines
H Hartley Sweeten [Mon, 12 Oct 2015 18:01:34 +0000 (11:01 -0700)]
staging: comedi: adv_pci1710: tidy up PCI1720_* register defines

The PCI-1720 board is supported by this driver but uses a different
register map. For aesthetics, rename the defines to match the
PCI171X_* format.

Signed-off-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 remaining PCI171x_* registers
H Hartley Sweeten [Mon, 12 Oct 2015 18:01:33 +0000 (11:01 -0700)]
staging: comedi: adv_pci1710: tidy up remaining PCI171x_* registers

Rename these CamelCase defines.

Signed-off-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 control register and bits
H Hartley Sweeten [Mon, 12 Oct 2015 18:01:32 +0000 (11:01 -0700)]
staging: comedi: adv_pci1710: tidy up control register and bits

Rename the CamelCase and use the BIT macro to define the bits.
Also, rename the associated CamelCase members of the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci1710: tidy up status register and bits
H Hartley Sweeten [Mon, 12 Oct 2015 18:01:31 +0000 (11:01 -0700)]
staging: comedi: adv_pci1710: tidy up status register and bits

Rename the CamelCase and use the BIT macro to define the bits.

Signed-off-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 multi-line comments
H Hartley Sweeten [Mon, 12 Oct 2015 18:01:30 +0000 (11:01 -0700)]
staging: comedi: adv_pci1710: tidy up multi-line comments

Reformat the multi-line comments in the kernel CodingStyle. And
refactor them to follow the normal format for comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adl_pci9111: fix alignment issue
H Hartley Sweeten [Mon, 12 Oct 2015 17:42:32 +0000 (10:42 -0700)]
staging: comedi: adl_pci9111: fix alignment issue

Use a local variable for the 'devpriv->ai_bounce_buffer' to shorten
the lines in pci9111_handle_fifo_half_full() and gix the checkpath.pl
issue about:

CHECK: Alignment should match open parenthesis

Signed-off-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: adl_pci9111: rename CamelCase parameters
H Hartley Sweeten [Mon, 12 Oct 2015 17:42:31 +0000 (10:42 -0700)]
staging: comedi: adl_pci9111: rename CamelCase parameters

Rename the CamelCase parameters of plx9050_interrupt_control().

Signed-off-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: adl_pci9111: tidy up multi-line comments
H Hartley Sweeten [Mon, 12 Oct 2015 17:42:30 +0000 (10:42 -0700)]
staging: comedi: adl_pci9111: tidy up multi-line comments

Reformat the multi-line comments in the kernel CodingStyle.

Remove the unnecessary CHANGELOG information, git provided this
better.

Signed-off-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: adl_pci9111: define a macro for the ai range bits
H Hartley Sweeten [Mon, 12 Oct 2015 17:42:29 +0000 (10:42 -0700)]
staging: comedi: adl_pci9111: define a macro for the ai range bits

For aesthetics, define a macro to set the analog input range bits.

Signed-off-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: adl_pci9111: prefer using the BIT macro
H Hartley Sweeten [Mon, 12 Oct 2015 17:42:28 +0000 (10:42 -0700)]
staging: comedi: adl_pci9111: prefer using the BIT macro

As suggested by checkpatch.pl, use the BIT macro to define the
register bits.

Signed-off-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: lustre: add a blank line after function/struct/union/enum declarations
Mike Rapoport [Tue, 13 Oct 2015 13:03:42 +0000 (16:03 +0300)]
staging: lustre: add a blank line after function/struct/union/enum declarations

Fixes checkpatch.pl CHECK:LINE_SPACING: Please use a blank line after
function/struct/union/enum declarations

The patch is generated using checkpatch.pl --fix-inplace:

for f in $(find drivers/staging/lustre/ -type f) ; do
    ./scripts/checkpatch.pl --types "LINE_SPACING" --fix-inplace -f $f
done

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: remove multiple blank lines
Mike Rapoport [Tue, 13 Oct 2015 13:03:41 +0000 (16:03 +0300)]
staging: lustre: remove multiple blank lines

Fixes checkpatch.pl CHECK:LINE_SPACING: Please don't use multiple blank
lines.

The patch is generated using checkpatch.pl --fix-inplace:

for f in $(find drivers/staging/lustre/ -type f) ; do
    ./scripts/checkpatch.pl --types "LINE_SPACING" --test-only=multiple \
    --fix-inplace  -f $f
done

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: add missing blank line after declarations
Mike Rapoport [Tue, 13 Oct 2015 13:03:40 +0000 (16:03 +0300)]
staging: lustre: add missing blank line after declarations

Fixes checkpatch.pl WARNING:LINE_SPACING: Missing a blank line after
declarations.
The patch is generated using checkpatch.pl --fix-inplace:

for f in $(find drivers/staging/lustre/ -type f) ; do
    ./scripts/checkpatch.pl --types "LINE_SPACING" --test-only=Missing \
    --fix-inplace -f $f
done

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8723au: Use snprintf instead rsprintf
Ksenija Stanojevic [Tue, 13 Oct 2015 17:09:21 +0000 (19:09 +0200)]
Staging: rtl8723au: Use snprintf instead rsprintf

Macro rsprintf is useless, remove it and use existing function
snprintf instead.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: dt9812: Use mutex instead of semaphore
Ksenija Stanojevic [Tue, 13 Oct 2015 17:08:03 +0000 (19:08 +0200)]
Staging: comedi: dt9812: Use mutex instead of semaphore

Replace binary semaphore with mutex. Mutex also gives better performance
than semaphore.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: lov: Remove unused #include header file
Shraddha Barke [Tue, 13 Oct 2015 16:50:28 +0000 (22:20 +0530)]
Staging: lustre: lov: Remove unused #include header file

Remove lclient.h header since it is not used.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: most: Remove exceptional & on function name
Shraddha Barke [Tue, 13 Oct 2015 15:37:49 +0000 (21:07 +0530)]
Staging: most: Remove exceptional & on function name

In this file, function names are otherwise used as pointers without &.

A simplified version of the Coccinelle semantic patch that makes this
change is as follows:

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Remove exceptional & on function name
Shraddha Barke [Tue, 13 Oct 2015 15:37:48 +0000 (21:07 +0530)]
Staging: iio: Remove exceptional & on function name

In this file, function names are otherwise used as pointers without &.

A simplified version of the Coccinelle semantic patch that makes this
change is as follows:

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: Remove exceptional & on function name
Shraddha Barke [Tue, 13 Oct 2015 15:37:47 +0000 (21:07 +0530)]
Staging: comedi: Remove exceptional & on function name

n this file, function names are otherwise used as pointers without &.

A simplified version of the Coccinelle semantic patch that makes this
change is as follows:

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: Remove useless cast on void pointer
Amitoj Kaur Chawla [Tue, 13 Oct 2015 13:21:10 +0000 (18:51 +0530)]
staging: lustre: llite: Remove useless cast on void pointer

The semantic patch used to find this is:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: Remove useless cast on void pointer
Amitoj Kaur Chawla [Tue, 13 Oct 2015 13:20:18 +0000 (18:50 +0530)]
staging: lustre: llite: Remove useless cast on void pointer

The semantic patch used to find this is:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: wilc1000: wilc_wlan: Remove unnecessary cast
Shivani Bhardwaj [Tue, 13 Oct 2015 11:34:48 +0000 (17:04 +0530)]
Staging: wilc1000: wilc_wlan: Remove unnecessary cast

Remove cast which is not required.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: wilc1000: wilc_wfi_cfgoperations: Remove unused code
Shivani Bhardwaj [Tue, 13 Oct 2015 09:48:38 +0000 (15:18 +0530)]
Staging: wilc1000: wilc_wfi_cfgoperations: Remove unused code

Remove the declaration, initialization and statement having a
variable that is not used anywhere in the code.
Semantic patch used:

@@
type T;
identifier i;
constant C;
position p != e.p;
@@

- T i@p;
  <+... when != i
- i = C;
  ...+>

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename u32Length of struct rcvd_net_info
Leo Kim [Tue, 13 Oct 2015 11:02:11 +0000 (20:02 +0900)]
staging: wilc1000: rename u32Length of struct rcvd_net_info

This patch renames u32Length of struct rcvd_net_info to len to
avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename pu8Buffer of struct rcvd_net_info
Leo Kim [Tue, 13 Oct 2015 11:02:10 +0000 (20:02 +0900)]
staging: wilc1000: rename pu8Buffer of struct rcvd_net_info

This patch renames pu8Buffer of struct rcvd_net_info to buffer to
avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename au8IPAddr of struct set_ip_addr
Leo Kim [Tue, 13 Oct 2015 11:02:09 +0000 (20:02 +0900)]
staging: wilc1000: rename au8IPAddr of struct set_ip_addr

This patch renames au8IPAddr of struct set_ip_addr to ip_addr to
avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename u32Timeout of struct power_mgmt_param
Leo Kim [Tue, 13 Oct 2015 11:02:08 +0000 (20:02 +0900)]
staging: wilc1000: rename u32Timeout of struct power_mgmt_param

This patch renames u32Timeout of struct power_mgmt_param to timeout to
avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wilc1000: rename bIsEnabled of struct power_mgmt_param
Leo Kim [Tue, 13 Oct 2015 11:02:07 +0000 (20:02 +0900)]
staging: wilc1000: rename bIsEnabled of struct power_mgmt_param

This patch renames bIsEnabled of struct power_mgmt_param to enabled to
avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>