linux-2.6-microblaze.git
7 years agoiio: iio_push_event(): Don't crash if the event interface is not registered
Lars-Peter Clausen [Thu, 8 Sep 2016 16:49:10 +0000 (18:49 +0200)]
iio: iio_push_event(): Don't crash if the event interface is not registered

iio_push_event() operates on a struct iio_dev. This struct can be allocated
using iio_device_alloc() which returns a valid struct iio_dev pointer. But
iio_push_event() is not safe to use on such a iio_dev until
iio_device_register() for the same device has successfully completed.

This restriction is not documented anywhere and most drivers are written
with the assumption that this restriction does not exist. The basic pattern
that is followed by all drivers looks like the following:

irqreturn_t event_callback(int irq, void *devid)
{
struct iio_dev *indio_dev = devid;
...
iio_push_event(indio_dev, ...);

return IRQ_HANDLED;
}

int driver_probe(struct device *dev)
{
struct iio_dev *indio_dev;

indio_dev = iio_device_alloc(...);

request_irq(event_irq, event_callback, ..., indio_dev);

return iio_device_register(indio_dev);
}

And while it is unlikely that the IRQ fires before iio_device_register()
completes (e.g. because the IRQ is disabled in the device) it is not
impossible and might be triggered by glitches on the signal line or
incorrect hardware configuration.

To avoid undefined behaviour in such a case extend iio_push_event() to
check if the event has been registered and discard generated events if it
has not.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: accel: mxc6255 add support for the mxc6225
Hans de Goede [Sun, 4 Sep 2016 17:35:32 +0000 (19:35 +0200)]
iio: accel: mxc6255 add support for the mxc6225

The mxc6225 is fully compatible with the existing mxc6255 driver,
add support for it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: at91: Add support for Touchscreen Switches Closure Time
Nicolas Ferre [Tue, 30 Aug 2016 12:27:01 +0000 (14:27 +0200)]
iio: adc: at91: Add support for Touchscreen Switches Closure Time

On newer components compatible with the at91sam9x5, the Touchscreen
Switches Closure Time or TSSCTIM value of the Touchscreen Mode Register is
not filled at all.
On some hardware, having no time indicated for it may lead to incoherent
values and jitter.
We fix this time to 10us as it is usually difficult to retrieve impedance
values from LCD manufacturers.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: devm_regulator_get_optional never returns NULL
Crt Mori [Mon, 5 Sep 2016 09:14:49 +0000 (11:14 +0200)]
iio: devm_regulator_get_optional never returns NULL

This patch is inspired by a comment of Jonathan Cameron on patch of
Linus Walleij commit aeb55fff3891834e07a3144159a7298a19696af8 ("iio:
st_sensors: fetch and enable regulators unconditionally"). Because
changes made in this patch are actually reference generators they should
be using devm_regulator_get_optional, but if they do not explicitly set
the reference to NULL they should not be using IS_ERR_OR_NULL, but
simple IS_ERR check.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: fetch and enable regulators unconditionally
Crt Mori [Mon, 5 Sep 2016 09:14:48 +0000 (11:14 +0200)]
iio: fetch and enable regulators unconditionally

This patch is inspired by a comment of Jonathan Cameron on patch of
Linus Walleij commit aeb55fff3891834e07a3144159a7298a19696af8 ("iio: st_sensors: fetch and enable regulators unconditionally").

The explanation for this change is same as in that patch:
"Supplies are *not* optional (optional means that the supply is
optional in the electrical sense, not the software sense) so we need to
get the and enable them at all times.

If the device tree or board file does not define suitable regulators for
the component, it will be substituted by a dummy regulator, or, if
regulators are disabled altogether, by stubs. There is no need to use the
IS_ERR_OR_NULL() check that is considered harmful.

Reported-by: Linus Wallerij <linus.walleij@linaro.org>
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: add resource managed triggered buffer init helpers
Gregor Boirie [Fri, 2 Sep 2016 18:47:55 +0000 (20:47 +0200)]
iio: add resource managed triggered buffer init helpers

Add resource managed devm_iio_triggered_buffer_setup() and
devm_iio_triggered_buffer_cleanup() to automatically clean up triggered
buffers setup by IIO drivers, thus leading to simplified IIO drivers code.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio:trigger: add resource managed (un)register
Gregor Boirie [Fri, 2 Sep 2016 18:47:54 +0000 (20:47 +0200)]
iio:trigger: add resource managed (un)register

Add resource managed devm_iio_trigger_register() and
devm_iio_triger_unregister() to automatically clean up registered triggers
allocated by IIO drivers, thus leading to simplified IIO drivers code.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: chemical: vz89x: fix boolreturn.cocci warnings
kbuild test robot [Thu, 1 Sep 2016 00:38:38 +0000 (08:38 +0800)]
iio: chemical: vz89x: fix boolreturn.cocci warnings

drivers/iio/chemical/vz89x.c:119:9-10: WARNING: return of 0/1 in function 'vz89x_measurement_is_valid' with return type bool

 Return statements in functions returning bool should use
 true/false instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci

CC: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: st_sensors: fix errorcheck for regulators
Linus Walleij [Tue, 30 Aug 2016 08:18:39 +0000 (10:18 +0200)]
iio: st_sensors: fix errorcheck for regulators

We were checking the return code of vdd when we should be checking
vdd_io. My mistake, mea culpa.

Cc: Giuseppe BARBA <giuseppe.barba@st.com>
Reported-by: Giuseppe BARBA <giuseppe.barba@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: stx104: Add IIO support for the ADC channels
William Breathitt Gray [Mon, 29 Aug 2016 20:22:56 +0000 (16:22 -0400)]
iio: stx104: Add IIO support for the ADC channels

