platform/kernel/linux-rpi.git
7 years agostaging: unisys: visorbus: combine response functions into a single one
David Kershner [Tue, 18 Apr 2017 20:55:01 +0000 (16:55 -0400)]
staging: unisys: visorbus: combine response functions into a single one

There are several different controlvm response functions, consolidate them
to one so we can simplify error handling.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix enumeration tags
Tobin C. Harding [Thu, 27 Apr 2017 01:25:27 +0000 (11:25 +1000)]
staging: ks7010: fix enumeration tags

Driver header declares enumeration types without tags. Using
informative tags makes the code easier to understand and
eliminates the need to comment the enum.

Add tags to enumeration types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add enum multicast_filter_type
Tobin C. Harding [Thu, 27 Apr 2017 01:25:26 +0000 (11:25 +1000)]
staging: ks7010: add enum multicast_filter_type

Driver uses preprocessor directives to define multicast filter
constants. These can be defined using an enumeration type. Doing so
adds to the readability and gives the assists the compiler.

Add enumeration type multicast_filter_type to replace preprocessor
defined constants.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean up macro ps_confirm_wait_inc
Tobin C. Harding [Thu, 27 Apr 2017 01:25:25 +0000 (11:25 +1000)]
staging: ks7010: clean up macro ps_confirm_wait_inc

Macro includes commented out code. Removing dead code line enables
braces to be removed. Macro is easier to read if the code is clean.

Clean up macro ps_confirm_wait_inc.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: continue from loop on unmatched mac
Tobin C. Harding [Thu, 27 Apr 2017 01:25:24 +0000 (11:25 +1000)]
staging: ks7010: continue from loop on unmatched mac

Inside loop, code block is guarded with an 'if' statement. Instead of
guarding the block we can invert the 'if' statement conditional and
continue the loop. Doing so allows subsequent code indentation to be
reduced and aids the readability of the code.

Invert 'if' statement conditional, continue loop if new conditional
evaluates to true. Reduce subsequent code indentation level. Do not
change program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove cast from netdev_priv()
Tobin C. Harding [Thu, 27 Apr 2017 01:25:23 +0000 (11:25 +1000)]
staging: ks7010: remove cast from netdev_priv()

The returned pointer from netdev_priv() (void *) does not need to be
cast.

Remove unnecessary cast of void * returned by netdev_priv().

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: make abbreviation mgmt uniform
Tobin C. Harding [Thu, 27 Apr 2017 01:25:22 +0000 (11:25 +1000)]
staging: ks7010: make abbreviation mgmt uniform

Driver currently uses abbreviations 'mgt' and 'mngmt' for
'management'. Also 'power' is sometimes abbreviated to 'pow' and other
times not. It makes the code easier to read and easier to modify if
one abbreviation is used throughout the driver. 'mgmt' is widely
accepted as an abbreviation of 'management'. 'power' can be spelled
out in full, the extra two characters aids readability without an
excessive cost.

Make abbreviation of 'management' uniform across the driver, function
names, preprocessor defined constants, and enumeration types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch LINE_SPACING
Tobin C. Harding [Thu, 27 Apr 2017 01:25:21 +0000 (11:25 +1000)]
staging: ks7010: fix checkpatch LINE_SPACING

Checkpatch emits CHECK: Please don't use multiple blank lines.

Remove multiple blank lines.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add enum sleep_mode_type
Tobin C. Harding [Thu, 27 Apr 2017 01:25:20 +0000 (11:25 +1000)]
staging: ks7010: add enum sleep_mode_type

Driver uses preprocessor directives to define SLP_ASLEEP and
SLP_ACTIVE. These can be defined using an enumeration type. Doing so
adds to the readability and gives the usual compiler benefits of
having an enum. Functions that currently accept integer types can now
use the new enumeration type, further aiding readability.

Add enumeration type sleep_mode_type. Update code that handles sleep
mode to use the new enumeration type.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: abstract connection status
Tobin C. Harding [Thu, 27 Apr 2017 01:25:19 +0000 (11:25 +1000)]
staging: ks7010: abstract connection status

Host interface connection status is handled using a 32 bit type. Top
byte is used as for FORCE_DISCONNECT status, low bits are used for
connect/disconnect status. Driver masks and checks integers to
ascertain status. If functions are defined to do the masking and
equality check then the details of how the status integer is used are
abstracted away. This makes the code easier to read. Also future
updates to the status handling will be easier because the code is in
one place.

