NeilBrown [Wed, 11 Apr 2018 21:54:48 +0000 (07:54 +1000)]
staging: lustre: convert osc_quota hash to rhashtable
As this is indexed by an integer, an extensible array
or extensible bitmap would be better.
If/when xarray lands, we should change to use that.
For now, just a simple conversion to rhashtable.
When removing an entry, we need to hold rcu_read_lock()
across the lookup and remove in case we race with another thread
performing a removal. This means we need to use call_rcu()
to free the quota info so we need an rcu_head in there, which
unfortunately doubles the size of the structure.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Wed, 11 Apr 2018 21:54:48 +0000 (07:54 +1000)]
staging: lustre: convert obd uuid hash to rhashtable
The rhashtable data type is a perfect fit for the
export uuid hash table, so use that instead of
cfs_hash (which will eventually be removed).
As rhashtable supports lookups and insertions in atomic
context, there is no need to drop a spinlock while
inserting a new entry, which simplifies code quite a bit.
As there are no simple lookups on this hash table (only
insertions which might fail and take a spinlock), there is
no need to use rcu to free the exports.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Wed, 11 Apr 2018 21:54:48 +0000 (07:54 +1000)]
staging: lustre: convert lov_pool to use rhashtable
The pools hashtable can be implemented using
the rhashtable implementation in lib.
This has the benefit that lookups are lock-free.
We need to use kfree_rcu() to free a pool so
that a lookup racing with a deletion will not access
freed memory.
rhashtable has no combined lookup-and-delete interface,
but as the lookup is lockless and the chains are short,
this brings little cost. Even if a lookup finds a pool,
we must be prepared for the delete to fail to find it,
as we might race with another thread doing a delete.
We use atomic_inc_not_zero() after finding a pool in the
hash table and if that fails, we must have raced with a
deletion, so we treat the lookup as a failure.
Use hashlen_string() rather than a hand-crafted hash
function.
Note that the pool_name, and the search key, are
guaranteed to be nul terminated.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Wed, 11 Apr 2018 21:54:48 +0000 (07:54 +1000)]
staging: lustre: ptlrpc: convert conn_hash to rhashtable
Linux has a resizeable hashtable implementation in lib,
so we should use that instead of having one in libcfs.
This patch converts the ptlrpc conn_hash to use rhashtable.
In the process we gain lockless lookup.
As connections are never deleted until the hash table is destroyed,
there is no need to count the reference in the hash table. There
is also no need to enable automatic_shrinking.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 16 Apr 2018 00:42:37 +0000 (10:42 +1000)]
staging: lustre: remove libcfs/linux/libcfs.h
This include file is only included in one place,
and only contains a list of other include directives.
So just move all those to the place where this file
is included, and discard the file.
One include directive uses a local name ("linux-cpu.h"), so
that needs to be given a proper path.
Probably many of these should be remove from here, and moved to
just the files that need them.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 16 Apr 2018 00:42:37 +0000 (10:42 +1000)]
staging: lustre: move stack-check macros to libcfs_debug.h
CDEBUG_STACK() and CHECK_STACK() are macros to help with
debugging, so move them from
drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
to
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
This seems a more fitting location, and is a step towards
removing linux/libcfs.h and simplifying the include file structure.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Mon, 16 Apr 2018 04:15:10 +0000 (00:15 -0400)]
staging: lustre: llite: correct removexattr detection
In ll_xattr_set_common() detect the removexattr() case correctly by
testing for a NULL value as well as XATTR_REPLACE.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10787
Reviewed-on: https://review.whamcloud.com/
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Mon, 16 Apr 2018 04:15:09 +0000 (00:15 -0400)]
staging: lustre: llite: use xattr_handler name for ACLs
If struct xattr_handler has a name member then use it (rather than
prefix) for the ACL xattrs. This avoids a bug where ACL operations
failed for some kernels.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10785
Reviewed-on: https://review.whamcloud.com/
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Mon, 16 Apr 2018 04:15:07 +0000 (00:15 -0400)]
staging: lustre: llite: style changes in xattr.c
Small style changes to match more the kernel code standard
and it make it more readable.
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
James Simmons [Mon, 16 Apr 2018 04:15:06 +0000 (00:15 -0400)]
staging: lustre: llite: cleanup xattr code comments
Add proper punctuation to the comments. Change buf_size to size
for comment in ll_listxattr() since buf_size doesn't exit which
will confuse someone reading the code.
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
James Simmons [Mon, 16 Apr 2018 04:15:05 +0000 (00:15 -0400)]
staging: lustre: llite: use proper types in the xattr code
Convert __uXX types to uXX types since this is kernel code.
The function ll_lov_user_md_size() returns ssize_t so change
lum_size from int to ssize_t.
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
James Simmons [Mon, 16 Apr 2018 04:15:04 +0000 (00:15 -0400)]
staging: lustre: llite: cleanup posix acl xattr code
Having an extra ifdef makes the code harder to read. For the case
of ll_xattr_get_common() we have a variable initialized at the
start of the function but it is only used in XATTR_ACL_ACCESS_T
code block. Lets move that variable to that location since its
only used there and make the code look cleaner.
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
James Simmons [Mon, 16 Apr 2018 04:15:03 +0000 (00:15 -0400)]
staging: lustre: llite: record in stats attempted removal of lma/link xattr
Keep track of attempted deletions as well as changing of the
lma/link xattrs.
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
James Simmons [Mon, 16 Apr 2018 04:15:02 +0000 (00:15 -0400)]
staging: lustre: llite: remove newline in fullname strings
In creating the full name of a xattr a new line was added that
was seen by the remote MDS server which confused it. Remove the
newline.
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
James Simmons [Mon, 16 Apr 2018 04:15:01 +0000 (00:15 -0400)]
staging: lustre: llite: fix invalid size test in ll_setstripe_ea()
The size check at the start of ll_setstripe_ea() is only
valid for a directory. Move that check to the section of
code handling the S_ISDIR case.
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
Bobi Jam [Mon, 16 Apr 2018 04:15:00 +0000 (00:15 -0400)]
staging: lustre: llite: eat -EEXIST on setting trusted.lov
Tools like rsync, tar, cp may copy and restore the xattrs on a file.
The client previously ignored the setting of trusted.lov/lustre.lov
if the layout had already been specified, to avoid causing these
tools to fail for no reason.
For PFL files we still need to silently eat -EEXIST on setting these
attributes to avoid problems.
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9484
Reviewed-on: https://review.whamcloud.com/27126
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bobi Jam [Mon, 16 Apr 2018 04:14:59 +0000 (00:14 -0400)]
staging: lustre: llite: return from ll_adjust_lum() if lump is NULL
No need to check several times if lump is NULL. Just test once and
return 0 if NULL.
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9484
Reviewed-on: https://review.whamcloud.com/27126
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bobi Jam [Mon, 16 Apr 2018 04:14:58 +0000 (00:14 -0400)]
staging: lustre: llite: break up ll_setstripe_ea function
Place all the handling of information of trusted.lov that
is not stripe related into the new function ll_adjust_lum().
Now ll_setstripe_ea() only handles striping information.
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9484
Reviewed-on: https://review.whamcloud.com/27126
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Niu Yawei [Mon, 16 Apr 2018 04:14:57 +0000 (00:14 -0400)]
staging: lustre: llite: add simple comment about lustre.lov xattrs
Simple comment added to ll_xattr_set.
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24851
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Niu Yawei [Mon, 16 Apr 2018 04:14:56 +0000 (00:14 -0400)]
staging: lustre: llite: refactor lustre.lov xattr handling
The function ll_xattr_set() contains special code to handle
the lustre specific xattr lustre.lov. Move all this code to
a new function ll_setstripe_ea().
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24851
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Robin Humble [Mon, 16 Apr 2018 04:14:55 +0000 (00:14 -0400)]
staging: lustre: llite: Remove filtering of seclabel xattr
The security.capability xattr is used to implement File
Capabilities in recent Linux versions. Capabilities are a
fine grained approach to granting executables elevated
privileges. eg. /bin/ping can have capabilities
cap_net_admin, cap_net_raw+ep instead of being setuid root.
This xattr has long been filtered out by llite, initially for
stability reasons (b15587), and later over performance
concerns as this xattr is read for every file with eg.
'ls --color'. Since LU-2869 xattr's are cached on clients,
alleviating most performance concerns.
Removing llite's filtering of the security.capability xattr
enables using Lustre as a root filesystem, which is used on
some large clusters.
Signed-off-by: Robin Humble <plaguedbypenguins@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9562
Reviewed-on: https://review.whamcloud.com/27292
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.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>
John L. Hammond [Mon, 16 Apr 2018 04:14:54 +0000 (00:14 -0400)]
staging: lustre: llite: handle xattr cache refill race
In ll_xattr_cache_refill() if the xattr cache was invalid (and no
request was sent) then return -EAGAIN so that ll_getxattr_common()
caller will fetch the xattr from the MDT.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10132
Reviewed-on: https://review.whamcloud.com/29654
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
Vitaly Fertman [Mon, 16 Apr 2018 04:14:53 +0000 (00:14 -0400)]
staging: lustre: ldlm: xattr locks are lost on mdt
On the server side mdt_intent_getxattr() can return EFAULT if a
buffer cannot be found, it is returned after lock_replace, where a
new lock is installed into lockp. An error forces ldlm_lock_enqueue()
to destroy the original lock, but ldlm_handle_enqueue0() drops the
reference on the new lock. The xattr client code implied intent
error is returned under a lock, which is immediately cancelled.
Check if a lock obtained and cancel it properly for error cases.
Note: we should support both cases for interop needs, an intent
error under a lock and with a lock abort. Keep returning a lock
with an intent error for interop purposes for now, to be dropped
later when client will get old enough. make all intent ops to
work through md_intent_lock: getxattr and layout, which should
extract the intent error.
Signed-off-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7433
Seagate-bug-id: MRP-3072 MRP-3137
Reviewed-on: http://review.whamcloud.com/17220
Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Reviewed-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com>
Reviewed-by: John L. Hammond <john.hammond@intel.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>
Vitaly Fertman [Mon, 16 Apr 2018 04:14:52 +0000 (00:14 -0400)]
staging: lustre: obd: change debug reporting in lmv_enqueue()
Remove LL_IT2STR(it) from debug macros in lmv_enqueue(). The
removal makes it possible to simplify the md_enqueue() functions.
Signed-off-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7433
Seagate-bug-id: MRP-3072 MRP-3137
Reviewed-on: http://review.whamcloud.com/17220
Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Reviewed-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com>
Reviewed-by: John L. Hammond <john.hammond@intel.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>
Vitaly Fertman [Mon, 16 Apr 2018 04:14:51 +0000 (00:14 -0400)]
staging: lustre: obd: create it_has_reply_body()
The lookup_intent it_op fields in many cases will be compared
to the settings of IT_OPEN | IT_UNLINK | IT_LOOKUP | IT_GETATTR.
Create a simple inline function for this common case.
Signed-off-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7433
Seagate-bug-id: MRP-3072 MRP-3137
Reviewed-on: http://review.whamcloud.com/17220
Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Reviewed-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com>
Reviewed-by: John L. Hammond <john.hammond@intel.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>
James Simmons [Mon, 16 Apr 2018 04:14:50 +0000 (00:14 -0400)]
staging: lustre: llite: initialize xattr->xe_namelen
When the allocation of xattr->xe_name was moved to kstrdup()
setting xattr->xe_namelen was dropped. This field is used
in several parts of the xattr cache code so it broke xattr
handling. Initialize xattr->xe_namelen when allocating
xattr->xe_name succeeds. Also change the debugging statement
to really report the xattr name instead of its length which
wasn't event being set.
Fixes:
b3dd8957c23a ("staging: lustre: lustre: llite: Use kstrdup"
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Fri, 30 Mar 2018 19:10:06 +0000 (15:10 -0400)]
staging: lustre: libcfs: use dynamic minors for /dev/{lnet, obd}
Request dynamic minor allocation when registering /dev/lnet and
/dev/obd.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-100086
Reviewed-on: https://review.whamcloud.com/29741
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: remove cruft from libcfs/linux/libcfs.h
These defines are unused or nearly unused, and do not
help at all.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: discard linux-time.h
Very little is left in linux-time.h.
Move CFS_TICK to libcfs.h discard the test.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: discard cfs_time_before_64()
cfs_time_before_64 is the same as time_before64()
similarly cfs_time_beforeq_64() matsches time_before_eq64()
So just use the standard interfaces.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: discard cfs_duration_sec()
cfs_duration_sec() simply divides by HZ.
It is mostly used to report durations in debug messages.
Remove and just use X/HZ.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: libcfs: remove cfs_timeout_cap()
This wrapper is only used once, so open-code it as max().
This allows us to remove the libcfs_time.h include file.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: libcfs: discard cfs_time_after()
cfs_time_after() behaves exactly like time_after()
similarly cfs_time_aftereq() matches time_after_eq()
so discard the cfs versions.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: libcfs: discard cfs_time_shift().
This function simply multiplies by HZ and adds jiffies.
This is simple enough to be opencoded, and doing so
makes the code easier to read.
Same for cfs_time_shift_64()
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: libcfs: discard cfs_time_add/sub
cfs_time_add adds its arguments.
cfs_time_sub subtracts finds the difference.
Discard these and use '+' and '-' directly.
This change highlighted a type error. The structure field
cr_queued_time was used to store jiffies, but was declared
as time_t (meant for seconds). So the time is changed to
"unsigned long".
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: cfs_time_current() -> jiffies.
Discard cfs_time_current() and cfs_time_current64()
and use jiffies and get_jiffies_64() like the rest of the kernel.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Hartman [Fri, 13 Apr 2018 05:17:22 +0000 (22:17 -0700)]
staging: Android: Add 'vsoc' driver for cuttlefish.
The cuttlefish system is a virtual SoC architecture based on QEMU. It
uses the QEMU ivshmem feature to share memory regions between guest and
host with a custom protocol.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Todd Kjos <tkjos@android.com>
Cc: Martijn Coenen <maco@android.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: devel@driverdev.osuosl.org
Cc: kernel-team@android.com
Signed-off-by: Greg Hartman <ghartman@google.com>
[astrachan: rebased against 4.16, added TODO, fixed checkpatch issues]
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Todd Poynor [Sat, 21 Apr 2018 02:56:29 +0000 (19:56 -0700)]
staging: android: ion: remove duplicate buffer field initializes
As a result of various previous patches, ion_buffer_create() now
has two sets of identical statements for initializing two fields of
the buffer struct, next to each other. Remove one set.
Move the initialization of these two fields together with the
statements that initialize the other two fields from the function
parameters, prior to the heap allocate() call, for consistency.
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: ldlm: free resource when ldlm_lock_create() fails.
ldlm_lock_create() gets a resource, but don't put it on
all failure paths. It should.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: tidy up ldlm_resource_putref()
1/ the return value of ldlm_resource_putref() is never
used, so change it to return 'void'.
2/ Move all of the code to run on the last putref to
__ldlm_resource_putref_final(). This means a lock
is taken in one function and dropped in another, but
that isn't too uncommon, and will disappear in a future
patch.
Now that the code it together, it becomes apparent that
we are dropping a ref on the namespace *before* the last
use. So keep the ref until after.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: remove unneeded include.
cfs_hash usage was removed from cl_object.c
some time ago, so remove the #include as well.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: remove unused hash tables.
exp_lock_hash and exp_flock_hash are unused in
the client, so remove all references.
Also remove unused hashtable size definitions.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: remove unused ldlm_completion_ast_async()
This function is unused.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: remove invariant in cl_io_read_ahead()
This invariant can fail as ci_type is somtimes CIS_INIT.
According to Jinshan Xiong, or of the most recent significant
change to this code, "We should get rid of it."
So do that.
Fixes:
1e1db2a97be5 ("staging: lustre: clio: Revise read ahead implementation")
Cc: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marc Dietrich [Thu, 19 Apr 2018 11:01:50 +0000 (13:01 +0200)]
staging: nvec: convert to use GPIO descriptors
Use GPIO descriptors instead of relying on the old method.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marc Dietrich [Thu, 19 Apr 2018 11:01:49 +0000 (13:01 +0200)]
staging: nvec: cleanup use of dev in probe function
This cleanups the probe function a bit by using a dev variable instead
of &pdev-dev.
Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wolfram Sang [Thu, 19 Apr 2018 14:06:19 +0000 (16:06 +0200)]
staging: nvec: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Renato Soma [Wed, 18 Apr 2018 02:03:02 +0000 (23:03 -0300)]
staging: fbtft: Fixed lines exceeding columns limit
Fix checkpatch.pl warnings of lines exceeding 80 columns.
Break lines in order to reduce instructions lengths to less than 80 columns.
Signed-off-by: Renato Soma <renatoys08@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:21 +0000 (10:41 +0200)]
staging: wilc1000: Augment TODO file with GPIO work item
To make sure that this driver does not leave staging before it
is properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Cc: Johnny Kim <johnny.kim@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:20 +0000 (10:41 +0200)]
staging: olpc_dcon: Augment TODO file with GPIO work item
To make sure that this driver does not leave staging before it
is properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Cc: Andres Salomon <dilinger@queued.net>
Cc: Jens Frederich <jfrederich@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:19 +0000 (10:41 +0200)]
staging: nvec: Augment TODO file with GPIO work item
To make sure that this driver does not leave staging before it
is properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Cc: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:18 +0000 (10:41 +0200)]
staging: gpio-mt7621: Include the right header
GPIO drivers should include <linux/gpio/driver.h> only, the
<linux/gpio.h> header is deprecated.
Cc: John Crispin <john@phrozen.org>
Cc: Zhiyong Tao <zhiyong.tao@mediatek.com>
Cc: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:17 +0000 (10:41 +0200)]
staging: atomisp: Augment TODO file with GPIO work item
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:16 +0000 (10:41 +0200)]
staging: iio: Augment TODO file with GPIO work item
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:15 +0000 (10:41 +0200)]
staging: greybus: Add TODO file with GPIO work items
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API, and the
GPIOLIB_IRQCHIP helper library, create the TODO file with these work
items.
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:14 +0000 (10:41 +0200)]
staging: fbtft: Add TODO file with GPIO work item
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API, create
the TODO file with this work item.
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Noralf Tronnes <notro@tronnes.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Walleij [Thu, 19 Apr 2018 08:41:13 +0000 (10:41 +0200)]
staging: emxx_udc: Add GPIO descriptor work to TODO
To make sure this driver does not leave staging without a proper
conversion to the GPIO descriptor API, leave a note in the TODO.
Cc: Magnus Damm <damm+renesas@opensource.se>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:15 +0000 (07:08 +0200)]
staging: ks7010: init local variables when they are declared in ks7010_sdio_probe
This commit change init point of two variables to forward them to
init time. This variables are just being assigned some lines after
and it is more clear to init them when the init value is known and
in this case this is known when they are declared.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:13 +0000 (07:08 +0200)]
staging: ks7010: align comments in ks_wlan_private_handler
This commit align comment inside ks_wlan_private_handler
WEXT private driver operations. This improves readability.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:10 +0000 (07:08 +0200)]
staging: ks7010: review includes of michael_mic.c file
This commit reviews includes of michael_mic.c source file
removing those which are not being used at all and
reordering the remaining ones in alphabetically order.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:09 +0000 (07:08 +0200)]
staging: ks7010: review includes of ks7010_sdio file
This commit reviews includes of ks7010_sdio.c source
file removing those which are not being used at all.
Kernel header includes have been ordered alphabetically
also.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:06 +0000 (07:08 +0200)]
staging: ks7010: remove enum from ks_wlan.h header
This commit removes an enum which is in ks_wlan.h
and it is not being used at all.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:04 +0000 (07:08 +0200)]
staging: ks7010: review includes of ks_wlan.h file
This commit reviews includes of ks_wlan.h header file.
It removes those which are not being used at all. It
also reorder remaining ones in alphabetical order.
The linux/module.h include file has been moved to the
correct file which is ks7010_sdio.c in order to be able
to compile the driver without problems.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:03 +0000 (07:08 +0200)]
staging: ks7010: review includes of ks_wlan_net.c file
This commit reviews really needed includes in ks_wlan_net.c
source file. It removes those which are not needed at all.
It also reorder the remaining ones in alphabetical order.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:02 +0000 (07:08 +0200)]
staging: ks7010: refactor ks_wlan_set_wps_enable function
This commit refactors ks_wlan_set_wps_enable function to
improve readability handling the error first to avoid an
'else'.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:01 +0000 (07:08 +0200)]
staging: ks7010: refactor ks_wlan_set_tx_gain function
This commit refactors ks_wlan_set_rx_gain function to
improve readability:
- error condition is handling the error to avoid an 'else'
- ternary operator is used to clean if-else block assignment.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:08:00 +0000 (07:08 +0200)]
staging: ks7010: refactor ks_wlan_set_rx_gain function
This commit refactors ks_wlan_set_rx_gain function to
improve readability:
- error condition is handling the error to avoid an 'else'
- ternary operator is used to clean if-else block assignment.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:07:59 +0000 (07:07 +0200)]
staging: ks7010: change if-else condition assignment to use ternary operator
This commit changes an if-else block used to just assign a
variable to use a ternary operator to do the same improving
readability.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:07:58 +0000 (07:07 +0200)]
staging: ks7010: refactor ks_wlan_set_encode function
This commit refactors ks_wlan_set_encode function to improve
readability. It just removes level indentation in some paths
as well as removes not needed conditions paths which was
checked before. Changes are as follows:
- (dwrq->length > MAX_KEY_SIZE) check has been moved to the top.
- extra check about (dwrq->length > 0) inside an if block where
that was the condition to enter inside it has been removed.
- (dwrq->flags & IW_ENCODE_NOKEY) check has been turned to avoid
one level indentation.
- extra check (index >= 0) && (index < 4) has been removed. In
the top of the file invalid index values are being checked
so it has no sense to check that again.
- remove commented line.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:07:57 +0000 (07:07 +0200)]
staging: ks7010: remove auxiliar zeros buffer in ks_wlan_get_encode
This commit removes the local buffer zeros in ks_wlan_get_encode
function. It also refactors related conditions in order to fill
'extra' output parameter of the function. Originally this zeros
is just memset to zeros and only being used if drw->length is
truncated to zero because of priv->reg.wep_key[index].size is
greater than 16 chars. In those cases the final if statement is
just using zeros but it is using memcpy with a length of zero
bytes which has no sense. Instead of that just handle the good
case copying from the same source the number of bytes of
priv->reg.wep_key[index].size. If it is zero the final 'extra'
parameter won't be copied at all because the number of bytes to
copy will be zero. With this change the code gets simplified.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:07:56 +0000 (07:07 +0200)]
staging: ks7010: remove not used enum in eap_packet header file
This commit removes an anonymous enumerator inside eap_packet
header file because it is not being used anymore.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Thu, 19 Apr 2018 05:07:55 +0000 (07:07 +0200)]
staging: ks7010: remove struct ieee802_1x_eapol_key
This commit removes ieee802_1x_eapol_key struct because
it is not being used at all. It also removes definitions
related to some fields of the removed struct.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Mon, 16 Apr 2018 10:29:32 +0000 (12:29 +0200)]
staging: ks7010: group some cases in switch-case block in hostif_mib_set_confirm
This commit groups some case statements because its behaviour is
just do nothing which is the same as the default. Clean 'break'
keyword in those which are affected.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Mon, 16 Apr 2018 10:29:29 +0000 (12:29 +0200)]
staging: ks7010: refactor code for hostif_sme_sleep_set function
This commit refactors code for hostif_sme_sleep_set function. This
function was using a switch-case block to handle only two states
where the action to do for them is the same. Just refactor a bit
to check for return condition at first and doing the common action
after in other case.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Mon, 16 Apr 2018 10:29:28 +0000 (12:29 +0200)]
staging: ks7010: remove nonsense break from case block
This commit removes 'break' from case block because the
code is just using the 'default' break for some cases and
this one can be included also there.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Mon, 16 Apr 2018 10:29:27 +0000 (12:29 +0200)]
staging: ks7010: change return value of ks_wlan_do_power_save function
This commit change return value of ks_wlan_do_power_save function
from int to void. This function is just returning zero and return
value is not being checked also, so it is nonsense to return an
integer.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Mon, 16 Apr 2018 10:29:23 +0000 (12:29 +0200)]
staging: ks7010: use linux circular buffer header macros to handle tx and rx queues
This commit replace current custom implementation of some circular
buffer head and tail logic in favour of the use of macros defined
in linux circ_buf.h header. Queue related inline function names
have been review also.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:51 +0000 (14:37 +0200)]
staging: ks7010: use msecs_to_jiffies in ks7010_rw_function function
This commit replaces custom time calculations done in ks7010_rw_function
with msecs_to_jiffies() function which has the same behaviour.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:50 +0000 (14:37 +0200)]
staging: ks7010: change sdio related read/write function parameter types
This commit reviews and changes SDIO related read and write
functions parameter types to use the preferred u* kernel types.
Also length parameter which was defined as int has nonsense
because calls to this functions are called useing an unsigned
instead. Because of this length parameters have been changed
also into unsigned int.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:49 +0000 (14:37 +0200)]
staging: ks7010: fix remaining long line warnings in ks7010_sdio source
This commit fixes remaining checkpatch warnings because of
the use of lines longer than 80 characters in ks7010_sdio
source file. After this clean, this file has no remaining
warnings around.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:48 +0000 (14:37 +0200)]
staging: ks7010: remove nonsense comment
This commit removes a comment which has nonsense because
it is obvious what the code does just reading SET_NETDEV_DEV
declaration. This also fixes a checkpatch warning because a
line longer than 80 characters.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:47 +0000 (14:37 +0200)]
staging: ks7010: remove '\' character from michael_block function
This commit removes '\' character from michael_block function.
It seems these two were not removed properly in the following
commit:
- staging: ks7010: replace MichaelBlockFunction macro with
inline function (
c61cc2cc3be358da10121d119356dfe67fe240f2).
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:45 +0000 (14:37 +0200)]
staging: ks7010: remove nosense #if 1 directive
This commit removes #if 1 directive from code to
improve readability. It is always true, so it makes
no sense to have it there.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:44 +0000 (14:37 +0200)]
staging: ks7010: remove KS_WLAN_MEM_FLAG definition
This commit removes KS_WLAN_MEM_FLAG definition which is
hiding GFP_ATOMIC along the code. It is better to use directly
GFP_ATOMIC in kmalloc's because this it is easier to read.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:43 +0000 (14:37 +0200)]
staging: ks7010: rewrite hif_align_size inline function
This commit rewrites hif_align_size inline function to
improve readability. It also change parameters and return
type from int to size_t which is the correct and the one
which is being used when this function is called from
several points of the code.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:42 +0000 (14:37 +0200)]
staging: ks7010: remove KS_ATOM preprocessor condtional code
This commit removes KS_ATOM preprocessor conditional code from
hif_align_size because it is not defined anywhere.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:41 +0000 (14:37 +0200)]
staging: ks7010: move and rename DEVICE_ALIGNMENT into correct header
This commit moves DEVICE_ALIGNMENT definition into the header ks_hostif.h
which is where it is being used. This is also defined always so just
remove nosense undef definitions also and clean some preprocessor
conditional directives in hif_align_size function.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:40 +0000 (14:37 +0200)]
staging: ks7010: indent enum properly in eap_packet.h header file
This commit indents properly some enumeration values to improve
code readability a bit.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:39 +0000 (14:37 +0200)]
staging: ks7010: change ETHER_HDR_SIZE definition to use the size of struct ether_hdr
This commit changes ETHER_HDR_SIZE definition which is a hardcoded
number using the size of the structure ether_hdr which is the one
for what this definition has been created. This improves readability
and makes clear the intention of this definition along the code.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:38 +0000 (14:37 +0200)]
staging: ks7010: remove two redefined defines in eap_packet.h header
This commit removes GENERIC_INFO_ELEM and RSN_INFO_ELEM definitions
from eap_packet.h header file which are not being used at all.
These two are also defined in the ks_wlan_net.c source file as
GENERIC_INFO_ELEM_ID and RSN_INFO_ELEM_ID with the same values.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:37 +0000 (14:37 +0200)]
staging: ks7010: remove EAPOL_VERSION preprocessor definition
This commit removes EAPOL_VERSION define from eap_packet.h
header file because it is not being used anywhere.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Fri, 6 Apr 2018 12:37:36 +0000 (14:37 +0200)]
staging: ks7010: remove not used enum values from eap_packet.h header
This commit removes not used at all enum values from eap_packet.h
header file. This values are defined in the kernel ieee80211.h
header and the only one that is being used in ks_wlan_net.c source
which is WLAN_REASON_MIC_FAILURE is being used from this header.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo A. R. Silva [Thu, 12 Apr 2018 16:23:51 +0000 (11:23 -0500)]
staging: ks7010_sdio: fix NULL pointer dereference and memory leak
priv is being explicitly dereferenced when it is still null, when
jumping to goto label err_free_netdev, before it is properly
updated with a valid memory address.
Also, when this happens, memory allocated for netdev at line 854:
netdev = alloc_etherdev(sizeof(*priv)) is not being free'd before
return, hence there is a memory leak.
The current code looks a bit too complicated and can be replaced
by just directly freeing netdev before return.
Notice that card->priv = NULL isn't required because the next thing
we do to card is kfree(card).
Addresses-Coverity-ID: 1467844 ("Explicit null dereferenced")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jia-Ju Bai [Tue, 10 Apr 2018 08:58:54 +0000 (16:58 +0800)]
staging: ks7010: Replace mdelay with usleep_range in ks7010_upload_firmware
ks7010_upload_firmware() is never called in atomic context.
The call chain ending up at ks7010_upload_firmware() is:
[1] ks7010_upload_firmware() <- ks7010_sdio_probe()
ks7010_sdio_probe() is set as ".probe" in struct sdio_driver.
This function is not called in atomic context.
Despite never getting called from atomic context, ks7010_upload_firmware()
calls mdelay() to busily wait.
This is not necessary and can be replaced with usleep_range() to
avoid busy waiting.
This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ji-Hun Kim [Fri, 6 Apr 2018 04:57:20 +0000 (13:57 +0900)]
staging: ks7010: replace kmalloc() + memcpy() with kmemdup()
Use kmemdup rather than duplicating its implementation.
Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Tue, 3 Apr 2018 15:13:02 +0000 (17:13 +0200)]
staging: ks7010: fix some style issues about long lines
This commit just fixes some checkpatch reported issues about
lines longer than 80 characters.
A new blank line has been added also to improve readability.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Tue, 3 Apr 2018 15:13:01 +0000 (17:13 +0200)]
staging: ks7010: ks7010: factor out firmware copy process into ks7010_copy_firmware
This commit extracts firmware copy process into a new function
ks7010_copy_firmware. Because rom_buf is only needed for this
process, memory request for it has been also moved to this new
function so the error handling label release_host_and_free has
been renamed to release_host into ks7010_upload_firmware original
function.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Tue, 3 Apr 2018 15:13:00 +0000 (17:13 +0200)]
staging: ks7010: fix error handling in ks7010_upload_firmware
This commit checks missing error code check when checking
if the firmware is running reading General Communication
Register A (GCR_A).
It also set ret to EBUSY if firmware is running before
copying it.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Tue, 3 Apr 2018 15:12:59 +0000 (17:12 +0200)]
staging: ks7010: factor out initial enqueue process into ks7010_sme_enqueue_events
This commit extract initial enqueue process into a new
ks7010_sme_enqueue_events function.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sergio Paracuellos [Tue, 3 Apr 2018 15:12:58 +0000 (17:12 +0200)]
staging: ks7010: factor out ks_wlan_private init process into ks7010_private_init
This commit extract ks_wlan_private initialization process
into a new function ks7010_private_init to improve a bit
readability.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>