The Apex Embedded Systems STX104 features 16 channels of single-ended (8
channels of true differential) 16-bit analog input. Differential input
configuration may be selected via a physical jumper on the device.
Similarly, input polarity (unipolar/bipolar) is configured via a
physical jumper on the device.

Input gain selection is available to the user via software, thus
allowing eight possible input ranges: +-10V, +-5V, +-2.5V, +-1.25V,
0 to 10V, 0 to 5V, 0 to 2.5V, and 0 to 1.25V. Four input gain
configurations are supported: x1, x2, x4, and x8.

This ADC resolution is 16-bits (1/65536 of full scale). Analog input
samples are taken on software trigger; neither FIFO sampling nor
interrupt triggering is supported by this driver.

The Apex Embedded Systems STX104 is primarily an analog-to-digital
converter device. The STX104 IIO driver was initially placed in the DAC
directory because only the DAC portion of the STX104 was supported at
the time. Now that ADC support has been added to the STX104 IIO driver,
the driver should be moved to the more appropriate ADC directory.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: ina2xx: remove unused debug field from chip global data
Alison Schofield [Sat, 3 Sep 2016 02:54:21 +0000 (19:54 -0700)]
iio: adc: ina2xx: remove unused debug field from chip global data

commit 1961bce76452 "iio: ina2xx: Remove trace_printk debug
statements" removed the code that used the chip->prev_ns field.
This patch cleans it up further by removing the unused field
and assignments.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: trigger: allow immutable triggers to be assigned
Matt Ranostay [Sat, 3 Sep 2016 06:36:15 +0000 (23:36 -0700)]
iio: trigger: allow immutable triggers to be assigned

There are times when an assigned trigger to a device shouldn't ever
change after intialization.

Examples of this being used is when an provider device has a trigger
that is assigned to an ADC, which uses it populate data into a callback
buffer.

Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: sx9500: add final devicetree support
Christoph Fritz [Sat, 3 Sep 2016 10:30:00 +0000 (12:30 +0200)]
iio: sx9500: add final devicetree support

This makes sx9500 driver usable on devicetree based platforms too.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Vlad Dogaru <ddvlad@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: add ADC12130/ADC12132/ADC12138 ADC driver
Akinobu Mita [Sun, 28 Aug 2016 14:52:49 +0000 (23:52 +0900)]
iio: adc: add ADC12130/ADC12132/ADC12138 ADC driver

This adds Texas Instruments' ADC12130/ADC12132/ADC12138 12-bit plus
sign ADC driver.  I have tested with the ADC12138.  The ADC12130 and
ADC12132 are not tested but these are similar to ADC12138 except that
the mode programming instruction is a bit different.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agomailmap: update Vlad Dogaru email address
Vlad Dogaru [Mon, 29 Aug 2016 10:31:13 +0000 (13:31 +0300)]
mailmap: update Vlad Dogaru email address

Replace my previous employer address.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agofix:iio:common:st_sensors:st_sensors_trigger:mark symbols static where possible
Baoyou Xie [Sat, 27 Aug 2016 06:26:30 +0000 (14:26 +0800)]
fix:iio:common:st_sensors:st_sensors_trigger:mark symbols static where possible

We get 2 warnings when biuld kernel with W=1:
drivers/iio/common/st_sensors/st_sensors_trigger.c:69:13: warning: no previous prototype
for 'st_sensors_irq_handler' [-Wmissing-prototypes]
drivers/iio/common/st_sensors/st_sensors_trigger.c:85:13: warning: no previous prototype
for 'st_sensors_irq_thread' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: magn: ak8974: remove .owner field for driver
Wei Yongjun [Fri, 26 Aug 2016 14:32:29 +0000 (14:32 +0000)]
iio: magn: ak8974: remove .owner field for driver

Remove .owner field if calls are used which set it automatically.

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

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: magn/ak8974: avoid unused function warning
Arnd Bergmann [Fri, 26 Aug 2016 15:31:19 +0000 (17:31 +0200)]
iio: magn/ak8974: avoid unused function warning

The ak8974_configure() function is used only from the PM code,
but that can be hidden when CONFIG_PM is disabled:

drivers/iio/magnetometer/ak8974.c:201:12: error: 'ak8974_configure' defined but not used [-Werror=unused-function]

This replaces the #ifdef with a __maybe_unused annotation, which
will work correctly in all configurations and avoid the warning,
as the compiler can now see where ak8974_configure is called from.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 7c94a8b2ee8c ("iio: magn: add a driver for AK8974")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: hid-sensors: avoid unused function warning
Arnd Bergmann [Fri, 26 Aug 2016 15:29:35 +0000 (17:29 +0200)]
iio: hid-sensors: avoid unused function warning

A small rework of the PM code in this driver introduced a harmless
warning when CONFIG_PM_SLEEP is not set:

drivers/iio/common/hid-sensors/hid-sensor-trigger.c:212:12: error: 'hid_sensor_resume' defined but not used [-Werror=unused-function]

This removes the #ifdef and instead marks all three PM functions
as __maybe_unused, which covers all possible cases and is harder
to get wrong.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 7f6cf7414538 ("iio: hid-sensors: use asynchronous resume")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: ti-ads1015: add missing of_node_put() in ads1015_get_channels_config_of()
Wei Yongjun [Fri, 26 Aug 2016 14:31:50 +0000 (14:31 +0000)]
iio: adc: ti-ads1015: add missing of_node_put() in ads1015_get_channels_config_of()