Driver currently uses the CONNECT_STATUS and DISCONNECT_STATUS as
values, as apposed to opaque values. Because of this driver code
checks for equality with CONNECT_STATUS and DISCONNECT_STATUS as
apposed to negating a single check (ie 'foo != CONNECT_STATUS). In
order to maintain the current functionality we define two separate
functions is_connect_status() and is_disconnect_status().

Add functions to abstract the status integer check. Update all sites
that do the check manually to use the newly defined functions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add hostif_generic_request()
Tobin C. Harding [Thu, 27 Apr 2017 01:25:18 +0000 (11:25 +1000)]
staging: ks7010: add hostif_generic_request()

Driver contains duplicate code. Host interface has numerous request
functions which allocate memory for a request header. Each request
header is different but all contain, as the first member, a hostif_hdr
structure. This structure has size and event members which need to be
set. By defining a helper function to allocate the memory and set the
initial hostif_hdr members code duplication is reduced.

Add function to allocate  memory for a host interface request. Set
'size' and 'event' members. Remove duplicate code using newly defined
function.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean memory allocation
Tobin C. Harding [Thu, 27 Apr 2017 01:25:17 +0000 (11:25 +1000)]
staging: ks7010: clean memory allocation

Memory allocation code contains unneeded debug statements, failed
kmalloc() calls typically do not require a debug message. Introduction
of a local 'size' variable allows kmalloc() call to be marginally
cleaner, still uses magic numbers but these require a more substantial
fix. Moving the magic numbers onto a single line opens the way for
further refactoring.

Clean memory allocation code, remove debug statements.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove duplicate code
Tobin C. Harding [Thu, 27 Apr 2017 01:25:16 +0000 (11:25 +1000)]
staging: ks7010: remove duplicate code

Current switch statement has duplicate code in branches. This code can
be put after the switch statement so as to remove the duplication.

Move code to after switch statement, remove duplicate code. Make error
branch return so as not to execute the moved code block. Do not change
the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove magic numbers
Tobin C. Harding [Thu, 27 Apr 2017 01:25:15 +0000 (11:25 +1000)]
staging: ks7010: remove magic numbers

Driver includes magic numbers. Defining constants or using existing
constants aids the readability of the code.

Magic number '12' is used for two ethernet addresses (6 bytes
each). ETH_ALEN is already defined within the kernel to 6. We can us
the expression '2 * ETH_ALEN' to make this code explicit.

Magic number '20' refers to the data size, in bytes, of a struct
ether_hdr (described in eap_packet.h). We can define a constant for
this purpose, making the code explicit and easier to read.

Define constant. Remove magic numbers, using newly defined constant
and/or expression using existing kernel constant.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move skb null check near allocation
Tobin C. Harding [Thu, 27 Apr 2017 01:25:14 +0000 (11:25 +1000)]
staging: ks7010: move skb null check near allocation

Currently, after allocating an sk_buff, driver fills the sk_buff
within code block guarded by a NULL check on the sk_buff. If a NULL
check is done immediately after the allocation, and code returns on
error, then the subsequent code need not be guarded and the level of
indentation may be reduced. This aids the readability of the code and
makes explicit the error path.

Check for NULL directly after allocating the sk_buff, return if
allocation fails. Reduce indentation of subsequent code. Do not change
the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused local variable eap_key
Tobin C. Harding [Thu, 27 Apr 2017 01:25:13 +0000 (11:25 +1000)]
staging: ks7010: remove unused local variable eap_key

Code declares and assigns to a local variable that is never used, it
can be safely removed.

Remove unused local variable.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unnecessary address check
Tobin C. Harding [Thu, 27 Apr 2017 01:25:12 +0000 (11:25 +1000)]
staging: ks7010: remove unnecessary address check

Currently source and destination ethernet addresses are checked twice,
once in hostif_data_indication() and then again in
hostif_data_indication_wpa(). The second of these functions is called
from the first right after the address check is done. This check is a
duplicate and is unnecessary.

Remove unnecessary duplicate address check.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: remove void function return
Valentin Vidic [Wed, 26 Apr 2017 10:48:31 +0000 (12:48 +0200)]
staging: lustre: remove void function return

All statements removed from the end of void functions
as reported by checkpatch.

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove whitespace before quoted newline
Paolo Cretaro [Tue, 25 Apr 2017 20:14:29 +0000 (22:14 +0200)]
staging: android: ion: Remove whitespace before quoted newline

Fix checkpatch.pl warning about unnecessary whitespace before a
quoted newline.

Signed-off-by: Paolo Cretaro <melko@frugalware.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: most: aim-sound style fixess
Dhananjay Balan [Mon, 24 Apr 2017 13:54:05 +0000 (15:54 +0200)]
staging: most: aim-sound style fixess

Replace hardcoded function name with __func__

Signed-off-by: Dhananjay Balan <mail@dbalan.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Replace spaces with tabs for indentation
Paolo Cretaro [Fri, 21 Apr 2017 22:47:59 +0000 (00:47 +0200)]
staging: android: ion: Replace spaces with tabs for indentation

Fix checkpatch ERRORs: code indent should use tabs where possible.

Signed-off-by: Paolo Cretaro <melko@frugalware.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: speakup: add send_xchar and tiocmset methods
Okash Khawaja [Sat, 22 Apr 2017 08:00:28 +0000 (09:00 +0100)]
staging: speakup: add send_xchar and tiocmset methods

This adds two methods to spk_synth struct: send_xchar and tiocmset, and
creates serial implementation for each of them. It takes existing code
in apollo, audptr and spkout which already fits the behaviour of
send_xchar and tiocmset. In follow-up patches there will be TTY-based
implementations of these methods. Then migrating the synths to TTY will
include repointing these methods to their TTY implementations

Rest of the changes simply make use of serial implementation of these two
functions.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: addi_apci_3xxx: check return value
Pan Bian [Sun, 23 Apr 2017 09:52:55 +0000 (17:52 +0800)]
staging: comedi: addi_apci_3xxx: check return value

Function pci_ioremap_bar() will return a NULL pointer if there is no
enough memory. However, in function apci3xxx_auto_attach(), the return
value of function pci_ioremap_bar() is not validated. This may result in
NULL dereference in following access to dev->mmio. This patch fixes the
bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: support vm_access_process for mmap'd buffer
Ian Abbott [Thu, 20 Apr 2017 18:05:14 +0000 (19:05 +0100)]
staging: comedi: support vm_access_process for mmap'd buffer

If a process that has mmap'd a COMEDI buffer is being run under a
debugger such as GDB, the buffer contents are inaccessible from the
debugger.  Support the `access()` VM operation to allow the buffer
contents to be accessed by another process.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/android: Update Ion TODO list
Laura Abbott [Tue, 18 Apr 2017 18:27:14 +0000 (11:27 -0700)]
staging/android: Update Ion TODO list

Most of the items have been taken care of by a clean up series. Remove
the completed items and add a few new ones.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Set query return value
Laura Abbott [Tue, 18 Apr 2017 18:27:13 +0000 (11:27 -0700)]
staging: android: ion: Set query return value

This never got set in the ioctl. Properly set a return value of 0 on
success.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Remove ion_handle and ion_client
Laura Abbott [Tue, 18 Apr 2017 18:27:12 +0000 (11:27 -0700)]
staging: android: ion: Remove ion_handle and ion_client

ion_handle was introduced as an abstraction to represent a reference to
a buffer via an ion_client. As frameworks outside of Ion evolved, the dmabuf
emerged as the preferred standard for use in the kernel. This has made
the ion_handle an unnecessary abstraction and prone to race
conditions. ion_client is also now only used internally. We have enough
mechanisms for race conditions and leaks already so just drop ion_handle
and ion_client. This also includes ripping out most of the debugfs
infrastructure since much of that was tied to clients and handles.
The debugfs infrastructure was prone to give confusing data (orphaned
allocations) so it can be replaced with something better if people
actually want it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Drop ion_map_kernel interface
Laura Abbott [Tue, 18 Apr 2017 18:27:11 +0000 (11:27 -0700)]
staging: android: ion: Drop ion_map_kernel interface

Nobody uses this interface externally. Drop it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Rework heap registration/enumeration
Laura Abbott [Tue, 18 Apr 2017 18:27:10 +0000 (11:27 -0700)]
staging: android: ion: Rework heap registration/enumeration

The current model of Ion heap registration  is based on the outdated
model of board files. The replacement for board files (devicetree)
isn't a good replacement for what Ion wants to do. In actuality, Ion
wants to show what memory is available in the system for something else
to figure out what to use. Switch to a model where Ion creates its
device unconditionally and heaps are registed as available regions.
Currently, only system and CMA heaps are converted over to the new
model. Carveout and chunk heaps can be converted over when someone wants
to figure out how.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Collapse internal header files
Laura Abbott [Tue, 18 Apr 2017 18:27:09 +0000 (11:27 -0700)]
staging: android: ion: Collapse internal header files

Ion current has ion_priv.h and ion.h as header files. ion.h was intended
to be used for public APIs but Ion never ended up really having anything
public. Combine the two headers so there is only one internal header.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Get rid of ion_phys_addr_t
Laura Abbott [Tue, 18 Apr 2017 18:27:08 +0000 (11:27 -0700)]
staging: android: ion: Get rid of ion_phys_addr_t

Once upon a time, phys_addr_t was not everywhere in the kernel. These
days it is used enough places that having a separate Ion type doesn't
make sense. Remove the extra type and just use phys_addr_t directly.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Break the ABI in the name of forward progress
Laura Abbott [Tue, 18 Apr 2017 18:27:07 +0000 (11:27 -0700)]
staging: android: ion: Break the ABI in the name of forward progress

Several of the Ion ioctls were designed in such a way that they
necessitate compat ioctls. We're breaking a bunch of other ABIs and
cleaning stuff up anyway so let's follow the ioctl guidelines and clean
things up while everyone is busy converting things over anyway. As part
of this, also remove the useless alignment field from the allocation
structure.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Stop butchering the DMA address
Laura Abbott [Tue, 18 Apr 2017 18:27:06 +0000 (11:27 -0700)]
staging: android: ion: Stop butchering the DMA address

Now that we have proper caching, stop setting the DMA address manually.
It should be set after properly calling dma_map.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Use CMA APIs directly
Laura Abbott [Tue, 18 Apr 2017 18:27:05 +0000 (11:27 -0700)]
staging: android: ion: Use CMA APIs directly

When CMA was first introduced, its primary use was for DMA allocation
and the only way to get CMA memory was to call dma_alloc_coherent. This
put Ion in an awkward position since there was no device structure
readily available and setting one up messed up the coherency model.
These days, CMA can be allocated directly from the APIs. Switch to using
this model to avoid needing a dummy device. This also mitigates some of
the caching problems (e.g. dma_alloc_coherent only returning uncached
memory).

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocma: Introduce cma_for_each_area
Laura Abbott [Tue, 18 Apr 2017 18:27:04 +0000 (11:27 -0700)]
cma: Introduce cma_for_each_area

Frameworks (e.g. Ion) may want to iterate over each possible CMA area to
allow for enumeration. Introduce a function to allow a callback.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocma: Store a name in the cma structure
Laura Abbott [Tue, 18 Apr 2017 18:27:03 +0000 (11:27 -0700)]
cma: Store a name in the cma structure

Frameworks that may want to enumerate CMA heaps (e.g. Ion) will find it
useful to have an explicit name attached to each region. Store the name
in each CMA structure.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'iio-fixes-for-4.11e' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Tue, 18 Apr 2017 17:38:38 +0000 (19:38 +0200)]
Merge tag 'iio-fixes-for-4.11e' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Fifth set of IIO fixes for the 4.11 cycle.

