platform/kernel/linux-exynos.git
8 years agoMerge tag 'iio-for-4.7b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Tue, 26 Apr 2016 22:07:23 +0000 (15:07 -0700)]
Merge tag 'iio-for-4.7b' of git://git./linux/kernel/git/jic23/iio into staging-testing

Jonathan writes:

2nd set of new device support, features and cleanup for IIO in the 4.7 cycle.

Bit of a bumper set for new drivers but plenty of other stuff here as well!

New device support
* ad5592R ADC/DAC
  - new driver supporting ad5592r and ad5593r combined ADC/DAC and gpio chips.
* Aosong am2315 relative humidity
  - new driver with triggered buffer support in follow up patch.
* bmi160 imu
  - new driver
* bmp280
  - bmp180 support - note there is support in the misc/bmp085 driver. Intent
    is to remove that driver long term.
* invensense mpu6050
  - cleanup leading to explicit support of mpu9150 with a good few cleanups
    along the way.
* Hope RF hp03 pressure and temperature sensor.
  - new driver
* maxim DS1803 potentiometer
  - new driver
* maxim max44000 light and proximity sensor
  - new driver built in a series of steps to support pretty much everything.
* ROHM BH1780 light sensor
  - new driver. There is an existing driver in misc that this is pretty much
    intended to replace.  The discussion on whether to support the non standard
    interface of that driver is some way is continuing.
* st-gyro
  - lsm9ds0-gyro.  The accel/magn side of this will take a while longer as
    extensions to the st library are needed for cases where two types of sensor
    share a single i2c address.
* ti-adc081c
  - support the adc101c and adc121c
* Vishay VEML6070 UV sensor
  - new driver.

New features
* core
  - devm_ APIs for channel_get and channel_get_all.  The first user of these
    is the generic ADC based thermal driver.  As it is going through the
    thermal tree these will be picked up as a patch to that next cycle as that
    is how the author preferred to do it.
  - mounting matrix support.  This new core support allows devices to provide
    to userspace (typically from the device tree) allowing compensation for how
    the sensor is mounted on the device.  First examples are on UAVs but it
    has a more mundane use on typical phone where the chip may be on the front
    or the back of the circuit board and soldered at any angle. Includes
    support for this ABI in ak8975 (which has an older interface, now
    deprecated) and mpu6050.
* tools
  - add a -a option to enable all available channels in generic_buffer sample.
    Makes it somewhat easier to use.
* adis library and drivers
  - support manual self test flag clearing.  This has technically been broken
    for a very long time - result is an offset on readings as the applied field
    is on all the time.
* ak8975
  - triggered buffer support
* bmc150
  - spi support (including splitting the driver into core and i2c parts)
* bmp280
  - oversampling support.
* dht11
  - improved logging - useful to debug timing issues on this quirky device.
* st-sensors
  - read each channel invidivually as not all support the optimization of
  reading in bulk.  This is technically a fix, but will need to be backported
  if desired.
  - support open drain and shared interrupts.
* ti-adc081c
  - triggered buffer support.

Cleanups
* inkern
  - white space fix.
* ad7606
  - use the iio_device_claim_direct_mode call rather than open coding equiv.
* ad799x
  - white space fix.
* ad9523
  - unsigned -> unsigned int
* apds9660
  - brace location tidying up.
  - silence an uninitialized variable warning.
* ak8975
  - else and brace on same line fix.
* at91_adc
  - white space fixes.
* bmc150
  - use regmap stored copy of the device pointer rather than having an
    additional copy.
* bmg160
  - use regmap stored copy of the device pointer rather than having an
    additional copy.
* hid-sensors
  - white space fixes.
* mcp3422
  - white space fix.
* mma7455
  - use regmap to retrieve the device struct rather than carrying another copy
    in the private data.
* ms_sensors
  - white space fix.
* mxs-lradc
  - move current bindings out of staging - some will be shortly deprecated but
    the reality is that we have device trees out there using them so they will
    need to be supported for some time.  They accidentally got left behind
    when the driver graduated from staging.
  - white space cleanup.
  - set INPUT_PROP_DIRECT.
  - move ts config into a better function.
  - move the STMP reset out of the ADC init.
* vf610_adc
  - case label indenting fix.

8 years agoiio: inv_mpu6050: Add explicit support for MPU9150
Crestez Dan Leonard [Wed, 20 Apr 2016 13:15:13 +0000 (16:15 +0300)]
iio: inv_mpu6050: Add explicit support for MPU9150

This device is a package containing a MPU6050-like sensor and an AK8975
magnetometer. The magnetometer component is supported by the existing
ak8975 driver.

This patch also rephrases the Kconfig descriptions.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: inv_mpu6050: Add spi_device_id for INV_MPU6500
Crestez Dan Leonard [Wed, 20 Apr 2016 13:15:12 +0000 (16:15 +0300)]
iio: inv_mpu6050: Add spi_device_id for INV_MPU6500

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: inv_mpu6050: Check WHO_AM_I register on probe
Crestez Dan Leonard [Wed, 20 Apr 2016 13:15:11 +0000 (16:15 +0300)]
iio: inv_mpu6050: Check WHO_AM_I register on probe

