]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
7 years agostaging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume
Brian Masney [Sat, 12 Nov 2016 18:19:18 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume

The device probing and the suspend/resume code checks a flag internal to
the driver that determines whether or not the chip is in a working
state. These checks are not needed. This patch removes the unnecessary
checks. It will do no harm to the hardware if the chip is
reinitialized if it is already powered on.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux
Brian Masney [Sat, 12 Nov 2016 18:19:17 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux

taos_get_lux checks to see if the chip is in a working state. This
check is not necessary since it is only called from tsl2583_read_raw
and in_illuminance_calibrate_store (via taos_als_calibrate). The chip
state is already checked by these functions.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: check if chip is in a working state in in_illuminance_calibrat...
Brian Masney [Sat, 12 Nov 2016 18:19:16 +0000 (13:19 -0500)]
staging: iio: tsl2583: check if chip is in a working state in in_illuminance_calibrate_store

in_illuminance_calibrate_store() did not check to see if the chip is
in a working state. This patch adds the proper check. The return value
from taos_als_calibrate() was also not checked in this function, so the
proper check was also added while changes are being made here.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: envelope-detector: ADC driver based on a DAC and a comparator
Peter Rosin [Tue, 8 Nov 2016 11:58:58 +0000 (12:58 +0100)]
iio: envelope-detector: ADC driver based on a DAC and a comparator

The DAC is used to find the peak level of an alternating voltage input
signal by a binary search using the output of a comparator wired to
an interrupt pin. Like so:
                          _
                         | \
    input +------>-------|+ \
                         |   \
           .-------.     |    }---.
           |       |     |   /    |
           |    dac|-->--|- /     |
           |       |     |_/      |
           |       |              |
           |       |              |
           |    irq|------<-------'
           |       |
           '-------'

Signed-off-by: Peter Rosin <peda@axentia.se>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agodt-bindings: iio: document envelope-detector bindings
Peter Rosin [Tue, 8 Nov 2016 11:58:57 +0000 (12:58 +0100)]
dt-bindings: iio: document envelope-detector bindings

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dpot-dac: DAC driver based on a digital potentiometer
Peter Rosin [Tue, 8 Nov 2016 11:58:56 +0000 (12:58 +0100)]
iio: dpot-dac: DAC driver based on a digital potentiometer

It is assumed that the dpot is used as a voltage divider between the
current dpot wiper setting and the maximum resistance of the dpot. The
divided voltage is provided by a vref regulator.

                  .------.
   .-----------.  |      |
   | vref      |--'    .---.
   | regulator |--.    |   |
   '-----------'  |    | d |
                  |    | p |
                  |    | o |  wiper
                  |    | t |<---------+
                  |    |   |
                  |    '---'       dac output voltage
                  |      |
                  '------+------------+

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agodt-bindings: iio: document dpot-dac bindings
Peter Rosin [Tue, 8 Nov 2016 11:58:55 +0000 (12:58 +0100)]
dt-bindings: iio: document dpot-dac bindings

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agodt-bindings: add axentia to vendor-prefixes
Peter Rosin [Tue, 8 Nov 2016 11:58:54 +0000 (12:58 +0100)]
dt-bindings: add axentia to vendor-prefixes

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: mcp4531: provide range of available raw values
Peter Rosin [Tue, 8 Nov 2016 11:58:53 +0000 (12:58 +0100)]
iio: mcp4531: provide range of available raw values

Example:

$ cat '/sys/bus/iio/devices/iio:device0/out_resistance_raw_available'
[0 1 256]

Meaning: min 0, step 1 and max 256.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: inkern: add helpers to query available values from channels
Peter Rosin [Tue, 8 Nov 2016 11:58:52 +0000 (12:58 +0100)]
iio: inkern: add helpers to query available values from channels

Specifically a helper for reading the available maximum raw value of a
channel and a helper for forwarding read_avail requests for raw values
from one iio driver to an iio channel that is consumed.

These rather specific helpers are in turn built with generic helpers
making it easy to build more helpers for available values as needed.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio:core: add a callback to allow drivers to provide _available attributes
Jonathan Cameron [Tue, 8 Nov 2016 11:58:51 +0000 (12:58 +0100)]
iio:core: add a callback to allow drivers to provide _available attributes

A large number of attributes can only take a limited range of values.
Currently in IIO this is handled by directly registering additional
*_available attributes thus providing this information to userspace.

It is desirable to provide this information via the core for much the same
reason this was done for the actual channel information attributes in the
first place.  If it isn't there, then it can only really be accessed from
userspace.  Other in kernel IIO consumers have no access to what valid
parameters are.

Two forms are currently supported:
* list of values in one particular IIO_VAL_* format.
e.g. 1.300000 1.500000 1.730000
* range specification with a step size:
e.g. [1.000000 0.500000 2.500000]
equivalent to 1.000000 1.5000000 2.000000 2.500000

An addition set of masks are used to allow different sharing rules for the
*_available attributes generated.

This allows for example:

in_accel_x_offset
in_accel_y_offset
in_accel_offset_available.

We could have gone with having a specification for each and every
info_mask element but that would have meant changing the existing userspace
ABI.  This approach does not.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[forward ported, added some docs and fixed buffer overflows /peda]
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: fix issue with changes to calibscale and int_time not being...
Brian Masney [Thu, 10 Nov 2016 09:25:38 +0000 (04:25 -0500)]
staging: iio: tsl2583: fix issue with changes to calibscale and int_time not being set on the chip

When updating the in_illuminance_calibscale and
in_illuminance_integration_time sysfs attributes, these values were not
actually written to the chip. The chip would continue to use the old
parameters. Extracted out tsl2583_set_als_gain() and
tsl2583_set_als_time() functions that are now called when these sysfs
attributes are updated. The chip initialization also calls these these
new functions.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: split out functionality of taos_chip_on()
Brian Masney [Thu, 10 Nov 2016 09:25:37 +0000 (04:25 -0500)]
staging: iio: tsl2583: split out functionality of taos_chip_on()

taos_chip_on() reads an eight member array called taos_config
that contains the desired state of the chip's registers. Only four
of the registers actually need to be written to. The four that do
not need to be written to are for the {low,high} byte of the lower
interrupt threshold and the {low,high} byte of the upper interrupt
threshold. Interrupts are currently not supported by this driver
so there is no need to write to these registers.

This patch removes the taos_config array and separates out the
i2c calls that write to the CONTROL, TIMING, INTERRUPT and ANALOG
registers. This is part of a larger refactor that was split up to
make the code review easier.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: pressure: st_pressure: inline per-sensor data
Linus Walleij [Wed, 9 Nov 2016 15:10:00 +0000 (16:10 +0100)]
iio: pressure: st_pressure: inline per-sensor data

We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: magn: st_magn: inline per-sensor data
Linus Walleij [Wed, 9 Nov 2016 15:09:59 +0000 (16:09 +0100)]
iio: magn: st_magn: inline per-sensor data

We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: gyro: st_gyro: inline per-sensor data
Linus Walleij [Wed, 9 Nov 2016 15:09:58 +0000 (16:09 +0100)]
iio: gyro: st_gyro: inline per-sensor data

We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: imu: inv_mpu6050: inform the i2c mux core about how it is used
Peter Rosin [Wed, 31 Aug 2016 08:02:40 +0000 (10:02 +0200)]
iio: imu: inv_mpu6050: inform the i2c mux core about how it is used

The i2c mux core can then take appropriate action depending on if it is
used for an actual i2c mux, or for an arbitrator or gate. In this case
it is used as a gate.

This will make devicetree bindings simpler when they are eventually
added.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: cros_ec_sensors_core: fix unsigned compared less than zero on status
Colin Ian King [Wed, 9 Nov 2016 23:12:31 +0000 (23:12 +0000)]
iio: cros_ec_sensors_core: fix unsigned compared less than zero on status

status is a u8 hence the check if status is less than zero has no effect.
Fix this by replacing status with int ret so the less than zero compare
will correctly detect errors.

Issue found with static analysis with CoverityScan, CID 1375919

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Fixes: 974e6f02e27e ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub")
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio:adc: ad7766: testing the wrong variable in probe
Dan Carpenter [Thu, 10 Nov 2016 19:30:18 +0000 (22:30 +0300)]
iio:adc: ad7766: testing the wrong variable in probe

We should be testing "ret" here.

Fixes: aa16c6bd0e09 ("iio:adc: Add support for AD7766/AD7767")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: gyro: mpu3050: add I2C dependency
Arnd Bergmann [Tue, 8 Nov 2016 13:59:30 +0000 (14:59 +0100)]
iio: gyro: mpu3050: add I2C dependency

The new mpu3050 driver fails to build if I2C is disabled:

drivers/iio/built-in.o: In function `mpu3050_i2c_driver_exit':
mpu3050-i2c.c:(.exit.text+0x17f): undefined reference to `i2c_del_driver'
drivers/iio/built-in.o: In function `mpu3050_i2c_driver_init':
mpu3050-i2c.c:(.init.text+0x215): undefined reference to `i2c_register_driver'

This adds a Kconfig dependency to ensure we only build it when I2C
is available.

Fixes: 3904b28efb2c ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: gyro: mpu3050: remove duplicate initializer
Arnd Bergmann [Tue, 8 Nov 2016 13:59:29 +0000 (14:59 +0100)]
iio: gyro: mpu3050: remove duplicate initializer

The newly added mpu3050 driver has two initializations for the
module owner, which causes a warning for 'make W=1':

include/linux/export.h:37:21: error: initialized field overwritten [-Werror=override-init]
drivers/iio/gyro/mpu3050-core.c:749:19: note: in expansion of macro 'THIS_MODULE'

This removes one of the two.

Fixes: 3904b28efb2c ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: fix unused function warning
Arnd Bergmann [Tue, 8 Nov 2016 14:01:44 +0000 (15:01 +0100)]
staging: iio: tsl2583: fix unused function warning

Removing a call to the taos_chip_off() makes it unused when CONFIG_PM
is disabled:

drivers/staging/iio/light/tsl2583.c:438:12: error: ‘taos_chip_off’ defined but not used [-Werror=unused-function]

This removes all the #ifdef in this file, and marks the PM functions as
__maybe_unused instead, which is more reliable and gives us better
compile time coverage.

Fixes: 0561155f6fc5 ("staging: iio: tsl2583: don't shutdown chip when updating the lux table")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: ad9832: allocate data before using
Arnd Bergmann [Tue, 8 Nov 2016 14:00:49 +0000 (15:00 +0100)]
staging: iio: ad9832: allocate data before using

The regulator changes assigned data to an uninitialized pointer:

drivers/staging/iio/frequency/ad9832.c: In function 'ad9832_probe':
drivers/staging/iio/frequency/ad9832.c:214:11: error: 'st' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This moves the allocation of the 'st' structure before its first
use, as it should have been.

Fixes: 43a07e48af44 ("staging: iio: ad9832: clean-up regulator 'reg'")
Fixes: a98461d79ba5 ("staging: iio: ad9832: add DVDD regulator")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: lustre: fixed shadowed variable in socklnd_cb.c
Andrew Kanner [Thu, 3 Nov 2016 22:49:46 +0000 (01:49 +0300)]
staging: lustre: fixed shadowed variable in socklnd_cb.c

Removed redundant declaration of variable 'tx' in local scope
Fixed: sparse warning:
socklnd_cb.c:2476:41: warning: symbol 'tx' shadows an earlier one
socklnd_cb.c:2435:25: originally declared here

Signed-off-by: Andrew Kanner <andrew.kanner@gmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: o2iblnd: replace space indentation with tabs
Nicholas Hanley [Sat, 5 Nov 2016 00:02:56 +0000 (20:02 -0400)]
staging: lustre: o2iblnd: replace space indentation with tabs

This patch fixes all CODE_INDENT checkpatch errors in o2iblnd.

Signed-off-by: Nicholas Hanley <nicholasjhanley@gmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Get rid of LIBLUSTRE_CLIENT and its users
Oleg Drokin [Thu, 3 Nov 2016 01:25:04 +0000 (21:25 -0400)]
staging/lustre: Get rid of LIBLUSTRE_CLIENT and its users

This define only made sense in a userspace library client, not in the kernel.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/llite: do not clear uptodate bit in page delete
Jinshan Xiong [Thu, 3 Nov 2016 01:25:03 +0000 (21:25 -0400)]
staging/lustre/llite: do not clear uptodate bit in page delete

Otherwise, if the race between page fault and truncate occurs, it
will cause the page fault routine to return an EIO error.

In filemap_fault() {
    page_not_uptodate:
    ...
        ClearPageError(page);
        error = mapping->a_ops->readpage(file, page);
        if (!error) {
                wait_on_page_locked(page);
                if (!PageUptodate(page))
                        error = -EIO;
    }
    ...
}

However, I tend to think this is a defect in kernel implementation,
because it assumes PageUptodate shouldn't be cleared but file read
routine doesn't make the same assumption.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/22827
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8633
Reviewed-by: Li Dongyang <dongyang.li@anu.edu.au>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/llite: update ras window correctly
Bobi Jam [Thu, 3 Nov 2016 01:25:02 +0000 (21:25 -0400)]
staging/lustre/llite: update ras window correctly

When stride-RA hit case miss, we only reset normal sequential
read-ahead window, but not reset the stride IO to avoid the overhead
of re-detecting stride IO. While when the normal RA window is set
to not insect with the stride-RA window, when we try to increase
the stride-RA window length later, the presumption does not hold.

This patch resets the stride IO as well in this case.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Reviewed-on: http://review.whamcloud.com/23032
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8683
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ptlrpc: Correctly calculate hrp->hrp_nthrs
Amir Shehata [Thu, 3 Nov 2016 01:25:01 +0000 (21:25 -0400)]
staging/lustre/ptlrpc: Correctly calculate hrp->hrp_nthrs

cpu_pattern can specify exactly 1 cpu in a partition:
"0[0]". That means CPT0 will have CPU 0. CPU 0 can have
hyperthreading enabled. This combination would result in

weight = cfs_cpu_ht_nsiblings(0);
hrp->hrp_nthrs = cfs_cpt_weight(ptlrpc_hr.hr_cpt_table, i);
hrp->hrp_nthrs /= weight;

evaluating to 0. Where
cfs_cpt_weight(ptlrpc_hr.hr_cpt_table, i) == 1
weight == 2

Therefore, if hrp_nthrs becomes zero, just set it to 1.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-on: http://review.whamcloud.com/19106
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8492
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/llite: protect from accessing NULL lli_clob
Bobi Jam [Thu, 3 Nov 2016 01:25:00 +0000 (21:25 -0400)]
staging/lustre/llite: protect from accessing NULL lli_clob

Need to check file's lli_clob object before calling
lov_read_and_clear_async_rc().

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/23031
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8682
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ptlrpc: Suppress error for flock requests
Patrick Farrell [Thu, 3 Nov 2016 01:24:59 +0000 (21:24 -0400)]
staging/lustre/ptlrpc: Suppress error for flock requests

-EAGAIN is a normal return when requesting POSIX flocks.
We can't recognize exactly that case here, but it's the
only case that should result in -EAGAIN on LDLM_ENQUEUE, so
don't print to console in that case.

Signed-off-by: Patrick Farrell <paf@cray.com>
Reviewed-on: http://review.whamcloud.com/22856
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8658
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ldlm: engage ELC for all ldlm enqueue req
Hongchao Zhang [Thu, 3 Nov 2016 01:24:58 +0000 (21:24 -0400)]
staging/lustre/ldlm: engage ELC for all ldlm enqueue req

If there is no request passed into ldlm_cli_enqueue, the enqueue
request will not engage ELC to drop unneeded locks. currently,
this kind of request is mainly related to EXTENT locks enqueue
requests (except for glimpse EXTENT lock for it has an intent).

Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/21739
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8209
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ldlm: Reinstate ldlm_enqueue_pack()
Oleg Drokin [Thu, 3 Nov 2016 01:24:57 +0000 (21:24 -0400)]
staging/lustre/ldlm: Reinstate ldlm_enqueue_pack()

The function becomes used again with the next patch, so bring it back
from dead, only this time make it static.

Reverts: bf2a033360f7 ("staging/lustre/ldlm: Remove unused ldlm_enqueue_pack()")
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/llite: drop_caches hangs in cl_inode_fini()
Andrew Perepechko [Thu, 3 Nov 2016 01:24:56 +0000 (21:24 -0400)]
staging/lustre/llite: drop_caches hangs in cl_inode_fini()

This patch releases cl_pages on error in ll_write_begin()
to avoid memory and object reference leaks. Also, it
reuses per-cpu lu_env in ll_invalidatepage() in the same
way as done in ll_releasepage().

Signed-off-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Seagate-bug-id: MRP-3504
Reviewed-on: http://review.whamcloud.com/22745
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8509
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Get rid of cl_env hash table
Jinshan Xiong [Thu, 3 Nov 2016 01:24:55 +0000 (21:24 -0400)]
staging/lustre: Get rid of cl_env hash table

cl_env hash table is under heavy contention when there are lots of
processes doing IO at the same time;
reduce lock contention by replacing cl_env cache with percpu array;
remove cl_env_nested_get() and cl_env_nested_put();
remove cl_env_reenter() and cl_env_reexit();

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/20254
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4257
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/llite: clear inode timestamps after losing UPDATE lock
Niu Yawei [Thu, 3 Nov 2016 01:24:54 +0000 (21:24 -0400)]
staging/lustre/llite: clear inode timestamps after losing UPDATE lock

Otherwise, those leftovers would interfere with new timestamps
especially when the timestamps are set back in time on the other
clients.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-on: http://review.whamcloud.com/22623
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8446
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: conflicting PW & PR extent locks on a client
Andriy Skulysh [Thu, 3 Nov 2016 01:24:53 +0000 (21:24 -0400)]
staging/lustre: conflicting PW & PR extent locks on a client

PW lock isn't replayed once a lock is marked
LDLM_FL_CANCELING and glimpse lock doesn't wait for
conflicting locks on the client. So the server will
grant a PR lock in response to the glimpse lock request,
which conflicts with the PW lock in LDLM_FL_CANCELING
state on the client.

Lock in LDLM_FL_CANCELING state may still have pending IO,
so it should be replayed until LDLM_FL_BL_DONE is set to
avoid granted conflicting lock by a server.

Seagate-bug-id: MRP-3311
Signed-off-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Reviewed-on: http://review.whamcloud.com/20345
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8175
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ldlm: fix export reference problem
Hongchao Zhang [Thu, 3 Nov 2016 01:24:52 +0000 (21:24 -0400)]
staging/lustre/ldlm: fix export reference problem

1, in client_import_del_conn, the export returned from
   class_conn2export is not released after using it.

2, in ptlrpc_connect_interpret, the export is not released
   if the connect_flags isn't compatible.

Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/22031
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8500
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ldlm: Drop unused blocking_refs flock field
Oleg Drokin [Thu, 3 Nov 2016 01:24:51 +0000 (21:24 -0400)]
staging/lustre/ldlm: Drop unused blocking_refs flock field

blocking_refs is only used on the server, so drop it on the client.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: remove unnecessary blank line
Sergio Paracuellos [Wed, 2 Nov 2016 18:47:49 +0000 (19:47 +0100)]
staging: wlan-ng: remove unnecessary blank line

Blank lines aren't necessary after an open brace '{'.
Clean them in p80211req.c source file to comply with
the standard kernel coding style.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: remove unnecessary parentheses
Sergio Paracuellos [Wed, 2 Nov 2016 18:47:48 +0000 (19:47 +0100)]
staging: wlan-ng: remove unnecessary parentheses

Avoid no necessary parentheses to comply with the standard kernel
coding style.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: change comparison to NULL to preferred style.
Sergio Paracuellos [Wed, 2 Nov 2016 18:47:47 +0000 (19:47 +0100)]
staging: wlan-ng: change comparison to NULL to preferred style.

Comparison to NULL could be written in preferred form.
Change it to comply with the standard kernel coding style.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: remove two unnecessary blank lines
Sergio Paracuellos [Wed, 2 Nov 2016 18:47:46 +0000 (19:47 +0100)]
staging: wlan-ng: remove two unnecessary blank lines

After open brace or before close brace blank lines are not really
necessary. Remove them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: add spaces around or operator : HOSTWEP_DEFAULTKEY_MASK
Sergio Paracuellos [Wed, 2 Nov 2016 18:47:45 +0000 (19:47 +0100)]
staging: wlan-ng: add spaces around or operator : HOSTWEP_DEFAULTKEY_MASK

Add spaces around or operator to comply with the standard
kernel coding style.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: st-cec: add parentheses around complex macros
Maninder Singh [Fri, 4 Nov 2016 07:58:31 +0000 (13:28 +0530)]
staging: st-cec: add parentheses around complex macros

This patch fixes the following checkpatch.pl error:
ERROR: Macros with complex values should be enclosed in parentheses

Signed-off-by: Maninder Singh <maninder.s2@samsung.com>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: card.c: Fixing multiple assignments
Nick Rosbrook [Wed, 2 Nov 2016 01:15:07 +0000 (21:15 -0400)]
staging: vt6655: card.c: Fixing multiple assignments

Running checkpath on card.c shows two locations where
multiple assignments are used.

This patch modifies the assignments into single assignments.

Signed-off-by: Nick Rosbrook <nrosbrook@mail.smcvt.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: sm750fb: Replace pr_*() with dev_*().
Elise Lennion [Tue, 1 Nov 2016 01:28:46 +0000 (23:28 -0200)]
staging: sm750fb: Replace pr_*() with dev_*().

dev_*() functions print identifying information about the struct device
and should be used instead of pr_*() whenever possible.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging:emxx_udc:emxx_udc: Compression of lines for immediate return
Nadim Almas [Mon, 31 Oct 2016 08:20:11 +0000 (13:50 +0530)]
Staging:emxx_udc:emxx_udc: Compression of lines for immediate return

This patch compresses two lines into a single line
if immediate return statement is found. Remove variable data as
it is no longer needed.

It is done using script Coccinelle. And coccinelle uses the following
semantic patch for this compression function

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Nadim Almas <nadim.902@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging : rtl8712: Free memory when kmalloc fails
Souptick Joarder [Mon, 31 Oct 2016 11:26:05 +0000 (16:56 +0530)]
staging : rtl8712: Free memory when kmalloc fails

There are few functions where we need to free previously allocated
memory when kmalloc fails. Else it may lead to memory leakage. In
_init_cmd_priv() and _r8712_init_xmit_priv(), in few places we are
not freeing previously allocated memory when kmalloc fails.

Signed-off-by: Souptick joarder <jrdr.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agos5p-cec: remove unused including <linux/version.h>
Wei Yongjun [Sat, 29 Oct 2016 16:17:55 +0000 (16:17 +0000)]
s5p-cec: remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_tio: fix warnings of uninitialized variables
Ted Chen [Sun, 30 Oct 2016 15:29:20 +0000 (23:29 +0800)]
staging: comedi: ni_tio: fix warnings of uninitialized variables

Fix the following warnings by initializing these variables
to zero and add error check to return early when the check
returns an error.

drivers/staging/comedi/drivers/ni_tio.c: In function ‘ni_tio_set_sync_mode’:
drivers/staging/comedi/drivers/ni_tio.c:492:28: warning: ‘ps’ may be used uninitialized in this function [-Wuninitialized]
drivers/staging/comedi/drivers/ni_tio.c: In function ‘ni_tio_insn_config’:
drivers/staging/comedi/drivers/ni_tio.c:820:2: warning: ‘temp64’ may be used uninitialized in this function [-Wuninitialized]
drivers/staging/comedi/drivers/ni_tio.c:811:6: note: ‘temp64’ was declared her

Signed-off-by: Ted Chen <tedc.37zngo@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vc04_services: fix up some printk warnings
Greg Kroah-Hartman [Mon, 7 Nov 2016 10:18:42 +0000 (11:18 +0100)]
staging: vc04_services: fix up some printk warnings

Some more printk warnings snuck in recently, no one seems to be building
this on 64bit machines...

Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Michael Zoran <mzoran@crowfest.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vchiq_arm: change order during module probe
Stefan Wahren [Mon, 31 Oct 2016 14:39:33 +0000 (14:39 +0000)]
staging: vchiq_arm: change order during module probe

The current order during module probe is prone to race conditions:

* debugfs entries, sysfs entries, platform code

So fix this by swapping the steps debugfs entries and platform code.
As a benefit this saves us a clean up step in the error path.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vchiq_arm: remove debugfs entries on module unload
Stefan Wahren [Mon, 31 Oct 2016 14:39:32 +0000 (14:39 +0000)]
staging: vchiq_arm: remove debugfs entries on module unload

This removes the debugfs entries on module unload and fix one
of the many kernel oops after loading the module again.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vchiq_arm: handle error case of get_user_pages
Stefan Wahren [Mon, 31 Oct 2016 14:39:31 +0000 (14:39 +0000)]
staging: vchiq_arm: handle error case of get_user_pages

It's possible that get_user_pages() could fail. So evaluate its
return code and handle this error case properly.

This issue has been found by Cppcheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vchiq_arm: remove hardcoded buffer length
Stefan Wahren [Mon, 31 Oct 2016 14:39:30 +0000 (14:39 +0000)]
staging: vchiq_arm: remove hardcoded buffer length

We better use sizeof instead of hardcoding buffer length multiple
times. This make it easier to increase the buffer in the future.
In order to keep below 80 chars limit make the variable name shorter.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vchiq_arm: add missing of_node_put
Stefan Wahren [Mon, 31 Oct 2016 14:39:29 +0000 (14:39 +0000)]
staging: vchiq_arm: add missing of_node_put

After device_node usage the refcount must be decremented with
of_node_put().

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vchiq_core: fix format strings in vchiq_dump_service_state
Stefan Wahren [Mon, 31 Oct 2016 14:39:28 +0000 (14:39 +0000)]
staging: vchiq_core: fix format strings in vchiq_dump_service_state

The member localport and remoteport are unsigned. So fix the format
string accordingly.

The issue has been found by Cppcheck.

Signed-off-by: Stefam Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vchiq_core: fix service dereference in unlock_service
Stefan Wahren [Mon, 31 Oct 2016 14:39:27 +0000 (14:39 +0000)]
staging: vchiq_core: fix service dereference in unlock_service

The service state is dereferenced before BUG_ON and outside of the
spin lock. So in order to avoid possible NULL pointer dereferences or
races move the whole scope at a safer place.

This issue has been found by Cppcheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vc04_services: parse_rx_slots() - Fix compiler warning
Michael Zoran [Tue, 1 Nov 2016 15:21:14 +0000 (08:21 -0700)]
staging: vc04_services: parse_rx_slots() - Fix compiler warning

vc04_services contains a debug logging mechanism.  The log is
maintained in a shared memory area between the kernel and the
firmware.  Changing the sizes of the data in this area would
require a firmware change which is distributed independently
from the kernel binary.

One of the items logged is the address of received messages.
This address is a pointer, but the debugging slot used to store
the information is a 32 bit integer.

Luckily, this value is never interpreted by anything other
then debug tools and it is expected that a human debugging
the kernel interpret it.

This change adds a cast to long before the original cast
to int to silence the warning.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vc04_services: remove vchiq_copy_from_user
Michael Zoran [Sun, 30 Oct 2016 12:55:07 +0000 (05:55 -0700)]
staging: vc04_services: remove vchiq_copy_from_user

The vchiq_copy_from_user function is not portable
and is consider "bad practice."  Replace this function
with a callback based mechanism that is passed downward
on the stack.  When it is actually time to copy the data,
the callback is called to copy the data into the message.

This callback is provided internally for userland calls
through ioctls on the device.

NOTE: Internal clients will need to be modified to work
with the new internal API.

Test Run:
vchiq_test -p 1
vchiq_test -f 10

Both tests pass.

Internal API Changes:

Change vchi_msg_queue to:
int32_t
vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle,
       ssize_t (*copy_callback)(void *context, void *dest,
        size_t offset, size_t maxsize),
       void *context,
       uint32_t data_size );

Remove:
vchi_msg_queuev_ex
vchi_msg_queuev

These functions were not implemented anyway so no need to fix them. It's
easier to just remove them.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vc04_services: setup DMA and coherent mask
Michael Zoran [Mon, 31 Oct 2016 21:02:03 +0000 (14:02 -0700)]
staging: vc04_services: setup DMA and coherent mask

VCHI messages between the CPU and firmware use 32-bit
bus addresses. Explicitly set the DMA mask and coherent
on all platforms.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vc04_services: call sg_init_table to init scatterlist
Michael Zoran [Fri, 28 Oct 2016 17:58:13 +0000 (10:58 -0700)]
staging: vc04_services: call sg_init_table to init scatterlist

Call the sg_init_table function to correctly initialze
the DMA scatterlist.  This function is required to completely
initialize the list and is mandatory if DMA debugging is
enabled in the build configuration.

One of the purposes of sg_init_table is to set
the magic "cookie" on each list element and ensure
the chain end is marked.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: vme: Fix parenthesis alignment.
Anton Leshchenko [Tue, 1 Nov 2016 22:27:11 +0000 (01:27 +0300)]
Staging: vme: Fix parenthesis alignment.

Align broken line for code readability.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: vme: Add required identifier names.
Anton Leshchenko [Tue, 1 Nov 2016 22:27:10 +0000 (01:27 +0300)]
Staging: vme: Add required identifier names.

Add identifier names for function definition arguments.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: vme: Use BIT macro for bit field definitions.
Anton Leshchenko [Tue, 1 Nov 2016 22:27:09 +0000 (01:27 +0300)]
Staging: vme: Use BIT macro for bit field definitions.

Instead of using shift operation use BIT macro for bit field
definitions.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: vme: Remove excessive blank lines.
Anton Leshchenko [Tue, 1 Nov 2016 22:27:08 +0000 (01:27 +0300)]
Staging: vme: Remove excessive blank lines.

To make code more readable, remove excessive blank lines.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorinput: Add default conditions to case statements
David Binder [Thu, 3 Nov 2016 15:44:29 +0000 (11:44 -0400)]
staging: unisys: visorinput: Add default conditions to case statements

This commit adds a default condition to those case statements that do not
already have one. This is done to provide both a logical covering of all
conditions, as well as to maintain uniformity with the rest of the Unisys
driver set.

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: visorbus: Adjust formatting of variable assignment
David Binder [Thu, 3 Nov 2016 15:44:28 +0000 (11:44 -0400)]
staging: unisys: visorbus: Adjust formatting of variable assignment

Adjusts the formatting of a variable assignment to use fewer line breaks,
making it follow the convention used elsewhere in the s-Par driver set.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: in my_device_destroy don't call device_epilog
David Kershner [Thu, 3 Nov 2016 15:44:27 +0000 (11:44 -0400)]
staging: unisys: visorbus: in my_device_destroy don't call device_epilog

The function my_device_destroy should call chipset_device_destroy
directly instead of calling device_epilog. Since this was the last
function to use device_epilog that function was removed as well.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: my_device_changestate: no longer call device_epilog
David Kershner [Thu, 3 Nov 2016 15:44:26 +0000 (11:44 -0400)]
staging: unisys: visorbus: my_device_changestate: no longer call device_epilog

Function my_device_changestate should call chipset_device_changestate
directly instead of calling device_epilog.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: my_device_changestate: add error response
David Kershner [Thu, 3 Nov 2016 15:44:25 +0000 (11:44 -0400)]
staging: unisys: visorbus: my_device_changestate: add error response

The function my_device_changestate was not sending a response if there
was an error with the CONTROLVM message.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: my_device_create does not call device_epilog
David Kershner [Thu, 3 Nov 2016 15:44:24 +0000 (11:44 -0400)]
staging: unisys: visorbus: my_device_create does not call device_epilog

Don't have my_device_create call device_epilog, have it call
chipset_device_create directly instead.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: remove bus_epilog
David Kershner [Thu, 3 Nov 2016 15:44:23 +0000 (11:44 -0400)]
staging: unisys: visorbus: remove bus_epilog

Remove the function bus_epilog since no one is calling it.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: bus_create fix error handling
David Kershner [Thu, 3 Nov 2016 15:44:22 +0000 (11:44 -0400)]
staging: unisys: visorbus: bus_create fix error handling

Add error handling to bus_create function.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: bus_destroy add error handling
David Kershner [Thu, 3 Nov 2016 15:44:21 +0000 (11:44 -0400)]
staging: unisys: visorbus: bus_destroy add error handling

Do proper error handling and return error codes instead of just ignoring
them.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: bus_destroy do not call bus_epilog
David Kershner [Thu, 3 Nov 2016 15:44:20 +0000 (11:44 -0400)]
staging: unisys: visorbus: bus_destroy do not call bus_epilog

Have bus_destroy call chipset_bus_destroy directly instead of going
through bus_epilog.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: bus_create no longer calls bus_epilog
David Kershner [Thu, 3 Nov 2016 15:44:19 +0000 (11:44 -0400)]
staging: unisys: visorbus: bus_create no longer calls bus_epilog

Have bus_create call chipset_bus_create directly instead of going
through the function bus_epilog.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: fix double response
David Kershner [Thu, 3 Nov 2016 15:44:18 +0000 (11:44 -0400)]
staging: unisys: visorbus: fix double response

This patch addresses the problem that we were sending double responses
back to the s-Par Firmware when processing CONTROLVM Messages. Every
message responds individually and the epilog functions would send a
response as well.

Since a message could delay the response, it was decided to remove the
extra response from the epilog function.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: remove unused initializations
Sameer Wadgaonkar [Thu, 3 Nov 2016 15:44:17 +0000 (11:44 -0400)]
staging: unisys: visorbus: remove unused initializations

Removed intializations from visorchipset_open(), visorchipset_init()
and moved the memset in initialize_controlvm_payload_info() down in
case of early returns from the function.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: convert client_bus_info sysfs to debugfs
Tim Sell [Thu, 3 Nov 2016 15:44:16 +0000 (11:44 -0400)]
staging: unisys: visorbus: convert client_bus_info sysfs to debugfs

Previously, the sysfs entry (assuming traditional sysfs mountpoint):

    /sys/bus/visorbus/devices/visorbus<n>/client_bus_info

violated kernel conventions by printing more than one item.  This along
with the fact that the data emitted was diagnostic data (intended to
shadow the client driver info provided via s-Par livedumps) made it a
logical candidate for debugfs.  So this patch moves this sysfs entry to
debugfs as (assuming traditional debugfs mountpoint):

    /sys/kernel/debug/visorbus/visorbus<n>/client_bus_info

Data for this debugfs is emitted using the preferred seq_file interface,
which allowed a vastly-simplified version of vbuschannel_print_devinfo()
to format the individual output components.

Functionality was verified as follows:

  [root@sparguest visorbus]# mount | grep debug
  debugfs on /sys/kernel/debug type debugfs (rw)
  [root@sparguest visorbus]# pwd
  /sys/kernel/debug/visorbus
  [root@sparguest visorbus]# l visorbus1/
  total 0
  drwxr-xr-x 2 root root 0 Sep 28 16:36 .
  drwxr-xr-x 4 root root 0 Sep 28 16:36 ..
  -r--r----- 1 root root 0 Sep 28 16:36 client_bus_info
  [root@sparguest visorbus]# l visorbus2
  total 0
  drwxr-xr-x 2 root root 0 Sep 28 16:36 .
  drwxr-xr-x 4 root root 0 Sep 28 16:36 ..
  -r--r----- 1 root root 0 Sep 28 16:36 client_bus_info
  [root@sparguest visorbus]# cat visorbus1/client_bus_info
  Client device / client driver info for s-Par Console partition (vbus #1):
     chipset          visorchipset     kernel ver. 4.8.0-rc6-ARCH+
     clientbus        visorbus         kernel ver. 4.8.0-rc6-ARCH+
  [2]keyboard         visorinput       kernel ver. 4.8.0-rc6-ARCH+
  [3]mouse            visorinput       kernel ver. 4.8.0-rc6-ARCH+
  [root@sparguest visorbus]# cat visorbus2/client_bus_info
  Client device / client driver info for s-Par IOVM partition (vbus #2):
     chipset          visorchipset     kernel ver. 4.8.0-rc6-ARCH+
     clientbus        visorbus         kernel ver. 4.8.0-rc6-ARCH+
  [0]ultravnic        visornic         kernel ver. 4.8.0-rc6-ARCH+
  [1]ultravnic        visornic         kernel ver. 4.8.0-rc6-ARCH+
  [2]sparvhba         visorhba         kernel ver. 4.8.0-rc6-ARCH+

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: move DEVICE_ATTR_RO defs as-per conventions
Tim Sell [Thu, 3 Nov 2016 15:44:15 +0000 (11:44 -0400)]
staging: unisys: visorbus: move DEVICE_ATTR_RO defs as-per conventions

The kernel convention is for DEVICE_ATTR_RO(<attr>) definitions to occur
immediately after the functions that implement the attribute behaviors.
DEVICE_ATTR_RO definitions in visorbus_main.c have been moved to comply
with this convention.

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: speakup: Remove unnecessary space after cast
Shiva Kerdel [Sun, 6 Nov 2016 14:09:18 +0000 (15:09 +0100)]
Staging: speakup: Remove unnecessary space after cast

The affected files have been modified to remove redundant spaces after
casts to solve checkpatch.pl checks.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoMerge tag 'iio-for-4.10b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Mon, 7 Nov 2016 08:14:03 +0000 (09:14 +0100)]
Merge tag 'iio-for-4.10b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing

Jonathan writes:

Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle

This includes two branch merges for elements that may also go via MFD.

New device support
* cros_ec
  - new driver to support these Chrome OS contiguous sensors which are behind
    the Chrome OS embedded controller.  Requires a few minor MFD and chrome
    platform changes.  One follow up fix deals with some dependency issues in
    Kconfig.
* mpu-3050
  - new driver and device tree bindings for this venerable device.
* st_accel
  - support for the lng2dm an

Driver features
* ad7192
  - Add DVdd regulator handling
* ad9832
  - Add DVDD regulator handling
* at91
  - Suspend and resume support
* si7020
  - Device tree bindings
* ti-am335x
  - DMA support - uses dma to accelerate short bursts of read back rather
  than full blown DMA buffer support.  Greatly improved performance.
  Includes an MFD addition to give access to the address needed for DMA.
* tsl2583
  - Device tree bindings

Cleanups and minor fixes
* ad7192
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
  - Rename reg variable to reflect which regulator it is
* ad5933
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* ad7746
  - Fix a missing return value (fallout from previous patch set)
* ad7780
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* ad9832
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
  - Rename reg regulator to reflect which one it is
* ad9834
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* hts221
  - Remove a duplicated include
* maxim thermocouple
  - Handle a wrong storage side in read function.  Prevent any problems that
  might be introduced by additions to this driver in future.
* tsl2583 - big set from Brian Masney to drive this towards a staging
  graduation.
  - Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
  - Improved error handling in various functions
  - Drop redundant power_state custom sysfs attribute.
  - Use IIO_*_ATTR* macros for remaining attributes.
  - Return an error code to userspace on invalid parameters being writen to
    sysfs files.
  - Add locking to various attribute accesses to remove possible races.
  - Add defines for various magic numbers.
  - Use smbus_read_byte_data instead of a write_byte followed by read_byte.
  - Query only relevant registers in probe.
  - Tidy up ordering of code comments.
  - Remove a pointless power off sequence in taos_chip_on.
  - Don't bother shutting down the chip when updating the lux table.
  The table is held entirely in the driver and doesn't effect the chip at all.
  - Drop a redundant i2c call in taos_als_calibrate where the same register
  is read twice in a row.

8 years agostaging: iio: tsl2583: remove redudant i2c call in taos_als_calibrate()
Brian Masney [Thu, 3 Nov 2016 12:56:17 +0000 (08:56 -0400)]
staging: iio: tsl2583: remove redudant i2c call in taos_als_calibrate()

taos_als_calibrate() queries the control register to determine if the
unit is powered on and has the ADC enabled. It then queries the same
register a second time to determine if the ADC reading is valid. This
patch removes the redundant i2c_smbus_read_byte_data() call.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: don't shutdown chip when updating the lux table
Brian Masney [Thu, 3 Nov 2016 12:56:16 +0000 (08:56 -0400)]
staging: iio: tsl2583: don't shutdown chip when updating the lux table

in_illuminance_lux_table_store() shuts down the chip, updates the
contents of the lux table, and then turns the chip back on. The values
in lux table are not used by the chip and are only used internally by
the driver. It is not necessary to change the power state on the chip.
This patch removes the calls to taos_chip_off() and taos_chip_on()
in in_illuminance_lux_table_store().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: remove redundant power off sequence in taos_chip_on()
Brian Masney [Thu, 3 Nov 2016 12:56:15 +0000 (08:56 -0400)]
staging: iio: tsl2583: remove redundant power off sequence in taos_chip_on()

taos_chip_on() explicitly turns the sensor power on and then writes the
8 registers that are stored in taos_config. The first register in
taos_config is the CONTROL register and the configuration is set to
turn the power off. The existing state sequence in taos_chip_on() is:

- Turn device power on
- Turn device power off (via taos_config)
- Configure other 7 registers (via taos_config)
- Turn device power on, enable ADC

This patch changes the code so that the device is not powered off via
taos_config.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: fixed ordering of comments
Brian Masney [Thu, 3 Nov 2016 12:56:14 +0000 (08:56 -0400)]
staging: iio: tsl2583: fixed ordering of comments

in taos_defaults()

The comments in taos_defaults() appear after the line of code
that they apply to. This patch moves the comments so that they appear
before the code. Some of the comments were updated to be more
informative.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: removed unused code from device probing
Brian Masney [Thu, 3 Nov 2016 12:56:13 +0000 (08:56 -0400)]
staging: iio: tsl2583: removed unused code from device probing

taos_probe() queries the all of the sensor's registers and loads all of
the values into a buffer stored on the stack. Only the chip ID register
was actually used. Change the probe function to just query the chip ID
register on the device.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: tsl2583: i2c_smbus_write_byte() / i2c_smbus_read_byte() migration
Brian Masney [Thu, 3 Nov 2016 12:56:12 +0000 (08:56 -0400)]
staging: iio: tsl2583: i2c_smbus_write_byte() / i2c_smbus_read_byte() migration

There were several places where the driver would first call
i2c_smbus_write_byte() to select the register on the device, and then
call i2c_smbus_read_byte() to get the contents of that register. The
code would look roughly like:

/* Select register */
i2c_smbus_write_byte(client, REGISTER);

/* Read the the last register that was written to */
int data = i2c_smbus_read_byte(client);

Rewrite this to use i2c_smbus_read_byte_data() to combine the two
calls into one:

int data = i2c_smbus_read_byte_data(chip->client, REGISTER);

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

This fixes the following warnings that were found by the
kbuild test robot that were introduced by commit 8ba355cce3c6 ("staging:
iio: tsl2583: check for error code from i2c_smbus_read_byte()").

drivers/staging/iio/light/tsl2583.c:365:5-12: WARNING: Unsigned
expression compared with zero: reg_val < 0

drivers/staging/iio/light/tsl2583.c:388:5-12: WARNING: Unsigned
expression compared with zero: reg_val < 0

This also removes the need for the taos_i2c_read() function since all
callers were only calling the function with a length of 1.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoMerge branch 'ib-iio-mfd-ti335x_dma' into togreg
Jonathan Cameron [Sat, 5 Nov 2016 17:38:00 +0000 (17:38 +0000)]
Merge branch 'ib-iio-mfd-ti335x_dma' into togreg

A local branch created as Lee requested these two patches were applied
in a fashion that would later let him merge the same branch into MFD
if needed.

8 years agodrivers: iio: ti_am335x_adc: add dma support
Mugunthan V N [Wed, 5 Oct 2016 09:04:41 +0000 (14:34 +0530)]
drivers: iio: ti_am335x_adc: add dma support

This patch adds the required pieces to ti_am335x_adc driver for
DMA support

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agomfd: ti_am335x_tscadc: store physical address
Mugunthan V N [Wed, 5 Oct 2016 09:04:40 +0000 (14:34 +0530)]
mfd: ti_am335x_tscadc: store physical address

store the physical address of the device in its priv to use it
for DMA addressing in the client drivers.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: adc: at91: add suspend and resume callback
Wenyou Yang [Wed, 2 Nov 2016 09:21:48 +0000 (17:21 +0800)]
iio: adc: at91: add suspend and resume callback

Add suspend/resume callback, support the pinctrl sleep state when
the system suspend as well.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agoiio: hid-sensor-attributes: Check sample_frequency/hysteresis write data legitimacy
Song Hongyan [Thu, 3 Nov 2016 00:45:48 +0000 (00:45 +0000)]
iio: hid-sensor-attributes: Check sample_frequency/hysteresis write data legitimacy

Neither sample frequency value nor hysteresis value can be set to be a
negative number, check and return "Invalid argument" if they are negative.

If not do this change, sample_frequency will be set into some unknown
value, read hysteresis value after write negative number will return
"Invalid argument".

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: ad9832: clean-up regulator 'reg'
Eva Rachel Retuya [Mon, 31 Oct 2016 17:04:35 +0000 (01:04 +0800)]
staging: iio: ad9832: clean-up regulator 'reg'

Rename regulator 'reg' to 'avdd' so as to be clear what regulator it
stands for specifically. Additionally, get rid of local variable 'reg'
and use direct assignment instead. Update also the goto label pertaining
to the avdd regulator during disable.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: ad9832: add DVDD regulator
Eva Rachel Retuya [Mon, 31 Oct 2016 17:04:34 +0000 (01:04 +0800)]
staging: iio: ad9832: add DVDD regulator

The AD9832/AD9835 is supplied with two power sources: AVDD as analog
supply voltage and DVDD as digital supply voltage.

Attempt to fetch and enable the regulator 'dvdd'. Bail out if any error
occurs.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: ad7192: rename regulator 'reg' to 'avdd'
Eva Rachel Retuya [Mon, 31 Oct 2016 17:04:33 +0000 (01:04 +0800)]
staging: iio: ad7192: rename regulator 'reg' to 'avdd'

Rename regulator 'reg' to 'avdd' so as to be clear what regulator it
stands for specifically. Also, update the goto label accordingly.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: ad7192: add DVdd regulator
Eva Rachel Retuya [Mon, 31 Oct 2016 17:04:32 +0000 (01:04 +0800)]
staging: iio: ad7192: add DVdd regulator

The AD7190/AD7192/AD7193/AD7195 is supplied with two power sources:
AVdd as analog supply voltage and DVdd as digital supply voltage.

Attempt to fetch and enable the regulator 'dvdd'. Bail out if any error
occurs.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8 years agostaging: iio: rework regulator handling
Eva Rachel Retuya [Mon, 31 Oct 2016 17:04:31 +0000 (01:04 +0800)]
staging: iio: rework regulator handling

Currently, the affected drivers ignore 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.

The following semantic patch was used to apply the change:
@r1@
expression reg, dev, en, volt;
@@

reg = \(devm_regulator_get\|regulator_get\)(dev, ...);
if (
- !
   IS_ERR(reg))
+ return PTR_ERR(reg);
(
- { en = regulator_enable(reg);
- if (en) return en; }
+
+ en = regulator_enable(reg);
+ if (en) {
+ dev_err(dev, "Failed to enable specified supply\n");
+ return en; }
|
+
- { en = regulator_enable(reg);
- if (en) return en;
- volt = regulator_get_voltage(reg); }
+ en = regulator_enable(reg);
+ if (en) {
+ dev_err(dev, "Failed to enable specified supply\n");
+ return en;
+ }
+ volt = regulator_get_voltage(reg);
)

@r2@
expression arg;
@@

- if (!IS_ERR(arg)) regulator_disable(arg);
+ regulator_disable(arg);

Hand-edit the debugging prints with the supply name to become more
specific.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>