As these are rather late in the cycle, they may sneak over into 4.12.
There is a fix for a regression caused by another fix (hid sensors
hardware seems to vary a lot in how various corner cases are handled).

* ad7303
  - fix channel description. Numeric values were being passed as characters
  presumably leading to garbage from the userspace interface.
* as3935
  - the write data macro was wrong so fix it.
* bmp280
  - incorrect handling of negative values as being unsigned broke humidity
  calculation.
* hid-sensor
  - Restore the poll and hysteresis values after resume as some hardware
  doesn't do it.
* stm32-trigger
  - buglet in reading the sampling frequency

7 years agoMerge tag 'iio-for-4.12d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Tue, 18 Apr 2017 15:13:31 +0000 (17:13 +0200)]
Merge tag 'iio-for-4.12d' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Fourth set of IIO new device support, features and cleanups for the 4.12 cycle

New device support
* max1117, 1118 and 1119
  - new ADC driver
* max9611
  - new ADC driver
* pm8xxx hk/xoadc
  - new driver with some shared features broken out from the SPMI vadc.
* sun4i-gpadc
  - A33 thermal sensor support (with associated rework)
* stm32-dac
  - new driver and bindings
* stm32 trigger
  - enable support of quadrature encoder device and counter modes

Features
* apds9960
  - use the runtime pm for normal suspend
* stm32-adc
  - add opition to sest resolution via devicetree
* xoadc
  - augment DT bindings to deal with some weird mux cases

Cleanups
* ad5933
  - protect direct mode using claim and release helpers
* ade7759
  - S_IRUGO and friends to octal in two goes
* adis16203
  - drop unnecessary brackets
