linux-2.6-block.git
7 years agoMerge tag 'iio-for-4.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Mon, 24 Oct 2016 09:34:22 +0000 (11:34 +0200)]
Merge tag 'iio-for-4.10a' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First round of IIO new device support, features and cleanups for the 4.10 cycle.

Fair number of outreachy related patches in here. Some of these may well
have already been picked up by Greg but git will sort that out for us.

Also some good staging cleanup work from other sources. Thanks Brian and Lars
in particular for this.

New device support
* ACCES 104-quad-8
  - New driver for this 8 channel encoder input board. Lots of new ABI with
    this one.
* AD7766
  - New driver supporting AD7766, AD7766-1, AD7766-2, AD7767, AD7767-1 and
    AD7767-2 24 bit ADCs.
* dmard 10
  - New driver for this 3 axis accelerometer.
* Honeywell ABP pressure sensors.
  - New driver covering 56 parts in this series (too many to list here!)
* HTS221
  - New driver to support this relative humidiy and temperature device.
* LMP91000
  - New driver for this potentiostat (form of chemical sensor). Nice example
    of use of the buffered consumer interfaces and the use of a consumer
    provided trigger.
* MiraMEMS DA311
  - New driver for this 3 axis accelerometer.
* MiraMEMS DA280
  - New driver for this 3 axis accelerometer. Follow up caught up with
  vendor prefixes for these.

Staging graduations
* isl29018 light sensor
  - Fixes and cleanups listed below (thanks for your hard work on this Brian!)
* sca3000
  - Fixes and cleanups listed below.  This was one of the small set of drivers
  that went into staging when IIO was first added.  Turns out it had a few
  bugs and needed to be brought into the modern era!  Not clear if I am
  the only person who actually has one of these still wired to a board.

New features (Core)
 - Add an iio_trigger_validate_own_device helper which relies on the device
   and trigger having the same parent.  Convenient to have this for some
   of the more complex trigger / device interactions. Was hand rolled in
   a few drivers already so good to bring it into the core.
 - Add an iio_read_channel_offset in kernel access helper (similar to
   the existing one for scale).
 - IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros.  These
   lead some rather contrived function naming, but there is no denying they
   do reduced boilerplate.  I'm going to resist their introduction in
   drivers 'unless' they form part of a larger set of cleanups.
 - Counter channel type and index type.

New features (Drivers)
* hdc100x
  - Triggered buffer support.
* mcp4725
  - Device tree bindings and support.
  - Voltage reference selection.
* ti-adc0832
  - Triggered buffer support.
* ti-adc161s626
  - Add regulator support allowing _scale and _offset values to be established
  and exported.

New features (Tools)
* iio_generic_buffer
  - -A option to force enable all channels rather than faulting if some are
  already enabled (like -a does).  Followup patches tidied this support up.

Cleanups (Core)
 - Use kmalloc_array in iio_scan_mask_set.
 - Take event_attrs field of iio_info structure constant
 - Staging todo list updates. Most of it was long done.
 - MAINTAINERS had a wrong directory listing.

Cleanups (Drivers)
* Missing i2c trivial devices entries.
* ad5592r
  - Fix an endian type related sparse warnings.
* ad7150
  - Constify the event attribute_group structures.
* ad7152
  - Add some blank lines to improve readability.
  - Sampling frequency control via chan-info element rather than hand rolled
  attributes.
  - add a new lock to avoid use of mlock for non state change related locking.
* ad7280
  - Constify atrribute_group structure (second patch covers the event ones)
* ad7606 (Lars is driving most of the cleanup on this with some additions from
  Eva)
  - Fix improper setting of oversampling pins.  This has been broken a very
  long time in this staging driver, so not going to push this back to stable.
  - Implement oversampling configuration via the chan_info mask element.
  - Remove an unused int_vref_mv field.
  - Remove a reundant name field from ad7606_chip_info.
  - Remove default device configuration from platform_data in favour of
  whatever the power on defaults are.
  - Remove out of band error reporting in the kernel log as not providing
  much information.
  - Fix oversampling ratio by having 1 be the value for no oversampling.
  - Avoid allocating buffer for each data capture.
  - Factor out common code between periodic and one-shot capture.
  - Move set_drvdat into common code.
  - Let the common probe function return int rather than jumping through
  an ERR_PTR.
  - Pass struct device * into common remove to simplify code.
  - Always run trigger handler only once per event (no one can remember why
  it was being possibly done twice).
  - Move over to the GPIO descriptor API to shorten and clarify code.
  - Move the buffer code into the main file as it's not optional and is
  now rather short in this driver.
  - Fix the naming of the supply regulator.
  - Rework regulator handling to handle errors including deferred probing.
  - Tidy up a ptr_err or 0 return.
* ad7746
  - Sampling frequency control via info_mask element rather than hand rolled
* ad7758
  - Sampling frequency control via info_mask element rather than hand rolled
  attributes.
* ad7816
  - Constify the event attribute_group structure.
* adt7316
  - Constify the event attribute group structures.
* ak8974
  - Cleanup some sparse warnings about endian types.
* ak8975
  - Cleanup some sparse warnings about endian types.
* bmi160
  - Spare endian warning cleanups.
* isl29018 (towards staging graduation)
  - Remove unusedvariables and defines.
  - Improve consistency of error handling.
  - Signed / unsigned comparison fixes.
  - Use the IIO_DEVICE_ATTR_{RO, RW} macros
  - Fix a race in in_illuminance_scale_available_show.
  - Cleanup exit points of _read_raw
  - Sanity check if in suspended state during a write_raw call as was already
    done for read_raw.
  - Document device tree bidnings.
  - Document infrared supression controls.
  - Add some newlines to improve readability and drop one that shouldn't be
    there.
  - Fix a poorly named functions name.
  - Fix multiline coment syntax.
  - Tidy up a pair or return statements by unifying them.
  - Rename description in Kconfig for consistency with similar drivers.