When terminating for_each_child_of_node() iteration with
break or return, of_node_put() should be used to prevent
stale device node references from being left behind.

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: temperature: fix non static symbol warnings
Wei Yongjun [Fri, 26 Aug 2016 14:33:20 +0000 (14:33 +0000)]
iio: temperature: fix non static symbol warnings

Fixes the following sparse warnings:

drivers/iio/temperature/maxim_thermocouple.c:35:28: warning:
 symbol 'max6675_channels' was not declared. Should it be static?
drivers/iio/temperature/maxim_thermocouple.c:52:28: warning:
 symbol 'max31855_channels' was not declared. Should it be static?
drivers/iio/temperature/maxim_thermocouple.c:98:38: warning:
 symbol 'maxim_thermocouple_chips' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-By: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: st_sensors: fetch and enable regulators unconditionally
Linus Walleij [Thu, 25 Aug 2016 22:10:08 +0000 (00:10 +0200)]
iio: st_sensors: fetch and enable regulators unconditionally

These sensors all have Vdd and Vdd_IO lines. This means the
supplies are *not* optional (optional means that the supply is
optional in the electrical sense, not the software sense)
so we need to get the and enable them at all times.

If the device tree or board file does not define suitable
regulators for the component, it will be substituted by a
dummy regulator, or, if regulators are disabled altogether,
by stubs. There is no need to use the IS_ERR_OR_NULL() check
that is considered harmful.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
Cc: Gregor Boirie <gregor.boirie@parrot.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: dac: AD8801: add Analog Devices AD8801/AD8803 support
Gwenhael Goavec-Merou [Wed, 24 Aug 2016 14:44:20 +0000 (16:44 +0200)]
iio: dac: AD8801: add Analog Devices AD8801/AD8803 support

Add support for Analog Devices AD8801/AD8803, 8 channels 8bits, Digital to
Analog converters.

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: chemical: vz89x: prevent corrupted buffer from being read
Matt Ranostay [Thu, 25 Aug 2016 06:44:49 +0000 (23:44 -0700)]
iio: chemical: vz89x: prevent corrupted buffer from being read

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: chemical: vz89x: add support for VZ89TE part
Matt Ranostay [Thu, 25 Aug 2016 06:44:48 +0000 (23:44 -0700)]
iio: chemical: vz89x: add support for VZ89TE part

Add support the VZ89TE variant which removes the voc_short channel,
and has CRC check for data transactions.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: chemical: vz89x: abstract chip configuration
Matt Ranostay [Thu, 25 Aug 2016 06:44:47 +0000 (23:44 -0700)]
iio: chemical: vz89x: abstract chip configuration

Abstract chip configuration data to allow supporting multiple variants
of the VZ89 chemical sensor line.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: ltc2485: add support for Linear Technology LTC2485 ADC
Alison Schofield [Thu, 25 Aug 2016 05:48:43 +0000 (22:48 -0700)]
iio: adc: ltc2485: add support for Linear Technology LTC2485 ADC

Adds basic support for the LTC2485 ADC - a delta-sigma analog-to-digital
converter with an I2C interface that operates in single shot conversion
mode.

The driver supports an on board 5V reference and the power-on default
configuration which rejects both 50hz & 60hz line frequencies and
operates in 1x speed mode.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: accel: sca3000: remove extra space
Clifton Barnes [Tue, 23 Aug 2016 02:45:05 +0000 (22:45 -0400)]
staging: iio: accel: sca3000: remove extra space

fix checkpatch.pl warning about 'Statements should start on a
tabstop'

Signed-off-by: Clifton Barnes <clifton.a.barnes@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: iio-utils: use channel modifier scaling if it exists
Matt Ranostay [Mon, 22 Aug 2016 22:19:37 +0000 (15:19 -0700)]
iio: iio-utils: use channel modifier scaling if it exists

Now there are channel modifiers with their own scaling those should be
used when possible over the generic channel type scaling.

Examples are of IIO_TEMP channel having a generic scaling value, and
another having IIO_MOD_TEMP_AMBIENT modifier with another scaling value.

Previously the first scaling value for a channel type would be applied
to all channels of like type in iio_generic_buffer

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: ad5755: fix off-by-one on devnr limit check
Colin Ian King [Mon, 25 Jul 2016 22:40:01 +0000 (23:40 +0100)]
iio: ad5755: fix off-by-one on devnr limit check

The comparison for devnr limits is off-by-one, the current check
allows 0 to AD5755_NUM_CHANNELS and the limit should be in fact
0 to AD5755_NUM_CHANNELS - 1.  This can lead to an out of bounds
write to pdata->dac[devnr]. Fix this by replacing > with >= on the
comparison.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Fixes: c947459979c6 ("iio: ad5755: add support for dt bindings")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoMerge tag 'iio-for-4.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Tue, 23 Aug 2016 21:50:16 +0000 (17:50 -0400)]
Merge tag 'iio-for-4.9a' of git://git./linux/kernel/git/jic23/iio into work-testing

Jonathan writes:

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

Device support

* ak8974
  - New driver and bindings for this 2009 vintage magnetometer (it was very
    popular back then!)
* atlas-ph-sensor
  -  ORP sensor support(I had to look up what one of these was)
* cio-dac
  - New driver for Measurement Computing DAC boards
* dmard06
  - New driver for Domintech DMARDO6 accelerometer. Also vendor prefix.
* dmard09
  - New driver for Domintech DMARD09 accelerometer.
* maxim-thermocouple
  - max6675 and max31855 new driver
* mt6577 auxdac
  - new driver for this Mediatek chip mt2701, mt6577 and mt8173 have this
    hardware.
* ti-adc161s626
  - new driver for this TI single channel differential ADC.