* hid-sensor
  - fix unbalanced pm_runtieme_enable error when probing after remove
* lsm6dsx
  - use actual part numbers for device name when known
  - simplify data read pin parsing
* mpu3050
  - avoid double reporting errors

7 years agostaging: rtl8192u: fix incorrect type in assignment in ieee80211_tx.c
Martin Karamihov [Mon, 17 Apr 2017 17:00:25 +0000 (20:00 +0300)]
staging: rtl8192u: fix incorrect type in assignment in ieee80211_tx.c

This patch fixes the following sparse warning:
ieee80211_tx.c:174:36: incorrect type in assignment (different base types)
ieee80211_tx.c:174:36: expected unsigned short [unsigned] [short] [usertype] <noident>
ieee80211_tx.c:174:36: got restricted __be16 [usertype] <noident>

by adding left side cast to __be16.

Signed-off-by: Martin Karamihov <martinowar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix sparse signedness warnings in rtw_generate_ie
Aishwarya Pant [Sat, 15 Apr 2017 12:38:39 +0000 (18:08 +0530)]
staging: rtl8188eu: fix sparse signedness warnings in rtw_generate_ie

Changed the type of wpa_ie_len from (int *) to (unsigned int *) in the
function rtw_get_wpa_ie(..) to suppress signedness mismatch warnings in
rtw_generate_ie of the type-

drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: warning: incorrect
type in argument 2 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60:    expected int
*wpa_ie_len
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60:    got unsigned
int *<noident>

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix sparse signedness warnings in rtw_set_ie
Aishwarya Pant [Sat, 15 Apr 2017 12:38:10 +0000 (18:08 +0530)]
staging: rtl8188eu: fix sparse signedness warnings in rtw_set_ie

Changed the type of sz from (int) to (unsigned int) to suppress
signedness mismatch warnings of the type-

drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: warning:
incorrect type in argument 5 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97:    expected
unsigned int [usertype] *frlen
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97:    got int
*<noident>

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: fix sparse signedness warnings in rtw_get_ie
Aishwarya Pant [Sat, 15 Apr 2017 12:37:42 +0000 (18:07 +0530)]
staging: rtl8188eu: fix sparse signedness warnings in rtw_get_ie

Changed the type of len from (int *) to (unsigned int *) in the
function rtw_get_ie(..) and wherever this function is called to
suppress signedness mismatch warnings of the type-

drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: warning: incorrect type
in argument 3 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60:    expected int *len
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60:    got unsigned int
*<noident>

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: clean up identical code on an if statement
Colin Ian King [Thu, 13 Apr 2017 15:46:36 +0000 (16:46 +0100)]
staging: rtl8723bs: clean up identical code on an if statement

The two different paths for an if statement are identical and hence
we can just replace it with the single statement.

Detected by CoverityScan, CID#1428443 ("Identical code for
different branches")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: remove redundant comparisons of unsigned ints with >= 0
Colin Ian King [Thu, 13 Apr 2017 14:13:46 +0000 (15:13 +0100)]
staging: rtl8723bs: remove redundant comparisons of unsigned ints with >= 0

The comparison of mode >= 0 is redundant as mode is a u32 and this
is always true.  Remove this redundant code.

Detected with CoverityScan ("Unsigned compared against 0")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: media/platform/bcm2835: remove gstreamer workaround
Kevin Wern [Tue, 11 Apr 2017 22:17:02 +0000 (18:17 -0400)]
staging: media/platform/bcm2835: remove gstreamer workaround

Gstreamer's v4l2src reacted poorly to certain outputs from the bcm2835
video driver's ioctl ops function vidioc_enum_framesizes, so a
workaround was created that could be activated by user input. This
workaround would replace the driver's ioctl ops struct with another,
similar struct--only with no function pointed to by
vidioc_enum_framesizes. With no response, gstreamer would attempt to
continue with some default settings that happened to work better.

However, this bug has been fixed in gstreamer since 2014, so we
shouldn't include this workaround in the stable version of the driver.

Signed-off-by: Kevin Wern <kevin.m.wern@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch SPLIT_STRING
Tobin C. Harding [Tue, 18 Apr 2017 00:35:42 +0000 (10:35 +1000)]
staging: ks7010: fix checkpatch SPLIT_STRING

Checkpatch emits WARNING: quoted string split across lines.

Concatenate string onto single line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: refactor SDIO read/write helpers
Tobin C. Harding [Tue, 18 Apr 2017 00:35:41 +0000 (10:35 +1000)]
staging: ks7010: refactor SDIO read/write helpers

Driver SDIO code uses helper functions to do IO to the SDIO
device. Current helpers handle IO of a single byte as well as
multi-byte. Driver predominately uses single byte IO. If the
common case is made simple it simplifies the whole driver. The common
case can be made simple by splitting the multi-byte and single byte
calls into separate functions, i.e 4 functions in total, read single
byte, read multi-byte, write single byte, write multi-byte.

Also, we need to handle the debug code. Currently debug calls after
read/write fail access the IO buffer. This buffer, at best, does not hold
useful data on the error path, at worst is uninitialized and holds
garbage.

Split read/write helper functions into two functions each, one for
single byte IO and one for multi-byte IO. Fix all call sites. Do not
change the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch LINE_SPACING
Tobin C. Harding [Tue, 18 Apr 2017 00:35:40 +0000 (10:35 +1000)]
staging: ks7010: fix checkpatch LINE_SPACING

Checkpatch emits CHECK: Please don't use multiple blank lines.

Remove multiple blank lines.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch SPACE_BEFORE_TAB
Tobin C. Harding [Tue, 18 Apr 2017 00:35:39 +0000 (10:35 +1000)]
staging: ks7010: fix checkpatch SPACE_BEFORE_TAB

Checkpatch emits WARNING: please, no space before tabs.

Remove space before tabs.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove err_ from non-error path label
Tobin C. Harding [Tue, 18 Apr 2017 00:35:38 +0000 (10:35 +1000)]
staging: ks7010: remove err_ from non-error path label