* lidar
  - cleanup power management by dropping unnecessary call.
* ltr501
  - Use the claim_direct_mode helpers. Fix a race condition along the way.
* max1027
  - Fix a dubious x | !y sparse warning.
  - Use the new iio_trigger_validate_own_device helper.
* max440000
  - Clean up some sparse warnings about endian types.
* mcp4725
  - Use the regulator framework to establish the reference voltage rather than
    getting it from platform data.
  - Tidy up a comment typo.
  - Fix a wrong PTR_ERR query (wrong regulator).
* mma7660
  - Take a mma7660_nscale static.
* mma8452
  - Use the new iio_trigger_validate_own_device helper.
  - Use claim_direct_mode helpers - fix a race condition along the way.
* mpl3115
  - Use claim_direct_mode helpers - fix a race condition along the way.
* ms65611
  - Tidy up regulator error handling and clean out a static warning in the mix.
* sca3000
  - Avoid a potential unitialized variable if a hardware read returns a value
  that isn't actually supported (mostly warning supression).
  - Fix a use before setting of the indio_dev->buffer pointer. Broken for
  a very long time so not going to rush this into stable.
  - Merge buffer file with core file.  We used to always split these.
  Sometimes it's just not worth the hassle. In this case the device's main
  feature is it's hardware fifos so unlikely anyone would want to run it
  without.
  - Drop the sca3000_register_ring_funcs function as it's a pointless wrapper
  once we have only one file.
  - Fix cleaning of flag + setting of size of scan. Without this you can't
  start the buffer twice and expect sensible (or any) results.  Again,
  broken for a long time so not heading for stable.
  - Drop the custom watershed setting ABI - for now we'll just support one
  value.
  - Move to a hybrid hard / soft buffer design (how we've been doing it
  for similar devices for a while now!)
  - Cleanup some unusued variables.
  - Use a fake channel to support core handling of freefall event registration.
  - Cleanup the register defines.
  - Fix an off by one error in axis due to IIO_NO_MOD taking up the 0 value.
  Been broken since first admission of IIO to the staging tree.
  - Add readback of the 3db low pass filter frequency and later writing
    allowing droppign of custom measurement mode attributes as they can
    be represented by the filter choices that is their main characteristic.
  - Drop non standard revision attr and replace with dev_info on probe.
  - Avoid a race in probe.
  - Various formatting fixes.
  - Kernel-docify docs that were very nearly in the write format.
* tsl2583
  - Constify attribute_group structure.
* zpa2326
  - Drop a redundant DEBUG ifdef.

Cleanups (Tools)
* iio_generic_buffer
  - Fix the ? arguement. Previously it sort of worked as you got the help
    message as a result of it not recognising the arguement.

7 years agoiio: dac: mcp4725: fix odd_ptr_err.cocci warnings
Julia Lawall [Sat, 22 Oct 2016 20:41:32 +0000 (22:41 +0200)]
iio: dac: mcp4725: fix odd_ptr_err.cocci warnings

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

CC: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: fix ptr_ret.cocci warnings
kbuild test robot [Sat, 22 Oct 2016 19:12:42 +0000 (03:12 +0800)]
staging:iio:ad7606: fix ptr_ret.cocci warnings

drivers/staging/iio/adc/ad7606.c:357:1-3: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

CC: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: proximity: pulsedlight-lidar-lite-v2: cleanup power management
Matt Ranostay [Sat, 15 Oct 2016 18:04:37 +0000 (11:04 -0700)]
iio: proximity: pulsedlight-lidar-lite-v2: cleanup power management

Remove pm_runtime_mark_last_busy() call that wasn't need in the probe
since the device should be put to sleep.

Clarification from Matt:
Basically it going to be suspended once pm_runtime_idle() is called,
and setting the last busy is useless and not needed.
Clearly this doesn't affect the device running but just makes the code
more consistent with other uses.

Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: ti-adc0832: add triggered buffer support
Akinobu Mita [Sun, 16 Oct 2016 15:59:42 +0000 (00:59 +0900)]
iio: ti-adc0832: add triggered buffer support

This adds triggered buffer support for the ti-adc0832 driver.  Tested with
ADC0831 and ADC0832 by using SYSFS trigger.

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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: humidity: hdc100x: add triggered buffer support for HDC100X
Alison Schofield [Fri, 2 Sep 2016 17:23:17 +0000 (10:23 -0700)]
iio: humidity: hdc100x: add triggered buffer support for HDC100X

Triggered buffer support uses the HDC100X's dual acquisition mode
to read both humidity and temperature in one shot.