* vcnl4000
  - support vcnl4010 and vcnl4020 which are compatible for all features
    currently supported by this driver.

New features

* Core
  - Allow retrieving of underlying iio_dev from a callback buffer handle.
    This is needed to allow client drivers to perform operations such as
    configuring the trigger used.
* hid-sensors
  - asynchronous resume support to avoid really long resume times.
* kxcjk-1013
  - add the mysterious KIOX000A ACPI id seen in the wild.
* Tools
  - lsiio now enumerates processed as well as raw channels.

Cleanup

* ad7298
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
* ad7793
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
ade7854
  - checkpatch fixups (alignment of parameters)
* atlas-ph-sensor
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
  - Switch to REGCACHE_NONE as there are no useful register to cache.
* bma180
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
* hdc100x
  - Add mention of the HDC1000 and HDC1008 to the Kconfig help text.
* isl29018
  - Add driver specific prefixes to defines and function names.
  - Remove excessive logging.
  - Drop newlines which add nothing to readability.
  - General tidying up of comments.
  - Drop I2C_CLASS_HWMON as irrelevant to driver.
* isl29028
  - Add driver specific prefixes to defines, enums and function names.
  - Drop comma's from available attribute output as not ABI compliant.
  - Drop I2C_CLASS_HWMON as irrelevant to driver.
* kxsd9
  - devicetree bindings.
* mag3110
  - This one wasn't locking to protect against mode switches during
    raw_reads.  Use the iio_claim_direct_mode function to fix this buglet.
* maxim-theromcouple
  - Fix missing selects for triggered buffer support in Kconfig.
* nau7802
  - Use complete instead of complete_all as only one completion at a time.
* sx9500
  - Use complete instead of complete_all as only one completion at a time.
* us5182d
  - Add a missing error code asignment instead of checking the result of
    an already checked statement.
* vcnl4000
  - Use BIT macro where appropriate.
  - Refactor return codes in read_raw callback.
  - Add some missing locking for concurrent accesses to the device.

7 years agostaging: most: aim-cdev: destroy ida struct in case of exception
Christian Gromm [Mon, 22 Aug 2016 14:46:24 +0000 (16:46 +0200)]
staging: most: aim-cdev: destroy ida struct in case of exception

This patch is needed to clean up the initialized ida structure in case
the function exits with an exception.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages
James Simmons [Mon, 22 Aug 2016 16:57:43 +0000 (12:57 -0400)]
staging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages

The function mdc_adjust_dirpages is only called on platforms which
don't have pages 4K in size which is why kbuild only reported this
for platforms like the Alpha. The problem was a typo in ordering of
variables in the beginning of a while loop. We were accessing the
dp pointer before it was kmapped.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/lustre: Remove unused cp_error from struct cl_page
Oleg Drokin [Sun, 21 Aug 2016 22:04:36 +0000 (18:04 -0400)]
staging/lustre: Remove unused cp_error from struct cl_page

cp_error member is not really set anywhere, so kill
it and the only printing user of it too.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/lustre: Make alignment match open parenthesis
Oleg Drokin [Sun, 21 Aug 2016 22:04:35 +0000 (18:04 -0400)]
staging/lustre: Make alignment match open parenthesis

This patch fixes most of checkpatch occurences of
"CHECK: Alignment should match open parenthesis"
in Lustre code.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/lustre: Add spaces preferred around that '{+, -, *, /, |, <<, >>, &}'
Oleg Drokin [Sun, 21 Aug 2016 22:04:34 +0000 (18:04 -0400)]
staging/lustre: Add spaces preferred around that '{+, -, *, /, |, <<, >>, &}'

This patch fixes all checkpatch occurences of
"CHECK: spaces preferred around that '{+,-,*,/,|,<<,>>,&}' (ctx:VxV)"
in Lustre code.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoiio: accel: kxsd9: Add device tree bindings
Linus Walleij [Tue, 16 Aug 2016 13:33:27 +0000 (15:33 +0200)]
iio: accel: kxsd9: Add device tree bindings

This accelerometer can be probed from the device tree, so it needs
to have proper documentation of it's device tree bindings.

Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: hid-sensors: use asynchronous resume
Srinivas Pandruvada [Mon, 15 Aug 2016 19:12:47 +0000 (12:12 -0700)]
iio: hid-sensors: use asynchronous resume

Some platforms power off sensor hubs during S3 suspend, which will require
longer time to resume. This hurts system resume time, so resume
asynchronously.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: adc: mt2701: Add Mediatek auxadc driver for mt2701.
Zhiyong Tao [Thu, 18 Aug 2016 07:11:36 +0000 (15:11 +0800)]
iio: adc: mt2701: Add Mediatek auxadc driver for mt2701.

Add Mediatek auxadc driver based on iio.
It will register a device in iio and support iio.
So thermal can read auxadc channel to sample data by iio device.
It is tested successfully on mt2701 platform.
Mt8173 and mt6577 platforms are not tested.
But the expectation is compatible.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agodt-bindings: auxadc: Add binding document for Mediatek auxadc.
Zhiyong Tao [Thu, 18 Aug 2016 07:11:35 +0000 (15:11 +0800)]
dt-bindings: auxadc: Add binding document for Mediatek auxadc.

The commit adds the device tree binding documentation for the mediatek
auxadc found on Mediatek MT2701.
Thermal gets auxadc sample data by iio device.
So the commit changes auxadc device tree binding documentation from
/soc/mediatek/auxadc.txt to /iio/adc/mt6577_auxadc.txt.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: temperature: add Kconfig selects for triggered buffer
Alison Schofield [Mon, 15 Aug 2016 23:09:36 +0000 (16:09 -0700)]
iio: temperature: add Kconfig selects for triggered buffer

