The entries in the lux table (als_device_lux) can be updated via sysfs
through the function in_illuminance_lux_table_store(). The last row in
the table must be terminated with values that are zero. The sysfs code
already ensures that the last row is all zeros. The call to memset to
clear out the table is not needed so this patch removes the unnecessary
call.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:36 +0000 (13:19 -0500)]
staging: iio: tsl2583: clarified comment about clearing interrupts
The comment that describes the code that clears the interrupt bit was
vague and didn't provide much value. This patch adds more detail about
why that bit needs to be cleared.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:35 +0000 (13:19 -0500)]
staging: iio: tsl2583: add tsl2583 to list of supported devices in the header
The header only listed the tsl2580 and tsl2581 devices as supported by
this driver. This patch adds the tsl2583 since it is also supported by
this driver.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:34 +0000 (13:19 -0500)]
staging: iio: tsl2583: move from a global to a per device lux table
The driver contains a global lux table that can be updated via sysfs.
Change this to a per device lux table so that multiple devices can be
hooked up to the same system with different lux tables.
There are 10 entries, plus 1 for the termination segment, set aside for
the entries in the lux table. When updating the lux table via sysfs,
only 9 entries, plus the terminator, could be added. This changes
the code to allow for the 10 entries, plus the terminator.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:31 +0000 (13:19 -0500)]
staging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on success
tsl2583_als_calibrate() returns the newly computed gain_trim if the
calibration was successful. This function is only called by
in_illuminance_calibrate_store() and the return value inside that
sysfs attribute is only checked to see if an error was returned.
This patch changes tsl2583_als_calibrate() to return 0 on success.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:30 +0000 (13:19 -0500)]
staging: iio: tsl2583: moved code block inside else statement
The check for ch1lux > ch0lux inside tsl2583_get_lux is only valid if
the ratio is not equal to zero. Move the code block inside the else
statement. This does away with the need to initialize the variables to
zero.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:29 +0000 (13:19 -0500)]
staging: iio: tsl2583: updated code comment to match what the code does
If channel 0 does not have any data, then the code sets the lux to zero.
The corresponding comment says that the last value is returned. This
updates the comment to correctly reflect what the code does. It also
clarifies the comment about why 0 is returned.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The definition of the tsl2583_device_lux struct has a series of single
line comments. There are two other cases where the multiline comments
did not have an initial blank line. Change these comments to use the
proper multiline syntax.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
There are two separate files describing the tsl2583 sysfs attributes.
Combine the two files into one. Updated the name of the sysfs attributes
to match the current ABI.
Signed-off-by: Brian Masney <masneyb@onstation.org> Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:24 +0000 (13:19 -0500)]
staging: iio: tsl2583: fix alignment of #define values
Most of the values in the #defines have their values aligned on a single
column, but some do not. This changes the remaining defines to use
consistent alignment with the majority to improve code readability.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:23 +0000 (13:19 -0500)]
staging: iio: tsl2583: unify function and variable prefix to tsl2583_
Some functions and variables were prefixed with either taos, tsl258x,
taos2583, or tsl2583. Change everything to use the tsl2583 prefix since
that is the name of the .c file. The taos_settings member inside the
taos_settings struct was renamed to als_settings.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:22 +0000 (13:19 -0500)]
staging: iio: tsl2583: cleaned up logging
There are several places in the code where the function name is
hardcoded in the log message. Use the __func__ constant string to build
the log message. This also clarifies some of the error messages to match
the code and ensures that the correct priority is used since the message
is already being changed.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:21 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove the FSF's mailing address
Address warning from checkpatch:
CHECK: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already
includes a copy of the GPL.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sat, 12 Nov 2016 18:19:20 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove redundant write to the control register in taos_probe()
taos_probe() calls i2c_smbus_write_byte() to select the control
register, however there are no subsequent calls to
i2c_smbus_read_byte(). The write call is unnecessary and is removed by
this patch.
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>
Brian Masney [Sat, 12 Nov 2016 18:19:19 +0000 (13:19 -0500)]
staging: iio: tsl2583: change current chip state from a tristate to a bool
The current chip state is represented as a tristate (working, suspended,
and unknown). The unknown state was not used. This patch changes the
chip state so that it is now represented as a single boolean value
(suspended).
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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.
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
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>
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).
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>
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>
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.
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.
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
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>
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>
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>
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>
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.
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>
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>
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>