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>
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>
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.
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):
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.
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>
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.
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>
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>
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>
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>
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>
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:
/* 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>
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>
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>
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>
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>
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>
staging: iio: set proper supply name to devm_regulator_get()
The name passed to devm_regulator_get() should match the name of the
supply as specified in the device datasheet. This makes it clear what
power supply is being referred to in case of presence of other
regulators.
Currently, the supply name specified on the affected devices is 'vcc'.
Use lowercase version of the datasheet name to specify the supply
voltage.
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>
Brian Masney [Fri, 28 Oct 2016 10:00:21 +0000 (06:00 -0400)]
staging: iio: tsl2583: add locking to sysfs attributes
in_illuminance_input_target_show(), in_illuminance_input_target_store(),
in_illuminance_calibrate_store(), and in_illuminance_lux_table_store()
accesses data from the tsl2583_chip struct. Some of these fields can be
modified by other parts of the driver concurrently. This patch adds the
mutex locking to these sysfs attributes.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 28 Oct 2016 10:00:20 +0000 (06:00 -0400)]
staging: iio: tsl2583: add error code to sysfs store functions
in_illuminance_input_target_store() and in_illuminance_calibrate_store()
validated the data from userspace, however it would not return an
error code to userspace if an invalid value was passed in. This patch
changes these functions so that they return -EINVAL if invalid data is
passed in.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 28 Oct 2016 10:00:19 +0000 (06:00 -0400)]
staging: iio: tsl2583: use IIO_*_ATTR* macros to create sysfs entries
Use the IIO_CONST_ATTR, IIO_DEVICE_ATTR_RW, and IIO_DEVICE_ATTR_WO
macros for creating the in_illuminance_calibscale_available,
in_illuminance_integration_time_available, in_illuminance_input_target,
in_illuminance_calibrate, and in_illuminance_lux_table sysfs entries.
Previously these sysfs entries were prefixed with illuminance0_, however
they are now prefixed with in_illuminance_ to make these sysfs entries
consistent with how the IIO core is creating the other sysfs entries.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 28 Oct 2016 10:00:18 +0000 (06:00 -0400)]
staging: iio: tsl2583: convert illuminance0_calibscale sysfs attr to use iio_chan_spec
The illuminance0_calibscale sysfs attribute is not currently created by
the IIO core. This patch adds the appropriate mask to iio_chan_spec,
along with the appropriate data handling in the read_raw() and
write_raw() functions, so that the sysfs attribute is created by the IIO
core. With this change, this sysfs entry will have its prefix changed
from illuminance0_ to in_illuminance_.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 28 Oct 2016 10:00:17 +0000 (06:00 -0400)]
staging: iio: tsl2583: convert to use iio_chan_spec and {read,write}_raw
The tsl2583 driver directly creates sysfs attributes that should instead
be created by the IIO core on behalf of the driver. This patch adds the
iio_chan_spec array, the relevant info_mask elements and the read_raw()
and write_raw() functions to take advantage of features provided by the
IIO core. These sysfs attributes were migrated with this patch:
illuminance0_input, illuminance0_calibbias,
illuminance0_integration_time. This also exposes the raw values read
from the two channels on the sensor.
With this change, these four sysfs entries have their prefix changed
from illuminance0_ to in_illuminance_. This is deemed to be acceptable
since none of the IIO light drivers in mainline use the illuminance0_
prefix, however 8 of the IIO light drivers in mainline use the
in_illuminance_ prefix.
Also fix the units of integration_time to meet with the ABI.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 28 Oct 2016 10:00:16 +0000 (06:00 -0400)]
staging: iio: tsl2583: check return values from taos_chip_{on,off}
The return value from taos_chip_on() and taos_chip_off() was not
checked in taos_luxtable_store() and taos_probe(). This patch adds
proper error checking to these function calls.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
IIO devices have a /sys/bus/iio/devices/iio:deviceX/power/ directory
that allows viewing and controling various power parameters. The tsl2583
driver also has an additional custom sysfs attribute named power_state
that is not needed. This patch removes the redundant power_state sysfs
attribute.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 28 Oct 2016 10:00:13 +0000 (06:00 -0400)]
staging: iio: tsl2583: check for error code from i2c_smbus_read_byte()
taos_i2c_read() and taos_als_calibrate() does not check to see if the
value returned by i2c_smbus_read_byte() was an error code. This patch
adds the appropriate error handling.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: si7020: Add devicetree support and trivial bindings
This adds devicetree support for the si7020 iio driver. Since it works
well without requiring any additional property, its compatible string is
added to the trivial i2c devices bindings list.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Cameron [Sun, 30 Oct 2016 12:08:42 +0000 (12:08 +0000)]
iio:cros_ec_sensors: Swap from a select to a depends in Kconfig
Would have merged this into the original patch as a fixup but I've already
pushed that out as an immutable branch for others to use so it'll have
to be a separate patch. The original select had a typo as well.
Trying to do this via a select was opening a can of worms due to
a tree of other elements that would also have needed selecting.
A simple depends seems much mroe straight forward and appropriate in this
case.
Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Lee Jones <lee.jones@linaro.org> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Elise Lennion [Fri, 28 Oct 2016 00:22:28 +0000 (22:22 -0200)]
staging: sm750fb: Refine code in set_current_gate().
The 'switch' statement in set_current_gate() had only two possible
scenarios, so it was replaced with an 'if' statement to make the code
shorter and easier to understand.