This can be used to distinguish mpu6500. This is a warning rather than
an error because the differences are mostly irrelevant and it's nice to
avoid breaking users with slightly incorrect ACPI/DT.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: inv_mpu6050: Remove inv_mpu6050_hw.num_reg
Crestez Dan Leonard [Wed, 20 Apr 2016 13:15:10 +0000 (16:15 +0300)]
iio: inv_mpu6050: Remove inv_mpu6050_hw.num_reg

This field was unused and incorrect for mpu6500.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: inv_mpu6050: Cleanup hw_info mapping
Crestez Dan Leonard [Wed, 20 Apr 2016 13:15:09 +0000 (16:15 +0300)]
iio: inv_mpu6050: Cleanup hw_info mapping

The hw_info array was indexed by enum inv_devices chip_type despite the
fact that the enumeration had more members than the array and was
ordered differently.

The patch cleans this up and adds explicit chip_types to i2c/spi/acpi
IDs. It also adds some stricter checks inside the driver core.

This happened to work so far because the differences between the
supported models are very minor.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: add ability to control oversampling rate
Akinobu Mita [Sun, 24 Apr 2016 13:52:11 +0000 (22:52 +0900)]
iio: pressure: bmp280: add ability to control oversampling rate

This adds ability to control the oversampling ratio of the temperature
and pressure measurement for both bmp180 and bmp280.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Vlad Dogaru <vlad.dogaru@intel.com>
Cc: Christoph Mair <christoph.mair@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: bmp280: add support for BMP180
Akinobu Mita [Sun, 24 Apr 2016 13:52:10 +0000 (22:52 +0900)]
iio: pressure: bmp280: add support for BMP180

This adds support for the BMP180 to the bmp280 iio driver.

The BMP180 has already been supported by misc/bmp085 driver but it
doesn't use iio framework.  This change adds the kconfig dependency
not to be selected both of them in order to avoid any issues.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Vlad Dogaru <vlad.dogaru@intel.com>
Cc: Christoph Mair <christoph.mair@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agomax44000: Initial triggered buffer support
Crestez Dan Leonard [Mon, 18 Apr 2016 14:31:57 +0000 (17:31 +0300)]
max44000: Initial triggered buffer support

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agomax44000: Expose ambient sensor scaling
Crestez Dan Leonard [Mon, 18 Apr 2016 14:31:56 +0000 (17:31 +0300)]
max44000: Expose ambient sensor scaling

This patch exposes ALSTIM as illuminance_integration_time and ALSPGA as
illuminance_scale.

Changing ALSTIM also changes the number of bits available in the data
register. This is handled inside raw value reading because:
* It's very easy to shift a few bits
* It allows SCALE and INT_TIME to be completely independent controls
* Buffer support requires constant scan_type.realbits per-channel

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agomax44000: Support controlling LED current output
Crestez Dan Leonard [Mon, 18 Apr 2016 14:31:55 +0000 (17:31 +0300)]
max44000: Support controlling LED current output

This is exposed as an output channel with "led" as an extend_name.

Other sensors also have support for controlling an external LED. It's
not clear that simply exposing an undecorated output channel is the
correct approach.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agomax44000: Initial support for proximity reading
Crestez Dan Leonard [Mon, 18 Apr 2016 14:31:54 +0000 (17:31 +0300)]
max44000: Initial support for proximity reading

The proximity sensor relies on sending pulses to an external IR led and
it is disabled by default on powerup. The driver will enable it with a
default power setting.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agomax44000: Initial support
Crestez Dan Leonard [Mon, 18 Apr 2016 14:31:53 +0000 (17:31 +0300)]
max44000: Initial support

This just adds support for reporting illuminance with default settings.

Important default registers are written on probe because the device
otherwise lacks a reset function.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: humidity: Add triggered buffer support for AM2315
Tiberiu Breana [Mon, 18 Apr 2016 14:50:44 +0000 (17:50 +0300)]
iio: humidity: Add triggered buffer support for AM2315

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: humidity: Add support for AM2315
Tiberiu Breana [Mon, 18 Apr 2016 14:50:43 +0000 (17:50 +0300)]
iio: humidity: Add support for AM2315

Add basic support for the Aosong AM2315 relative humidity
and ambient temperature sensor.
Includes support for raw readings and ACPI detection.

Datasheet:
http://www.aosong.com/asp_bin/Products/en/AM2315.pdf

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: hp03: Add Hope RF HP03 sensor support
Marek Vasut [Mon, 18 Apr 2016 14:05:24 +0000 (16:05 +0200)]
iio: pressure: hp03: Add Hope RF HP03 sensor support

Add support for HopeRF pressure and temperature sensor.

This device uses two fixed I2C addresses, one for storing
calibration coefficients and another for accessing the ADC.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Matt Ranostay <mranostay@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: st_gyro: Add lsm9ds0-gyro support
Crestez Dan Leonard [Tue, 19 Apr 2016 12:02:11 +0000 (15:02 +0300)]
iio: st_gyro: Add lsm9ds0-gyro support

This device has an identical interface to other supported sensors and the patch
only adds IDs.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: apds9960: silence uninitialized variable warning
Dan Carpenter [Fri, 22 Apr 2016 10:04:14 +0000 (13:04 +0300)]
iio: light: apds9960: silence uninitialized variable warning