This patch depends on
447136effbf4 ("iio: humidity: hdc100x: fix sensor data reads of
       temp and humidity")

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: mcp4725: add devicetree support
Tomas Novotny [Tue, 18 Oct 2016 17:43:09 +0000 (19:43 +0200)]
iio: dac: mcp4725: add devicetree support

Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: mcp4725: support voltage reference selection
Tomas Novotny [Tue, 18 Oct 2016 17:43:08 +0000 (19:43 +0200)]
iio: dac: mcp4725: support voltage reference selection

MCP47x6 chip supports selection of a voltage reference (VDD, VREF buffered
or unbuffered). MCP4725 doesn't have this feature thus the eventual setting
is ignored and user is warned.

The setting is stored only in the volatile memory of the chip. You need to
manually store it to the EEPROM of the chip via 'store_eeprom' sysfs entry.

Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoDocumentation: dt: iio: add mcp4725/6 dac device binding
Tomas Novotny [Tue, 18 Oct 2016 17:43:07 +0000 (19:43 +0200)]
Documentation: dt: iio: add mcp4725/6 dac device binding

Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: mcp4725: fix incorrect comment
Tomas Novotny [Tue, 18 Oct 2016 17:43:06 +0000 (19:43 +0200)]
iio: dac: mcp4725: fix incorrect comment

Number 2 is referencing to the settings with the largest available
resistor.

No functional change.

Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: ad7606: rework regulator handling
Eva Rachel Retuya [Thu, 20 Oct 2016 13:08:23 +0000 (21:08 +0800)]
staging: iio: ad7606: rework regulator handling

Currently, this driver ignores all errors from regulator_get(). The way
it is now, it also breaks probe deferral (EPROBE_DEFER). The correct
behavior is to propagate the error to the upper layers so they can
handle it accordingly.

Rework the regulator handling so that it matches the standard behavior.
If the specific design uses a static always-on regulator and does not
explicitly specify it, regulator_get() will return the dummy regulator.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: ad7606: set proper supply name to devm_regulator_get()
Eva Rachel Retuya [Thu, 20 Oct 2016 13:08:22 +0000 (21:08 +0800)]
staging: iio: ad7606: set proper supply name to devm_regulator_get()

The name passed to devm_regulator_get() should match the name of the
supply as specified in the device datasheet. The supply on this device
is called 'AVcc' while currently, the driver uses just 'vcc'.

Use 'avcc' to specify the supply voltage since it is custom to use the
lower-caps version of the datasheet name.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Move buffer code to main source file
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:08 +0000 (19:07 +0200)]
staging:iio:ad7606: Move buffer code to main source file

Currently the ad7606 buffer handling code resides in its own source file.
But this file contains only 4 small functions of which half are just
wrappers around other functions. Buffer support is also always enabled for
this driver, so move them over to the main source file. This reduces the
amount of boilerplate code.

Also rename the main function from ad7606_core.c to ad7606.c since there is
only a single file now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Use GPIO descriptor API
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:07 +0000 (19:07 +0200)]
staging:iio:ad7606: Use GPIO descriptor API

Convert the ad7606 driver away from the deprecated legacy GPIO API and use
the new GPIO descriptor API.

This also means that the platform data struct is now empty and can be
removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Run trigger handler only once per trigger event
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:06 +0000 (19:07 +0200)]
staging:iio:ad7606: Run trigger handler only once per trigger event

Currently the ad7606 driver installs the same function for the hard-irq and
threaded trigger handlers. This was introduced in commit 1caf7cb46135
("staging:iio:adc:ad7606 Convert to new channel registration method Update
Add missing call to iio_trigger_notify_done() Set pollfunc top and bottom
half handler"). Unfortunately the commit message does not mention why this
was done and Michael does not remember either.

Since the trigger handler function is idempotent (set a GPIO to 1) running
it twice does not do any harm, but is simply not necessary either. So set
the threaded trigger handler for the driver to NULL.

While we are at it also remove the function description comment that does
no say anything that can't be derived from the function name itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Let common remove function take a struct device *
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:05 +0000 (19:07 +0200)]
staging:iio:ad7606: Let common remove function take a struct device *

Currently the common remove function takes a struct iio_dev *. This
parameter is retrieved by the individual driver remove functions by calling
get_drvdata() on their device. To simplify the code let the common remove
function directly take a struct dev * and do the IIO device in retrieval
the common remove function.

This also aligns the interface with the common probe function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Let the common probe function return int
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:04 +0000 (19:07 +0200)]
staging:iio:ad7606: Let the common probe function return int

The common probe function for the ad7606 currently returns a struct iio_dev
pointer. The returned value is not used by the individual driver probe
functions other than for error checking.

Let the common probe function return a int instead to report the error
value directly (or 0 on success). This allows to simplify the code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Move set_drvdata() into common code
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:03 +0000 (19:07 +0200)]
staging:iio:ad7606: Move set_drvdata() into common code

Both the platform_device and SPI driver call set_drvdata() at the end of
their probe function. Move this into the common probe() function to reduce
duplicated code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Factor out common code between periodic and one-shot capture
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:02 +0000 (19:07 +0200)]
staging:iio:ad7606: Factor out common code between periodic and one-shot capture

Both the periodic buffer based and one-shot sysfs based capture methods
share a large portion of their code. Factor this out into a common helper
function.

Also provide a comment that better explains in more detail what is going on
in the capture function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Avoid allocating buffer for each data capture
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:01 +0000 (19:07 +0200)]
staging:iio:ad7606: Avoid allocating buffer for each data capture

Currently the ad7606 driver dynamically allocates and frees a transfer
buffer each time a sample capture is performed in buffered mode, which
introduces unnecessary overhead. The driver state struct already contains a
buffer that is used for transfers in one-shot mode. This buffer is large
enough to hold all samples, but not the timestamp that might be present in
buffered mode. Extend the buffer size to be able to contain the timestamp
and update the buffered capture function to use this buffer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Use oversampling ratio of 1 for no oversampling
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:00 +0000 (19:07 +0200)]
staging:iio:ad7606: Use oversampling ratio of 1 for no oversampling

Currently the ad7606 driver uses a value of 0 for the oversampling ratio to
express that no oversampling is done. Strictly speaking this means though
that no data capture is done at all. Instead change the driver to use a
value of 1, this is in accordance with what other drivers do and what the
IIO spec suggests.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Remove out-of-band error reporting
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:59 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove out-of-band error reporting

Currently the ad7606 driver prints a error message to the kernel log when
an application writes an invalid value to a sysfs attribute. While for
initial driver development and testing this might be useful it is quite
disadvantageous in a production environment. The write() call to the sysfs
attribute will already return an error if the value was invalid so the
application is aware that the operation failed. And generally speaking it
is impossible for an application to reliably match a log message in the
kernel log to a specific operation it performed, so the message becomes
just noise and might distract from more critical messages.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Remove default device configuration from platform data
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:58 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove default device configuration from platform data