Select IIO_BUFFER and IIO_TRIGGERED_BUFFER to compile maxim_thermocouple.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agoiio: magnetometer: mag3110: claim direct mode during raw reads
Alison Schofield [Thu, 18 Aug 2016 16:09:00 +0000 (09:09 -0700)]
iio: magnetometer: mag3110: claim direct mode during raw reads

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

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: rts5208: Change data type to unsigned int.
Louie Lu [Mon, 15 Aug 2016 10:44:41 +0000 (18:44 +0800)]
staging: rts5208: Change data type to unsigned int.

This patch fixes a minor checkpatch warning:

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

Signed-off-by: Louie Lu <louie.lu@hopebaytech.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV
Quentin Lambert [Fri, 12 Aug 2016 14:15:18 +0000 (16:15 +0200)]
staging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV

mg_get_local_EKB and mg_get_ICV used to return with an error code before
releasing all resources. This patch add a jump to the appropriate label
ensuring that the resources are properly released before returning.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rts5208/ms.c: change the label name to respect the coding style
Quentin Lambert [Fri, 12 Aug 2016 14:15:17 +0000 (16:15 +0200)]
staging: rts5208/ms.c: change the label name to respect the coding style

This patch changes label names using camel case to snake case as well as giving
a new name representing what will be done after the label.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rts5208: fix double blank line coding style issues
Jonas Rickert [Sat, 30 Jul 2016 11:27:58 +0000 (13:27 +0200)]
Staging: rts5208: fix double blank line coding style issues

This is a patch for double blank lines and a missing blank line reported
by checkpatch.pl

Signed-off-by: Jonas Rickert <jrickertkc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtl8723au: rtw_ieee80211: Fixed operators spacing style issues
Shiva Kerdel [Fri, 5 Aug 2016 20:14:41 +0000 (22:14 +0200)]
Staging: rtl8723au: rtw_ieee80211: Fixed operators spacing style issues

Fixed spaces around operators to fix their coding style issues.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723au: hal: check BT_Active and BT_State with correct bit pattern
Colin Ian King [Thu, 14 Jul 2016 10:21:28 +0000 (11:21 +0100)]
staging: rtl8723au: hal: check BT_Active and BT_State with correct bit pattern

BT_Active and BT_State are being masked with 0x00ffffff so it the subsequent
comparisons with 0xffffffff are therefore a buggy check.  Instead, check them
against 0x00ffffff.

Unfortunately I couldn't find a datasheet or hardware to see if 0xffffffff
is an expected invalid bit pattern that should be checked before BT_Active and
BT_State are masked with 0x00ffffff, so for now, this fix seems like the least
risky approach.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: fsl-mc: make bus/mc-bus explicitly non-modular
Paul Gortmaker [Sat, 2 Jul 2016 23:48:51 +0000 (19:48 -0400)]
staging: fsl-mc: make bus/mc-bus explicitly non-modular

The Kconfig currently controlling compilation of this code is:

config FSL_MC_BUS
        bool "Freescale Management Complex (MC) bus driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since the code was already not using module_init, we don't have to change
the initcall and the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We don't replace module.h with init.h since the file does make some
references to "struct *module" for processing other modules.

Cc: "J. German Rivera" <German.Rivera@freescale.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agofsl-mc: add helper macro to determine if a device is of fsl_mc type
Nipun Gupta [Wed, 29 Jun 2016 17:14:39 +0000 (22:44 +0530)]
fsl-mc: add helper macro to determine if a device is of fsl_mc type

Add a helper macro to return if a device has a bus type of fsl_mc.
This makes the bus driver code more readable and provides a way for
drivers like the SMMU driver to easily check the bus type.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Bharat Bhushan <bharat.bhushan@nxp.com>
Acked-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8723au: Remove unused semaphores
Binoy Jayan [Wed, 8 Jun 2016 07:40:55 +0000 (13:10 +0530)]
staging: r8723au: Remove unused semaphores

The semaphores xmit_sema, terminate_xmitthread_sema, tx_retevt and
io_req have no users, hence remove all references to them.
Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8723au: pwrctrl_priv: Replace semaphore lock with mutex
Binoy Jayan [Wed, 8 Jun 2016 07:40:54 +0000 (13:10 +0530)]
staging: r8723au: pwrctrl_priv: Replace semaphore lock with mutex

The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8188eu: Fix scheduling while atomic splat
Larry Finger [Sun, 5 Jun 2016 19:11:19 +0000 (14:11 -0500)]
staging: r8188eu: Fix scheduling while atomic splat