It causes a static checker warning if we use "buf" on the failure path
so move that inside the if statement.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:imu:mpu6050: enhance mounting matrix support
Gregor Boirie [Wed, 20 Apr 2016 17:23:45 +0000 (19:23 +0200)]
iio:imu:mpu6050: enhance mounting matrix support

Add a new rotation matrix sysfs attribute compliant with IIO core
mounting matrix API.
Matrix is retrieved from "in_anglvel_mount_matrix" and
"in_accel_mount_matrix" sysfs attributes. It is declared into mpu6050 DTS
entry as a "mount-matrix" property.

Old interface is kept for backward userspace compatibility and may be
retrieved from legacy platform_data mechanism only.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:ak8975: add mounting matrix support
Gregor Boirie [Wed, 20 Apr 2016 17:23:44 +0000 (19:23 +0200)]
iio:ak8975: add mounting matrix support

Expose a rotation matrix to indicate userspace the chip orientation with
respect to the overall hardware system.
Matrix is retrieved from "in_mount_matrix". It is declared into ak8975 DTS
entry as a "mount-matrix" property.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:core: mounting matrix support
Gregor Boirie [Wed, 20 Apr 2016 17:23:43 +0000 (19:23 +0200)]
iio:core: mounting matrix support

Expose a rotation matrix to indicate userspace the chip placement with
respect to the overall hardware system. This is needed to adjust
coordinates sampled from a sensor chip when its position deviates from the
main hardware system.

Final coordinates computation is delegated to userspace since:
* computation may involve floating point arithmetics ;
* it allows an application to combine adjustments with arbitrary
  transformations.

This 3 dimentional space rotation matrix is expressed as 3x3 array of
strings to support floating point numbers. It may be retrieved from a
"[<dir>_][<type>_]mount_matrix" sysfs attribute file. It is declared into a
device / driver specific DTS property or platform data.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: gyro: bmg160: use regmap to retrieve struct device
Alison Schofield [Sun, 10 Apr 2016 19:08:14 +0000 (12:08 -0700)]
iio: gyro: bmg160: use regmap to retrieve struct device

Driver includes struct regmap and struct device in its global data.
Remove the struct device and use regmap API to retrieve device info.

Patch created using Coccinelle plus manual edits.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: accel: bmc150: use regmap to retrieve struct device
Alison Schofield [Sun, 10 Apr 2016 19:05:13 +0000 (12:05 -0700)]
iio: accel: bmc150: use regmap to retrieve struct device

Driver includes struct regmap and struct device in its global data.
Remove the struct device and use regmap API to retrieve device info.

Patch created using Coccinelle plus manual edits.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: Add Vishay VEML6070 UV A light sensor driver
Peter Meerwald-Stadler [Sun, 20 Mar 2016 15:20:24 +0000 (16:20 +0100)]
iio: Add Vishay VEML6070 UV A light sensor driver

ultraviolet (UV) light sensor with I2C interface with a peak
sensitivity at 355 nm

strangely, chip uses two addresses 0x38 and 0x39 for LSB and
MSB data, resp.

datasheet: http://www.vishay.com/docs/84277/veml6070.pdf

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: Add resource managed APIs devm_iio_channel_{get,release) in devres
Laxman Dewangan [Wed, 6 Apr 2016 10:31:08 +0000 (16:01 +0530)]
iio: Add resource managed APIs devm_iio_channel_{get,release) in devres

Add following APIs in the list of managed resources of IIO:
devm_iio_channel_get()
devm_iio_channel_get_all()
devm_iio_channel_release()
devm_iio_channel_release_all()

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: core: Add devm_ APIs for iio_channel_{get,release}_all
Laxman Dewangan [Wed, 6 Apr 2016 10:31:07 +0000 (16:01 +0530)]
iio: core: Add devm_ APIs for iio_channel_{get,release}_all

Some of kernel driver uses the IIO framework to get the sensor
value via ADC or IIO HW driver. The client driver get iio channel
by iio_channel_get_all() and release it by calling
iio_channel_release_all().

Add resource managed version (devm_*) of these APIs so that if client
calls the devm_iio_channel_get_all() then it need not to release it
explicitly, it can be done by managed device framework when driver
get un-binded.

This reduces the code in error path and also need of .remove callback in
some cases.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: core: Add devm_ APIs for iio_channel_{get,release}
Laxman Dewangan [Wed, 6 Apr 2016 10:31:06 +0000 (16:01 +0530)]
iio: core: Add devm_ APIs for iio_channel_{get,release}

Some of kernel driver uses the IIO framework to get the sensor
value via ADC or IIO HW driver. The client driver get iio channel
by iio_channel_get() and release it by calling iio_channel_release().

Add resource managed version (devm_*) of these APIs so that if client
calls the devm_iio_channel_get() then it need not to release it explicitly,
it can be done by managed device framework when driver get un-binded.

This reduces the code in error path and also need of .remove callback in
some cases.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: tools: generic_buffer: auto-enable channels
Linus Walleij [Thu, 14 Apr 2016 08:26:47 +0000 (10:26 +0200)]
iio: tools: generic_buffer: auto-enable channels