goto label includes 'err_' suffix but is executed on non-error paths.

Remove err_ suffix from goto label.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean up SDIO source comments
Tobin C. Harding [Tue, 18 Apr 2017 00:35:37 +0000 (10:35 +1000)]
staging: ks7010: clean up SDIO source comments

SDIO code currently has a number of unneeded comments. Following
kernel coding style we do not need extraneous comments, especially on
code where it is clear what is being done. Spelling typos can be
fixed.

Remove unnecessary comments, fix typos in comments.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add struct comment to ks_sdio_card
Tobin C. Harding [Tue, 18 Apr 2017 00:35:36 +0000 (10:35 +1000)]
staging: ks7010: add struct comment to ks_sdio_card

ks_sdio_card structure description does not have a kernel doc format
comment.

Add kernel doc format comment to struct ks_sdio_card.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move hw info into dev private data
Tobin C. Harding [Tue, 18 Apr 2017 00:35:35 +0000 (10:35 +1000)]
staging: ks7010: move hw info into dev private data

Currently driver uses a hardware information struct description to
group some SDIO related functionality (work, work queue, sdio private
data pointer). This structure is then embedded in the device private
data structure. Having nested structures described in different header
files means that to view the device private data programmers must open
two header files. This structure could be embedded anonymously in the
device private data and achieve the same result (grouping of function
specific to SDIO) without the need to open multiple headers. However,
the SDIO private data structure already has various different data and
pointers, adding the embedded structure adds little extra meaning and
lengthens all the dereferences throughout the driver, often meaning
addition line breaks and braces. We can increase readability and
reduce code complexity by moving the hardware information data and
pointers to directly be within the device private data structure
description.

While preparing for this refactoring it was noted that the identifier
currently used for the delayed work is 'rw_wq', this is confusing
since the 'wq' suffix typically means 'work queue'. This identifier
would be more meaningful if it used the suffix 'dwork' as does the
declaration of queue_delayed_work() (include/linux/workqueue.h).

The identifier for the work queue is currently 'ks7010sdio_wq'. This
identifier can be shortened without loss of meaning because there is
only one work queue within the driver. Identifier 'wq' is typical
within in-tree driver code and aptly describes the pointer.

Current pointer to the SDIO private data is identified by 'sdio_card',
this is sufficiently meaningful from within the hw_info structure but
once the hw_info_t structure is removed the pointer would be better to
have a prefix appended to it to retain the prior level of meaning.

Move members from struct hw_info_t to struct ks_wlan_private.

Rename identifiers;
struct delayed_work pointer 'rw_wq' to 'rw_dwork'.
struct workqueue_struct pointer 'ks7010sdio_wq' to 'wq'.
struct ks_sdio_card  pointer 'sdio_card' to 'ks_sdio_card'.

Remove structure description hw_info_t. Fix init/destroy calls. Fix
all call sites, SDIO private data access calls, and queuing calls.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move tasklet_struct to ks_wlan_private
Tobin C. Harding [Tue, 18 Apr 2017 00:35:34 +0000 (10:35 +1000)]
staging: ks7010: move tasklet_struct to ks_wlan_private

Currently a pointer to the tasklet_struct used for bottom half
processing on the receive path is within the hw_info_t structure. This
structure is then embedded in the device private data
structure. Having the tasklet_struct nested does not add meaning to
the device private data, device private data already (and typically)
has various data relating to the device, there is no real need to
separate the tasklet_struct to a SDIO specific structure. While not
adding allot of extra meaning having the nested structure means the
programmer must open two header files to read the description of the
device private data, the code would be easier to read if the device
private data struct description was not spread over two files.

Move tasklet_struct out of sdio header file and into the device
private data structure description.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: rename wakeup work struct
Tobin C. Harding [Tue, 18 Apr 2017 00:35:33 +0000 (10:35 +1000)]
staging: ks7010: rename wakeup work struct

struct work_struct uses identifier ks_wlan_wakeup_task, this is
confusing because the 'task' suffix implies that this is a
tasklet_struct instead of a work struct. Suffix 'work' would be more
clear. The code would be easier to read if it followed the principle
of least surprise and used the 'work' suffix for a work_struct
identifier.

Rename work_struct structure 'ks_wlan_wakeup_task' to 'wakeup_work'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: clean up SDIO header comments
Tobin C. Harding [Tue, 18 Apr 2017 00:35:32 +0000 (10:35 +1000)]
staging: ks7010: clean up SDIO header comments

SDIO header file does not use kernel doc format struct
comments. Adding them aids readability and enables documentation to be
built from the source code. Other comments may be tidied up as we do this.

Add kernel format struct comments. Tidy up comments.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix complete_handler
Tobin C. Harding [Tue, 18 Apr 2017 00:35:31 +0000 (10:35 +1000)]
staging: ks7010: fix complete_handler

complete_handler() takes void * types as parameters. void * parameters are then
cast to struct types. Call sites for this function either pass in NULL
or pointers to the struct types cast to void *. This casting is
unnecessary and can be removed.

Struct tx_device_buffer (which contains a pointer member to the
complete_handler() function) has as member 'ks_wlan_priv *priv' this is
unnecessary, we always have a pointer to this struct there is no need
to store it here.

The complete_handler can be more clearly defined by using struct
pointer types instead of void * types. The code is currently
unnecessarily complex, storing and passing extraneous pointer
parameters.

Remove unnecessary parameters, unnecessary casting to/from 'void
*'. Fix all call sites involving complete_handler().

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: replace defines with enum types
Tobin C. Harding [Tue, 18 Apr 2017 00:35:30 +0000 (10:35 +1000)]
staging: ks7010: replace defines with enum types

Header has multiple constants defined using preprocessor
directive. In the cases where these are an integer progression an
enumeration type can be used. Doing so adds documentation to the code
and makes the usage explicit. Maintain original constant value, this
value is returned by the device.