While for some very selected setups it might be useful to be able to
provide default configuration data via the platform data, generally this
becomes very impractical as the number of configuration options increases.
So the general policy is to use the power-on default values of the device
and let the application using the device configure it according to its
needs.

Implement this scheme for the ad7606 driver by removing support for
specifying a default configuration via the platform data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Remove redundant name field from ad7606_chip_info
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:57 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove redundant name field from ad7606_chip_info

The name field in the ad7606_chip_info struct is set to the same value as
the as the name field in the corresponding {platform,spi}_device_id table
entry. Remove it from the ad7606_chip_info struct and pass the name from
the ID to the probe function. This slightly reduces the size of the
chip_info table and adding new entries requires less boilerplate.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:ad7606: Remove unused int_vref_mv field
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:56 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove unused int_vref_mv field

Remove the int_vref_mv field from the ad7606_chip_info struct since the
field is never used by the driver. The value is also the same for all
derivatives of this chip, so if it will ever be used in the driver a
constant value will work just fine.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agotools: iio: iio_generic_buffer: drop unneeded parentheses
Eva Rachel Retuya [Thu, 20 Oct 2016 09:19:24 +0000 (17:19 +0800)]
tools: iio: iio_generic_buffer: drop unneeded parentheses

Remove extra parentheses introduced in commit <73e176a tools: iio:
iio_generic_buffer: add -A to force-enable all channels>.

Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agotools: iio: iio_generic_buffer: rename and change type of force variable
Eva Rachel Retuya [Thu, 20 Oct 2016 09:19:23 +0000 (17:19 +0800)]
tools: iio: iio_generic_buffer: rename and change type of force variable

Replace the type of 'force' flag from int to bool and at the same time
rename it to 'force_autochannels' for better readability.

Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoDocumentation: dt: iio: humidity: add hts221 sensor device binding
Lorenzo Bianconi [Thu, 13 Oct 2016 20:06:05 +0000 (22:06 +0200)]
Documentation: dt: iio: humidity: add hts221 sensor device binding

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: humidity: add support to hts221 rh/temp combo device
Lorenzo Bianconi [Thu, 13 Oct 2016 20:06:04 +0000 (22:06 +0200)]
iio: humidity: add support to hts221 rh/temp combo device

Add support to STM HTS221 humidity + temperature sensor

http://www.st.com/resource/en/datasheet/hts221.pdf

- continuous mode support
- i2c support
- spi support
- trigger mode support

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: light: ltr501: claim direct mode during raw writes
Alison Schofield [Sun, 16 Oct 2016 05:02:19 +0000 (22:02 -0700)]
iio: light: ltr501: claim direct mode during raw writes

Driver was checking for direct mode but not locking it.  Use
claim/release helper functions to guarantee the device stays
in direct mode during all raw write operations.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: light: ltr501: claim direct mode during select raw reads
Alison Schofield [Sun, 16 Oct 2016 05:00:53 +0000 (22:00 -0700)]
iio: light: ltr501: claim direct mode during select raw reads

Driver was checking for direct mode but not locking it.  Use
claim/release helper functions to guarantee the device stays
in direct mode during required raw read cases.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:accel:sca3000 Move out of staging.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:18 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Move out of staging.

Now the driver is in a reasonable state, lets get it (finally) out
of staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 kernel docify comments that were nearly kernel doc.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:17 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 kernel docify comments that were nearly kernel doc.