If no channels are enabled when we run generic_buffer on a
device, add a command-line option to just enable all of them,
run the sampling and disable them all again afterwards.

This is extremely useful when I'm low-level testing my
sensors with interrupts and triggers, sample session:

root@Ux500:/ lsiio
Device 000: lsm303dlh_accel
Device 001: lis331dl_accel
Device 002: l3g4200d
Device 003: lsm303dlh_magn
Device 004: lps001wp
Trigger 000: lsm303dlh_accel-trigger
Trigger 001: lis331dl_accel-trigger
Trigger 002: l3g4200d-trigger

root@Ux500:/ generic_buffer -a -c 10 -n l3g4200d
iio device number being used is 2
iio trigger number being used is 2
No channels are enabled, enabling all channels
Enabling: in_anglvel_x_en
Enabling: in_anglvel_y_en
Enabling: in_anglvel_z_en
Enabling: in_timestamp_en
/sys/bus/iio/devices/iio:device2 l3g4200d-trigger
-3.593664 -0.713133 4.870143 946684863662292480
3.225546 0.867357 -4.945878 946684863671875000
-0.676413 0.127296 0.106641 946684863681488037
-0.661113 0.110160 0.128826 946684863690673828
-0.664173 0.113067 0.123471 946684863700683593
-0.664938 0.109395 0.124848 946684863710144042
-0.664173 0.110619 0.130203 946684863719512939
-0.666162 0.111231 0.132651 946684863729125976
-0.668610 0.111690 0.130662 946684863738739013
-0.660501 0.110466 0.131733 946684863748565673
Disabling: in_anglvel_x_en
Disabling: in_anglvel_y_en
Disabling: in_anglvel_z_en
Disabling: in_timestamp_en

Pure awesomeness. If some channels have been enabled through
scripts or manual interaction, nothing happens.

Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: st_sensors: support open drain mode
Linus Walleij [Thu, 14 Apr 2016 08:45:21 +0000 (10:45 +0200)]
iio: st_sensors: support open drain mode

Some types of ST Sensors can be connected to the same IRQ line
as other peripherals using open drain. Add a device tree binding
and a sensor data property to flip the right bit in the interrupt
control register to enable open drain mode on the INT line.

If the line is set to be open drain, also tag on IRQF_SHARED
to the IRQ flags when requesting the interrupt, as the whole
point of using open drain interrupt lines is to share them with
more than one peripheral (wire-or).

Cc: devicetree@vger.kernel.org
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Acked-by: Rob Herring <rob@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: st_sensors: verify interrupt event to status
Linus Walleij [Thu, 24 Mar 2016 13:18:05 +0000 (14:18 +0100)]
iio: st_sensors: verify interrupt event to status

This makes all ST sensor drivers check that they actually have
new data available for the requested channel(s) before claiming
an IRQ, by reading the status register (which is conveniently
the same for all ST sensors) and check that the channel has new
data before proceeding to read it and fill the buffer.

This way sensors can share an interrupt line: it can be flaged
as shared and then the sensor that did not fire will return
NO_IRQ, and the sensor that fired will handle the IRQ and
return IRQ_HANDLED.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: st_sensors: read each channel individually
Linus Walleij [Thu, 24 Mar 2016 13:18:04 +0000 (14:18 +0100)]
iio: st_sensors: read each channel individually

The current buffer read code tries to optimize reads from the
sensor data registers by issuing a single read operation across
all the indata registers.

This doesn't work: when the LIS331DL accelerometer sensor is
configured to open drain, active low interrupt mode, this will
just clear the XDA (X-axis data available) bit in the STATUS_REG
register (0x27), while YDA, ZDA and even ZYXDA remain set to 1,
and the internal logic of the sensor holds the DRDY (INT1) line
asserted (the value of the status register is 0xee).

If we instead issue one read operation per enabled channel
(X, Y, Z) things start working and we can use open drain and
active low interrupts.

Note that a backported patch fixing this issue will be heading
via the fixes branch but changes in this file already in staging-next
will make that patch 'look' rather different.  The code in here
is the correct one when that clash hits.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: mxs-lradc: move STMP reset out of ADC init
Stefan Wahren [Thu, 14 Apr 2016 15:48:27 +0000 (15:48 +0000)]
iio: mxs-lradc: move STMP reset out of ADC init

This patch moves the STMP reset out of ADC init function so as to remove
the possiblity of an error return which will be necessary for PM ops support
patches to follow.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: mxs-lradc: move TS config into suitable function
Stefan Wahren [Thu, 14 Apr 2016 15:48:26 +0000 (15:48 +0000)]
iio: mxs-lradc: move TS config into suitable function

This patch moves the touchscreen type configuration into
a more suitable function. Btw this simplifies PM ops later.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: bmc150: Introduce SPI support
Daniel Baluta [Fri, 15 Apr 2016 14:13:10 +0000 (17:13 +0300)]
iio: magn: bmc150: Introduce SPI support

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: Split bmc150 driver in common/i2c parts
Daniel Baluta [Fri, 15 Apr 2016 14:13:09 +0000 (17:13 +0300)]
iio: magn: Split bmc150 driver in common/i2c parts

This is useful for easily adding SPI support in later patches.

