Ian Abbott [Fri, 27 Mar 2015 19:13:41 +0000 (19:13 +0000)]
staging: comedi: comedi_fc.h: begin migration to comedidev.h
"comedi_fc.h" contains a few inline functions used by the `do_cmdtest`
handler functions for comedi subdevices in several low-level comedi
drivers for checking asynchronous command trigger sources and arguments.
They all use the prefix `cfc_check_trigger_arg`. Copy them over to
"../comedidev.h", but change the `cfc_` prefix to `comedi_`. Change the
original functions in "comedi_fc.h" into simple wrappers for their
replacements.
Once the drivers have been changed to call the replacement functions,
"comedi_fc.h" can be removed.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 27 Mar 2015 15:13:06 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: extend spin-lock scope in comedi_event()
`comedi_event()` is called from low-level drivers to handle comedi
asynchronous command event flags. As a safety check, it checks the
subdevice's "run" flags to make sure an asynchronous command is running.
It can also change the run flags to mark the command as no longer
running (possibly also marking it as terminated with an error).
Checking the runflags and modifying them involves two uses of the
subdevice's spin-lock. It seems better to do it with a single use of
the spin-lock. This also avoids possible interactions with
`do_become_nonbusy()`.
Acquire the subdevice's spin-lock at the start of `comedi_event()` and
release it near the end, before a possible call to `kill_fasync()` (but
after it's parameter values have been determined).
Add and make use of few new inline helper functions:
* `__comedi_clear_subdevice_runflags()` -- clears some run flags without
using the spin-lock
* `__comedi_set_subdevice_runflags()` -- sets some run flags without
using the spin-lock
* `__comedi_get_subdevice_runflags()` -- a spin-lockless version of
`comedi_get_subdevice_runflags()
* `__comedi_is_subdevice_running()` -- a spin-lockless version of
* `comedi_is_subdevice_running()`
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 27 Mar 2015 15:13:05 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: send SIGIO according to command direction
`comedi_event()` is called from low-level drivers to handle comedi
asynchronous command event flags. Some events cause waiting tasks to be
woken up, and a `SIGIO` signal to be sent via `kill_fasync()`. The
signal code is `POLL_OUT` if the subdevice supports commands in the
"write" direction, or `POLL_IN` for the "read" direction. If the
subdevice supports commands in either direction, it sends two `SIGIO`
signals, one with each code. Change that latter case to only send one
`SIGIO` signal, using the direction of the current command to determine
the signal code. If the `CMDF_WRITE` flag is set in the current
command, it's in the "write" direction, otherwise it's in the "read"
direction.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 27 Mar 2015 15:13:04 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: always clear events
`comedi_event()` is called from low-level drivers to handle asynchronous
command event flags that are stored in `s->async->events` for subdevice
`s`. It normally clears the event flags as well. As a safety check, it
does nothing if no asynchronous command is running, but it leaves
`s->async->events` unchanged in this case. For additional safety,
change it to always clear the event flags to avoid leaving stale event
flags set when another asynchronous command is set up.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 27 Mar 2015 15:13:01 +0000 (15:13 +0000)]
staging: comedi: comedi_fops: eliminate a use of subdevice spin-lock
`comedi_is_subdevice_in_error()` is only used by `comedi_read()` and
`comedi_write()` and is only called (soon) after
`comedi_is_subdevice_running()` returns `false` (with extra conditions
in the case of `comedi_write()`). `comedi_is_subdevice_running()` and
`comedi_get_subdevice_runflags()` both call
`comedi_get_subdevice_runflags()` which uses the subdevice's spin-lock.
Eliminate one use of the subdevice's spin-lock in `comedi_read()` and
`comedi_write()` by calling `comedi_get_subdevice_runflags()` and
checking the runflags directly. Add a couple of inline functions to
check the runflags: `comedi_is_runflags_running()` and
`comedi_is_runflags_in_error()`. These do the same test on runflags as
`comedi_is_subdevice_running()` and `comedi_is_subdevice_in_error()` but
get passed the runflags value directly.
`comedi_is_subdevice_in_error()` is no longer used, so remove it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
`comedi_set_subdevice_runflags()` changes the comedi subdevice's
`runflags` member according to a bit-mask and new bit values. It's name
might suggest that it only "sets", not "clears". Rename it to
`comedi_update_subdevice_runflags()` to avoid confusion.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge lustre patches based on 4.0-rc5 into staging-testing
This is done to handle some lustre patches that were made against the
wrong kernel branch, which was my fault, as I gave a lecture where I
messed things up for the students, it wasn't their fault.
Aya Mahfouz [Thu, 2 Apr 2015 18:00:24 +0000 (20:00 +0200)]
staging: lustre: include: replace OBD_CHECK_DEV_ACTIVE by obd_check_dev_active
Static inline functions are preferred over macros. The inline function
obd_check_dev_active is introduced to replace OBD_CHECK_DEV_ACTIVE.
All functions that call obd_check_dev_active store the return values
and return them if they represent an error code.
Some of the changes were carried out manually while others were done
using coccinelle.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aya Mahfouz [Thu, 2 Apr 2015 17:59:15 +0000 (19:59 +0200)]
staging: lustre: include: replace OBD_CHECK_DEV by obd_check_dev
Static inline functions are preferred over macros. Hence, the function
obd_check_dev was introduced. obd_check_dev replaces the macro
OBD_CHECK_DEV. All functions that call obd_check_dev store the return
values and return them if they represent an error code.
Some of the changes were carried out manually while others were done
using coccinelle.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Power down device when an error occurs in order to avoid wasting
power. Move powerdown function up to be seen by the new call and
align parameters for the ltr501_write_contr() call.
Ioana Ciornei [Mon, 30 Mar 2015 23:29:35 +0000 (02:29 +0300)]
staging: dgnc_sysfs: Replace printk(KERN_ERR ) with pr_err()
Fix the following checkpatch warning:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ...
then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
Staging: lustre: Mark internal functions static in llog_cat.c
This patch marks functions llog_cat_set_first_idx and cat_cancel_cb
static as these are used only within this file. Also since cat_cancel_cb
is made static do not export it.
This eliminates the following sparse warning:
warning: symbol * was not declared. Should it be static?
Staging: lustre: Include header for functions prototypes
This patch includes the header lustre/include/lclient.h that declares
the functions lov_lsm_put and lov_read_and_clear_async_rc defined in
lov_object.c.
This eliminates warnings reported by sparse:
warning: symbol was not declared. Should it be static?
Staging: lustre: Add function prototypes in console.h
Sparse reported the following warnings:
warning: symbol 'lstcon_console_init' was not declared. Should it be static?
warning: symbol 'lstcon_console_fini' was not declared. Should it be static?
warning: symbol 'lstcon_ioctl_entry' was not declared. Should it be static?
However since these functions are used in other files,
they cannot be made static, so add protoypes for the same in console.h.
Staging: rtl8712: Use memdup_user() instead of copy_from_user()
Use memdup_user() to avoid its duplicated implementation and simplify
code. memdup_user() uses GFP_KERNEL instead of GFP_ATOMIC,
which is valid because copy_from_user() might sleep and it's useless
to make the allocation atomic. Found with coccinelle.
Merge tag 'iio-for-4.1b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second set of new devices, functionality and cleanup for IIO in the 4.1 cycle.
New Functionality
* Watermark logic for buffers. Allows for blocking reads to block until
their requested amount is available - previously they only blocked until
a single scan of data was available. Also allows for polling for a
watermark amount of data to be available. This feature was first proposed
some time ago to good responses, but not taken further by the original author
Octavian has picked up the gauntlet and taken it through
to merging (along with the hardware fifo support that follows).
* New approach to hardware fifo handling - in particular handling the
interaction of a hardware fifo feeding into a software fifo and their
watershed events. We don't have every possible case well covered yet,
but this is certainly a good, flexible starting point. This will replace
the previous approach used in ancient drivers (sca3000) where we just
exposed the hardware buffer directly to userspace. Very few pieces of
hardware have sufficiently long buffers for that to be an adequate solution.
* bmc150_accel - hardware fifo support.
* mlx90614 - support dual IR sensor devices + some refactoring to clean up the
code and allow some other functionality currently under review.
* L3GD20H gyroscope support added to the st_gyro driver.
* lis3lv02d accelerometer added to the st_gyro driver. Note this part is
also supported by the older lis3 driver under misc. A lengthy discussion
took place and concluded that holding parts out on the basis that whole
driver would be subsumed into this one was counter productive. Better
to add part support and add additional features as people need them.
Basically there was not advantage in not merging the support.
* max517 driver gains support for MAX520 and MAX521 DACs.
Documentation
* 3.20 -> 4.0 renaming for recent docs. Whilst technically a fix, I think
people will cope until the next merge merge window.
* An ABI typo hat -> What: More ABIs should have hats.
* Document in_rot_offset, illuminance_raw and illuminance_scale.
Cleanups
* Fix a scale extraction bug in generic_buffer.c example.
* Constify a load of device tree related structures.
Octavian Purdila [Sun, 22 Mar 2015 18:33:40 +0000 (20:33 +0200)]
iio: bmc150_accel: add support for hardware fifo
We only advertise hardware fifo support if the I2C bus supports full
I2C or smbus I2C block data reads since it is mandatory to read the
full frame in one read (otherwise the rest of the frame is discarded).
The hardware fifo is enabled only when triggers are not active because:
(a) when using the any-motion trigger the user expects to see samples
based on ROC events, but the fifo stores samples based on the sample
frequency
(b) the data-ready trigger is waking the CPU for for every sample, so
using the hardware fifo does not have any benefit
Octavian Purdila [Sun, 22 Mar 2015 18:33:39 +0000 (20:33 +0200)]
iio: add support for hardware fifo
Some devices have hardware buffers that can store a number of samples
for later consumption. Hardware usually provides interrupts to notify
the processor when the FIFO is full or when it has reached a certain
watermark level. This helps with reducing the number of interrupts to
the host processor and thus it helps decreasing the power consumption.
This patch enables usage of hardware FIFOs for IIO devices in
conjunction with software device buffers. When the hardware FIFO is
enabled the samples are stored in the hardware FIFO. The samples are
later flushed to the device software buffer when the number of entries
in the hardware FIFO reaches the hardware watermark or when a flush
operation is triggered by the user when doing a non-blocking read
on an empty software device buffer.
In order to implement hardware FIFO support the device drivers must
implement the following new operations: setting and getting the
hardware FIFO watermark level, flushing the hardware FIFO to the
software device buffer. The device must also expose information about
the hardware FIFO such it's minimum and maximum watermark and if
necessary a list of supported watermark values. Finally, the device
driver must activate the hardware FIFO when the device buffer is
enabled, if the current device settings allows it.
The software device buffer watermark is passed by the IIO core to the
device driver as a hint for the hardware FIFO watermark. The device
driver can adjust this value to allow for hardware limitations (such
as capping it to the maximum hardware watermark or adjust it to a
value that is supported by the hardware). It can also disable the
hardware watermark (and implicitly the hardware FIFO) it this value is
below the minimum hardware watermark.
Since a driver may support hardware FIFO only when not in triggered
buffer mode (due to different semantics of hardware FIFO sampling and
triggered sampling) this patch changes the IIO core code to allow
falling back to non-triggered buffered mode if no trigger is enabled.
Currently the IIO buffer blocking read only wait until at least one
data element is available.
This patch makes the reader sleep until enough data is collected before
returning to userspace. This should limit the read() calls count when
trying to get data in batches.
When using generic_buffer to read data, the scale is not properly
detected for scale shared by type. This is caused by a problem
with the generation of generic name out of the full name.
E.g.: for current->name in_accel_z, the extracted generic name
is "in" (when it should be "in_accel"). This is used in generic_buffer
to generate scale and offset paths (in_accel_scale).
Consider the in_ or out_ prefix when extracting the generic name
from the full name.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: Add ABI documentation for illuminance raw and scale values in light
This patchset adds ABI documentation for the following attributes:
in_illuminance_scale, used atleast once in al3320a staging/iio/light/
in_illuminance_calibscale, used atleast once in cm32181
in_illuminance_input, used in cm3232 at least once
in_illuminance_raw used atleast once in al3320a
in_illuminance_clear_raw and in_illuminance_ir_raw exposed by
gp2ap020a00f with modifiers IIO_MOD_LIGHT_CLEAR and
IIO_MOD_LIGHT_IR respectively.
Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Helen Fornazier [Thu, 26 Mar 2015 17:09:15 +0000 (14:09 -0300)]
staging: sm750fb: Fix for statement style
This patch fixes the checkpatch.pl warnings:
ERROR: spaces required around that '=' (ctx:VxV)
ERROR: spaces required around that '<=' (ctx:VxV)
ERROR: spaces required around that '>' (ctx:VxV)
ERROR: space required before the open parenthesis '('
ERROR: space required after that ';' (ctx:VxV)
Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ERROR: that open brace { should be on the previous line
ERROR: else should follow close brace '}'
WARNING: braces {} are not necessary for single statement blocks
ERROR: space required before the open brace '{'
Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:28 +0000 (20:47 +0530)]
staging: unisys: use local variable in cleanup
the dev_t was being stored in visorchipset_platform_device.dev.devt
while initializing the module. so pass that value as an argument to
cleanup() so that it can use this local variable instead of the global
variable.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:27 +0000 (20:47 +0530)]
staging: unisys: use local variable
we are getting dev_t as an argument in the function, so use the local
variable instead of the global variable "majordev".
this global variable will be removed in one of the next patch of the
series.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Tue, 24 Mar 2015 15:17:26 +0000 (20:47 +0530)]
staging: unisys: remove redundant variable
remove the variable "registered", which was used in the cleanup() to
detect if the driver has successfully initialized. the cleanup()
is called from module_exit, so its obvious that the module has
successfully initialized. if the initialization had failed, then
we will never be in the cleanup().
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Joe Perches [Wed, 25 Mar 2015 19:54:25 +0000 (12:54 -0700)]
staging: rts5208: Remove TRACE_RET and TRACE_GOTO macros
Remove these flow hiding macros.
Miscellanea:
o Add a macro and function to replace a large inline
o Simplify #includes
o Add trace.c and update Makefile
o Remove static inline filename function and use kbasename instead
This reduces object size quite a lot: ~350KB (x86-64 allyesconfig)
$ size drivers/staging/rts5208/built-in.o*
text data bss dec hex filename
248385 36728 77888 363001 589f9 drivers/staging/rts5208/built-in.o.new
506691 83352 115896 705939 ac593 drivers/staging/rts5208/built-in.o.old
Joe Perches [Tue, 24 Mar 2015 23:06:44 +0000 (16:06 -0700)]
staging: rtl8723au: Update RT_TRACE macro and uses
Create an rt_trace function using %pV to reduce overall code size.
Update the macro uses to remove unnecessary and now harmful parentheses.
Miscellanea around these changes:
o Coalesce formats
o Realign arguments
o Remove commented-out RT_TRACE uses
o Spelling fixes in formats
o Add missing newlines to formats
o Remove multiple newlines from formats
o Neaten formats where noticed
o Use %pM in one instance