Replace (integer progression) preprocessor constants with enumeration
type.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: create reg_status_type enum type
Tobin C. Harding [Tue, 18 Apr 2017 00:35:29 +0000 (10:35 +1000)]
staging: ks7010: create reg_status_type enum type

SDIO header currently defines unused constants READ_STATUS_BUSY and
WRITE_STATUS_IDLE. There are reciprocal constants that are used
READ_STATUS_IDLE and WRITE_STATUS_BUSY. We can roll these into a
single enumeration type and remove the two that are unused.

Add enumeration type containing IDLE/BUSY pair that are currently used
within the SDIO source. Change source to use new enum types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: uart.c: Remove include linux/serial.h
Darryl T. Agostinelli [Thu, 13 Apr 2017 01:36:15 +0000 (20:36 -0500)]
staging: greybus: uart.c: Remove include linux/serial.h

$ make includecheck | grep staging
./drivers/staging/greybus/uart.c: linux/serial.h is included more than once.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: light.c: Remove include linux/version.h
Darryl T. Agostinelli [Thu, 13 Apr 2017 01:36:14 +0000 (20:36 -0500)]
staging: greybus: light.c: Remove include linux/version.h

Fixes:
$ make versioncheck | grep staging
./drivers/staging/greybus/light.c: 15 linux/version.h not needed.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32
Skanda Guruanand [Sun, 16 Apr 2017 00:48:59 +0000 (17:48 -0700)]
staging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32

The struct lu_dirpage elements in lustre_idl.h file are modified to
__le64 and __le32 types since the  elements are always converted from
litte endian to processor native format in mdc_request.c file.

Following warnings are removed by this fix.

drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted __le32
drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted __le64

Signed-off-by: Skanda Guruanand <skanda.kashyap@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: lustre cleanup macros in libcfs_private.h
Craig Inches [Thu, 13 Apr 2017 09:24:41 +0000 (10:24 +0100)]
Staging: lustre cleanup macros in libcfs_private.h

This resolves a checkpatch warning that "Single statement macros should
not use a do {} while (0) loop" by removing the loop and adjusting line
length accordingly.

Signed-off-by: Craig Inches <Craig@craiginches.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: make cport_quiesce() method optional
Alexandre Bailon [Sun, 26 Mar 2017 16:58:23 +0000 (18:58 +0200)]
staging: greybus: make cport_quiesce() method optional

The cport_quiesce() method is mandatory in the case of
the es2 Greybus hd controller to shutdown the cports on
the es2 controller.
In order to add support of another controller which may not
need to shutdown its cports, make the cport_quiesce() optional,
and check if the controller implement it before to use it.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/media: make atomisp vlv2_plat_clock explicitly non-modular
Paul Gortmaker [Thu, 13 Apr 2017 01:57:55 +0000 (21:57 -0400)]
staging/media: make atomisp vlv2_plat_clock explicitly non-modular

The Makefile / Kconfig currently controlling compilation of this code is:

clock/Makefile:obj-$(CONFIG_INTEL_ATOMISP)     += vlv2_plat_clock.o

atomisp/Kconfig:menuconfig INTEL_ATOMISP
atomisp/Kconfig:        bool "Enable support to Intel MIPI camera drivers"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was already not in use by this driver, the init
ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: linux-media@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: remove odd 'list' file
Greg Kroah-Hartman [Tue, 18 Apr 2017 11:20:22 +0000 (13:20 +0200)]
staging: atomisp: remove odd 'list' file

This removes a strange 'list' file in
drivers/staging/media/atomisp/pci/atomisp2/ that was not being used for
anything.

Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: fix build breakage from files going away
Greg Kroah-Hartman [Tue, 18 Apr 2017 11:19:16 +0000 (13:19 +0200)]
staging: atomisp: fix build breakage from files going away

Previous patches deleted files, but the Makefile still referenced their
.o files.  Fix this up by removing them in the Makefile.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoIIO: bmp280-core.c: fix error in humidity calculation
Andreas Klinger [Mon, 10 Apr 2017 17:00:01 +0000 (19:00 +0200)]
IIO: bmp280-core.c: fix error in humidity calculation

While calculating the compensation of the humidity there are negative values
interpreted as unsigned because of unsigned variables used.  These values as
well as the constants need to be casted to signed as indicated by the
documentation of the sensor.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: light: apds9960: add system-wide suspend
Matt Ranostay [Thu, 13 Apr 2017 02:16:57 +0000 (19:16 -0700)]
iio: light: apds9960: add system-wide suspend

APDS9960 can safely force runtime suspend if the system wants
to enter system-wide suspend

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: add support for stm32 DAC
Fabrice Gasnier [Mon, 10 Apr 2017 15:49:50 +0000 (17:49 +0200)]
iio: dac: add support for stm32 DAC

Add support for STMicroelectronics STM32 DAC. It's a 12-bit, voltage
output digital-to-analog converter. It has two output channels, each
with its own converter.
It supports 8 bits or 12bits left/right aligned data format. Only
12bits right-aligned is used here. It has built-in noise or
triangle waveform generator, and supports external triggers for
conversions.
Each channel can be used independently, with separate trigger, then
separate IIO devices are used to handle this. Core driver is intended
to share common resources such as clock, reset, reference voltage and
registers.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agodt-bindings: iio: stm32-dac: Add support for STM32 DAC
Fabrice Gasnier [Mon, 10 Apr 2017 15:49:49 +0000 (17:49 +0200)]
dt-bindings: iio: stm32-dac: Add support for STM32 DAC

Document STMicroelectronics STM32 DAC (digital-to-analog converter).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoStaging: iio: accel: adis16203: fixed a brace coding style issue
René Hickersberger?= [Thu, 13 Apr 2017 13:51:37 +0000 (15:51 +0200)]
Staging: iio: accel: adis16203: fixed a brace coding style issue

Fixed a brace coding style issue.

Signed-off-by: René Hickersberger <renehickersberger@gmx.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: imu: st_lsm6dsx: simplify data ready pin parsing
Lorenzo Bianconi [Sun, 9 Apr 2017 18:03:37 +0000 (20:03 +0200)]
iio: imu: st_lsm6dsx: simplify data ready pin parsing