Now bmc150_magn exports core functions to be used by I2C/SPI drivers
instances. For the moment only I2C driver is supported.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: set INPUT_PROP_DIRECT
Ksenija Stanojevic [Sun, 10 Apr 2016 19:22:32 +0000 (21:22 +0200)]
iio: adc: set INPUT_PROP_DIRECT

Set INPUT_PROP_DIRECT to indicate that it is a touchscreen on the
device to help userspace classify it.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoti-adc081c: Initial triggered buffer support
Crestez Dan Leonard [Mon, 11 Apr 2016 14:24:27 +0000 (17:24 +0300)]
ti-adc081c: Initial triggered buffer support

Using this requires software triggers like CONFIG_IIO_HRTIMER_TRIGGER.

The device can be configured to do internal periodic sampling but does not
offer some sort of interrupt on data ready. Interrupts can only trigger when
values get out of a specific range.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoti-adc081c: Add support for adc101c and adc121c
Crestez Dan Leonard [Mon, 11 Apr 2016 14:24:26 +0000 (17:24 +0300)]
ti-adc081c: Add support for adc101c and adc121c

These chips have an almost identical interface but support a different
number of value bits. Datasheet links for comparison:

 * http://www.ti.com/lit/ds/symlink/adc081c021.pdf
 * http://www.ti.com/lit/ds/symlink/adc101c021.pdf
 * http://www.ti.com/lit/ds/symlink/adc121c021.pdf

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: frequency: ad9523: use unsigned int rather then bare unsigned
Slawomir Stepien [Thu, 14 Apr 2016 15:40:24 +0000 (17:40 +0200)]
iio: frequency: ad9523: use unsigned int rather then bare unsigned

This fix checkpatch warnings:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light: new driver for the ROHM BH1780
Linus Walleij [Mon, 11 Apr 2016 12:12:04 +0000 (14:12 +0200)]
iio: light: new driver for the ROHM BH1780

This is a reimplementation of the old misc device driver for the
ROHM BH1780 ambient light sensor (drivers/misc/bh1780gli.c).

Differences from the old driver:
- Uses the IIO framework
- Uses runtime PM to idle the hardware after 5 seconds
- No weird custom power management from userspace
- No homebrewn values in sysfs

This uses the same (undocumented) device tree compatible-string
as the old driver ("rohm,bh1780gli").

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Daniel Mack <daniel@caiaq.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: Indent if statement
Ksenija Stanojevic [Sun, 10 Apr 2016 19:20:56 +0000 (21:20 +0200)]
iio: adc: Indent if statement

Indent lines inside if statement.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging:iio:adis16240: Set self_test_no_autoclear flag
Lars-Peter Clausen [Fri, 15 Apr 2016 14:59:42 +0000 (16:59 +0200)]
staging:iio:adis16240: Set self_test_no_autoclear flag

The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging:iio:adis16209: Set self_test_no_autoclear flag
Lars-Peter Clausen [Fri, 15 Apr 2016 14:59:41 +0000 (16:59 +0200)]
staging:iio:adis16209: Set self_test_no_autoclear flag

The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging:iio:adis16203: Set self_test_no_autoclear flag
Lars-Peter Clausen [Fri, 15 Apr 2016 14:59:40 +0000 (16:59 +0200)]
staging:iio:adis16203: Set self_test_no_autoclear flag

The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging:iio:adis16201: Set self_test_no_autoclear flag
Lars-Peter Clausen [Fri, 15 Apr 2016 14:59:39 +0000 (16:59 +0200)]
staging:iio:adis16201: Set self_test_no_autoclear flag

The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:adis: Add support for manual self-test flag clear
Lars-Peter Clausen [Fri, 15 Apr 2016 14:59:38 +0000 (16:59 +0200)]
iio:adis: Add support for manual self-test flag clear

Some variants of the devices from the ADIS family don't auto-clear the
self-test bit after the self-test has completed. Instead we have to
manually clear. Add support for this to the ADIS library.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: ms5611: use tab for indention
Jonathan Cameron [Sat, 16 Apr 2016 12:38:49 +0000 (13:38 +0100)]
iio: pressure: ms5611: use tab for indention

This fixes the errors reported by checkpatch.pl:

ERROR: code indent should use tabs where possible

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magnetometer: ak8975: put else and brace at the same line
Slawomir Stepien [Thu, 14 Apr 2016 19:36:41 +0000 (21:36 +0200)]
iio: magnetometer: ak8975: put else and brace at the same line

This fixes the error reported by checkpatch.pl:

ERROR: else should follow close brace '}'

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: common: hid-sensors: use tab for indention
Slawomir Stepien [Thu, 14 Apr 2016 19:36:40 +0000 (21:36 +0200)]
iio: common: hid-sensors: use tab for indention

This fixes the error reported by checkpatch.pl:

ERROR: code indent should use tabs where possible

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: common: ms_sensors: use tab for indention
Slawomir Stepien [Thu, 14 Apr 2016 19:36:39 +0000 (21:36 +0200)]
iio: common: ms_sensors: use tab for indention

This fixes the error reported by checkpatch.pl:

ERROR: code indent should use tabs where possible

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: ad799x: remove space before comma
Slawomir Stepien [Thu, 14 Apr 2016 19:36:38 +0000 (21:36 +0200)]
iio: adc: ad799x: remove space before comma

This fixes the error reported by checkpatch.pl:

ERROR: space prohibited before that ',' (ctx:WxW)

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: at91_adc: fix errors reported by checkpatch.pl
Slawomir Stepien [Thu, 14 Apr 2016 19:36:37 +0000 (21:36 +0200)]
iio: adc: at91_adc: fix errors reported by checkpatch.pl

This fixes the errors reported by checkpatch.pl:

ERROR: space prohibited before that ',' (ctx:WxW)
ERROR: code indent should use tabs where possible

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: mcp3422: remove spaces before comma
Slawomir Stepien [Thu, 14 Apr 2016 19:36:36 +0000 (21:36 +0200)]
iio: adc: mcp3422: remove spaces before comma

This fixes the error reported by checkpatch.pl:

ERROR: space prohibited before that ',' (ctx:WxW)

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: vf610_adc: fix case label indent
Slawomir Stepien [Thu, 14 Apr 2016 19:36:35 +0000 (21:36 +0200)]
iio: adc: vf610_adc: fix case label indent

This fixes the error reported by checkpatch.pl:

ERROR: switch and case should be at the same indent

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: inkern: add a missing space before if
Slawomir Stepien [Thu, 14 Apr 2016 19:36:34 +0000 (21:36 +0200)]
iio: inkern: add a missing space before if

This fixes the error reported by checkpatch.pl:

ERROR: space required before the open parenthesis '('

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: light apds9960: fix wrong use of brace
Slawomir Stepien [Thu, 14 Apr 2016 19:36:33 +0000 (21:36 +0200)]
iio: light apds9960: fix wrong use of brace

This fixes the error reported by checkpatch.pl:

ERROR: that open brace { should be on the previous line

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: imu: Add initial support for Bosch BMI160
Daniel Baluta [Fri, 15 Apr 2016 15:06:56 +0000 (18:06 +0300)]
iio: imu: Add initial support for Bosch BMI160

BMI160 is an Inertial Measurement Unit (IMU) which provides acceleration
and angular rate measurement. It also offers a secondary I2C interface
for connecting a magnetometer sensor (usually BMM160).

Current driver offers support for accelerometer and gyroscope readings
via sysfs or via buffer interface using an external trigger (e.g.
hrtimer). Data is retrieved from IMU via I2C or SPI interface.

Datasheet is at:
http://www.mouser.com/ds/2/783/BST-BMI160-DS000-07-786474.pdf

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: unisys: visornic: prevent double-unlock of priv_lock
Tim Sell [Fri, 8 Apr 2016 13:21:10 +0000 (09:21 -0400)]
staging: unisys: visornic: prevent double-unlock of priv_lock

Previously, devdata->priv_lock was being unlocked in visornic_serverdown()
both before calling visornic_serverdown_complete(), then again at the end
of the function.  This bug was corrected.

The structure of visornic_serverdown() was also improved to make it easier
to follow and to decrease the chance that such bugs will be introduced
again.  The main-path logic now falls thru down the left-side of the page,
with a common error-exit point to handle error conditions.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorinput: remove erroneous 'FIXME' comments
Tim Sell [Fri, 8 Apr 2016 12:48:05 +0000 (08:48 -0400)]
staging: unisys: visorinput: remove erroneous 'FIXME' comments

These comments were mistakenly carried forward by a previous copy/paste.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: removed unused 'visor_device.respond_to_device_create'
Alexander Curtin [Wed, 6 Apr 2016 15:20:21 +0000 (11:20 -0400)]
staging: unisys: removed unused 'visor_device.respond_to_device_create'

The respond_to_device_create flag was used previously when we used to
delay responses to create requests until the drivers were finished
loading. This behaviour was removed some time ago, yet the field still
existed, while never being referenced or even initialized.

Signed-off-by: Alexander Curtin <alexander.curtin@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: make bus_epilog match device_epilog
David Kershner [Tue, 5 Apr 2016 03:31:39 +0000 (23:31 -0400)]
staging: unisys: visorbus: make bus_epilog match device_epilog

The paths in bus_epilog should match device_epilog.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: device_epilog: clean up gotos
David Kershner [Tue, 5 Apr 2016 03:31:38 +0000 (23:31 -0400)]
staging: unisys: visorbus: device_epilog: clean up gotos

The away flag is ambiguous, rename it to out and appropriately
call the correct goto.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: visorchipset_init clean up gotos
David Kershner [Tue, 5 Apr 2016 03:31:37 +0000 (23:31 -0400)]
staging: unisys: visorbus: visorchipset_init clean up gotos

Several error paths were not logging a message to s-Par during failure.
Error paths in visorchipset_init() were corrected so that they now all
do proper clean-ups. This made it necessary to move the function
visorchipset_file_cleanup() above visorchipset_init so it can be
referenced.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorchannel: remove redundant member size
David Binder [Tue, 5 Apr 2016 03:31:32 +0000 (23:31 -0400)]
staging: unisys: visorchannel: remove redundant member size

Removes size member from the visorchannel struct, since it was
a duplicate of the nbytes member.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visornic: CHECK: Alignment should match open parenthesis
Tim Sell [Tue, 5 Apr 2016 03:31:13 +0000 (23:31 -0400)]
staging: unisys: visornic: CHECK: Alignment should match open parenthesis

Fix 'CHECK: Alignment should match open parenthesis' as recommended by
checkpatch.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: CHECK: Alignment should match open parenthesis
Tim Sell [Tue, 5 Apr 2016 03:31:12 +0000 (23:31 -0400)]
staging: unisys: visorbus: CHECK: Alignment should match open parenthesis

Fix 'CHECK: Alignment should match open parenthesis' as recommended by
checkpatch.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: 'unsigned' --> 'unsigned int'
Tim Sell [Tue, 5 Apr 2016 03:31:11 +0000 (23:31 -0400)]
staging: unisys: visorbus: 'unsigned' --> 'unsigned int'

Fix as recommended by checkpatch.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: split error handling code into multiple labels
Cihangir Akturk [Sat, 9 Apr 2016 18:47:44 +0000 (21:47 +0300)]
staging: lustre: split error handling code into multiple labels

Instead of using a switch-case statement to find out what kind of error
has just happened, split error handling logic into multiple labels and
jump right into the appropriate label to do the error handling. This way
it is easier to follow different code paths. It also looks easy on the
eyes.

Additionally silences the following coccinelle warning:

drivers/staging/lustre/lustre/obdecho/echo_client.c:762:22-27: ERROR: ed
is NULL but dereferenced.

Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: change srpc_state_t to proper enum
James Simmons [Wed, 6 Apr 2016 19:25:50 +0000 (15:25 -0400)]
staging: lustre: selftest: change srpc_state_t to proper enum

Turn typedef srpc_state_t to proper enum

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert srpc_msg_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:48 +0000 (15:25 -0400)]
staging: lustre: selftest: convert srpc_msg_t to proper struct