Basic tidy up of comments to bring them into a standard style.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 small checkpatch fixes (alignment etc)
Jonathan Cameron [Sat, 8 Oct 2016 16:39:16 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 small checkpatch fixes (alignment etc)

Tidied up where checkpatch warning suppressions doesn't effect the
readability of the code.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 Tidy up probe order to avoid a race.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:15 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Tidy up probe order to avoid a race.

Previously the device was exposed to userspace and in kernel consumers
before the interrupts had been configured. As nothing stopped them being
enabled in the interval this could cause unhandled interrupts.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 replace non standard revision attr with dev_info on probe
Jonathan Cameron [Sat, 8 Oct 2016 16:39:14 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 replace non standard revision attr with dev_info on probe

There seems little point in being able to query the part revision number
via sysfs.  Hence just put it in the kernel logs during probe incase
anyone ever wants to know.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 Drop custom measurement mode attributes
Jonathan Cameron [Sat, 8 Oct 2016 16:39:13 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Drop custom measurement mode attributes

This is now represented by the standard 3db filter frequency controls.
Things get complex wrt to the sampling frequency as these modes change
but that is fine under the IIO ABI where any value is allowed to effect
any other.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 Add write support to the low pass filter control
Jonathan Cameron [Sat, 8 Oct 2016 16:39:12 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Add write support to the low pass filter control

Also includes an available attribute.  The ordering of values appears
a bit random, but as the ABI doesn't specify this and we already have
both rising and falling lists I think this is fine.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000: Fix off by one error in axis due to IIO_NO_MOD
Jonathan Cameron [Sat, 8 Oct 2016 16:39:11 +0000 (17:39 +0100)]
staging:iio:accel:sca3000: Fix off by one error in axis due to IIO_NO_MOD

Given the introduction of IIO_NO_MOD was prior to the first submission
prior to IIO entering staging this has been broken for a while.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 add readback of the 3db low pass filter frequency
Jonathan Cameron [Sat, 8 Oct 2016 16:39:10 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 add readback of the 3db low pass filter frequency

Driving towards getting rid of the non standard mode control interface.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 Clean up register defines.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:09 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Clean up register defines.

Introduce some more masks and generally drive towards consistent naming.
Note the small indents used to indicate parts of registers + parts of
multiplexed registers.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 use a 'fake' channel to handle freefall event registration.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:08 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 use a 'fake' channel to handle freefall event registration.

This is an approach used in some newer drivers as it exposes the
compound channel events to the core rather than hiding their control
in sysfs attributes entirely via the driver.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 drop some unused variables.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:07 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 drop some unused variables.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 move to hybrid hard / soft buffer design.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:06 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 move to hybrid hard / soft buffer design.

In a similar fashion to other newer drivers (e.g. ti_am335x), instead
of using the hardware buffer support in IIO to directly access the hardware
fifo, insert a software fifo and feed that from the hardware one when
interrupts occur.  This gives a simpler structure to the data flows and
allows more flexibility over how often data is shipped to userspace etc.

This was also the only direct user of the simplistic generalization found
in ring_hw.h so that header is removed.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 Drop custom ABI for watersheds.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:05 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Drop custom ABI for watersheds.

For now we support only the 50% watershed interrupt and start and stop it
as part of the buffer bring up.  The 75% case may come back in future.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 Fix clearing of flag + setting of size of scan.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:04 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Fix clearing of flag + setting of size of scan.

Not clearing the stuff_to_read flag can lead to a false flag being set
on restarting the buffer if the data was not all read the previous time.

The size of the scan is needed to ensure the function
iio_buffer_read_first_n_outer actually tries to read the data.

This stuff has been broken for some time so not stable material.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 drop sca3000_register_ring_funcs
Jonathan Cameron [Sat, 8 Oct 2016 16:39:03 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 drop sca3000_register_ring_funcs

This was needed when the buffer support was optional. Pointless wrapper
now so drop it.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 merge files into one.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:02 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 merge files into one.

In the early days of IIO we were much more inclined to keep the impact
of the core IIO elements to the minimum.  As time has moved on it has
become clear that hardly any builds are done without buffer support
and that it adds considerable complexity to the drivers.

Hence merge down the buffer and non buffer elements of the sca3000 driver
also allowing us to drop the header file used for the interfaces between
the two.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging:iio:accel:sca3000 Fix a use before setting of the indio_dev->buffer pointer.
Jonathan Cameron [Sat, 8 Oct 2016 16:39:01 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Fix a use before setting of the indio_dev->buffer pointer.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
7 years agostaging: iio: isl29018: move out of staging
Brian Masney [Mon, 10 Oct 2016 07:20:02 +0000 (03:20 -0400)]
staging: iio: isl29018: move out of staging

Move ISL29018/ISL29023/ISL29035 driver out of staging into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: isl29018: add ABI documentation for infrared suppression
Brian Masney [Mon, 10 Oct 2016 07:20:01 +0000 (03:20 -0400)]
staging: iio: isl29018: add ABI documentation for infrared suppression

Add ABI documentation from the ISL29018 Data Sheet (FN6619.4, Oct 8,
2012) about the infrared suppression that can be controlled
with the proximity_on_chip_ambient_infrared_suppression sysfs attribute.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: pressure: mpl3115: claim direct mode during raw reads
Alison Schofield [Tue, 11 Oct 2016 19:33:12 +0000 (12:33 -0700)]
iio: pressure: mpl3115: claim direct mode during raw reads

Driver was checking for direct mode but not locking it.  Use
claim/release helper functions to guarantee the device stays
in direct mode during raw reads.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: accel: mma8452: claim direct mode during write raw
Jonathan Cameron [Sat, 15 Oct 2016 14:55:06 +0000 (15:55 +0100)]
iio: accel: mma8452: claim direct mode during write raw

Driver was checking for direct mode but not locking it.  Use
claim/release helper functions to guarantee the device stays
in direct mode during all write raw operations.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: accel: mma8452: claim direct mode during raw reads
Alison Schofield [Tue, 11 Oct 2016 19:31:36 +0000 (12:31 -0700)]
iio: accel: mma8452: claim direct mode during raw reads

Driver was checking for direct mode but not locking it.  Use
claim/release helper functions to guarantee the device stays
in direct mode during raw reads.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agotools: iio: iio_generic_buffer: add -A to force-enable all channels
Eva Rachel Retuya [Fri, 14 Oct 2016 10:18:39 +0000 (18:18 +0800)]
tools: iio: iio_generic_buffer: add -A to force-enable all channels

If attribute/s is/are already enabled (by default or via scripts or
manual interaction), issuing -a will fail to enable the channels thereby
one has to manually disable the said attribute/s before proceeding with
auto-enabling.

Add a command-line option -A to force-activate all channels regardless
of their current state.

Suggested-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: mcp4725: use regulator framework
Tomas Novotny [Tue, 11 Oct 2016 13:57:40 +0000 (15:57 +0200)]
iio: dac: mcp4725: use regulator framework

Use a standard framework to get the reference voltage. It is done that way
in the iio subsystem and it will simplify extending of the driver.

Structure mcp4725_platform_data is left undeleted because it used in the
next patch.

This change breaks the current users of the driver, but there is no
mainline user of struct mcp4725_platform_data.

Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: ms65611_core: Fixes dereferencing regulator pointer
Crt Mori [Fri, 14 Oct 2016 13:43:14 +0000 (15:43 +0200)]
iio: ms65611_core: Fixes dereferencing regulator pointer

Change in handling of the regulator description means that static
checkers correctly assume we could be using dereferenced pointer to the
regulator. In reality we will never get the -ENODEV error, as current
behavior flow does not predict it, because:
If the device tree or board file does not define suitable regulators for
the component, it will be substituted by a dummy regulator, or, if
regulators are disabled altogether, by stubs.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoStaging: iio: fix a MAINTAINERS entry
Dan Carpenter [Tue, 11 Oct 2016 11:12:29 +0000 (14:12 +0300)]
Staging: iio: fix a MAINTAINERS entry

The "drivers/" part of the path name was missing.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: bmi160_core: Fix sparse warning due to incorrect type in assignment
sayli karnik [Tue, 11 Oct 2016 11:37:21 +0000 (17:07 +0530)]
iio: bmi160_core: Fix sparse warning due to incorrect type in assignment

There is a type mismatch between the buffer which is of type s16 and the
samples stored, which are declared as __le16.

Fix the following sparse warning:
drivers/iio/imu/bmi160/bmi160_core.c:411:26: warning: incorrect type
in assignment (different base types)

drivers/iio/imu/bmi160/bmi160_core.c:411:26: expected signed short
[signed] [short] [explicitly-signed] <noident>
drivers/iio/imu/bmi160/bmi160_core.c:411:26: got restricted __le16
[addressable] [usertype] sample

This is a cosmetic-type patch since it does not alter code behaviour.
The le16 is going into a 16bit buf element, and is labelled as IIO_LE in the
channel buffer definition.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: isl29018: rename description in Kconfig for consistency
Brian Masney [Mon, 10 Oct 2016 07:20:00 +0000 (03:20 -0400)]
staging: iio: isl29018: rename description in Kconfig for consistency

Rename description from "ISL 29018" to "Intersil 29018" in Kconfig for
consistency with other drivers in mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: isl29018: remove blank line for consistency
Brian Masney [Mon, 10 Oct 2016 07:19:59 +0000 (03:19 -0400)]
staging: iio: isl29018: remove blank line for consistency

Remove blank line between MODULE_DEVICE_TABLE() and its corresponding
structure for consistency with the other device table entries.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: isl29018: combine two return statements into one
Brian Masney [Mon, 10 Oct 2016 07:19:58 +0000 (03:19 -0400)]
staging: iio: isl29018: combine two return statements into one

Use the return value from isl29018_set_integration_time() as the return
value for isl29018_chip_init() since this is the last piece of work
inside that function.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: isl29018: fix multiline comment syntax
Brian Masney [Mon, 10 Oct 2016 07:19:57 +0000 (03:19 -0400)]
staging: iio: isl29018: fix multiline comment syntax

Change multiline comments from:

/* line1
 * line2
 * ...
 */

to

/*
 * line1
 * line2
 * ...
 */

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: isl29018: fix poorly named function
Brian Masney [Mon, 10 Oct 2016 07:19:56 +0000 (03:19 -0400)]
staging: iio: isl29018: fix poorly named function

isl29035_detect() did not just do chip detection. Move functionality directly
into isl29018_chip_init() to avoid naming confusion.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: isl29018: add newlines to improve readability
Brian Masney [Mon, 10 Oct 2016 07:19:55 +0000 (03:19 -0400)]
staging: iio: isl29018: add newlines to improve readability

Add newlines to improve code readability in preparation for moving the
driver out of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging:iio:TODO drop outdated entries in this todo.
Jonathan Cameron [Sun, 9 Oct 2016 10:38:19 +0000 (11:38 +0100)]
staging:iio:TODO drop outdated entries in this todo.

There is still stuff to be done in the remaining drivers but pretty much
nothing was left from this original TODO.

Sorry Greg, should have been keeping this up to date.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: iio: cdc: ad7152: Replace mlock with a local mutex lock
sayli karnik [Mon, 10 Oct 2016 06:20:48 +0000 (11:50 +0530)]
staging: iio: cdc: ad7152: Replace mlock with a local mutex lock

mlock is intended to protect only switches between modes.
Given this driver doesn't support more than one mode (sysfs polled reads
only), replace mlock with a local mutex lock.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ
Eva Rachel Retuya [Mon, 10 Oct 2016 10:01:31 +0000 (18:01 +0800)]
staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ

This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ
attribute wherein usage has some advantages like it can be accessed by
in-kernel consumers as well as reduces the code size.

Therefore, use IIO_CHAN_INFO_SAMP_FREQ to implement the
sampling_frequency attribute instead of using IIO_DEVICE_ATTR() macro.

Move code from the functions associated with IIO_DEVICE_ATTR() into
respective read and write hooks with the mask set to
IIO_CHAN_INFO_SAMP_FREQ.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: cdc: ad7152: Implement IIO_CHAN_INFO_SAMP_FREQ attribute
sayli karnik [Mon, 10 Oct 2016 15:39:17 +0000 (21:09 +0530)]
staging: iio: cdc: ad7152: Implement IIO_CHAN_INFO_SAMP_FREQ attribute

Attributes that were once privately defined become standard with time
and hence a special global define is used. Hence update driver ad7152 to use
IIO_CHAN_INFO_SAMP_FREQ which is a global define instead of
IIO_DEV_ATTR_SAMP_FREQ.
Move functionality from IIO_DEV_ATTR_SAMP_FREQ attribute into
IIO_CHAN_INFO_SAMP_FREQ to implement the sampling_frequency attribute.
Modify ad7152_read_raw() and ad7152_write_raw() to allow reading and
writing the element as well. Also add a lock in the driver's private
data.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoStaging: vt6655: Replace dwIoBase by iobase
Varsha Rao [Sat, 15 Oct 2016 10:32:58 +0000 (16:02 +0530)]
Staging: vt6655: Replace dwIoBase by iobase

In this patch dwIoBase is renamed as iobase. This is done to fix the
checkpatch issue of CamelCase.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: core: constify local structure
Elizabeth Ferdman [Mon, 17 Oct 2016 06:46:30 +0000 (23:46 -0700)]
staging: rtl8188eu: core: constify local structure

Constify the static struct RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE.

The only other instance was one of its properties being assigned to a
variable:
Index2G = RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE.Index2G;

Therefore this is a good candidate for constification.

Running size did not show any difference:
Before/After:
text    data     bss     dec     hex filename
44122     408    2974   47504    b990

Lastly, break up the long line to fix the checkpatch warning and conform
to kernel coding style.

Signed-off-by: Elizabeth Ferdman <gnudevliz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: Compress return logic into one line.
Elise Lennion [Mon, 17 Oct 2016 02:15:47 +0000 (00:15 -0200)]
staging: rtl8192e: Compress return logic into one line.

Simplify return logic to avoid unnecessary variable assignments.

Coccinelle was used with this semantic patch:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: xgifb: Compress return logic into one line.
Elise Lennion [Mon, 17 Oct 2016 02:17:20 +0000 (00:17 -0200)]
staging: xgifb: Compress return logic into one line.

Simplify return logic to avoid unnecessary variable assignments.

Coccinelle was used with this semantic patch:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6656: Compress return logic into one line.
Elise Lennion [Mon, 17 Oct 2016 02:18:58 +0000 (00:18 -0200)]
staging: vt6656: Compress return logic into one line.

Compress the return logic into one line avoids unnecessary variable
declarations. In this case it also makes it easier to understand the
function.

Coccinelle was used to find this return statement. However, additional
compressions were done to make the function clearer.

Semantic patch:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: unisys: visorbus: Make a read-only structure
Mihaela Muraru [Sat, 15 Oct 2016 22:41:14 +0000 (01:41 +0300)]
Staging: unisys: visorbus: Make a read-only structure

This patch add const qualifier at the declaration of the structure.
The structure become a read-only data, this increase the security.

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: Remove braces around single statement blocks
Sabitha George [Sun, 16 Oct 2016 16:14:26 +0000 (21:44 +0530)]
staging: ks7010: Remove braces around single statement blocks

Fixes checkpatch warning: braces{} are not necessary for
single statment blocks

Signed-off-by: Sabitha George <sabitha.george@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: Add blank line after declarations
Sabitha George [Sun, 16 Oct 2016 16:12:44 +0000 (21:42 +0530)]
staging: ks7010: Add blank line after declarations

Fixes checkpatch.pl warning :Missing a blank line
after declarations

Signed-off-by: Sabitha George <sabitha.george@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wilc1000: Remove unnecessary extern variables.
Elise Lennion [Sat, 15 Oct 2016 22:26:26 +0000 (19:26 -0300)]
staging: wilc1000: Remove unnecessary extern variables.

Extern variables and functions used in only one file were removed
from .h files, and made static in the .c files they're used.

Extern variable wilc_initialized was declared and never used, so it was
removed.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: vt6656: Make a read-only structure
Mihaela Muraru [Sat, 15 Oct 2016 21:55:22 +0000 (00:55 +0300)]
Staging: vt6656: Make a read-only structure

This patch add const qualifier at the declaration of the structure.
The structure become a read-only data, this increase the security.

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: unisys: visorbus: add missing include
Laurent Navet [Sat, 15 Oct 2016 09:50:11 +0000 (11:50 +0200)]
staging: unisys: visorbus: add missing include

this removes lots of sparse warnings :
warning: symbol 'visorchannel_destroy' was not declared. Should it be static?
warning: symbol 'visorchannel_get_physaddr' was not declared. Should it be static?
warning: symbol 'visorchannel_get_nbytes' was not declared. Should it be static?
warning: symbol 'visorchannel_uuid_id' was not declared. Should it be static?
warning: symbol 'visorchannel_id' was not declared. Should it be static?
warning: symbol 'visorchannel_zoneid' was not declared. Should it be static?
warning: symbol 'visorchannel_get_clientpartition' was not declared. Should it be static?
warning: symbol 'visorchannel_set_clientpartition' was not declared. Should it be static?
warning: symbol 'visorchannel_read' was not declared. Should it be static?
warning: symbol 'visorchannel_write' was not declared. Should it be static?
warning: symbol 'visorchannel_get_header' was not declared. Should it be static?
warning: symbol 'visorchannel_create' was not declared. Should it be static?
warning: symbol 'visorchannel_create_with_lock' was not declared. Should it be static?

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:baseband.h: fix function definition argument without identifier name...
Mikhail Golubev [Fri, 14 Oct 2016 08:58:08 +0000 (11:58 +0300)]
staging:vt6656:baseband.h: fix function definition argument without identifier name issue

Function definitions arguments should also have an identifier name as
reported by checkpatch.pl.

Signed-off-by: Mikhail Golubev <golubev.mikhail@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: Add const qualifier to struct declaration.
Elise Lennion [Sat, 15 Oct 2016 00:35:13 +0000 (21:35 -0300)]
staging: dgnc: Add const qualifier to struct declaration.

Const qualifier added to struct declaration to avoid data overwrite
during runtime and improve security.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: Add const qualifier to struct declaration.
Elise Lennion [Sat, 15 Oct 2016 00:32:03 +0000 (21:32 -0300)]
staging: sm750fb: Add const qualifier to struct declaration.

Const qualifier added to struct declaration to avoid data overwrite
during runtime and improve security.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: android: ion: constify dma_buf_ops structure
Bhumika Goyal [Sat, 15 Oct 2016 06:13:48 +0000 (11:43 +0530)]
Staging: android: ion: constify dma_buf_ops structure

The dma_buf_ops structure is stored in the ops field of a
dma_buf_export_info structure and also used as a condition inside the
if() statement. The if condition does not modify its value and the
ops field is of type const struct *dma_buf_ops, so dma_buf_ops
structures having this property can be declared as const.

File size before:
   text    data     bss     dec     hex filename
  14471     819     224   15514    3c9a
drivers/staging/android/ion/ion.o

File size after:
   text    data     bss     dec     hex filename
  14599     707     224   15530    3caa
drivers/staging/android/ion/ion.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: greybus: uart: constify tty_port_operations structure
Bhumika Goyal [Sat, 15 Oct 2016 06:58:01 +0000 (12:28 +0530)]
Staging: greybus: uart: constify tty_port_operations structure

Declare tty_port_operations structure as const as it is only stored in
the ops field of a tty_port structure which is a field of a gb_tty
structure. The ops field is of type const struct tty_port_operations *,
so tty_port_operations structures having this property can be
declared as const.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct tty_port_operations i@p = {...};

@ok1@
identifier r1.i;
position p;
struct gb_tty q;
@@
q.port.ops=&i@p

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct tty_port_operations i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct tty_port_operations i;

File size before:
   text    data     bss     dec     hex filename
   7646     512      56    8214    2016 drivers/staging/greybus/uart.o

File size after:
   text    data     bss     dec     hex filename
   7710     448      56    8214    2016 drivers/staging/greybus/uart.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Johan Hovold <johan@kernel.org>
Reviewed-by: David Lin <dtwlin@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: es2: Use kmemdup instead of kmalloc and memcpy
sayli karnik [Sun, 16 Oct 2016 08:49:48 +0000 (14:19 +0530)]
staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy

This patch replaces kmalloc and memcpy with kmemdup for duplication of
memory.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: audio: Rename cport with intf_id
Pankaj Bharadiya [Sun, 16 Oct 2016 09:59:14 +0000 (15:29 +0530)]
staging: greybus: audio: Rename cport with intf_id

gb_audio_manager_module_descriptor's cport field is actually used to
manage and pass interface id to user space.

Thus rename gb_audio_manager_module_descriptor's 'cport' field and
few other things to avoid confusion.

Signed-off-by: Pankaj Bharadiya <pankaj.bharadiya@gmail.com>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: lustre: indent an if statement
Dan Carpenter [Thu, 13 Oct 2016 08:52:02 +0000 (11:52 +0300)]
Staging: lustre: indent an if statement

This if statement wasn't intended.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: Fixes warning :do not add new typedefs
Sabitha George [Thu, 13 Oct 2016 17:06:23 +0000 (22:36 +0530)]
staging: ks7010: Fixes warning :do not add new typedefs

Fixes checkpatch.pl warning: do not add new typedefs in
ks_wlan_net.c

Signed-off-by: Sabitha George <sabitha.george@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: Replace __attribute__(aligned(x)) with __aligned(x)
Sabitha George [Thu, 13 Oct 2016 17:02:20 +0000 (22:32 +0530)]
staging: ks7010: Replace __attribute__(aligned(x)) with __aligned(x)

Fixes checkpatch.pl warning: __aligned(size) is preferred over
__attribute__((aligned(size)) in ks7010_sdio.h

Signed-off-by: Sabitha George <sabitha.george@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: Remove unnecessary comments.
Elise Lennion [Thu, 13 Oct 2016 22:27:17 +0000 (19:27 -0300)]
staging: sm750fb: Remove unnecessary comments.

Remove function comments that only restate the function name.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: Replace functions CamelCase naming with underscores.
Elise Lennion [Thu, 13 Oct 2016 22:25:52 +0000 (19:25 -0300)]
staging: sm750fb: Replace functions CamelCase naming with underscores.

Replace CamelCase function names with underscores to comply with
the standard kernel coding style.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: audio_codec: Remove useless return statement.
Elise Lennion [Thu, 13 Oct 2016 22:40:04 +0000 (19:40 -0300)]
staging: greybus: audio_codec: Remove useless return statement.

Remove return statement that is immediately followed by the function
closing bracket.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: wilc1000: Compress return logic into one line
Mihaela Muraru [Thu, 13 Oct 2016 21:00:51 +0000 (00:00 +0300)]
Staging: wilc1000: Compress return logic into one line

Simplify function returns by merging assignment and return into
one command line.

Delete unnecesarry return variable.

Found with Coccinelle
@@
expression e, ret;
@@

-ret =
+return
        e;
-return ret

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: netlogic: Compress return logic into one line
Mihaela Muraru [Thu, 13 Oct 2016 16:45:59 +0000 (19:45 +0300)]
Staging: netlogic: Compress return logic into one line

Simplify function returns by merging assignment and return into
one command line.
Found with Coccinelle
@@
expression e, ret;
@@

-ret =
+return
        e;
-return ret;

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtl8188eu: hal: Compress return logic into one line
Mihaela Muraru [Thu, 13 Oct 2016 15:27:31 +0000 (18:27 +0300)]
Staging: rtl8188eu: hal: Compress return logic into one line

Simplify function returns by merging assignment and return into
one command line.
Found with Coccinelle
@@
expression e, ret;
@@

-ret =
+return
        e;
-return ret;

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: vt6655: Removes unused macros.
Varsha Rao [Thu, 13 Oct 2016 22:59:54 +0000 (04:29 +0530)]
Staging: vt6655: Removes unused macros.

This patch removes the macros BBvClearFOE and BBvSetFOE. As they are not
used anywhere else.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6655: Adding space around '<<'
Varsha Rao [Thu, 13 Oct 2016 18:59:22 +0000 (00:29 +0530)]
staging: vt6655: Adding space around '<<'

This patch fixes the checkpatch issue by adding space around '<<'.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6655: Adding space around '+'
Varsha Rao [Thu, 13 Oct 2016 18:47:22 +0000 (00:17 +0530)]
staging: vt6655: Adding space around '+'

This patch fixes the checkpatch issue by adding space around the
operator '+'.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:card.c: fix block comments should align the * on each line
Mikhail Golubev [Wed, 12 Oct 2016 14:57:49 +0000 (17:57 +0300)]
staging:vt6656:card.c: fix block comments should align the * on each line

Block comments should align the * on each line as reported by checkpatch.pl

Signed-off-by: Mikhail Golubev <golubev.mikhail@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>