Mikko Koivunen [Thu, 18 May 2017 12:12:50 +0000 (15:12 +0300)]
iio: light: rpr0521 poweroff for probe fails
Set sensor measurement off after probe fail in pm_runtime_set_active() or
iio_device_register(). Without this change sensor measurement stays on
even though probe fails on these calls.
This is maybe rare case, but causes constant power drain without any
benefits when it happens. Power drain is 20-500uA, typically 180uA.
Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Mikko Koivunen [Thu, 18 May 2017 12:12:49 +0000 (15:12 +0300)]
iio: light: rpr0521 disable sensor -bugfix
Sensor was marked enabled on each call even if the call was for disabling
sensor.
Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Surender Polsani [Fri, 19 May 2017 09:37:12 +0000 (15:07 +0530)]
staging: iio: light: Replace symbolic permissions as per coding style
Fixed the following checkpatch.pl warnings:
octal permissions are more preferable than symbolic permissions
Replaced DEVICE_ATTR family macros with DEVICE_ATTR_RW family
as suggested by Greg K-H. Changed attributes and function
names where ever required to satisfy internal macro definitions
like __ATTR__RW().
Signed-off-by: Surender Polsani <surenderpolsani@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Currently driver uses gpiod_set_value(1) to clean reset, which depends
on device tree to contain GPIO_ACTIVE_HIGH - that does not match reality.
This fixes driver to use _raw version of gpiod_set_value() to enforce
active-low semantics despite of what's written in device tree. Allowing
device tree to override that only opens possibility for errors and does
not add any value.
Additionally, use _cansleep version to make things work with i2c-gpio
and other sleeping gpio drivers.
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Currently, driver generates events for channels if new reading differs
from previous one. This "previous value" is initialized to zero, which
results into event if value is constant-one.
Fix that by initializing "previous value" by reading at event enable
time.
This provides reliable sequence for userspace:
- enable event,
- AFTER THAT read current value,
- AFTER THAT each event will correspond to change.
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: light: isl29018: Only declare ACPI table when ACPI is enabled
This fixes the following warning when building with clang:
drivers/iio/light/isl29018.c:808:36: error: variable
'isl29018_acpi_match' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
HID sensor hubs using Integrated Senor Hub (ISH) has added capability to
support batch mode. This allows host processor to go to sleep for extended
duration, while the sensor hub is storing samples in its internal buffers.
'Commit f4f4673b7535 ("iio: add support for hardware fifo")' implements
feature in IIO core to implement such feature. This feature is used in
bmc150-accel-core.c to implement batch mode. This implementation allows
software device buffer watermark to be used as a hint to adjust hardware
FIFO.
But HID sensor hubs don't allow to change internal buffer size of FIFOs.
Instead an additional usage id to set "maximum report latency" is defined.
This allows host to go to sleep upto this latency period without getting
any report. Since there is no ABI to set this latency, a new attribute
"hwfifo_timeout" is added so that user mode can specify a latency.
This change checks presence of usage id to get/set maximum report latency
and if present, it will expose hwfifo_timeout.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 25 Apr 2017 08:06:33 +0000 (04:06 -0400)]
iio: tsl2583: add runtime power management support
This patch adds runtime power management support to the tsl2583 driver.
The device is powered off after two seconds of inactivity. 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>
Mike Looijmans [Mon, 8 May 2017 07:26:24 +0000 (09:26 +0200)]
iio:ad5064: Add support for ltc2633 and similar devices
The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
to the AD5064 device, in particular the LTC2627.
This patch adds support for those devices. Only the LTC2633 has been
tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
and the LTC2635 the 4-channel version. The actual DAC resolution depends
on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
so this has no effect on the register map. The internal reference is set
to 2.5V on "L" versions, and it's 4.096V for "H" versions.
iio: pressure: zpa2326: report interrupted case as failure
If the timeout-case prints a warning message then probably the interrupted
case should also. Further, wait_for_completion_interruptible_timeout()
returns long not int.
Fixes: commit 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support") Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fabrice Gasnier [Tue, 2 May 2017 12:33:45 +0000 (14:33 +0200)]
iio: stm32 trigger: Add support for TRGO2 triggers
Add support for TRGO2 trigger that can be found on STM32F7.
Add additional master modes supported by TRGO2.
Register additional "tim[1/8]_trgo2" triggers for timer1 & timer8.
Detect TRGO2 timer capability (master mode selection 2).
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Stefan Brüns [Mon, 1 May 2017 11:19:42 +0000 (13:19 +0200)]
iio: adc: Fix bad GENMASK use, typos, whitespace
Commit 7906dd52c5a0 ("iio: ina2xx: Fix whitespace and re-order code")
changed the register number of the MASK_ENABLE register from 0x06 to the
value equivalent GENMASK(2,1), although its no mask.
Also fix a typo (INA2_6_6 instead of INA2_2_6), and use the datasheet
name ("Mask/Enable") for the register number define.
Fix bad indentation for channel attributes.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Julia Lawall [Thu, 4 May 2017 20:10:52 +0000 (22:10 +0200)]
iio: hid-sensor-accel-3d: Drop unnecessary static
Drop static on a local variable, when the variable is initialized before
use, on every possible execution path through the function. The static has
no benefit, and dropping it reduces the code size.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@bad exists@
position p;
identifier x;
type T;
@@
static T x@p;
...
x = <+...x...+>
@@
identifier x;
expression e;
type T;
position p != bad.p;
@@
-static
T x@p;
... when != x
when strict
?x = e;
// </smpl>
The change in code size is indicates by the following output from the size
command.
before:
text data bss dec hex filename
3879 512 8 4399 112f drivers/iio/accel/hid-sensor-accel-3d.o
after:
text data bss dec hex filename
3863 512 0 4375 1117 drivers/iio/accel/hid-sensor-accel-3d.o
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
tsl2x7x: remove paragraph about writing to the FSF's mailing address
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: Enric Balletbo i Serra <eballetbo@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Meson GX SoCs however use some magic bits to prevent simultaneous (=
conflicting, because only consumer should use the FIFO buffer with the
ADC results) usage by the Linux kernel and the bootloader (the BL30
bootloader uses the SAR ADC to read the CPU temperature).
This patch changes guards all BL30 functionality so it is skipped on
SoCs which don't have it. Since the hardware itself doesn't know whether
BL30 is available the internal meson_sar_adc_data is extended so this
information can be provided per of_device_id.data inside the driver.
Additionally the clocks "adc_clk" and "adc_sel" are not provided by the
clock-controller itself. "adc_sel" is not available at all. "adc_clk"
is provided by the SAR ADC IP block itself on Meson8b (and earlier).
This is already supported by the meson_saradc driver.
Finally this introduces new of_device_ids for the Meson8 and Meson8b
SoCs so the driver can be wired up in the corresponding DT.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
dt-bindings: iio: adc: add Meson8 and Meson8b support
The Amlogic Meson SAR ADC driver can be used on Meson8 and Meson8b
(probably on earlier SoC generations as well, but I don't have any
hardware available for testing that).
Add a separate compatible for Meson8 and Meson8b because it does not
need any of the BL30 magic (unlike the GX SoCs).
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: meson-saradc: mark all meson_sar_adc_data static and const
These are only passed as of_device_id.data and never modified. Thus we
can mark them as static const, just like the of_device_id instances
where they are used.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Song Hongyan [Sun, 7 May 2017 10:24:26 +0000 (18:24 +0800)]
iio: hid-sensor-rotation: Add "scale" and "offset" properties parse support
Add orientation sensor "scale" and "offset" parse support.
These two properties are needed for exponent data conversion.
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Xu Even <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Geomagnetic orientation(AM) sensor is one kind of orientation 6dof sensor.
It gives the device rotation in respect to the earth center and the
magnetic north. The sensor is implemented through use of an accelerometer
and magnetometer do not use gyroscope. It is a standard HID sensor.
More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR59_-_Usages_for_Wearables.pdf
Geomagnetic orientation(AM) sensor and dev rotation sensor have same
channel and share channel usage id. So the most of the code for relative
orientation sensor can be reused.
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Song Hongyan [Sun, 7 May 2017 10:24:24 +0000 (18:24 +0800)]
iio: hid-sensor-rotation: Add relative orientation sensor hid support
Relative orientation(AG) sensor is a 6dof orientation sensor,
it depends on acceleration and gyroscope sensor data. It gives
a quaternion describing the orientation of the device relative
to an initial orientation. It is a standard HID sensor.
More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR59_-_Usages_for_Wearables.pdf
Relative orientation(AG) sensor and dev rotation sensor have same
channels and share channel usage id. So the most of the code for
relative orientation sensor can be reused.
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Xu Even <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lorenzo Bianconi [Thu, 27 Apr 2017 20:31:56 +0000 (22:31 +0200)]
iio: imu: st_lsm6dsx: add system power management support
Add system sleep power management support to st_lsm6dsx driver.
In particular during suspend phase each sensor is disabled and
hw fifo is configured in bypass in order to avoid subsequent
I/O operations. The patch has been tested on HiKey board device
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29030 is basically the same chip. The only difference
is the chip's first pin. For isl29028 its named ADDR0 and
can be used to change the chip's i2c address. For isl29030
on the other hand that pin is named Ials and is an analog
current output proportional to ALS/IR. This change is
irrelevant for the Linux driver.
This has been tested on Motorola Droid 4.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Colin Ian King [Wed, 19 Apr 2017 14:35:48 +0000 (15:35 +0100)]
iio: hid-sensor: fix return of -EINVAL on invalid values in ret or value
Ensure that when an invalid value in ret or value is found -EINVAL
is returned. A previous commit broke the way the return error is
being returned and instead caused the return code in ret to be
re-assigned rather than be returned.
Fixes: 5d9854eaea776 ("iio: hid-sensor: Store restore poll and hysteresis on S3") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sekhar Nori [Fri, 21 Apr 2017 12:31:25 +0000 (18:01 +0530)]
tools/iio: Use include/uapi with __EXPORTED_HEADERS__
Use the local uapi headers to keep in sync with "recently" added enum
values like IIO_UVINDEX.
Build tested using:
$ make -C <kernelsrcdir> tools/iio
$ make -C <kernelsrcdir>/tools iio
$ make -C <kernelsrcdir>/tools/iio
This follows a strategy similar to that used by tools/hv, tools/net and
tools/leds among others.
Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marek Vasut [Thu, 20 Apr 2017 15:42:16 +0000 (17:42 +0200)]
iio: adc: rcar-gyroadc: Drop if clock from Renesas GyroADC bindings
The "if" interface clock speed is actually derived from the "fck"
block clock, as in the hardware they are the same clock. Drop the
incorrect second "if" clock and retain only the "fck" clock.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Rob Herring <robh@kernel.org> Cc: linux-renesas-soc@vger.kernel.org
To: devicetree@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marek Vasut [Thu, 20 Apr 2017 15:43:10 +0000 (17:43 +0200)]
iio: adc: rcar-gyroadc: Derive interface clock speed from fck clock
The "if" interface clock speed is actually derived from the "fck"
block clock, as in the hardware they are the same clock. Drop the
incorrect second "if" clock and get the clock speed from "fck".
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Cc: linux-renesas-soc@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: st_pressure: st_accel: Initialise sensor platform data properly
This patch fixes the sensor platform data initialisation for st_pressure
and st_accel device drivers. Without this patch, the driver fails to
register the sensors when the user removes and re-loads the driver.
1. Unload the kernel modules for st_pressure
$ sudo rmmod st_pressure_i2c
$ sudo rmmod st_pressure
Brian Masney [Tue, 25 Apr 2017 01:34:33 +0000 (21:34 -0400)]
staging: iio: isl29028: correct proximity sleep times
The sysfs attribute in_proximity_sampling_frequency_available currently
shows the values 1 3 5 10 13 20 83 100. These values are supposed to
correspond to the sleep values 800 400 200 100 75 50 12.5 0 (all in ms).
When passing in a sampling frequency of 3, it actually uses a sleep
time of 200ms instead of the expected 400ms value. This patch changes
the value shown by this sysfs attribute to use fixed-point numbers so
that the correct sampling frequency is shown to the user. This patch
also changes the code that updates the proximity sampling frequency to
only allow values that are shown in the _available sysfs attribute.
The original code showed the value 83 that corresponds to the sleep
time 12 ms. The data sheet actually lists 12.5 ms as the sleep time,
so the proximity frequency was updated to 80.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Rosin [Thu, 20 Apr 2017 21:01:57 +0000 (23:01 +0200)]
iio: inkern: fix a static checker error
Avoid this smatch error:
drivers/iio/inkern.c:751 iio_read_avail_channel_raw() error: double unlock 'mutex:&chan->indio_dev->info_exist_lock'
Fixes: 00c5f80c2fad ("iio: inkern: add helpers to query available values from channels") Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:12 +0000 (11:27 -0700)]
staging: android: ion: Remove ion_handle and ion_client
ion_handle was introduced as an abstraction to represent a reference to
a buffer via an ion_client. As frameworks outside of Ion evolved, the dmabuf
emerged as the preferred standard for use in the kernel. This has made
the ion_handle an unnecessary abstraction and prone to race
conditions. ion_client is also now only used internally. We have enough
mechanisms for race conditions and leaks already so just drop ion_handle
and ion_client. This also includes ripping out most of the debugfs
infrastructure since much of that was tied to clients and handles.
The debugfs infrastructure was prone to give confusing data (orphaned
allocations) so it can be replaced with something better if people
actually want it.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The current model of Ion heap registration is based on the outdated
model of board files. The replacement for board files (devicetree)
isn't a good replacement for what Ion wants to do. In actuality, Ion
wants to show what memory is available in the system for something else
to figure out what to use. Switch to a model where Ion creates its
device unconditionally and heaps are registed as available regions.
Currently, only system and CMA heaps are converted over to the new
model. Carveout and chunk heaps can be converted over when someone wants
to figure out how.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ion current has ion_priv.h and ion.h as header files. ion.h was intended
to be used for public APIs but Ion never ended up really having anything
public. Combine the two headers so there is only one internal header.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:08 +0000 (11:27 -0700)]
staging: android: ion: Get rid of ion_phys_addr_t
Once upon a time, phys_addr_t was not everywhere in the kernel. These
days it is used enough places that having a separate Ion type doesn't
make sense. Remove the extra type and just use phys_addr_t directly.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:07 +0000 (11:27 -0700)]
staging: android: ion: Break the ABI in the name of forward progress
Several of the Ion ioctls were designed in such a way that they
necessitate compat ioctls. We're breaking a bunch of other ABIs and
cleaning stuff up anyway so let's follow the ioctl guidelines and clean
things up while everyone is busy converting things over anyway. As part
of this, also remove the useless alignment field from the allocation
structure.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:05 +0000 (11:27 -0700)]
staging: android: ion: Use CMA APIs directly
When CMA was first introduced, its primary use was for DMA allocation
and the only way to get CMA memory was to call dma_alloc_coherent. This
put Ion in an awkward position since there was no device structure
readily available and setting one up messed up the coherency model.
These days, CMA can be allocated directly from the APIs. Switch to using
this model to avoid needing a dummy device. This also mitigates some of
the caching problems (e.g. dma_alloc_coherent only returning uncached
memory).
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:03 +0000 (11:27 -0700)]
cma: Store a name in the cma structure
Frameworks that may want to enumerate CMA heaps (e.g. Ion) will find it
useful to have an explicit name attached to each region. Store the name
in each CMA structure.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'iio-fixes-for-4.11e' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Fifth set of IIO fixes for the 4.11 cycle.
As these are rather late in the cycle, they may sneak over into 4.12.
There is a fix for a regression caused by another fix (hid sensors
hardware seems to vary a lot in how various corner cases are handled).
* ad7303
- fix channel description. Numeric values were being passed as characters
presumably leading to garbage from the userspace interface.
* as3935
- the write data macro was wrong so fix it.
* bmp280
- incorrect handling of negative values as being unsigned broke humidity
calculation.
* hid-sensor
- Restore the poll and hysteresis values after resume as some hardware
doesn't do it.
* stm32-trigger
- buglet in reading the sampling frequency
Merge tag 'iio-for-4.12d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Fourth set of IIO new device support, features and cleanups for the 4.12 cycle
New device support
* max1117, 1118 and 1119
- new ADC driver
* max9611
- new ADC driver
* pm8xxx hk/xoadc
- new driver with some shared features broken out from the SPMI vadc.
* sun4i-gpadc
- A33 thermal sensor support (with associated rework)
* stm32-dac
- new driver and bindings
* stm32 trigger
- enable support of quadrature encoder device and counter modes
Features
* apds9960
- use the runtime pm for normal suspend
* stm32-adc
- add opition to sest resolution via devicetree
* xoadc
- augment DT bindings to deal with some weird mux cases
Cleanups
* ad5933
- protect direct mode using claim and release helpers
* ade7759
- S_IRUGO and friends to octal in two goes
* adis16203
- drop unnecessary brackets
* hid-sensor
- fix unbalanced pm_runtieme_enable error when probing after remove
* lsm6dsx
- use actual part numbers for device name when known
- simplify data read pin parsing
* mpu3050
- avoid double reporting errors
Martin Karamihov [Mon, 17 Apr 2017 17:00:25 +0000 (20:00 +0300)]
staging: rtl8192u: fix incorrect type in assignment in ieee80211_tx.c
This patch fixes the following sparse warning:
ieee80211_tx.c:174:36: incorrect type in assignment (different base types)
ieee80211_tx.c:174:36: expected unsigned short [unsigned] [short] [usertype] <noident>
ieee80211_tx.c:174:36: got restricted __be16 [usertype] <noident>
by adding left side cast to __be16.
Signed-off-by: Martin Karamihov <martinowar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: fix sparse signedness warnings in rtw_generate_ie
Changed the type of wpa_ie_len from (int *) to (unsigned int *) in the
function rtw_get_wpa_ie(..) to suppress signedness mismatch warnings in
rtw_generate_ie of the type-
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: warning: incorrect
type in argument 2 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: expected int
*wpa_ie_len
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: got unsigned
int *<noident>
staging: rtl8188eu: fix sparse signedness warnings in rtw_set_ie
Changed the type of sz from (int) to (unsigned int) to suppress
signedness mismatch warnings of the type-
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: warning:
incorrect type in argument 5 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: expected
unsigned int [usertype] *frlen
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: got int
*<noident>
staging: rtl8188eu: fix sparse signedness warnings in rtw_get_ie
Changed the type of len from (int *) to (unsigned int *) in the
function rtw_get_ie(..) and wherever this function is called to
suppress signedness mismatch warnings of the type-
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: warning: incorrect type
in argument 3 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: expected int *len
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: got unsigned int
*<noident>
Colin Ian King [Thu, 13 Apr 2017 15:46:36 +0000 (16:46 +0100)]
staging: rtl8723bs: clean up identical code on an if statement
The two different paths for an if statement are identical and hence
we can just replace it with the single statement.
Detected by CoverityScan, CID#1428443 ("Identical code for
different branches")
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Colin Ian King [Thu, 13 Apr 2017 14:13:46 +0000 (15:13 +0100)]
staging: rtl8723bs: remove redundant comparisons of unsigned ints with >= 0
The comparison of mode >= 0 is redundant as mode is a u32 and this
is always true. Remove this redundant code.
Detected with CoverityScan ("Unsigned compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gstreamer's v4l2src reacted poorly to certain outputs from the bcm2835
video driver's ioctl ops function vidioc_enum_framesizes, so a
workaround was created that could be activated by user input. This
workaround would replace the driver's ioctl ops struct with another,
similar struct--only with no function pointed to by
vidioc_enum_framesizes. With no response, gstreamer would attempt to
continue with some default settings that happened to work better.
However, this bug has been fixed in gstreamer since 2014, so we
shouldn't include this workaround in the stable version of the driver.
Signed-off-by: Kevin Wern <kevin.m.wern@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Driver SDIO code uses helper functions to do IO to the SDIO
device. Current helpers handle IO of a single byte as well as
multi-byte. Driver predominately uses single byte IO. If the
common case is made simple it simplifies the whole driver. The common
case can be made simple by splitting the multi-byte and single byte
calls into separate functions, i.e 4 functions in total, read single
byte, read multi-byte, write single byte, write multi-byte.
Also, we need to handle the debug code. Currently debug calls after
read/write fail access the IO buffer. This buffer, at best, does not hold
useful data on the error path, at worst is uninitialized and holds
garbage.
Split read/write helper functions into two functions each, one for
single byte IO and one for multi-byte IO. Fix all call sites. Do not
change the program logic.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SDIO code currently has a number of unneeded comments. Following
kernel coding style we do not need extraneous comments, especially on
code where it is clear what is being done. Spelling typos can be
fixed.
Remove unnecessary comments, fix typos in comments.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: ks7010: move hw info into dev private data
Currently driver uses a hardware information struct description to
group some SDIO related functionality (work, work queue, sdio private
data pointer). This structure is then embedded in the device private
data structure. Having nested structures described in different header
files means that to view the device private data programmers must open
two header files. This structure could be embedded anonymously in the
device private data and achieve the same result (grouping of function
specific to SDIO) without the need to open multiple headers. However,
the SDIO private data structure already has various different data and
pointers, adding the embedded structure adds little extra meaning and
lengthens all the dereferences throughout the driver, often meaning
addition line breaks and braces. We can increase readability and
reduce code complexity by moving the hardware information data and
pointers to directly be within the device private data structure
description.
While preparing for this refactoring it was noted that the identifier
currently used for the delayed work is 'rw_wq', this is confusing
since the 'wq' suffix typically means 'work queue'. This identifier
would be more meaningful if it used the suffix 'dwork' as does the
declaration of queue_delayed_work() (include/linux/workqueue.h).
The identifier for the work queue is currently 'ks7010sdio_wq'. This
identifier can be shortened without loss of meaning because there is
only one work queue within the driver. Identifier 'wq' is typical
within in-tree driver code and aptly describes the pointer.
Current pointer to the SDIO private data is identified by 'sdio_card',
this is sufficiently meaningful from within the hw_info structure but
once the hw_info_t structure is removed the pointer would be better to
have a prefix appended to it to retain the prior level of meaning.
Move members from struct hw_info_t to struct ks_wlan_private.
Rename identifiers;
struct delayed_work pointer 'rw_wq' to 'rw_dwork'.
struct workqueue_struct pointer 'ks7010sdio_wq' to 'wq'.
struct ks_sdio_card pointer 'sdio_card' to 'ks_sdio_card'.
Remove structure description hw_info_t. Fix init/destroy calls. Fix
all call sites, SDIO private data access calls, and queuing calls.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: ks7010: move tasklet_struct to ks_wlan_private
Currently a pointer to the tasklet_struct used for bottom half
processing on the receive path is within the hw_info_t structure. This
structure is then embedded in the device private data
structure. Having the tasklet_struct nested does not add meaning to
the device private data, device private data already (and typically)
has various data relating to the device, there is no real need to
separate the tasklet_struct to a SDIO specific structure. While not
adding allot of extra meaning having the nested structure means the
programmer must open two header files to read the description of the
device private data, the code would be easier to read if the device
private data struct description was not spread over two files.
Move tasklet_struct out of sdio header file and into the device
private data structure description.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
struct work_struct uses identifier ks_wlan_wakeup_task, this is
confusing because the 'task' suffix implies that this is a
tasklet_struct instead of a work struct. Suffix 'work' would be more
clear. The code would be easier to read if it followed the principle
of least surprise and used the 'work' suffix for a work_struct
identifier.
Rename work_struct structure 'ks_wlan_wakeup_task' to 'wakeup_work'.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SDIO header file does not use kernel doc format struct
comments. Adding them aids readability and enables documentation to be
built from the source code. Other comments may be tidied up as we do this.
Add kernel format struct comments. Tidy up comments.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
complete_handler() takes void * types as parameters. void * parameters are then
cast to struct types. Call sites for this function either pass in NULL
or pointers to the struct types cast to void *. This casting is
unnecessary and can be removed.
Struct tx_device_buffer (which contains a pointer member to the
complete_handler() function) has as member 'ks_wlan_priv *priv' this is
unnecessary, we always have a pointer to this struct there is no need
to store it here.
The complete_handler can be more clearly defined by using struct
pointer types instead of void * types. The code is currently
unnecessarily complex, storing and passing extraneous pointer
parameters.
Header has multiple constants defined using preprocessor
directive. In the cases where these are an integer progression an
enumeration type can be used. Doing so adds documentation to the code
and makes the usage explicit. Maintain original constant value, this
value is returned by the device.
Replace (integer progression) preprocessor constants with enumeration
type.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SDIO header currently defines unused constants READ_STATUS_BUSY and
WRITE_STATUS_IDLE. There are reciprocal constants that are used
READ_STATUS_IDLE and WRITE_STATUS_BUSY. We can roll these into a
single enumeration type and remove the two that are unused.
Add enumeration type containing IDLE/BUSY pair that are currently used
within the SDIO source. Change source to use new enum types.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32
The struct lu_dirpage elements in lustre_idl.h file are modified to
__le64 and __le32 types since the elements are always converted from
litte endian to processor native format in mdc_request.c file.
Following warnings are removed by this fix.
drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted __le32
drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted __le64
Staging: lustre cleanup macros in libcfs_private.h
This resolves a checkpatch warning that "Single statement macros should
not use a do {} while (0) loop" by removing the loop and adjusting line
length accordingly.
Alexandre Bailon [Sun, 26 Mar 2017 16:58:23 +0000 (18:58 +0200)]
staging: greybus: make cport_quiesce() method optional
The cport_quiesce() method is mandatory in the case of
the es2 Greybus hd controller to shutdown the cports on
the es2 controller.
In order to add support of another controller which may not
need to shutdown its cports, make the cport_quiesce() optional,
and check if the controller implement it before to use it.
Andreas Klinger [Mon, 10 Apr 2017 17:00:01 +0000 (19:00 +0200)]
IIO: bmp280-core.c: fix error in humidity calculation
While calculating the compensation of the humidity there are negative values
interpreted as unsigned because of unsigned variables used. These values as
well as the constants need to be casted to signed as indicated by the
documentation of the sensor.
Signed-off-by: Andreas Klinger <ak@it-klinger.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for STMicroelectronics STM32 DAC. It's a 12-bit, voltage
output digital-to-analog converter. It has two output channels, each
with its own converter.
It supports 8 bits or 12bits left/right aligned data format. Only
12bits right-aligned is used here. It has built-in noise or
triangle waveform generator, and supports external triggers for
conversions.
Each channel can be used independently, with separate trigger, then
separate IIO devices are used to handle this. Core driver is intended
to share common resources such as clock, reset, reference voltage and
registers.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>