Simplify st_lsm6dsx_of_get_drdy_pin routine since of_property_read_u32
error conditions are already managed in st_lsm6dsx_get_drdy_reg()

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio:meter:ade7759: Removing use of deprecated macros (S_IRUGO, S_IWUSR)
Chen Guanqiao [Sun, 9 Apr 2017 15:21:00 +0000 (23:21 +0800)]
iio:meter:ade7759: Removing use of deprecated macros (S_IRUGO, S_IWUSR)

This fixes the coding style issue of using (S_IWUSR | S_IRUGO) in place of
4-digit octal numbers.

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: ad5933: Protect DIRECT mode using claim/release helpers
Narcisa Ana Maria Vasile [Sun, 9 Apr 2017 10:40:07 +0000 (13:40 +0300)]
staging: iio: ad5933: Protect DIRECT mode using claim/release helpers

This device operates in DIRECT_MODE and BUFFER_HARDWARE mode.
Replace usages of iio_dev->mlock with iio_device_{claim|release}_direct_mode()
helper functions to guarantee DIRECT mode and consequently protect
BUFFER mode too.

Add and use a device private lock to protect against conflicting access of the
state data.
This helps with IIO subsystem redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.

Protect changing of attributes inside ad5933_store(). Attributes
can no longer be changed while in buffered mode.

Remove lock from ad5933_work() because buffer mode should be enabled
when we reach this, and claiming DIRECT mode in all the other places
should protect it.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: add max1117/max1118/max1119 ADC driver
Akinobu Mita [Tue, 28 Mar 2017 16:34:48 +0000 (01:34 +0900)]
iio: adc: add max1117/max1118/max1119 ADC driver

This adds max1117/max1118/max1119 8-bit, dual-channel ADC driver.

This new driver uses the zero length spi_transfers with the cs_change
flag set and/or the non-zero delay_usecs.

1. The zero length transfer with the spi_transfer.cs_change set is
required in order to select CH1.  The chip select line must be brought
high and low again without transfer.

2. The zero length transfer with the spi_transfer.delay_usecs > 0 is
required for waiting the conversion to be complete.  The conversion
begins with the falling edge of the chip select.  During the conversion
process, SCLK is ignored.