Commit fadbe0cd5292851608e2e01b91d9295fa287b9fe ("staging: rtl8188eu:
Remove rtw_zmalloc(), wrapper for kzalloc()") changed all allocation
calls to be GFP_KERNEL even though the original wrapper was testing
to determine if the caller was in atomic mode. Most of the mistakes
were corrected with commit 33dc85c3c667209c930b2dac5ccbc2a365e06b7a
("staging: r8188eu: Fix scheduling while atomic error introduced in
commit fadbe0cd"); however, two kzalloc calls were missed as the
call only happens when the driver is shutting down.

Fixes: fadbe0cd5292851608e2e01b91d9295fa287b9fe ("staging: rtl8188eu: Remove rtw_zmalloc(), wrapper for kzalloc()")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8188eu: Remove some false positives from kmemleak
Larry Finger [Sun, 5 Jun 2016 15:20:59 +0000 (10:20 -0500)]
staging: r8188eu: Remove some false positives from kmemleak

When this driver preallocates some SKBs, kmemleak is unable to find that
allocated memory when it scans. When the driver is unloaded, that memory
is released; therefore, the report is a false positive.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8712u: Handle some false positives from kmemleak
Larry Finger [Sat, 4 Jun 2016 01:17:37 +0000 (20:17 -0500)]
staging: r8712u: Handle some false positives from kmemleak

When this driver preallocates some URBs, kmemleak is unable to find that
allocated memory when it scans. When the driver is unloaded, that memory
is reclaimed, therefore, the report is a false positive.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8712u: Fix leak of skb
Larry Finger [Sat, 4 Jun 2016 01:17:36 +0000 (20:17 -0500)]
staging: r8712u: Fix leak of skb

There are two types of messages queued for RX. The major type, which does
I/O on the device, was being handled properly. The skbs that communicated
with the firmware were being leaked.

While rewriting the code that sets up the skb, it was possible to remove
the private variable indicating that the old skb could be reused.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: r8712u: Check pointer before use
Larry Finger [Sat, 4 Jun 2016 01:17:35 +0000 (20:17 -0500)]
staging: r8712u: Check pointer before use

Routine r8712_usb_read_port() dereferences "precvbuf" before testing it
for NULL.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8712: Fixed multiple parenthesis alignment warnings in ieee80211.c
Parth Sane [Wed, 8 Jun 2016 11:27:45 +0000 (16:57 +0530)]
staging: rtl8712: Fixed multiple parenthesis alignment warnings in ieee80211.c

Multiple parenthesis alignment warnings were thrown by checkpatch in ieee80211.c
This patch effectively fixes that.

Signed-off-by: Parth Sane <laerdevstudios@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: rtl8712: Fixed brace and comment style issue
Anuradha Weeraman [Mon, 27 Jun 2016 07:42:16 +0000 (13:12 +0530)]
Staging: rtl8712: Fixed brace and comment style issue

Fixed issues with coding style.

Signed-off-by: Anuradha Weeraman <anuradha@weeraman.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8712: intf_priv: Replace semaphore lock with completion
Binoy Jayan [Thu, 2 Jun 2016 04:24:09 +0000 (09:54 +0530)]
rtl8712: intf_priv: Replace semaphore lock with completion

The semaphore 'lock' in 'intf_priv' is used as completion,
so convert it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8712: Replace semaphore terminate_cmdthread_sema with completion
Binoy Jayan [Thu, 2 Jun 2016 04:24:08 +0000 (09:54 +0530)]
rtl8712: Replace semaphore terminate_cmdthread_sema with completion

The semaphore 'terminate_cmdthread_sema' is used as completion,
so convert it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8712: Replace semaphore cmd_queue_sema with completion
Binoy Jayan [Thu, 2 Jun 2016 04:24:07 +0000 (09:54 +0530)]
rtl8712: Replace semaphore cmd_queue_sema with completion

The semaphore 'cmd_queue_sema' is used as completion,
so convert it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8192e: Replace semaphore ips_sem with mutex
Binoy Jayan [Wed, 1 Jun 2016 09:26:56 +0000 (14:56 +0530)]
rtl8192e: Replace semaphore ips_sem with mutex

The semaphore 'ips_sem' in the rtl8192e is a simple mutex, so it should
be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8192e: Replace semaphore scan_sem with mutex
Binoy Jayan [Wed, 1 Jun 2016 09:26:55 +0000 (14:56 +0530)]
rtl8192e: Replace semaphore scan_sem with mutex

The semaphore 'scan_sem' in the rtl8192e is a simple mutex, so it should
be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8192e: Replace semaphore rf_sem with mutex
Binoy Jayan [Wed, 1 Jun 2016 09:26:54 +0000 (14:56 +0530)]
rtl8192e: Replace semaphore rf_sem with mutex

The semaphore 'rf_sem' in the rtl8192e is a simple mutex, so it should
be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8192e: r8192_priv: Replace semaphore wx_sem with mutex
Binoy Jayan [Wed, 1 Jun 2016 09:26:53 +0000 (14:56 +0530)]
rtl8192e: r8192_priv: Replace semaphore wx_sem with mutex

The semaphore 'wx_sem' in the r8192_priv is a simple mutex,
so it should be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8192e: rtllib_device: Replace semaphore wx_sem with mutex
Binoy Jayan [Wed, 1 Jun 2016 09:26:52 +0000 (14:56 +0530)]
rtl8192e: rtllib_device: Replace semaphore wx_sem with mutex

The semaphore 'wx_sem' in the rtllib_device is a simple mutex,
so it should be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/rtl8192e: avoid comparing unsigned type >= 0
Arnd Bergmann [Wed, 20 Jul 2016 15:26:06 +0000 (17:26 +0200)]
staging/rtl8192e: avoid comparing unsigned type >= 0

There is one remaining warning about a type limit check in rtl8192e:

staging/rtl8192e/rtl819x_TSProc.c:326:14: error: comparison is always true due to limited range of data type [-Werror=type-limits]

This changes a macro into a local function to clarify the types and simplify
the check while removing the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/rtl8192e: use s8 instead of char
Arnd Bergmann [Wed, 20 Jul 2016 15:26:05 +0000 (17:26 +0200)]
staging/rtl8192e: use s8 instead of char

Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of
incorrect code that results from 'char' being unsigned here, e.g.

staging/rtl8192e/rtl8192e/r8192E_phy.c:1072:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/r8192E_phy.c:1104:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/rtl_core.c:1987:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/rtl_dm.c:782:37: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtllib_softmac_wx.c:465:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]

This patch changes all uses of 'char' in this driver that refer to
8-bit integers to use 's8' instead, which is signed on all architectures.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/rtl8192u: use s8 instead of char
Arnd Bergmann [Wed, 20 Jul 2016 15:13:58 +0000 (17:13 +0200)]
staging/rtl8192u: use s8 instead of char

Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of
incorrect code that results from 'char' being unsigned here, e.g.

staging/rtl8192u/r8192U_core.c:4150:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192u/r8192U_dm.c:646:50: error: comparison is always false due to limited range of data type [-Werror=type-limits]

This patch changes all uses of 'char' in this driver that refer to
8-bit integers to use 's8' instead, which is signed on all architectures.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: remove _EFUSE_DEF_TYPE enum
Ivan Safonov [Mon, 20 Jun 2016 05:29:30 +0000 (12:29 +0700)]
staging: rtl8188eu: remove _EFUSE_DEF_TYPE enum

This enumeration does not used.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: remove EFUSE_GetEfuseDefinition function
Ivan Safonov [Mon, 20 Jun 2016 05:29:02 +0000 (12:29 +0700)]
staging: rtl8188eu: remove EFUSE_GetEfuseDefinition function

This function does not used.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: replace EFUSE_GetEfuseDefinition(..., TYPE_AVAILABLE_EFUSE_BYTES_...
Ivan Safonov [Mon, 20 Jun 2016 05:28:43 +0000 (12:28 +0700)]
staging: rtl8188eu: replace EFUSE_GetEfuseDefinition(..., TYPE_AVAILABLE_EFUSE_BYTES_BANK, &a) call with a = (EFUSE_REAL_CONTENT_LEN_88E - EFUSE_OOB_PROTECT_BYTES_88E)

This makes the code easier to read.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: replace EFUSE_GetEfuseDefinition(..., TYPE_EFUSE_MAX_SECTION...
Ivan Safonov [Mon, 20 Jun 2016 05:28:20 +0000 (12:28 +0700)]
staging: rtl8188eu: replace EFUSE_GetEfuseDefinition(..., TYPE_EFUSE_MAX_SECTION, &a) with a = EFUSE_MAX_SECTION_88E

This makes the code easier to read.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: remove efuse_max variable in hal_EfusePartialWriteCheck
Ivan Safonov [Mon, 20 Jun 2016 05:27:37 +0000 (12:27 +0700)]
staging: rtl8188eu: remove efuse_max variable in hal_EfusePartialWriteCheck

This variable does not used after assigning value.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: replace EFUSE_GetEfuseDefinition(..., TYPE_EFUSE_MAP_LEN, .....
Ivan Safonov [Mon, 20 Jun 2016 05:26:51 +0000 (12:26 +0700)]
staging: rtl8188eu: replace EFUSE_GetEfuseDefinition(..., TYPE_EFUSE_MAP_LEN, ...) call with it's result (EFUSE_MAP_LEN_88E)

This makes the code easier to read.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8188eu: Remove unused semaphores
Binoy Jayan [Mon, 6 Jun 2016 04:38:07 +0000 (10:08 +0530)]
rtl8188eu: Remove unused semaphores

The semaphores xmit_sema, terminate_xmitthread_sema and tx_retevt
have no users, hence remove all references to them.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex
Binoy Jayan [Mon, 6 Jun 2016 04:38:06 +0000 (10:08 +0530)]
rtl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex

The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Also, remove the now unused wrappers _init_pwrlock, _enter_pwrlock,
_exit_pwrlock and _rtw_down_sema.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8188eu: Replace semaphore terminate_cmdthread_sema with completion
Binoy Jayan [Mon, 6 Jun 2016 04:38:05 +0000 (10:08 +0530)]
rtl8188eu: Replace semaphore terminate_cmdthread_sema with completion

The semaphore 'terminate_cmdthread_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agortl8188eu: Replace semaphore cmd_queue_sema with completion
Binoy Jayan [Mon, 6 Jun 2016 04:38:04 +0000 (10:08 +0530)]
rtl8188eu: Replace semaphore cmd_queue_sema with completion

The semaphore 'cmd_queue_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: don't print skb->dev->name if skb is null
Colin Ian King [Mon, 15 Aug 2016 14:45:04 +0000 (15:45 +0100)]
staging: ks7010: don't print skb->dev->name if skb is null

A null pointer dereference will occur when skb is null and
skb->dev->name is printed.  Replace the skb->dev->name with
plain text "ks_wlan" to fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: declare private functions static
Nicholas Mc Guire [Mon, 25 Jul 2016 19:22:27 +0000 (21:22 +0200)]
staging: ks7010: declare private functions static

Private functions in ks_hostif.c can be declared static.

Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix wait_for_completion_interruptible_timeout return handling
Nicholas Mc Guire [Mon, 25 Jul 2016 19:21:50 +0000 (21:21 +0200)]
staging: ks7010: fix wait_for_completion_interruptible_timeout return handling

wait_for_completion_interruptible_timeout return 0 on timeout and
-ERESTARTSYS if interrupted. The check for
!wait_for_completion_interruptible_timeout() would report an interrupt
as timeout. Further, while HZ/50 will work most of the time it could
fail for HZ < 50, so this is switched to msecs_to_jiffies(20).

Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6655: power.c: Fix checkpatch warning
Anson Jacob [Sat, 9 Jul 2016 01:33:08 +0000 (21:33 -0400)]
staging: vt6655: power.c: Fix checkpatch warning

Fix checkpatch.pl warning for trailing */ on a separate line
Remove '+' postfix and '-' prefix from the start and end of block comments

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6655: Fix checkpatch warning
Anson Jacob [Sat, 9 Jul 2016 01:27:05 +0000 (21:27 -0400)]
staging: vt6655: Fix checkpatch warning

Fix warning by checkpatch.pl
Add * for block comments on subsequent lines

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6655: channel.c: Fix block comments usage warning by checkpatch.pl
Anson Jacob [Fri, 8 Jul 2016 22:22:37 +0000 (18:22 -0400)]
staging: vt6655: channel.c: Fix block comments usage warning by checkpatch.pl

This patch fixes the following checkpatch.pl warnings:

WARNING: Block comments use * on subsequent lines
+ /* TX_PE will reserve 3 us for MAX2829 A mode only,
+    it is for better TX throughput */

WARNING: Block comments use a trailing */ on a separate line
+    it is for better TX throughput */

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:dpc.h:fix parantheses alignment
Rithvik Patibandla [Mon, 27 Jun 2016 14:52:04 +0000 (20:22 +0530)]
staging:vt6656:dpc.h:fix parantheses alignment

The following patch fixes "Alignment should match open parantheses"
check thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:dpc.c:Fix spaces
Rithvik Patibandla [Mon, 27 Jun 2016 13:56:55 +0000 (19:26 +0530)]
staging:vt6656:dpc.c:Fix spaces

The following patch fixes two checks thrown by checkpatch.pl, "Spaces
preferred around '+'" and "No space is necessary after a cast"

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:dpc.c:Fix parantheses alignment
Rithvik Patibandla [Mon, 27 Jun 2016 13:51:28 +0000 (19:21 +0530)]
staging:vt6656:dpc.c:Fix parantheses alignment

This patch fixes "Alignment should match open parantheses" check
thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:baseband.h: Fix alignment issue
Rithvik Patibandla [Fri, 17 Jun 2016 06:55:42 +0000 (12:25 +0530)]
staging:vt6656:baseband.h: Fix alignment issue

Fix "Alignment should match open paranthesis" check thrown by
checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:card.c: fix camel case issue
Rithvik Patibandla [Fri, 17 Jun 2016 03:56:47 +0000 (09:26 +0530)]
staging:vt6656:card.c: fix camel case issue

Fix "Avoid camel case" issue thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:card.c: fix blank line issue
Rithvik Patibandla [Fri, 17 Jun 2016 03:53:42 +0000 (09:23 +0530)]
staging:vt6656:card.c: fix blank line issue

Fix "Please use a blank line after function declaration" check thrown
by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:card.c: fix blank lines issue
Rithvik Patibandla [Fri, 17 Jun 2016 03:51:28 +0000 (09:21 +0530)]
staging:vt6656:card.c: fix blank lines issue

Fix "Blank lines aren't necessary after an open brace" check thrown by
checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:card.c:fix alignment checks
Rithvik Patibandla [Fri, 17 Jun 2016 04:27:31 +0000 (09:57 +0530)]
staging:vt6656:card.c:fix alignment checks

Fix "Alignment should match with open paranthesis" check thrown by
checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging:vt6656:card.c:Fix comment block issue
Rithvik Patibandla [Sat, 11 Jun 2016 20:08:58 +0000 (01:38 +0530)]
staging:vt6656:card.c:Fix comment block issue

Fix "Block comments use * on subsequent lines" and "Block comments use
*/ on trailing lines" warnings thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: Fix block comment style
Edward Lipinsky [Sat, 23 Jul 2016 18:57:25 +0000 (11:57 -0700)]
staging: sm750fb: Fix block comment style

This patch fixes the checkpatch.pl warning:

WARNING: Block comments use * on subsequent lines

Signed-off-by: Edward Lipinsky <ellipinsky@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosm750fb/sm750_hw.c: split assignment & long lines
Stefan Wolz [Thu, 23 Jun 2016 12:00:13 +0000 (14:00 +0200)]
sm750fb/sm750_hw.c: split assignment & long lines

Split lines over 80 characters and separated assignments.

Signed-off-by: Stefan Wolz <wolzstefan@web.de>
Signed-off-by: Christian Halder <christian.halder@fau.de>
Signed-off-by: Sebastian Handwerker <sebastian.handwerker@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosm750fb/sm750_hw.c: fixed comments
Stefan Wolz [Thu, 23 Jun 2016 12:00:12 +0000 (14:00 +0200)]
sm750fb/sm750_hw.c: fixed comments

Fixed multiline comments to meet style standards,
fixed typos and split comment lines over 80 characters.

Signed-off-by: Stefan Wolz <wolzstefan@web.de>
Signed-off-by: Christian Halder <christian.halder@fau.de>
Signed-off-by: Sebastian Handwerker <sebastian.handwerker@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosm750fb/sm750_hw.c: fixed whitespacing
Stefan Wolz [Thu, 23 Jun 2016 12:00:11 +0000 (14:00 +0200)]
sm750fb/sm750_hw.c: fixed whitespacing

Deleted unnecessary newlines and added whitespaces around operators.

Signed-off-by: Stefan Wolz <wolzstefan@web.de>
Signed-off-by: Christian Halder <christian.halder@fau.de>
Signed-off-by: Sebastian Handwerker <sebastian.handwerker@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosm750fb/sm750_hw.c: corrected alignment
Stefan Wolz [Thu, 23 Jun 2016 12:00:10 +0000 (14:00 +0200)]
sm750fb/sm750_hw.c: corrected alignment

Fixed alignment in multiline declarations.

Signed-off-by: Stefan Wolz <wolzstefan@web.de>
Signed-off-by: Christian Halder <christian.halder@fau.de>
Signed-off-by: Sebastian Handwerker <sebastian.handwerker@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>