Shreeya Patel [Thu, 21 Dec 2017 22:28:21 +0000 (03:58 +0530)]
Staging: rtlwifi: Remove unused variable and the code
Remove unused variable and also remove unused code
associated with initializing the unused variable.
Unused variable was detected using the following
semantic patch by coccinelle.
@@
type T;
identifier i;
constant C;
@@
(
extern T i;
|
- T i;
<+... when != i
- i = C;
...+>
)
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Sidong Yang [Mon, 25 Dec 2017 16:37:45 +0000 (16:37 +0000)]
staging: vc05_services: fix checkpatch.pl errors
Fix some errors for wrong brace position reported by checkpatch.
Signed-off-by: Sidong Yang <realwakka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kishore KP [Sun, 24 Dec 2017 14:03:54 +0000 (19:33 +0530)]
staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG.
Coccinelle suggested to use BUG_ON instead of if condition followed by BUG
but BUG_ON should be used in situations where integrity of the system is no
longer guaranteed. In this case, as suggested by Stefan Wahren, vchiq isn't
critical.
Since it is not critical, BUG_ON should be avoided.
Replaced if condition followed by BUG with WARN_ON_ONCE.
Signed-off-by: Kishore KP <kishore.p@techveda.org>
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kishore KP [Sat, 23 Dec 2017 14:46:59 +0000 (20:16 +0530)]
staging: vc04_services: Fix platform_no_drv_owner.cocci warnings.
Removed .owner field initialization, platform core does it automatically.
Pointed out by Coccinelle.
Signed-off-by: Kishore KP <kishore.p@techveda.org>
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andy Pusch [Sat, 23 Dec 2017 15:37:56 +0000 (16:37 +0100)]
Staging: wlan-ng: hfa384x_usb: fixed two line limit coding style issues
Fixed two coding style issues.
Signed-off-by: Andy Pusch <drag@black-pixel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Philippe Loctaux [Thu, 28 Dec 2017 21:51:24 +0000 (22:51 +0100)]
Staging: vme: vme_user: fixed an alignment coding style issue
Fixed a coding style issue.
Signed-off-by: Philippe Loctaux <loctauxphilippe@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Xiongwei Song [Thu, 4 Jan 2018 23:34:36 +0000 (07:34 +0800)]
staging: android: check the return value of register_shrinker
register_shrinker call is made in ashmem_init, it may return error code,
so we need to check it.
Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Xiongwei Song [Fri, 29 Dec 2017 12:37:03 +0000 (20:37 +0800)]
staging: android: check for error from register_shrinker in ion_heap_init_shrinker
The function register_shrinker in ion_heap_init_shrinker may return an
error, check it out. Meanwhile, ion_heap_init_shrinker has to a return
value.
Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Zhai Zhaoxuan [Thu, 28 Dec 2017 13:56:06 +0000 (21:56 +0800)]
staging: android: ashmem: add procfs fdinfo helper
This print the inode number of backing file and the name in
/proc/pid/fdinfo/fd.
These information helps users to know which processes are sharing the same
ashmem.
Signed-off-by: Zhai Zhaoxuan <kxuanobj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
George Edward Bulmer [Fri, 29 Dec 2017 21:26:20 +0000 (21:26 +0000)]
staging: most: convert macro to static function
This fixes checkpatch warning:
CHECK: Macro argument reuse 'buf' - possible side effects?
Signed-off-by: George Edward Bulmer <gebulmer@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ravi Eluri [Fri, 22 Dec 2017 10:09:02 +0000 (15:39 +0530)]
staging: most: Fix identifiers to function parameters
fixed "function definition argument should have an identifier name",
with appropriate identifier names. Pointed out by checkpatch.
Signed-off-by: Ravi Eluri <venkataravi.e@techveda.org>
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ravi Eluri [Fri, 22 Dec 2017 08:25:44 +0000 (13:55 +0530)]
staging: most: Avoid trailing semicolon for macros
Fixes checkpatch warning:
macros should not use a trailing semicolon.
Signed-off-by: Ravi Eluri <venkataravi.e@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Derek Robson [Sat, 30 Dec 2017 01:16:58 +0000 (14:16 +1300)]
Staging: pi433 - fix ccheckpatch issue, updated include line.
Updated the include of compat.h to fix checkpatch error
Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Valentin Vidic [Mon, 25 Dec 2017 18:20:56 +0000 (19:20 +0100)]
staging: pi433: fix CamelCase for payload identifiers
Fixes checkpatch warnings:
CHECK: Avoid CamelCase: <payloadLength>
CHECK: Avoid CamelCase: <payloadReady>
Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Valentin Vidic [Fri, 22 Dec 2017 08:36:59 +0000 (09:36 +0100)]
staging: pi433: fix CamelCase for maxMinus variables
Fixes checkpatch warnings:
CHECK: Avoid CamelCase: <maxMinus12>
CHECK: Avoid CamelCase: <maxMinus24>
CHECK: Avoid CamelCase: <maxMinus36>
CHECK: Avoid CamelCase: <maxMinus48>
CHECK: Avoid CamelCase: <maxMinus6>
Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marcin Ciupak [Thu, 21 Dec 2017 21:39:41 +0000 (21:39 +0000)]
staging: pi433: remove unused rf69_reset_flag function
Function rf69_reset_flag is unused and should be removed.
Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marcin Ciupak [Thu, 21 Dec 2017 21:39:12 +0000 (21:39 +0000)]
staging: pi433: remove unused rf69_set_sync_tolerance function
Function rf69_set_sync_tolerance is unused and should be removed.
Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:37 +0000 (12:14 +0000)]
staging: ccree: update TODO
Update TODO to reflect work done
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:34 +0000 (12:14 +0000)]
stating: ccree: fix allocation of void sized buf
We were allocating buffers using sizeof(*struct->field) where field was
type void. Fix it by having a local variable with the real type.
Cc: stable@vger.kernel.org
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:33 +0000 (12:14 +0000)]
staging: ccree: put pointer next to var name
Put pointer next to var name as per coding style.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:32 +0000 (12:14 +0000)]
staging: ccree: fold common code into service func
Fold common code in hash call into service functions.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:31 +0000 (12:14 +0000)]
staging: ccree: fix indentation of func params
Fix indentation of some function params in hash code for
better readability.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:30 +0000 (12:14 +0000)]
staging: ccree: do not map bufs in ahash_init
hash_init was mapping DMA memory that were then being unmap in
hash_digest/final/finup callbacks, which is against the Crypto API
usage rules (see discussion at
https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg30077.html)
Fix it by moving all buffer mapping/unmapping or each Crypto API op.
This also properly deals with hash_import() not knowing if
hash_init was called or not as it now no longer matters.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:29 +0000 (12:14 +0000)]
staging: ccree: allocate hash bufs inside req ctx
Move to allocating the buffers needed for requests as part of
the request structure instead of malloc'ing each one on it's
own, making for simpler (and more efficient) code.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:28 +0000 (12:14 +0000)]
staging: ccree: use array for double buffer
The ccree hash code is using a double buffer to hold data
for processing but manages the buffers and their associated
data count in two separate fields and uses a predicate to
chose which to use.
Move to using a proper 2 members array for a much cleaner code.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:27 +0000 (12:14 +0000)]
staging: ccree: remove unused field
Remove unused struct field.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:26 +0000 (12:14 +0000)]
staging: ccree: use Makefile to include PM code
Replace ugly ifdefs with some inline macros and Makefile magic
for optionally including power management related code for
better readability.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:25 +0000 (12:14 +0000)]
staging: ccree: handle end of sg list gracefully
If we are asked for number of entries of an offset bigger than the
sg list we should not crash.
Cc: stable@vger.kernel.org
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:24 +0000 (12:14 +0000)]
staging: ccree: check DMA pool buf !NULL before free
If we ran out of DMA pool buffers, we get into the unmap
code path with a NULL before. Deal with this by checking
the virtual mapping is not NULL.
Cc: stable@vger.kernel.org
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:23 +0000 (12:14 +0000)]
staging: ccree: failing the suspend is not an error
PM suspend returning a none zero value is not an error. It simply
indicates a suspend is not advised right now so don't treat it as
an error.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:22 +0000 (12:14 +0000)]
stating: ccree: revert "staging: ccree: fix leak of import() after init()"
This reverts commit
c5f39d07860c ("staging: ccree: fix leak of import()
after init()") and commit
aece09024414 ("staging: ccree: Uninitialized
return in ssi_ahash_import()").
This is the wrong solution and ends up relying on uninitialized memory,
although it was not obvious to me at the time.
Cc: stable@vger.kernel.org
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:21 +0000 (12:14 +0000)]
staging: ccree: add backlog processing
Crypto API tfm providers are required to provide a backlog
service, if so indicated, that queues up requests in the case
of the provider being busy and processing them later.
The ccree driver did not provide this facility. Add it now.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:20 +0000 (12:14 +0000)]
staging: ccree: break send_request and fix ret val
The send_request() function was handling both synchronous
and asynchronous invocations, but were not handling
the asynchronous case, which may be called in an atomic
context, properly as it was sleeping.
Start to fix the problem by breaking up the two use
cases to separate functions calling a common internal
service function and return error instead of sleeping
for the asynchronous case.
The next patch will complete the fix by implementing
proper backlog handling.
Fixes: abefd6741d ("staging: ccree: introduce CryptoCell HW driver").
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:19 +0000 (12:14 +0000)]
staging: ccree: remove unused leftover field
Remove the unused monitor_desc field.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:18 +0000 (12:14 +0000)]
staging: ccree: tag debugfs init/exit func properly
The debugfs global init and exit functions were missing
__init and __exit tags, potentially wasting memory.
Fix it by properly tagging them.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:17 +0000 (12:14 +0000)]
staging: ccree: copy larval digest from RAM
The ccree driver was using a DMA operation to copy larval digest
from the ccree SRAM to RAM. Replace it with a simple memcpy.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:16 +0000 (12:14 +0000)]
staging: ccree: pick alloc mem flags based on req flags
The ccree driver was allocating memory using GFP_KERNEL flag
always, ignoring the flags set in the crypto request. Fix it
by choosing gfp flags based on crypto request flags.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:15 +0000 (12:14 +0000)]
staging: ccree: remove GFP_DMA flag from mem allocs
Remove bogus GFP_DMA flag from memory allocations. ccree driver
does not operate over an ISA or similar limited bus.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:14 +0000 (12:14 +0000)]
staging: ccree: fold reg common defines into driver
Fold the 2 macro defined in dx_reg_common.h into the file they
are used in and delete the file.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:13 +0000 (12:14 +0000)]
staging: ccree: fold hash defs into queue defs
Fold the two remaining enum in hash defs into the queue defs
that are using them and delete the hash defs include file.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gilad Ben-Yossef [Sun, 7 Jan 2018 12:14:12 +0000 (12:14 +0000)]
staging: ccree: SPDXify driver
Replace verbatim GPL v2 copy with SPDX tag.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arnd Bergmann [Wed, 3 Jan 2018 09:26:17 +0000 (10:26 +0100)]
staging: ccree: mark debug_regs[] as static
The global array clashes with an existing symbol of the same name:
drivers/staging/ccree/cc_debugfs.o:(.data+0x0): multiple definition of `debug_regs'
drivers/mmc/host/s3cmci.o:(.data+0x70): first defined here
We should fix both, this one addresses the ccree driver by removing
the symbol from the global namespace.
Fixes: 9bdd203b4dc8 ("s3cmci: add debugfs support for examining driver and hardware state")
Fixes: b3ec9a6736f2 ("staging: ccree: staging: ccree: replace sysfs by debugfs interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Kapshuk [Mon, 25 Dec 2017 14:42:59 +0000 (16:42 +0200)]
vboxvideo: Fix incorrect type in assignment sparse warning
Sparse emitted the following warning:
../drivers/staging/vboxvideo/vbox_fb.c:173:27: warning: incorrect type in assignment (different address spaces)
../drivers/staging/vboxvideo/vbox_fb.c:173:27: expected char [noderef] <asn:2>*screen_base
../drivers/staging/vboxvideo/vbox_fb.c:173:27: got void *virtual
The vbox_bo buffer object kernel mapping is handled by a call
to ttm_bo_kmap() prior to the assignment of bo->kmap.virtual to
info->screen_base of type char __iomem*.
Casting bo->kmap.virtual to char __iomem* in this assignment fixes
the warning.
vboxvideo: Fix address space of expression removal sparse warning
Sparse emitted the following warning:
../drivers/staging/vboxvideo/vbox_main.c:64:25: warning: cast removes address space of expression
vbox->vbva_buffers iomapping is handled by calling vbox_accel_init()
from vbox_hw_init().
__force attribute is used in assignment to vbva to fix the warning.
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Luis Gerhorst [Mon, 8 Jan 2018 10:06:37 +0000 (11:06 +0100)]
drivers/fbtft: Remove unnecessary braces from if/else
The Linux kernel coding style states that braces should only be used
when necessary.
This fixes the checkpatch warning
WARNING: line over 80 characters
+ } else if (display->regwidth == 8 && display->buswidth == 9 && par->spi) {
introduced by patch #1.
Signed-off-by: Luis Gerhorst <linux-kernel@luisgerhorst.de>
Acked-by: Jonny Schaefer <schaefer.jonny@gmail.com>
Acked-by: Alexander Wuerstlein <arw@cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Luis Gerhorst [Mon, 8 Jan 2018 10:02:47 +0000 (11:02 +0100)]
drivers/fbtft: Remove newline after else in else-if
This removes the following warning issued by checkpatch
WARNING: suspect code indent for conditional statements (8, 8)
+ } else
+ if (display->regwidth == 8 && display->buswidth == 9 && par->spi) {
Signed-off-by: Luis Gerhorst <linux-kernel@luisgerhorst.de>
Acked-by: Jonny Schaefer <schaefer.jonny@gmail.com>
Acked-by: Alexander Wuerstlein <arw@cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sumit Pundir [Fri, 5 Jan 2018 16:49:47 +0000 (22:19 +0530)]
Staging: lustre: Fix prefer kcalloc over kzalloc with multiply
Use kcalloc for allocating an array instead of kzalloc with
multiply. kcalloc is the preferred API. Issue reported by
checkpatch.pl
Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sumit Pundir [Fri, 5 Jan 2018 16:13:56 +0000 (21:43 +0530)]
Staging: lustre: Fix prefer seq_puts to seq_printf
Use seq_puts() for strings without format specifiers instead of
seq_printf(). Issue reported by checkpatch.pl
Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aliaksei Karaliou [Sat, 23 Dec 2017 11:13:16 +0000 (14:13 +0300)]
drivers: lustre: obdclass: simplify unregister_shrinker() usage
lu_global_fini() explicitly uses knowledge about shrinker's
internals to make decision about calling of unregister_shrinker().
Now this check was integrated into unregister_shrinker(),
so it is safe to call it against unregistered shrinker.
Signed-off-by: Aliaksei Karaliou <akaraliou.dev@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 00:46:30 +0000 (11:46 +1100)]
staging: lustre: lnet: discard CFS_ALLOC_PTR
These trivial wrappers hurt readability and
as they use kvmalloc, they are overly generic.
So discard them and use kmalloc/kfree as is
normal in Linux.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 00:46:30 +0000 (11:46 +1100)]
staging: lustre: lnet-lib: opencode some alloc/free functions.
These functions just call LIBCFS_ALLOC() which in-turn
calls kvmalloc().
In none of these cases is the 'vmalloc' option needed.
LIBCFS_ALLOC also produces a warning if NULL is returned,
but that can be provided with CONFIG_SLAB_DEBUG.
LIBCFS_ALLOC zeros the memory, so we need to use
__GFP_ZERO too.
So with one exception where the alloc function is not trivial,
open-code the alloc and free functions using kmalloc and kfree.
Note that the 'size' used in lnet_md_alloc() is limited and less than
a page because LNET_MAX_IOV is 256, so kvmalloc is not needed.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:41:42 +0000 (12:41 +1100)]
staging: lustre: libcfs: remove prng
The cfs prng is no longer used, so discard it.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:41:42 +0000 (12:41 +1100)]
staging: lustre: replace cfs_get_random_bytes calls with get_random_byte()
The cfs_get_random_bytes() interface adds nothing of value
to get_random_byte() (which it uses internally). So just use the
standard interface.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:41:42 +0000 (12:41 +1100)]
staging: lustre: replace cfs_srand() calls with add_device_randomness().
The only places that cfs_srand is called, the random bits are
mixed with bits from get_random_bytes(). So it is equally effective
to add entropy to either pool.
So we can replace calls to cfs_srand() with calls that add the
entropy with add_device_randomness(). That function adds time-based
entropy, so we can discard the ktime_get_ts64 calls.
One location in lustre_handles.c only adds timebased
entropy. This cannot improve the entropy provided by get_random_bytes(),
so just discard that call.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:41:42 +0000 (12:41 +1100)]
staging: lustre: replace cfs_rand() with prandom_u32_max()
All occurrences of
cfs_rand() % X
are replaced with
prandom_u32_max(X)
cfs_rand() is a simple Linear Congruential PRNG. prandom_u32_max()
is at least as random, is seeded with more randomness, and uses
cpu-local state to avoid cross-cpu issues.
This is the first step is discarding the libcfs prng with
the standard linux prng.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:25:19 +0000 (12:25 +1100)]
staging: lustre: libcfs: remove wi_data from cfs_workitem
In every case, the value passed via wi_data can be determined
from the cfs_workitem pointer using container_of().
So use container_of(), and discard wi_data.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:25:19 +0000 (12:25 +1100)]
staging: lustre: libcfs: use a workqueue for rehash work.
lustre has a work-item queuing scheme that provides the
same functionality as linux work_queues.
To make the code easier for linux devs to follow, change
to use work_queues.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:13:20 +0000 (12:13 +1100)]
staging: lustre: obd_mount: fix possible race with module unload.
lustre_fill_super() calls client_fill_super() without holding a
reference to the module containing client_fill_super. If that
module is unloaded at a bad time, this can crash.
To be able to get a reference to the module using
try_get_module(), we need a pointer to the module.
So replace
lustre_register_client_fill_super() and
lustre_register_kill_super_cb()
with a single
lustre_register_super_ops()
which also passed a module pointer.
Then use a spinlock to ensure the module pointer isn't removed
while try_module_get() is running, and use try_module_get() to
ensure we have a reference before calling client_fill_super().
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:13:20 +0000 (12:13 +1100)]
staging: lustre: obdclass: remove vfsmount option from client_fill_super
This arg is always NULL and is never used.
So discard it from this and related functions.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:13:20 +0000 (12:13 +1100)]
staging: lustre: obdclass: remove pointless struct lustre_mount_data2
This is used to pass a void* and NULL to lustre_fill_super().
It is easier just to pass the void*.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 01:13:20 +0000 (12:13 +1100)]
staging: lustre: obdclass: discard FS_NEEDS_DEV flag.
Lustre mounts do not need a dev, as we can see from lustre_mount()
calling mount_nodev(). So remove the flag which could cause
confusion elsewhere.
Also format lustre_fs_types so that fields line up.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 23:01:47 +0000 (10:01 +1100)]
staging: lustre: disable preempt while sampling processor id.
Calling smp_processor_id() without disabling preemption
triggers a warning (if CONFIG_DEBUG_PREEMPT).
I think the result of cfs_cpt_current() is only used as a hint for
load balancing, rather than as a precise and stable indicator of
the current CPU. So it doesn't need to be called with
preemption disabled.
So disable preemption inside cfs_cpt_current() to silence the warning.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 18 Dec 2017 23:01:47 +0000 (10:01 +1100)]
staging: lustre: use strim instead of cfs_trimwhite.
Linux lib provides identical functionality to cfs_trimwhite,
so discard that code and use the standard.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Narcisa Ana Maria Vasile [Wed, 6 Dec 2017 16:57:58 +0000 (18:57 +0200)]
iio: chemical: ccs811: Fix output of IIO_CONCENTRATION channels
in_concentration_raw should report, according to sysfs-bus-iio documentation,
a "Raw (unscaled no offset etc.) percentage reading of a substance."
Modify scale to convert from ppm/ppb to percentage:
1 ppm = 0.0001%
1 ppb = 0.
0000001%
There is no offset needed to convert the ppm/ppb to percentage,
so remove offset from IIO_CONCENTRATION (IIO_MOD_CO2) channel.
Cc'd stable to reduce chance of userspace breakage in the long
run as we fix this wrong bit of ABI usage.
Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Cc: <Stable@vger.kernel.org>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Venkat Prashanth B U [Sun, 7 Jan 2018 09:36:11 +0000 (15:06 +0530)]
imu:adis16480: fix debugfs_simple_attr.cocci warnings
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.
Semantic patch information:
Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
Signed-off-by: Venkat Prashanth B U <venkat.prashanth2498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Venkat Prashanth B U [Sun, 7 Jan 2018 09:01:57 +0000 (14:31 +0530)]
gyro:adis16136: fix debugfs_simple_attr.cocci warnings
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.
Semantic patch information:
Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
Signed-off-by: Venkat Prashanth B U <venkat.prashanth2498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
George Edward Bulmer [Sun, 7 Jan 2018 15:08:01 +0000 (15:08 +0000)]
staging: iio: light: Add breaks to lengthy lines
This fixes three instances of checkpatch warning:
WARNING: line over 80 characters
Signed-off-by: George Edward Bulmer <gebulmer@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Lorenzo Bianconi [Sat, 6 Jan 2018 22:23:25 +0000 (23:23 +0100)]
iio: imu: st_lsm6dsx: remove st_lsm6dsx_write_with_mask() declaration
Remove st_lsm6dsx_write_with_mask() declaration since it has been removed
in commit
6674bef628e6 ("iio: imu: st_lsm6dsx: add regmap API support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Lorenzo Bianconi [Sat, 6 Jan 2018 22:23:24 +0000 (23:23 +0100)]
iio: imu: st_lsm6dsx: pre-allocate read buffer at bootstrap
Allocate device read buffer at bootstrap and do not put it on the stack
since it is pretty big (~200B) and its size will increase adding support
to device hw timestamp.
Moreover this patch fixes following sparse warnings:
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:250:17: warning: Variable length
array is used.
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:283:55: error: cannot size
expression
Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tobin C. Harding [Sat, 6 Jan 2018 21:56:06 +0000 (08:56 +1100)]
iio: add field identifier for @use_count kernel-doc
Kernel-doc for @use_count does not currently have a field identifier.
All the rest of the fields do. @use_count is used internally and should
not be accessed directly by the driver so it should be marked as so.
Add [INTERN] identifier to @use_count field.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tobin C. Harding [Sat, 6 Jan 2018 21:56:05 +0000 (08:56 +1100)]
iio: add kernel-doc for field @owner
When building kernel documentation sphinx emits the following warning
warning: No description found for parameter 'owner'
Add description for struct member 'owner'.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sumit Pundir [Sat, 6 Jan 2018 15:05:24 +0000 (20:35 +0530)]
Staging: iio: cdc: ad7152: Prefer using BIT macro
This patch fixes the following checkpatch.pl issue at multiple lines:
CHECK: Prefer using the BIT macro
Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fabrice Gasnier [Fri, 5 Jan 2018 14:34:54 +0000 (15:34 +0100)]
iio: adc: stm32: fix scan of multiple channels with DMA
By default, watermark is set to '1'. Watermark is used to fine tune
cyclic dma buffer period. In case watermark is left untouched (e.g. 1)
and several channels are being scanned, buffer period is wrongly set
(e.g. to 1 sample). As a consequence, data is never pushed to upper layer.
Fix buffer period size, by taking scan channels number into account.
Fixes: 2763ea0585c9 ("iio: adc: stm32: add optional dma support")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Venkat Prashanth B U [Fri, 5 Jan 2018 03:43:57 +0000 (09:13 +0530)]
Drivers:iio:adc:ti_am335x_adc remove comparison to bool
This is the patch to the file ti_am335x_adc.c
which fixes the following coccinelle warning:
WARNING: Comparison to bool
Signed-off-by: Venkat Prashanth B U <venkat.prashanth2498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aishwarya Pant [Thu, 4 Jan 2018 10:58:51 +0000 (16:28 +0530)]
staging: iio: trigger: blackfin timer: replace device_attr with device_attr_rw
This is a clean-up patch which replaces DEVICE_ATTR() macro with the
file permission specific DEVICE_ATTR_RW() macro for compaction and
readability. Done using coccinelle.
Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Julia Lawall [Tue, 2 Jan 2018 13:28:07 +0000 (14:28 +0100)]
iio: common: ssp_sensors: account for const type of of_device_id.data
This driver creates a number of const structures that it stores in the
data field of an of_device_id array.
Add const to the declaration of the location that receives a value
from the data field to ensure that the compiler will continue to check
that the value is not modified and remove the const-dropping cast on
the access to the data field.
Done using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Lorenzo Bianconi [Mon, 1 Jan 2018 18:54:44 +0000 (19:54 +0100)]
iio: imu: st_lsm6dsx: add regmap API support
Introduce regmap API support to access to i2c/spi bus instead of
using a custom support. Set max bulk read to
(32 / SAMPLE_SIZE) * SAMPLE_SIZE since spi_write_then_read() used in
regmap_spi indicates that is the max buffer length to use in order to
avoid a kmalloc for each bus access.
Remove lock mutex since concurrency is already managed by regmap API
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Lorenzo Bianconi [Mon, 1 Jan 2018 18:54:43 +0000 (19:54 +0100)]
iio: imu: st_lsm6dsx: introduce conf_lock mutex
Add conf_lock mutex to prevent concurrent FIFO configuration update
Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Lorenzo Bianconi [Mon, 1 Jan 2018 18:54:42 +0000 (19:54 +0100)]
iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot()
Apply le16_to_cpu() to data read from the sensor in order to take into
account architecture endianness
Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Lorenzo Bianconi [Fri, 29 Dec 2017 23:33:04 +0000 (00:33 +0100)]
iio: humidity: hts221: move common code in hts221_core
Move duplicated i2c/spi probe code in hts221_probe()
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Tatschner [Tue, 12 Dec 2017 20:35:37 +0000 (21:35 +0100)]
iio:pressure:bmp280: Read calibration data in probe
This patch affects BME280 and BMP280. The readout of the calibration
data is moved to the probe function. Each sensor data access triggered
reading the full calibration data before this patch. According to the
datasheet, Section 4.4.2., the calibration data is stored in non-volatile
memory.
Since the calibration data does not change, and cannot be changed by the
user, we can reduce bus traffic by reading the calibration data once.
Additionally, proper organization of the data types enables removing
some odd casts in the compensation formulas.
Signed-off-by: Stefan Tatschner <stefan.tatschner@gmail.com>
Tested-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns [Thu, 21 Dec 2017 18:31:38 +0000 (19:31 +0100)]
iio: adc: ina2xx: Actually align the loop with the conversion ready flag
Currently, the registers are read out once per conversion interval. If
the reading is delayed as the conversion has not yet finished, this extra
time is treated as being part of the readout, although it should delay
the start of the poll interval. This results in the interval starting
slightly earlier in each iteration, until all time between reads is
spent polling the status registers instead of sleeping.
To fix this, the delay has to account for the state of the conversion
ready flag. Whenever the conversion is already finished, schedule the next
read on the regular interval, otherwise schedule it one interval after the
flag bit has been set.
Split the work function in two functions, one for the status poll and one
for reading the values, to be able to note down the time when the flag
bit is raised.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns [Thu, 21 Dec 2017 18:31:37 +0000 (19:31 +0100)]
iio: adc: ina2xx: Align timestamp with conversion ready flag
As the timestamp is no longer (ab-)used to measure the function run time,
it can be taken at the correct time, i.e. when the conversion has finished.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns [Mon, 1 Jan 2018 01:24:42 +0000 (02:24 +0100)]
iio: adc: ina2xx: Use a monotonic clock for delay calculation
The iio timestamp clock is user selectable and may be non-monotonic. Also,
only part of the acquisition time is measured, thus the delay was longer
than intended.
Use a monotonic timestamp to track the time for the next poll iteration.
The timestamp is advanced by the sampling interval each iteration. In case
the conversion overrruns the register readout (i.e. fast sampling combined
with a slow bus), one or multiple samples will be dropped.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tobin C. Harding [Tue, 19 Dec 2017 05:59:35 +0000 (16:59 +1100)]
iio: fix SPHINX kernel-docs build warning
When building kernel documentation sphinx emits the following warnings
No description found for parameter 'iio_dev'
Excess function parameter 'indio_dev' description in 'iio_device_register'
These warnings are caused by a macro with a different argument identifier to the
one listed in the kernel-docs.
Change macro argument to be the same as the docs.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Maciej Purski [Mon, 18 Dec 2017 08:43:58 +0000 (09:43 +0100)]
iio: adc: ina2xx: Make calibration register value fixed
Calibration register is used for calculating current register in
hardware according to datasheet:
current = shunt_volt * calib_register / 2048 (ina 226)
current = shunt_volt * calib_register / 4096 (ina 219)
Fix calib_register value to 2048 for ina226 and 4096 for ina 219 in
order to avoid truncation error and provide best precision allowed
by shunt_voltage measurement. Make current scale value follow changes
of shunt_resistor from sysfs as calib_register value is now fixed.
Power_lsb value should also follow shunt_resistor changes as stated in
datasheet:
power_lsb = 25 * current_lsb (ina 226)
power_lsb = 20 * current_lsb (ina 219)
This is a part of the patchset: https://lkml.org/lkml/2017/11/22/394
Signed-off-by: Maciej Purski <m.purski@samsung.com>
Reviewed-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ji-Hun Kim [Thu, 28 Dec 2017 02:47:18 +0000 (18:47 -0800)]
staging: iio: remove unnecessary parentheses
Clean up checkpatch warning:
CHECK: Unnecessary parentheses around 'st->devid != ID_AD7195'
Signed-off-by: Ji-Hun Kim <jihuun.k@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Venkat Prashanth B U [Sun, 17 Dec 2017 09:07:48 +0000 (14:37 +0530)]
Drivers: iio:adc: fix brace coding style issue in at91_adc.c
This is a patch to the at91_adc.c file that fixes up a brace
warning found by the checkpatch.pl tool
Signed-off-by: Venkat Prashanth B U <venkat.prashanth2498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andreas Klinger [Wed, 13 Dec 2017 17:10:34 +0000 (18:10 +0100)]
iio: hx711: fix bug in reset functionality
Return value in hx711_reset() should indicate status of dout otherwise the
calling function is reporting an error as false positive
If there are two reads too close to each other, then the second one will
never succeed. This happens especially when using buffered mode with both
channels enabled.
When changing the channel on every trigger event the former 100 ms are not
enough for waiting until the device indicates normal mode.
Wait up to 1 second until the device turns into normal mode.
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andreas Klinger [Wed, 13 Dec 2017 17:10:11 +0000 (18:10 +0100)]
iio: hx711: add triggered buffer support
Add buffer to device data struct and add trigger function
Data format is quite simple:
voltage - channel 0 32 Bit
voltage - channel 1 32 Bit
timestamp 64 Bit
Using both channels at the same time is working quite slow because of
changing the channel which needs a dummy read.
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns [Fri, 8 Dec 2017 17:41:49 +0000 (18:41 +0100)]
iio: adc: ina2xx: Do not udelay for several seconds
The conversion time can be up to 16 seconds (8 ms per channel, 2 channels,
1024 times averaging).
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns [Fri, 8 Dec 2017 17:41:48 +0000 (18:41 +0100)]
iio: adc: ina2xx: Remove unneeded dummy read to clear CNVR flag
Although the datasheet states the CNVR flag is cleared by reading the
BUS_VOLTAGE register, it is actually cleared by reading any of the
voltage/current/power registers.
The behaviour has been confirmed by TI support:
http://e2e.ti.com/support/amplifiers/current-shunt-monitors/f/931/p/647053/
2378282
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns [Fri, 8 Dec 2017 17:41:47 +0000 (18:41 +0100)]
iio: adc: ina2xx: Clarify size requirement for data buffer
The timestamp is inserted into the buffer after the sample data by
iio_push_to_buffers_with_timestamp, document the space requirement for
the timestamp.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns [Fri, 8 Dec 2017 17:41:46 +0000 (18:41 +0100)]
iio: adc: ina2xx: Remove bogus cast for data argument
iio_push_to_buffers_with_timestamp expects a void pointer, so the cast
is both unnecessary and misleading.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Blumenstingl [Tue, 31 Oct 2017 20:01:47 +0000 (21:01 +0100)]
iio: adc: meson-saradc: program the channel muxes during initialization
On some Meson8 devices the channel muxes are not programmed. This
results in garbage values when trying to read channels that are not set
up.
Fix this by initializing the channel 0 and 1 muxes in
MESON_SAR_ADC_CHAN_10_SW as well as the muxes for all other channels in
MESON_SAR_ADC_AUX_SW based on what the vendor driver does (which is
simply a 1:1 mapping of channel number and channel mux).
This only showed up on Meson8 devices, because for GXBB and newer BL30
is taking care of initializing the channel muxes.
This additionally fixes a typo in the
MESON_SAR_ADC_AUX_SW_MUX_SEL_CHAN_MASK macro because the old definition
assumed that the register fields were 2 bit wide, while they are
actually 3 bit wide.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Blumenstingl [Tue, 31 Oct 2017 20:01:46 +0000 (21:01 +0100)]
iio: adc: meson-saradc: fix the clock frequency on Meson8 and Meson8b
GX SoCs use a 1.2 MHz ADC clock, while the older SoCs use a 1.14 MHz
clock.
A comment in the driver from Amlogic's GPL kernel says that it's
running at 1.28 MHz. However, it's actually programming a divider of
20 + 1. With a XTAL clock of 24 MHz this results in a frequency of
1.14 MHz. (their calculation might be based on a 27 MHz XTAL clock,
but this is not what we have on the Meson8 and Meson8b SoCs).
The ADC was still working with the 1.2MHz clock. In my own tests I did
not see a difference between 1.2 and 1.14 MHz (regardless of the clock
frequency used, the ADC results were identical).
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Tue, 5 Dec 2017 10:57:27 +0000 (11:57 +0100)]
iio: ABI: Fix name of timestamp sysfs file
The name of the file is "current_timetamp_clock" not
"timestamp_clock".
Fixes: bc2b7dab629a ("iio:core: timestamping clock selection support")
Cc: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Pravin Shedge [Tue, 5 Dec 2017 02:00:19 +0000 (07:30 +0530)]
drivers: iio: gyro: remove duplicate includes
These duplicate includes have been found with scripts/checkincludes.pl but
they have been removed manually to avoid removing false positives.
Signed-off-by: Pravin Shedge <pravin.shedge4linux@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andrew F. Davis [Tue, 5 Dec 2017 19:12:01 +0000 (13:12 -0600)]
iio: dac: mcp4725: Remove unneeded conversions to bool
Found with scripts/coccinelle/misc/boolconv.cocci.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Benjamin Gaignard [Tue, 5 Dec 2017 14:55:59 +0000 (15:55 +0100)]
iio: stm32: Adopt SPDX identifier
Add SPDX identifier in stm32's files in IIO directory
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Colin Ian King [Mon, 4 Dec 2017 12:04:06 +0000 (12:04 +0000)]
iio: light: make a couple of config structures static
Structures st_uvis25_i2c_regmap_config and st_uvis25_spi_regmap_config are
local to the source and do not need to be in global scope, so make them
both static.
Cleans up sparse warnings:
warning: symbol 'st_uvis25_i2c_regmap_config' was not declared. Should
it be static?
warning: symbol 'st_uvis25_spi_regmap_config' was not declared. Should
it be static?
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>