Turn typedef struct srpc_msg to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert lstcon_batch_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:46 +0000 (15:25 -0400)]
staging: lustre: selftest: convert lstcon_batch_t to proper struct

Turn typedef lstcon_batch_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert lstcon_tsb_hdr_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:45 +0000 (15:25 -0400)]
staging: lustre: selftest: convert lstcon_tsb_hdr_t to proper struct

Turn typedef lstcon_tsb_hdr_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert lstcon_group_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:44 +0000 (15:25 -0400)]
staging: lustre: selftest: convert lstcon_group_t to proper struct

Turn typedef lstcon_group_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert lstcon_ndlink_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:43 +0000 (15:25 -0400)]
staging: lustre: selftest: convert lstcon_ndlink_t to proper struct

Turn typedef lstcon_ndlink_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert lstcon_node_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:42 +0000 (15:25 -0400)]
staging: lustre: selftest: convert lstcon_node_t to proper struct

Turn typedef lstcon_node_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert lstcon_rpc_trans_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:41 +0000 (15:25 -0400)]
staging: lustre: selftest: convert lstcon_rpc_trans_t to proper struct

Turn typedef lstcon_rpc_trans_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert lstcon_rpc_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:40 +0000 (15:25 -0400)]
staging: lustre: selftest: convert lstcon_rpc_t to proper struct

Turn typedef lstcon_rpc_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert sfw_test_case_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:39 +0000 (15:25 -0400)]
staging: lustre: selftest: convert sfw_test_case_t to proper struct

Turn typedef sfw_test_case_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert sfw_test_unit_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:38 +0000 (15:25 -0400)]
staging: lustre: selftest: convert sfw_test_unit_t to proper struct

Turn typedef sfw_test_unit_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert sfw_test_instance_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:37 +0000 (15:25 -0400)]
staging: lustre: selftest: convert sfw_test_instance_t to proper struct

Turn typedef sfw_test_instance_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert sfw_test_client_ops_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:36 +0000 (15:25 -0400)]
staging: lustre: selftest: convert sfw_test_client_ops_t to proper struct

Turn typedef sfw_test_client_ops_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert sfw_batch_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:35 +0000 (15:25 -0400)]
staging: lustre: selftest: convert sfw_batch_t to proper struct

Turn typedef sfw_batch_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert sfw_session_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:34 +0000 (15:25 -0400)]
staging: lustre: selftest: convert sfw_session_t to proper struct

Turn typedef sfw_session_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert srpc_service_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:33 +0000 (15:25 -0400)]
staging: lustre: selftest: convert srpc_service_t to proper struct

Turn typedef srpc_service_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert srpc_client_rpc_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:32 +0000 (15:25 -0400)]
staging: lustre: selftest: convert srpc_client_rpc_t to proper struct

Turn typedef srpc_client_rpc_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert swi_workitem_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:31 +0000 (15:25 -0400)]
staging: lustre: selftest: convert swi_workitem_t to proper struct

Turn typedef swi_workitem_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert srpc_buffer_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:30 +0000 (15:25 -0400)]
staging: lustre: selftest: convert srpc_buffer_t to proper struct

Turn typedef srpc_buffer_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert srpc_bulk_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:29 +0000 (15:25 -0400)]
staging: lustre: selftest: convert srpc_bulk_t to proper struct

