iio: bmg160: add callbacks for the filter frequency
The filter frequency and sample rate have a fixed relationship.
Only the filter frequency is unique, however.
Currently the driver ignores the filter settings for 32 Hz and
64 Hz.
This patch adds the necessary callbacks to be able to configure
and read the filter setting from sysfs.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The patch adds devicetree binding document for broadcom's
iproc-static-adc controller driver.
Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Thu, 30 Jun 2016 01:48:54 +0000 (03:48 +0200)]
iio: pressure: bmp280: read calibration data once
The calibration data is described as coming from an E2PROM and that
means it does not change. Just read it once at probe time and store
it in the device state container. Also toss the calibration data
into the entropy pool since it is device unique.
Linus Walleij [Thu, 30 Jun 2016 01:48:53 +0000 (03:48 +0200)]
iio: pressure: bmp280: add power management
The PM280 has an internal standby-mode, but to really save power
we should shut the sensor down and disconnect the power. With
the proper .pm hooks we can enable both runtime and system power
management of the sensor. We use the *force callbacks from the
system PM hooks. When the sensor comes back we always reconfigure
it to make sure it is ready to roll as expected.
Linus Walleij [Thu, 30 Jun 2016 01:48:52 +0000 (03:48 +0200)]
iio: pressure: bmp280: add support for BMP085 EOC interrupt
The first version of this sensor, BMP085, supports sending an
End-of-Conversion (EOC) interrupt. Add code to support this using
a completion, in a similar vein as drivers/misc/bmp085.c does.
Make sure to check that we are given a rising edge, because the
EOC line goes from low-to-high when the conversion is ready.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Thu, 30 Jun 2016 01:48:51 +0000 (03:48 +0200)]
iio: pressure: bmp280: add SPI interface driver
This patch mimics the SPI functionality found in the misc driver in
drivers/misc/bh085-spi.c to make it possible to reuse the existing
BMP280/BMP180/BMP085 driver with all clients of the other driver.
The adoption is straight-forward since like the other driver, it is
a simple matter of using regmap.
This driver is also so obviously inspired/copied from the old misc
driver in drivers/misc/bmp085.c that I just took the liberty to
add in the authors of the other drivers + self in the core driver
file.
The MISC driver also supports a variant named "BMP181" so include
that here to be complete in comparison to the old driver.
The bus mapping code for SPI was written by Akinobu Mita.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Tested-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Thu, 30 Jun 2016 01:48:50 +0000 (03:48 +0200)]
iio: pressure: bmp280: split off an I2C Kconfig entry
This creates a separate BMP280_I2C Kconfig entry that gets selected
by BMP280 for I2C transport. As we currently only support I2C
transport there is not much practical change other than getting
a separate object file (or module) for the I2C driver part. The
old Kconfig symbol BMP280 will still select the stuff we need so
that oldconfig and old defconfigs works fine.
Tested-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Thu, 30 Jun 2016 01:48:49 +0000 (03:48 +0200)]
iio: pressure: bmp280: split driver in logical parts
This splits the BMP280 driver in three logical parts: the core driver
bmp280-core that only operated on a struct device * and a struct regmap *,
the regmap driver bmp280-regmap that can be shared between I2C and other
transports and the I2C module driver bmp280-i2c.
Cleverly bake all functionality into a single object bmp280.o so that
we still get the same module binary built for the device in the end,
without any fuzz exporting symbols to the left and right.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Thu, 30 Jun 2016 01:48:48 +0000 (03:48 +0200)]
iio: pressure: bmp280: support supply regulators
The BMP085/BMP180/BMP280 is supplied with two power sources:
VDDA (analog power) and VDDD (digital power). As these may come
from regulators (as on the APQ8060 Dragonboard) we need the driver
to attempt to fetch and enable these regulators.
We FAIL if we cannot: boards should either define:
- Proper regulators if present
- Define fixed regulators if power is hardwired to the component
- Rely on dummy regulators (will be present on all DT systems and
any boardfile system that calls regulator_has_full_constraints().
Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers:iio:light:isl29125: added macros for sensing range
Added macros for sensing range as the corresponding magic numbers
were used at multiple places.
- ISL29125_SENSING_RANGE_0 for 375 lux full range
- ISL29125_SENSING_RANGE_1 for 10k lux full range
Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Wed, 29 Jun 2016 13:14:42 +0000 (15:14 +0200)]
iio: st_sensors: harden interrupt handling
Leonard Crestez observed the following phenomenon: when using
hard interrupt triggers (the DRDY line coming out of an ST
sensor) sometimes a new value would arrive while reading the
previous value, due to latencies in the system.
We discovered that the ST hardware as far as can be observed
is designed for level interrupts: the DRDY line will be held
asserted as long as there are new values coming. The interrupt
handler should be re-entered until we're out of values to
handle from the sensor.
If interrupts were handled as occurring on the edges (usually
low-to-high) new values could appear and the line be held
asserted after that, and these values would be missed, the
interrupt handler would also lock up as new data was
available, but as no new edges occurs on the DRDY signal,
nothing happens: the edge detector only detects edges.
To counter this, do the following:
- Accept interrupt lines to be flagged as level interrupts
using IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW. If the line
is marked like this (in the device tree node or ACPI
table or similar) it will be utilized as a level IRQ.
We mark the line with IRQF_ONESHOT and mask the IRQ
while processing a sample, then the top half will be
entered again if new values are available.
- If we are flagged as using edge interrupts with
IRQF_TRIGGER_RISING or IRQF_TRIGGER_FALLING: remove
IRQF_ONESHOT so that the interrupt line is not
masked while running the thread part of the interrupt.
This way we will never miss an interrupt, then introduce
a loop that polls the data ready registers repeatedly
until no new samples are available, then exit the
interrupt handler. This way we know no new values are
available when the interrupt handler exits and
new (edge) interrupts will be triggered when data arrives.
Take some extra care to update the timestamp in the poll
loop if this happens. The timestamp will not be 100%
perfect, but it will at least be closer to the actual
events. Usually the extra poll loop will handle the new
samples, but once in a blue moon, we get a new IRQ
while exiting the loop, before returning from the
thread IRQ bottom half with IRQ_HANDLED. On these rare
occasions, the removal of IRQF_ONESHOT means the
interrupt will immediately fire again.
- If no interrupt type is indicated from the DT/ACPI,
choose IRQF_TRIGGER_RISING as default, as this is necessary
for legacy boards.
Tested successfully on the LIS331DL and L3G4200D by setting
sampling frequency to 400Hz/800Hz and stressing the system:
extra reads in the threaded interrupt handler occurs.
Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Tested-by: Crestez Dan Leonard <cdleonard@gmail.com> Reported-by: Crestez Dan Leonard <cdleonard@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Wed, 29 Jun 2016 12:08:38 +0000 (14:08 +0200)]
iio: magn: ak8975: deploy runtime and system PM
This adds runtime PM support to the AK8975 driver. It solves two
problems:
- After reading the first value the chip was left in MODE_ONCE,
meaning (presumably) it may be consuming more power. Now the
runtime PM hooks kick in and set it to POWER_DOWN.
- Regulators were simply enabled and left on, making it
impossible to turn the power consuming regulators off because
of the increased refcount. We now disable the regulators at
autosuspend.
- We also handle system suspend: by using pm_runtime_force_suspend()
and pm_runtime_force_resume() from the system PM sleep hooks,
the runtime PM code is managing the power also for this case.
It is currently not completely optimal: when the system resumes
the AK8975 goes into active mode even if noone is going to use
it: currently the force calls need to be paired, but the runtime
PM people are working on making it possible to leave devices
runtime suspended when coming back from sleep.
Inspired by my work on the BH1780 light sensor driver.
Linus Walleij [Wed, 29 Jun 2016 12:08:37 +0000 (14:08 +0200)]
iio: magn: ak8975: make sure to power down at remove()
The code was not powering the magnetometer down properly at
remove(): just cutting the regulators without first setting the
device in power off mode. Fix this.
Linus Walleij [Wed, 29 Jun 2016 12:08:34 +0000 (14:08 +0200)]
iio: magn: ak8975: add Vid regulator
The AK8975 has two power sources: Vdd (analog voltage supply)
and Vid (digital voltage supply). Optionally also obtain the Vid
supply regulator and enable it.
If an error occurs when enabling one of the regulators: bail out.
Cc: Gregor Boirie <gregor.boirie@parrot.com> Cc: Richard Leitner <dev@g0hl1n.net> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Wed, 29 Jun 2016 12:08:33 +0000 (14:08 +0200)]
iio: magn: ak8975: fix regulator usage
IS_ERR_OR_NULL() should never be used with regulators because
a NULL pointer may be a perfectly valid dummy regulator
We should always succeed to fetch and enable a regulator, but
it may be a dummy. That is fine, so bail out for any real
errors or probe deferrals
Include the error code in the warning print so we know what
kind of problem we're dealing with (for example it is nice to
see if it is a probe deferral).
As we will bail out of probe if the regulator is erroneous,
just issue regulator_disable() on the poweroff path: it will
succeed.
Cc: Mark Brown <broonie@kernel.org> Cc: Lars-Peter Clausen Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Thu, 30 Jun 2016 01:48:47 +0000 (03:48 +0200)]
iio: pressure: bmp280: add reset GPIO line handling
On the APQ8060 Dragonboard the reset line to the BMP085 pressure
sensor is not deasserted on boot, so the driver needs to handle
this. For a simple GPIO line supplied as a descriptor (from a board
file, device tree or ACPI) this does the trick.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Gregor Boirie [Wed, 9 Mar 2016 18:05:49 +0000 (19:05 +0100)]
iio:core: timestamping clock selection support
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.
Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Gregor Boirie [Wed, 9 Mar 2016 18:05:48 +0000 (19:05 +0100)]
timekeeping: export get_monotonic_coarse64 symbol
EXPORT_SYMBOL() get_monotonic_coarse64 for new IIO timestamping clock
selection usage. This provides user apps the ability to request a
particular IIO device to timestamp samples using a monotonic coarse clock
granularity.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Merge tag 'iio-for-4.8b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second round of new iio device support, features and cleanups in the 4.8 cycle
Firstly some contact detail updates:
* NXP took over freescale. Update the mma8452 header to reflect this.
* Martin Kepplinger email address change in mma8452 header.
* Adriana Reus has changed email address. Update .mailmap.
* Matt Ranostay has changed email address. Update .mailmap.
New Device Support
* max1363
- add the missing i2c_device_ids for a couple of parts so they can actually
be used.
* ms5867
- add device ids for ms5805 and ms5837 parts.
New Features
* ad5755
- DT support. This one was a bit controversial and under review for a long
time. Still no one could come up with a better solution.
* stx104
- add gpio support
* ti-adc081c
- Add ACPI device ID matching.
Core changes
* Refuse to register triggers with duplicate names. There is no way to
distinguish between them so this makes no sense. A few drivers do not
generate unique names for each instance of the device present. We can't
fix this without changing ABI so leave them and wait for someone to
actually take the rare step of two identical accelerometers on the same
board.
* buffer-dma
- use ARRAY_SIZE in a few appropriate locations.
Tools
* Fix the fact that the --trigger-num option in generic_buffer didn't allow
0 which is perfectly valid in the ABI.
Cleanups
* as3935
- improve error reporting.
- remove redundant zeroing of a field in iio_priv.
* gp2ap020a00f
- use the iio_device_claim_*_mode helpers rather than open coding locking
around mode changes.
* isl29125
- use the iio_device_claim_*_mode helpers rather than open coding locking.
* lidar
- use the iio_device_claim_*_mode helpers rather than open coding locking.
* mma8452
- more detail in devices supported description in comments (addresses and
similar)
* sca3000
- add a missing error check.
* tcs3414
- use the iio_device_claim_*_mode helpers rather than open coding locking.
* tcs3472
- use the iio_device_claim_*_mode helpers rather than open coding locking.
Phil Reid [Mon, 27 Jun 2016 03:17:56 +0000 (11:17 +0800)]
iio: buffer-dma: Use ARRAY_SIZE in for loop range
Use the ARRAY_SIZE macro in the for loops that access queue->fileio.blocks.
Macro is already used in a couple of places where this access occurs,
but range was hardcoded in these locations.
Signed-off-by: Phil Reid <preid@electromag.com.au> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: stx104: Add GPIO support for the Apex Embedded Systems STX104
The Apex Embedded Systems STX104 device features eight lines of digital
I/O (four digital inputs and four digital outputs). This patch adds GPIO
support for these eight lines of digital I/O via GPIOLIB.
Cc: Alexandre Courbot <gnurou@gmail.com> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Arnd Bergmann [Mon, 30 May 2016 14:52:04 +0000 (16:52 +0200)]
iio: as3935: improve error reporting in as3935_event_work
gcc warns about a potentially uninitialized variable use
in as3935_event_work:
drivers/iio/proximity/as3935.c: In function ‘as3935_event_work’:
drivers/iio/proximity/as3935.c:231:6: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
This case specifically happens when spi_w8r8() fails with a
negative return code. We check all other users of this function
except this one.
As the error is rather unlikely to happen after the device
has already been initialized, this just adds a dev_warn().
Another warning already exists in the same function, but is
missing a trailing '\n' character, so I'm fixing that too.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: Refuse to register triggers with duplicate names
The trigger name is documented as unique but drivers are currently
allowed to register triggers with duplicate names. This should be
considered a bug since it makes the 'current_trigger' interface
unusable.
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Ioana Radulescu [Wed, 22 Jun 2016 21:40:52 +0000 (16:40 -0500)]
staging: fsl-mc: convert mc command build/parse to use C structs
The layer abstracting the building of commands and extracting
responses is currently based on macros that shift and mask the command
fields and requires exposing offset/size values as macro parameters
and makes the code harder to read.
For clarity and maintainability, instead use an implementation based on
mapping the MC command definitions to C structures. These structures
contain the hardware command fields (which are naturally-aligned)
and individual fields are little-endian ordering (the byte ordering
of the hardware).
As such, there is no need to perform the conversion between core and
hardware (LE) endianness in mc_send_command(), but instead each
individual field in a command will be converted separately if needed
by the function building the command or extracting the response.
This patch does not introduce functional changes, both the hardware
ABIs and the APIs exposed for the DPAA2 objects remain the same.
Stuart Yoder [Wed, 22 Jun 2016 21:40:51 +0000 (16:40 -0500)]
staging: fsl-mc: properly set hwirq in msi set_desc
For an MSI domain the hwirq is an arbitrary but unique
id to identify an interrupt. Previously the hwirq was set to
the MSI index of the interrupt, but that only works if there is
one DPRC. Additional DPRCs require an expanded namespace. Use
both the ICID (which is unique per DPRC) and the MSI index to
compose a hwirq value.
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bharat Bhushan [Wed, 22 Jun 2016 21:40:48 +0000 (16:40 -0500)]
staging: fsl-mc: fix asymmetry in destroy of mc_io
An mc_io represents a mapped MC portal. Previously, an mc_io was
created for the root dprc in fsl_mc_bus_probe() and for child dprcs
in dprc_probe(). But the free of that data structure happened in the
general bus remove callback. This asymmetry resulted in some bugs due
to unwanted destroys of mc_io object in some scenarios (e.g. vfio).
Fix this bug by making things symmetric-- mc_io created in
fsl_mc_bus_probe() is freed in fsl_mc_bus_remove(). The mc_io created
in dprc_probe() is freed in dprc_remove().
Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
[Stuart: added check for root dprc and reworded commit message] Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stuart Yoder [Wed, 22 Jun 2016 21:40:45 +0000 (16:40 -0500)]
staging: fsl-mc: add support for device table matching
Move the definition of fsl_mc_device_id to its proper location in
mod_devicetable.h, and add fsl-mc bus support to devicetable-offsets.c
and file2alias.c to enable device table matching. With this patch udev
based module loading of fsl-mc drivers is supported.
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stuart Yoder [Wed, 22 Jun 2016 21:40:42 +0000 (16:40 -0500)]
staging: fsl-mc: add support for the modalias sysfs attribute
In order to support uevent based module loading implement modalias support
for the fsl-mc bus driver. Aliases are based on vendor and object/device
id and are of the form "fsl-mc:vNdN".
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wei Yongjun [Fri, 17 Jun 2016 17:34:17 +0000 (17:34 +0000)]
staging: wilc1000: fix return value check in wlan_initialize_threads()
In case of error, the function kthread_run() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().
hif_drv->usr_scan_req.net.net_info[i] contains found_net_info structs
which have the following element:
u8 bssid[6];
pstrNetworkInfo, of type network_info, also contains an u8 array named
bssid.
request->ssids is an array of cfg80211_ssid structs. Making ssid:
u8 ssid[IEEE80211_MAX_SSID_LEN];
In these 3 cases the arrays are being checked against NULL, which can't
happen. Removing the checks since they will always be true.
Found with smatch:
drivers/staging/wilc1000/host_interface.c:1234 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'hif_drv->usr_scan_req.net_info[i].bssid'
drivers/staging/wilc1000/host_interface.c:1235 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'pstrNetworkInfo->bssid'
drivers/staging/wilc1000/host_interface.c:1253 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].bssid'
drivers/staging/wilc1000/host_interface.c:1254 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'pstrNetworkInfo->bssid'
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Binoy Jayan [Thu, 23 Jun 2016 05:41:52 +0000 (11:11 +0530)]
staging: wilc1000: Change interface wilc_mq_send to wilc_enqueue_cmd
Replace the interface 'wilc_mq_send' with 'wilc_enqueue_cmd'
and remove the now unused structures 'message' and 'message_queue'.
Restructure switch statement in the work queue helper function
host_if_work and remove unwanted indentation.
Binoy Jayan [Thu, 23 Jun 2016 05:41:51 +0000 (11:11 +0530)]
staging: wilc1000: Replace kthread with workqueue for host interface
Deconstruct the kthread / message_queue logic, replacing it with
create_singlethread_workqueue() / queue_work() setup, by adding a
'struct work_struct' to 'struct host_if_msg'. The current kthread
hostIFthread() is converted to a work queue helper with the name
'host_if_work'.
Binoy Jayan [Thu, 23 Jun 2016 05:41:50 +0000 (11:11 +0530)]
staging: wilc1000: message_queue: Move code to host interface
Move the contents of wilc_msgqueue.c and wilc_msgqueue.h into
host_interface.c, remove 'wilc_msgqueue.c' and 'wilc_msgqueue.h'.
This is done so as to restructure the implementation of the kthread
'hostIFthread' using a work queue.
The semaphore 'close_exit_sync' does not serve any purpose other
than delaying the deregistration of the device which it is trying
to protect from shared access. 'up' is called only when a subdevice
is closed and not when it is opened. So, the semaphore count only
goes up when the device is used.
Binoy Jayan [Wed, 15 Jun 2016 05:30:37 +0000 (11:00 +0530)]
staging: wilc1000: Replace semaphore sync_event with completion
The semaphore 'sync_event' is used as completion, so convert
it to a struct completion type. Also, return -ETIME if the return
value of wait_for_completion_timeout is 0.
Binoy Jayan [Wed, 15 Jun 2016 05:30:35 +0000 (11:00 +0530)]
staging: wilc1000: Replace semaphore txq_add_to_head_cs with mutex
The semaphore 'txq_add_to_head_cs' is a simple mutex, so it should be
written as one. Semaphores are going away in the future. Also, removing
the timeout scenario as the error handling code does not propagate the
timeout properly.
trivial fix to spelling mistake in dev_err messages
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Chaehyun Lim [Sun, 12 Jun 2016 23:28:12 +0000 (08:28 +0900)]
staging: wilc1000: rename result in handle_cfg_param
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. Some handle_*() functions are used as result,
others are used as ret. It will be changed as ret in all handle_*()
functions to match variable name.
Chaehyun Lim [Sun, 12 Jun 2016 23:28:11 +0000 (08:28 +0900)]
staging: wilc1000: change data type of result in handle_cfg_param
This patch changes data type of result variable from s32 to int. result
is used to get return value from wilc_send_config_pkt that has return
type of int.
Chaehyun Lim [Sun, 12 Jun 2016 23:28:10 +0000 (08:28 +0900)]
staging: wilc1000: change handle_cfg_param's return type to void
When handle_cfg_param is called in hostIFthread that is a kernel thread,
it is not checked return type of this function. This patch changes
return type to void.
Lockdep complains about potential recursive locking during mount
because the client configuration log is holding a lock on the MGC
obd_device to prevent it from being torn down, while also getting
mutexes on the MDC and OSC devices as they are instantiated:
Lustre: Mounted myth-client
=============================================
[ INFO: possible recursive locking detected ]
4.7.0-rc2-vm-nfs+ #127 Tainted: G C
---------------------------------------------
May be due to missing lock nesting notation
2 locks held by ll_cfg_requeue/5928:
#0: (&cli->cl_sem){.+.+.+}, at: mgc_requeue_thread+0x15d/0x730 [mgc]
#1: (&cld->cld_lock){+.+.+.}, at: mgc_process_log+0x5e/0xf80 [mgc]
CPU: 0 PID: 5928 Comm: ll_cfg_requeue
Call Trace:
[<ffffffff814a0855>] dump_stack+0x86/0xc1
[<ffffffff810e7766>] __lock_acquire+0x726/0x1210
[<ffffffff810e86be>] lock_acquire+0xfe/0x1f0
[<ffffffff81888171>] down_read+0x51/0xa0
[<ffffffffa04a8477>] sptlrpc_conf_client_adapt+0x47/0x150 [ptlrpc]
[<ffffffffa0186b16>] mdc_set_info_async+0x2b6/0x470 [mdc]
[<ffffffffa0294090>] class_notify_sptlrpc_conf+0x190/0x360 [obdclass]
[<ffffffffa01a9e85>] mgc_process_log+0x925/0xf80 [mgc]
[<ffffffffa01abafa>] mgc_requeue_thread+0x1fa/0x730 [mgc]
[<ffffffff810af331>] kthread+0x101/0x120
[<ffffffff8188ad6f>] ret_from_fork+0x1f/0x40
Add a separate lock class for the MGC callpath, since it will always
be held first, and none of the other obd_device locks should ever
be held concurrently.
Oleg Drokin [Mon, 20 Jun 2016 20:55:51 +0000 (16:55 -0400)]
staging/lustre/libcfs: Do not call kthread_run in wrong state
kthread_run might sleep during an allocation, and so
it's considered unsafe to call with a state that's not
RUNNABLE.
Move the state setting to after kthread_run call.
Andriy Skulysh [Mon, 20 Jun 2016 20:55:50 +0000 (16:55 -0400)]
staging/lustre/osc: glimpse lock should match only with granted locks
A deadlock is possible during ccc_prep_size()->ldlm_lock_match() vs
cl_io_lock() which is waiting for a matched lock and conflicts with
already taken lock before ccc_prep_size().
It is better to send an additional lock request to avoid deadlock.
Oleg Drokin [Mon, 20 Jun 2016 20:55:49 +0000 (16:55 -0400)]
staging/lustre: Add documentation for unstable_stats in sysfs
commit ac5b14810952 ("staging: lustre: osc: Track and limit
"unstable" pages") added a new sysfs variable, but corresponding bit of
documentation was not forgotten.
staging/lustre/llite: IOC_MDC_GETFILEINFO returns the wrong ino
req_capsule_server_get() through __req_capsule_get in ll_dir_ioctl()
returns a pointer to a PTLRPC request or reply buffer, which is assigned
to struct mdt_body.
If the command is IOC_MDS_GETFILEINFO then the inode "st.st_ino" should
be assigned from one extracted from mdt_body through cl_fid_build_ino().
Oleg Drokin [Mon, 20 Jun 2016 20:55:46 +0000 (16:55 -0400)]
staging/lustre/llite: ll_revalidate_dentry update
There are a couple of cases in ll_revalidate_dentry() where
we are pretty sure the dentry is valid, so check for them early
and save more expensive checks for later.
Mark dentries that came to us via NFS in a special way so that
we can tell them apart during open and activate open cache
(we really don't want to do open/close RPC for every NFS IO).
This became needed since dentry revlidate no longer reimplements
any RPCs for lookup, and as such if a dentry is valid,
ll_revalidate_dentry returns 1 and ll_lookup_it() is never visited
during opens, we get straght into ll_file_open() without a valid
intent/RPC. This used to be only true for NFS, so opencache was
engaged needlessly, and it carries a cost of it's own if there is
in fact no repetitive file opening-closing going on
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/20354
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8019 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Li Xi <lixi@ddn.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Niu Yawei [Mon, 20 Jun 2016 20:55:43 +0000 (16:55 -0400)]
staging/lustre/mdc: Zero atime in close RPC
While atime on close is supposed to only increase, there's
a bug in some older server versions where atime from a client
is taken no matter the value that allows a stale client atime
to overwrite a correct value.
Update atime in close rpc to 0 to help such servers out.
Patrick Farrell [Mon, 20 Jun 2016 20:55:35 +0000 (16:55 -0400)]
staging/lustre/llite: take trunc_sem only at vvp layer
The lli_trunc_sem is taken in 'read' mode in both
ll_page_mkwrite and vvp_io_fault_start. This can lead to a
deadlock with another thread which asks for the semaphore
in write mode between thse two read calls.
Since all users of lli_trunc_sem are in the vvp layer, we
can satisfy the requirement to exclude truncate by taking
the semaphore only in vvp_io_fault_start.
Vitaly Fertman [Mon, 20 Jun 2016 20:55:34 +0000 (16:55 -0400)]
staging/lustre/ptlrpc: lost bulk leads to a hang
The reverse order of request_out_callback() and reply_in_callback()
puts the RPC into UNREGISTERING state, which is waiting for RPC &
bulk md unlink, whereas only RPC md unlink has been called so far.
If bulk is lost, even expired_set does not check for UNREGISTERING
state.
The same for write if server returns an error.
This phase is ambiguous, split to UNREG_RPC and UNREG_BULK.
Signed-off-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Seagate-bug-id: MRP-2953, MRP-3206 Reviewed-by: Andriy Skulysh <andriy.skulysh@seagate.com> Reviewed-by: Alexey Leonidovich Lyashkov <alexey.lyashkov@seagate.com> Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com>
Reviewed-on: http://review.whamcloud.com/19953 Reviewed-by: Chris Horn <hornc@cray.com> Reviewed-by: Ann Koehler <amk@cray.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vitaly Fertman [Mon, 20 Jun 2016 20:55:32 +0000 (16:55 -0400)]
staging/lustre/ptlrpc: Early Reply vs Reply MDunlink
A race between unregister_reply & early reply.
When buffers are busy for the early transfer, they cannon be unlinked
by unregister_reply, so the RPC gets into UNREGISTERING state. The
coming reply_in_callback for the early RPC already has unlinked flag
set due to previous mdunlink attempt, but we handle it properly only
for UNILNK event, whereas this is PUT in this case.
Liang Zhen [Mon, 20 Jun 2016 20:55:31 +0000 (16:55 -0400)]
staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set
This patch changes a few things:
- There is no guarantee that request_out_callback will happen
before reply_in_callback, if a request got reply and unlinked
reply buffer before request_out_callback is called, then the
thread waiting on ptlrpc_request_set will miss wakeup event.
This may seriously impact performance of some IO workloads or
result in RPC timeout
- To make code more easier to understand, this patch changes
action-bits "rq_req_unlink" and "rq_reply_unlink" to
status-bits "rq_req_unlinked" and "rq_reply_unlinked"
Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-on: http://review.whamcloud.com/12158
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5696 Reviewed-by: Johann Lombardi <johann.lombardi@intel.com> Reviewed-by: Li Wei <wei.g.li@intel.com> Reviewed-by: Mike Pershin <mike.pershin@intel.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Liang Zhen [Mon, 20 Jun 2016 20:55:30 +0000 (16:55 -0400)]
staging/lustre/ptlrpc: reorganize ptlrpc_request
ptlrpc_request has some structure members are only for client side,
and some others are only for server side, this patch moved these
members to different structure then putting into an union.
By doing this, size of ptlrpc_request is decreased about 300 bytes,
besides saving memory, it also can reduce memory footprint while
processing.
Oleg Drokin [Mon, 20 Jun 2016 20:55:29 +0000 (16:55 -0400)]
staging/lustre/osc: Fix reverted condition in osc_lock_weight
When imprting clio simplification patch, the check for
pbject got reversed by mistake when converting from
if (obj == NULL) it somehow became (if (obj) which is obviously wrong,
and so when it does hit, a crash was happening as result.
With huge number of pages to scan by osc_lock_weight() it is likely
CLP_GANG_RESCHED is returned from osc_page_gang_lookup() and the scan
will be repeated again from the start. To be sure that the scan is
progressing across those restarts, next scan should be started from
the last scanned page index plus one.
Xyratex-bug-id: MRP-2145 Signed-off-by: Alexander Zarochentsev <alexander.zarochentsev@seagate.com> Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/12362
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5781 Reviewed-by: Bobi Jam <bobijam@hotmail.com> Reviewed-by: James Simmons <uja.ornl@gmail.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bruno Faccini [Mon, 20 Jun 2016 20:55:27 +0000 (16:55 -0400)]
staging/lustre/llite: lock i_lock before __d_drop()
There has been several Lustre Client crashes reported by sites
running with Lustre versions 2.1/2.5, all showing the same
dentry->d_hash->next corrupted pointer cause.
This patch fixes a regression that has been introduced since a
long time by commit :
(LU-506 kernel: FC15 - support dcache scalability changes.)
where i_lock protection usage has been removed and
that is likely to cause racy condition during dentry [un]hashing
and to be the root cause of these crashes.
Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Reviewed-on: http://review.whamcloud.com/19287
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7973 Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Yang Sheng <yang.sheng@intel.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Mon, 20 Jun 2016 20:55:25 +0000 (16:55 -0400)]
staging/lustre/llite: correct request handling after ll_lookup_it()
In the FIFO cases of ll_atomic_open() and ll_lookup_nd() remove
spurious calls to ptlrpc_req_finished(). Explain that these cases are
unreachable in practice anyway.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/17068
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7402 Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Emoly Liu [Mon, 20 Jun 2016 20:55:24 +0000 (16:55 -0400)]
staging/lustre/llite: allocate and free client cache asynchronously
Since the inflight request holds import refcount as well as export,
sometimes obd_disconnect() in client_common_put_super() can't put
the last refcount of OSC import (e.g. due to network disconnection),
this will cause cl_cache being accessed after free.
To fix this issue, ccc_users is used as cl_cache refcount, and
lov/llite/osc all hold one cl_cache refcount respectively, to avoid
the race that a new OST is being added into the system when the client
is mounted.
The following cl_cache functions are added:
- cl_cache_init(): allocate and initialize cl_cache
- cl_cache_incref(): increase cl_cache refcount
- cl_cache_decref(): decrease cl_cache refcount and free the cache
if refcount=0.
Fan Yong [Mon, 20 Jun 2016 02:53:53 +0000 (22:53 -0400)]
staging: lustre: remove remote client support
There are several obsolete sub commands for lfs to work with
remote client. We do not support that anymore, and should be
deleted along with any kernel code related to remote client.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6971
Reviewed-on: http://review.whamcloud.com/19789 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Torvalds [Sun, 19 Jun 2016 17:05:14 +0000 (07:05 -1000)]
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull UDF fixes and a reiserfs fix from Jan Kara:
"A couple of udf fixes (most notably a bug in parsing UDF partitions
which led to inability to mount recent Windows installation media) and
a reiserfs fix for handling kstrdup failure"
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
reiserfs: check kstrdup failure
udf: Use correct partition reference number for metadata
udf: Use IS_ERR when loading metadata mirror file entry
udf: Don't BUG on missing metadata partition descriptor
Linus Torvalds [Sun, 19 Jun 2016 06:36:17 +0000 (20:36 -1000)]
Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC fixes from Olof Johansson:
"Another batch of fixes for ARM SoC platforms. Most are smaller fixes.
Two areas that are worth pointing out are:
- OMAP had a handful of changes to voltage specs that caused a bit of
churn, most of volume of change in this branch is due to this.
- There are a couple of _rcuidle fixes from Paul that touch common
code and came in through the OMAP tree since they were the ones who
saw the problems.
The rest is smaller changes across a handful of platforms"
* tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (36 commits)
ARM: dts: STi: stih407-family: Disable reserved-memory co-processor nodes
ARM: dts: am437x-sk-evm: Reduce i2c0 bus speed for tps65218
ARM: OMAP2+: timer: add probe for clocksources
ARM: OMAP1: fix ams-delta FIQ handler to work with sparse IRQ
memory: omap-gpmc: Fix omap gpmc EXTRADELAY timing
arm: Use _rcuidle for smp_cross_call() tracepoints
MAINTAINERS: Add myself as reviewer of ARM FSL/NXP
ARM: OMAP: DRA7: powerdomain data: Remove unused pwrsts_mem_ret
ARM: OMAP: DRA7: powerdomain data: Remove unused pwrsts_logic_ret
ARM: OMAP: DRA7: powerdomain data: Set L3init and L4per to ON
ARM: imx6ul: Fix Micrel PHY mask
ARM: OMAP2+: Select OMAP_INTERCONNECT for SOC_AM43XX
ARM: dts: DRA74x: fix DSS PLL2 addresses
ARM: OMAP2: Enable Errata 430973 for OMAP3
ARM: dts: socfpga: Add missing PHY phandle
ARM: dts: exynos: Fix port nodes names for Exynos5420 Peach Pit board
ARM: dts: exynos: Fix port nodes names for Exynos5250 Snow board
ARM: dts: sun6i: yones-toptech-bs1078-v2: Drop constraints on dc1sw regulator
ARM: dts: sun6i: primo81: Drop constraints on dc1sw regulator
ARM: dts: sunxi: Add OLinuXino Lime2 eMMC to the Makefile
...
Olof Johansson [Sun, 19 Jun 2016 05:57:48 +0000 (22:57 -0700)]
Merge tag 'omap-for-v4.7/fixes-powedomain' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
Fixes for omaps for v4.7-rc cycle:
- Fix dra7 for hardware issues limiting L4Per and L3init power domains
to on state. Without this the devices may not work correctly after
some time of use because of asymmetric aging. And related to this,
let's also remove the unusable states.
- Always select omap interconnect for am43x as otherwise the am43x
only configurations will not boot properly. This can happen easily
for any product kernels that leave out other SoCs to save memory.
- Fix DSS PLL2 addresses that have gone unused for now
- Select erratum 430973 for omap3, this is now safe to do and can
save quite a bit of debugging time for people who may have left
it out.
* tag 'omap-for-v4.7/fixes-powedomain' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
ARM: OMAP: DRA7: powerdomain data: Remove unused pwrsts_mem_ret
ARM: OMAP: DRA7: powerdomain data: Remove unused pwrsts_logic_ret
ARM: OMAP: DRA7: powerdomain data: Set L3init and L4per to ON
ARM: OMAP2+: Select OMAP_INTERCONNECT for SOC_AM43XX
ARM: dts: DRA74x: fix DSS PLL2 addresses
ARM: OMAP2: Enable Errata 430973 for OMAP3
+ Linux 4.7-rc2