These two usages are unusual.  But the spi controller drivers that use
a default implementation of transfer_one_message() are likely to work.
(I've tested this adc driver with spi-omap2-mcspi and spi-xilinx)

On the other hand, some spi controller drivers that have their own
transfer_one_message() may not work.  But at least for the zero length
transfer with delay_usecs > 0, I'm proposing a new testcase for the
spi-loopback-test that can test whether the delay_usecs setting has
taken effect.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio:meter:ade7759: Removing use of deprecated macros (S_IRUGO, S_IWUSR, S_IXUGO)
Chen Guanqiao [Sun, 9 Apr 2017 04:30:26 +0000 (12:30 +0800)]
iio:meter:ade7759: Removing use of deprecated macros (S_IRUGO, S_IWUSR, S_IXUGO)

Removing use of deprecated macros(S_IRUGO, S_IWUSR, S_IXUGO), and replace
with 4 digit octal.

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: stm32 trigger: Add counter enable modes
Benjamin Gaignard [Tue, 4 Apr 2017 07:47:52 +0000 (09:47 +0200)]
iio: stm32 trigger: Add counter enable modes

Device counting could be controlled by the level or the edges of
a trigger.
in_count0_enable_mode attibute allow to set the control mode.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: stm32 trigger: Add quadrature encoder device
Benjamin Gaignard [Tue, 4 Apr 2017 07:47:51 +0000 (09:47 +0200)]
iio: stm32 trigger: Add quadrature encoder device

One of the features of STM32 trigger hardware block is a quadrature
encoder that can counts up/down depending of the levels and edges
of the selected external pins.

This patch allow to read/write the counter, get it direction,
set/get quadrature modes and get scale factor.

When counting up preset value is the limit of the counter.
When counting down the counter start from preset value down to 0.
This preset value could be set/get by using
/sys/bus/iio/devices/iio:deviceX/in_count0_preset attribute.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: proximity: as3935: fix as3935_write
Matt Ranostay [Fri, 14 Apr 2017 06:21:56 +0000 (23:21 -0700)]
iio: proximity: as3935: fix as3935_write

AS3935_WRITE_DATA macro bit is incorrect and the actual write
sequence is two leading zeros.

Cc: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: ad7303: fix channel description
Pavel Roskin [Thu, 13 Apr 2017 21:54:23 +0000 (14:54 -0700)]
iio: dac: ad7303: fix channel description

realbits, storagebits and shift should be numbers, not ASCII characters.

Signed-off-by: Pavel Roskin <plroskin@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: ks7010: remove unused spin_lock
Tobin C. Harding [Tue, 11 Apr 2017 23:56:50 +0000 (09:56 +1000)]
staging: ks7010: remove unused spin_lock

Driver SDIO private data structure description includes a spin_lock
that is never used. This data structure only contains a pointer to the
sdio_func and a pointer to the main device private data. A spin_lock
is not required here.

Remove unused spin_lock.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused structure description
Tobin C. Harding [Tue, 11 Apr 2017 23:56:49 +0000 (09:56 +1000)]
staging: ks7010: remove unused structure description

Driver SDIO header describes a structure that is never used. It can be
safely removed.

Remove unused structure description.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused read_buf
Tobin C. Harding [Tue, 11 Apr 2017 23:56:48 +0000 (09:56 +1000)]
staging: ks7010: remove unused read_buf

Driver SDIO code allocates memory for a buffer that is never used. It
can be safely removed.

Remove unused buffer, including allocation and freeing of memory.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused completion
Tobin C. Harding [Tue, 11 Apr 2017 23:56:47 +0000 (09:56 +1000)]
staging: ks7010: remove unused completion

Driver SDIO code initializes a completion that is never used. It can
be safely removed.

Remove unused completion.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: ensure cmd is large enough for %4s scanf format
Colin Ian King [Tue, 11 Apr 2017 21:21:47 +0000 (22:21 +0100)]
staging: rtl8723bs: ensure cmd is large enough for %4s scanf format

char array cmd is being scanned in using a %4s scanf format
specifier and so cmd must be an array of 5 chars. Increase size
to 5 chars to ensure we don't have an overflow.

Detected with static analysis by cppcheck:

"(error) Width 4 given in format string (no. 1) is larger than
destination buffer 'cmd[4]', use %3s to prevent overflowing it."

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: checking for NULL instead if IS_ERR
Dan Carpenter [Wed, 12 Apr 2017 08:31:53 +0000 (11:31 +0300)]
staging: lustre: checking for NULL instead if IS_ERR

lustre_cfg_new() returns error pointers and never NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: media: atomisp: i2c: removed unnecessary white space before comma in memset()
Valerio Genovese [Sun, 2 Apr 2017 19:43:46 +0000 (21:43 +0200)]
staging: media: atomisp: i2c: removed unnecessary white space before comma in memset()

Removed extra space before comma in memset() as a part of
checkpatch.pl fix-up.

Signed-off-by: Valerio Genovese <valerio.click@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: avoid false-positive maybe-uninitialized warning
Arnd Bergmann [Wed, 29 Mar 2017 21:12:21 +0000 (23:12 +0200)]
staging: atomisp: avoid false-positive maybe-uninitialized warning

In combination with CONFIG_PROFILE_ANNOTATED_BRANCHES=y, the unlikely()
inside of the WARN() macro becomes too complex for gcc to see that
we don't use the output arguments of mt9m114_to_res() are used
correctly:

drivers/staging/media/atomisp/i2c/mt9m114.c: In function 'mt9m114_get_fmt':
drivers/staging/media/atomisp/i2c/mt9m114.c:817:13: error: 'height' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  int width, height;
             ^~~~~~
drivers/staging/media/atomisp/i2c/mt9m114.c: In function 'mt9m114_s_exposure_selection':
drivers/staging/media/atomisp/i2c/mt9m114.c:1179:13: error: 'height' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Without WARN_ON(), there is no problem, so by simply replacing it with
v4l2_err(), the warnings go away. The WARN() output is also not needed
here, as we'd probably catch the problem before even getting here,
and other checks for the same condition already use v4l2_err.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove UDS kernel code
Alan Cox [Wed, 12 Apr 2017 18:22:46 +0000 (19:22 +0100)]
atomisp: remove UDS kernel code

UDS is another layer which actually boils down to some trivial assignments so
remove it so inline the code.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove xnr3_0_5 and xnr3_0_11
Alan Cox [Wed, 12 Apr 2017 18:22:35 +0000 (19:22 +0100)]
atomisp: remove xnr3_0_5 and xnr3_0_11

These are not used in the driver so can go away.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove fixedbds kernel code
Alan Cox [Wed, 12 Apr 2017 18:22:25 +0000 (19:22 +0100)]
atomisp: remove fixedbds kernel code

This is a whole pile of code that wraps a single assignment. Remove it and
put the assignment in the caller. Once we have the kernels sorted we should
revisit these and remove all the pointless 1 item structs that go with it.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove satm kernel
Alan Cox [Wed, 12 Apr 2017 18:22:13 +0000 (19:22 +0100)]
atomisp: remove satm kernel

This isn't used so it can go in the bitbucket.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove contiguous handling
Alan Cox [Wed, 12 Apr 2017 18:21:59 +0000 (19:21 +0100)]
atomisp: remove contiguous handling

The base hmm MMU code doesn't support contiguous allocations (they BUG), so
remove support from them from the higher levels of the heirarchy.

We still need to unwind all these layers but it turns out that some of the init
order stuff is rather sensitive and the simple cleanup breaks everything

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove sh_css_malloc indirections where we can
Alan Cox [Wed, 12 Apr 2017 18:21:44 +0000 (19:21 +0100)]
atomisp: remove sh_css_malloc indirections where we can

Where we know the buffer size is reasonably constrained we can just use kmalloc,
and where it will be large vmalloc. This still leaves a pile in the middle.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove indirection from sh_css_malloc
Alan Cox [Wed, 12 Apr 2017 18:21:33 +0000 (19:21 +0100)]
atomisp: remove indirection from sh_css_malloc

We have one hard coded set of behaviour so unpick the indirection and function
pointers. This isn't the whole story. A lot of the callers are known sizes and
use cases so we can switch them directly to kmalloc later on.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: unwrap the _ex malloc/free functions
Alan Cox [Wed, 12 Apr 2017 18:21:22 +0000 (19:21 +0100)]
atomisp: unwrap the _ex malloc/free functions

We are not using these for debugging or debug logging so remove the defines,
trim and rename the functions.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove most of the uses of atomisp_kernel_malloc
Alan Cox [Wed, 12 Apr 2017 18:21:05 +0000 (19:21 +0100)]
atomisp: remove most of the uses of atomisp_kernel_malloc

They can be replaced by kmalloc. There are a few that do need to pick kmalloc
or vmalloc. Those we leave for the moment.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: move mipi_info assignment to next line in __get_asd_from_port()
Daeseok Youn [Wed, 12 Apr 2017 18:20:49 +0000 (19:20 +0100)]
staging: atomisp: move mipi_info assignment to next line in __get_asd_from_port()

The line which is initializing mipi_info variable is too long
to read. It would be placed in next line.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: replace "&isp->asd[i]" with "asd" in __get_asd_from_port()
Daeseok Youn [Wed, 12 Apr 2017 18:20:36 +0000 (19:20 +0100)]
staging: atomisp: replace "&isp->asd[i]" with "asd" in __get_asd_from_port()

The address of isp->asd[i] is already assigned to
local "asd" variable. "&isp->asd[i]" would be replaced with
just "asd".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>