Turn typedef srpc_bulk_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert srpc_event_t to proper struct
James Simmons [Wed, 6 Apr 2016 19:25:28 +0000 (15:25 -0400)]
staging: lustre: selftest: convert srpc_event_t to proper struct

Turn typedef srpc_event_t to proper structure

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: selftest: convert srpc_event_type to proper enum
James Simmons [Wed, 6 Apr 2016 19:25:27 +0000 (15:25 -0400)]
staging: lustre: selftest: convert srpc_event_type to proper enum

Turn tyepdef srpc_event_type to proper enum

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/obdclass: fix build warning
Sudip Mukherjee [Tue, 5 Apr 2016 14:45:34 +0000 (20:15 +0530)]
staging/lustre/obdclass: fix build warning

While building with W=1 we were getting the warning:

drivers/staging/lustre/lustre/obdclass/cl_object.c:1056:16:
warning: old-style function definition
 struct lu_env *cl_env_percpu_get()
                ^

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: fix 'no effect' errors
Sebastien Buisson [Tue, 5 Apr 2016 01:37:02 +0000 (21:37 -0400)]
staging: lustre: fix 'no effect' errors

Fix 'no effect' issues found by Coverity version 6.5.1:

Unsigned compared against 0 (NO_EFFECT)
This greater-than-or-equal-to-zero comparison of an unsigned value
is always true.

Remove useless cast.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3907
Reviewed-on: http://review.whamcloud.com/7166
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: hsm: Add support to drop all pages for ll_data_version
Jinshan Xiong [Tue, 5 Apr 2016 01:37:01 +0000 (21:37 -0400)]
staging: lustre: hsm: Add support to drop all pages for ll_data_version

This will be used by HSM release to get data version and drop all
caching pages from all clients, before sending IT_RELEASE close
REQ to MDT.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/6794
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: llite: cancel open lock before closing file
Jinshan Xiong [Tue, 5 Apr 2016 01:37:00 +0000 (21:37 -0400)]
staging: lustre: llite: cancel open lock before closing file

In error handling path of ll_lease_open(), och has already been
freed in ll_close_inode_openhandle() so the sequence of cancel
open lock and close open handle need adjusting.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/7346
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: fix 'NULL pointer dereference' errors
Sebastien Buisson [Tue, 5 Apr 2016 01:36:59 +0000 (21:36 -0400)]
staging: lustre: fix 'NULL pointer dereference' errors

Fix 'NULL pointer dereference' defects found by Coverity version
6.5.0:
Dereference after null check (FORWARD_NULL)
For instance, Passing null pointer to a function which dereferences
it.
Dereference before null check (REVERSE_INULL)
Null-checking variable suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
Dereference null return value (NULL_RETURNS)

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Signed-off-by: James Nunez <james.a.nunez@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3042
Reviewed-on: http://review.whamcloud.com/5868
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: hsm: Add CLF_RENAME_LAST flag
JC Lafoucriere [Tue, 5 Apr 2016 01:36:58 +0000 (21:36 -0400)]
staging: lustre: hsm: Add CLF_RENAME_LAST flag

Create a special flag for the last rename event.

Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3718
Reviewed-on: http://review.whamcloud.com/7260
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: mdc: document mdc_rpc_lock
Ned Bass [Tue, 5 Apr 2016 01:36:57 +0000 (21:36 -0400)]
staging: lustre: mdc: document mdc_rpc_lock

As this lock can be a bottleneck, clarifying why it is needed may be
helpful to those working on client performance.

Signed-off-by: Ned Bass <bass6@llnl.gov>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3443
Reviewed-on: http://review.whamcloud.com/6593
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: llite: Delaying creation of client side proc entries.
Gaurav Mahajan [Tue, 5 Apr 2016 01:36:56 +0000 (21:36 -0400)]
staging: lustre: llite: Delaying creation of client side proc entries.

In client_common_fill_super() proc entries are created before
before cl_sb_init() and therefore lu_site is not allocated resulting
in client crash when tried reading lu_site stats.
Delaying creation of proc entries after creation of all required data
structures fixed the problem.

Signed-off-by: Gaurav Mahajan <gmahajan@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2941
Reviewed-on: http://review.whamcloud.com/6852
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lov: Get the correct address of lmm_objects
Swapnil Pimpale [Tue, 5 Apr 2016 01:36:54 +0000 (21:36 -0400)]
staging: lustre: lov: Get the correct address of lmm_objects

The introduction of lmm_layout_gen makes the assumption that
lmm_objects is present after lmm_stripe_count incorrect.
Fixed this to get the correct address of lmm_objects when lmmk is cast
to lov_mds_md_v1.

Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3162
Reviewed-on: http://review.whamcloud.com/7258
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED
Aurelien Degremont [Tue, 5 Apr 2016 01:36:53 +0000 (21:36 -0400)]
staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED

If an error occurs when initializing a HSM request, in
ll_ioc_copy_start(), the PROGRESS message, sent to coordinator, should
carry the error code but also HP_FLAG_COMPLETED to mark the request as
finished (with error). If not, the Coordinator will ignore this
message and consider the request is still running.

Signed-off-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3685
Reviewed-on: http://review.whamcloud.com/7265
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>