Re: [PATCH v2] binder: fix use-after-free due to fdget() optimization

2018-12-05 Thread Al Viro
On Wed, Dec 05, 2018 at 04:21:55PM -0800, Todd Kjos wrote:

> > How about grabbing the references to all victims (*before* screwing with
> > ksys_close()), sticking them into a structure with embedded callback_head
> > and using task_work_add() on it, the callback doing those fput()?
> >
> > The callback would trigger before the return to userland, so observable
> > timing of the final close wouldn't be changed.  And it would avoid the
> > kludges like this.
> 
> I'll rework it according to your suggestion. I had hoped to do this in a way
> that doesn't require adding calls to non-exported functions since we are
> trying to clean up binder (I hear you snickering) to be a better citizen and
> not rely on internal functions that drivers shouldn't be using. I presume
> there are no plans to export task_work_add()...

Er...  Your variant critically depends upon binder being non-modular; if it
*was* built as a module, you could
* lose the timeslice just after your fput()
* have another process hit the final fput() *and* close the struct file
* now that module refcount is not pinned by anything, get rmmod remove
your module
* have the process in binder_ioctl() regain the timeslice and find the
code under it gone.

That's one of the reasons why such kludges are brittle as hell - normally you
are guaranteed that once fdget() has succeeded, the final fput() won't happen
until fdput().  With everything that guarantees in terms of code/data not going
away under you.  This patch relies upon the lack of accesses to anything
sensitive after that fput() added into binder_ioctl().  Which is actually
true, but only because the driver is not modular...

At least this variant (task_work_add()-based) doesn't depend on anything
subtle - the lack of exports is the only problem there (IOW, it would've
worked in a module if not for that).
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] media: rockchip vpu: remove some unused vars

2018-12-05 Thread Mauro Carvalho Chehab
As complained by gcc:

drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c: In 
function 'rk3288_vpu_jpeg_enc_set_qtable':
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c:70:10: 
warning: variable 'chroma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *chroma_qtable_p;
  ^~~
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c:69:10: 
warning: variable 'luma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *luma_qtable_p;
  ^
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c: In 
function 'rk3399_vpu_jpeg_enc_set_qtable':
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c:101:10: 
warning: variable 'chroma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *chroma_qtable_p;
  ^~~
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c:100:10: 
warning: variable 'luma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *luma_qtable_p;
  ^
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c: In function 
'rockchip_vpu_queue_setup':
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c:522:33: warning: 
variable 'vpu_fmt' set but not used [-Wunused-but-set-variable]
  const struct rockchip_vpu_fmt *vpu_fmt;
 ^~~
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c: In function 
'rockchip_vpu_buf_prepare':
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c:560:33: warning: 
variable 'vpu_fmt' set but not used [-Wunused-but-set-variable]
  const struct rockchip_vpu_fmt *vpu_fmt;
 ^~~

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 5 -
 drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 5 -
 drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c   | 6 --
 3 files changed, 16 deletions(-)

diff --git a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c 
b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
index e27c10855de5..5282236d1bb1 100644
--- a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
+++ b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
@@ -66,13 +66,8 @@ rk3288_vpu_jpeg_enc_set_qtable(struct rockchip_vpu_dev *vpu,
   unsigned char *luma_qtable,
   unsigned char *chroma_qtable)
 {
-   __be32 *luma_qtable_p;
-   __be32 *chroma_qtable_p;
u32 reg, i;
 
-   luma_qtable_p = (__be32 *)luma_qtable;
-   chroma_qtable_p = (__be32 *)chroma_qtable;
-
for (i = 0; i < VEPU_JPEG_QUANT_TABLE_COUNT; i++) {
reg = get_unaligned_be32(_qtable[i]);
vepu_write_relaxed(vpu, reg, VEPU_REG_JPEG_LUMA_QUAT(i));
diff --git a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c 
b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
index 5f75e4d11d76..dbc86d95fe3b 100644
--- a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
+++ b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
@@ -97,13 +97,8 @@ rk3399_vpu_jpeg_enc_set_qtable(struct rockchip_vpu_dev *vpu,
   unsigned char *luma_qtable,
   unsigned char *chroma_qtable)
 {
-   __be32 *luma_qtable_p;
-   __be32 *chroma_qtable_p;
u32 reg, i;
 
-   luma_qtable_p = (__be32 *)luma_qtable;
-   chroma_qtable_p = (__be32 *)chroma_qtable;
-
for (i = 0; i < VEPU_JPEG_QUANT_TABLE_COUNT; i++) {
reg = get_unaligned_be32(_qtable[i]);
vepu_write_relaxed(vpu, reg, VEPU_REG_JPEG_LUMA_QUAT(i));
diff --git a/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c 
b/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c
index 038a7136d5d1..ab0fb2053620 100644
--- a/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c
+++ b/drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c
@@ -519,17 +519,14 @@ rockchip_vpu_queue_setup(struct vb2_queue *vq,
 struct device *alloc_devs[])
 {
struct rockchip_vpu_ctx *ctx = vb2_get_drv_priv(vq);
-   const struct rockchip_vpu_fmt *vpu_fmt;
struct v4l2_pix_format_mplane *pixfmt;
int i;
 
switch (vq->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
-   vpu_fmt = ctx->vpu_dst_fmt;
pixfmt = >dst_fmt;
break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
-   vpu_fmt = ctx->vpu_src_fmt;
pixfmt = >src_fmt;
break;
default:
@@ -557,7 +554,6 @@ static int rockchip_vpu_buf_prepare(struct vb2_buffer *vb)
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct 

[PATCH] media: rockchip vpu: remove some unused vars

2018-12-05 Thread Mauro Carvalho Chehab
As complained by gcc:

drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c: In 
function 'rk3288_vpu_jpeg_enc_set_qtable':
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c:70:10: 
warning: variable 'chroma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *chroma_qtable_p;
  ^~~
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c:69:10: 
warning: variable 'luma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *luma_qtable_p;
  ^
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c: In 
function 'rk3399_vpu_jpeg_enc_set_qtable':
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c:101:10: 
warning: variable 'chroma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *chroma_qtable_p;
  ^~~
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c:100:10: 
warning: variable 'luma_qtable_p' set but not used [-Wunused-but-set-variable]
  __be32 *luma_qtable_p;
  ^
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c: In function 
'rockchip_vpu_queue_setup':
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c:522:33: warning: 
variable 'vpu_fmt' set but not used [-Wunused-but-set-variable]
  const struct rockchip_vpu_fmt *vpu_fmt;
 ^~~
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c: In function 
'rockchip_vpu_buf_prepare':
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c:560:33: warning: 
variable 'vpu_fmt' set but not used [-Wunused-but-set-variable]
  const struct rockchip_vpu_fmt *vpu_fmt;
 ^~~

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c 
b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
index e27c10855de5..5282236d1bb1 100644
--- a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
+++ b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
@@ -66,13 +66,8 @@ rk3288_vpu_jpeg_enc_set_qtable(struct rockchip_vpu_dev *vpu,
   unsigned char *luma_qtable,
   unsigned char *chroma_qtable)
 {
-   __be32 *luma_qtable_p;
-   __be32 *chroma_qtable_p;
u32 reg, i;
 
-   luma_qtable_p = (__be32 *)luma_qtable;
-   chroma_qtable_p = (__be32 *)chroma_qtable;
-
for (i = 0; i < VEPU_JPEG_QUANT_TABLE_COUNT; i++) {
reg = get_unaligned_be32(_qtable[i]);
vepu_write_relaxed(vpu, reg, VEPU_REG_JPEG_LUMA_QUAT(i));
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] binder: fix kerneldoc header for struct binder_buffer

2018-12-05 Thread Todd Kjos
Fix the incomplete kerneldoc header for struct binder_buffer.

Signed-off-by: Todd Kjos 
---
v2: no code change. Removed needless "Change-Id:"
There is no dependancy on patch 1/3

 drivers/android/binder_alloc.h | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h
index fb3238c74c8a8..c0aadbbf7f193 100644
--- a/drivers/android/binder_alloc.h
+++ b/drivers/android/binder_alloc.h
@@ -30,16 +30,16 @@ struct binder_transaction;
  * struct binder_buffer - buffer used for binder transactions
  * @entry:  entry alloc->buffers
  * @rb_node:node for allocated_buffers/free_buffers rb trees
- * @free:   true if buffer is free
- * @allow_user_free:describe the second member of struct blah,
- * @async_transaction:  describe the second member of struct blah,
- * @debug_id:   describe the second member of struct blah,
- * @transaction:describe the second member of struct blah,
- * @target_node:describe the second member of struct blah,
- * @data_size:  describe the second member of struct blah,
- * @offsets_size:   describe the second member of struct blah,
- * @extra_buffers_size: describe the second member of struct blah,
- * @data:i  describe the second member of struct blah,
+ * @free:   %true if buffer is free
+ * @allow_user_free:%true if user is allowed to free buffer
+ * @async_transaction:  %true if buffer is in use for an async txn
+ * @debug_id:   unique ID for debugging
+ * @transaction:pointer to associated struct binder_transaction
+ * @target_node:struct binder_node associated with this buffer
+ * @data_size:  size of @transaction data
+ * @offsets_size:   size of array of offsets
+ * @extra_buffers_size: size of space for other objects (like sg lists)
+ * @data:   pointer to base of buffer space
  *
  * Bookkeeping structure for binder transaction buffers
  */
-- 
2.20.0.rc1.387.gf8505762e3-goog

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/3] binder: fix sparse warnings on locking context

2018-12-05 Thread Todd Kjos
Add __acquire()/__release() annnotations to fix warnings
in sparse context checking

There is one case where the warning was due to a lack of
a "default:" case in a switch statement where a lock was
being released in each of the cases, so the default
case was added.

Signed-off-by: Todd Kjos 
---
v2: no change, just resubmitted as #1 of 3 patches instead of by itself

 drivers/android/binder.c   | 43 +-
 drivers/android/binder_alloc.c |  1 +
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index d6979cf7b2dad..172c207fbf99d 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -660,6 +660,7 @@ struct binder_transaction {
 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__)
 static void
 _binder_proc_lock(struct binder_proc *proc, int line)
+   __acquires(>outer_lock)
 {
binder_debug(BINDER_DEBUG_SPINLOCKS,
 "%s: line=%d\n", __func__, line);
@@ -675,6 +676,7 @@ _binder_proc_lock(struct binder_proc *proc, int line)
 #define binder_proc_unlock(_proc) _binder_proc_unlock(_proc, __LINE__)
 static void
 _binder_proc_unlock(struct binder_proc *proc, int line)
+   __releases(>outer_lock)
 {
binder_debug(BINDER_DEBUG_SPINLOCKS,
 "%s: line=%d\n", __func__, line);
@@ -690,6 +692,7 @@ _binder_proc_unlock(struct binder_proc *proc, int line)
 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__)
 static void
 _binder_inner_proc_lock(struct binder_proc *proc, int line)
+   __acquires(>inner_lock)
 {
binder_debug(BINDER_DEBUG_SPINLOCKS,
 "%s: line=%d\n", __func__, line);
@@ -705,6 +708,7 @@ _binder_inner_proc_lock(struct binder_proc *proc, int line)
 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, 
__LINE__)
 static void
 _binder_inner_proc_unlock(struct binder_proc *proc, int line)
+   __releases(>inner_lock)
 {
binder_debug(BINDER_DEBUG_SPINLOCKS,
 "%s: line=%d\n", __func__, line);
@@ -720,6 +724,7 @@ _binder_inner_proc_unlock(struct binder_proc *proc, int 
line)
 #define binder_node_lock(node) _binder_node_lock(node, __LINE__)
 static void
 _binder_node_lock(struct binder_node *node, int line)
+   __acquires(>lock)
 {
binder_debug(BINDER_DEBUG_SPINLOCKS,
 "%s: line=%d\n", __func__, line);
@@ -735,6 +740,7 @@ _binder_node_lock(struct binder_node *node, int line)
 #define binder_node_unlock(node) _binder_node_unlock(node, __LINE__)
 static void
 _binder_node_unlock(struct binder_node *node, int line)
+   __releases(>lock)
 {
binder_debug(BINDER_DEBUG_SPINLOCKS,
 "%s: line=%d\n", __func__, line);
@@ -751,12 +757,16 @@ _binder_node_unlock(struct binder_node *node, int line)
 #define binder_node_inner_lock(node) _binder_node_inner_lock(node, __LINE__)
 static void
 _binder_node_inner_lock(struct binder_node *node, int line)
+   __acquires(>lock) __acquires(>proc->inner_lock)
 {
binder_debug(BINDER_DEBUG_SPINLOCKS,
 "%s: line=%d\n", __func__, line);
spin_lock(>lock);
if (node->proc)
binder_inner_proc_lock(node->proc);
+   else
+   /* annotation for sparse */
+   __acquire(>proc->inner_lock);
 }
 
 /**
@@ -768,6 +778,7 @@ _binder_node_inner_lock(struct binder_node *node, int line)
 #define binder_node_inner_unlock(node) _binder_node_inner_unlock(node, 
__LINE__)
 static void
 _binder_node_inner_unlock(struct binder_node *node, int line)
+   __releases(>lock) __releases(>proc->inner_lock)
 {
struct binder_proc *proc = node->proc;
 
@@ -775,6 +786,9 @@ _binder_node_inner_unlock(struct binder_node *node, int 
line)
 "%s: line=%d\n", __func__, line);
if (proc)
binder_inner_proc_unlock(proc);
+   else
+   /* annotation for sparse */
+   __release(>proc->inner_lock);
spin_unlock(>lock);
 }
 
@@ -1384,10 +1398,14 @@ static void binder_dec_node_tmpref(struct binder_node 
*node)
binder_node_inner_lock(node);
if (!node->proc)
spin_lock(_dead_nodes_lock);
+   else
+   __acquire(_dead_nodes_lock);
node->tmp_refs--;
BUG_ON(node->tmp_refs < 0);
if (!node->proc)
spin_unlock(_dead_nodes_lock);
+   else
+   __release(_dead_nodes_lock);
/*
 * Call binder_dec_node() to check if all refcounts are 0
 * and cleanup is needed. Calling with strong=0 and internal=1
@@ -1890,18 +1908,22 @@ static struct binder_thread *binder_get_txn_from(
  */
 static struct binder_thread *binder_get_txn_from_and_acq_inner(
struct binder_transaction *t)
+   __acquires(>from->proc->inner_lock)
 {
struct binder_thread *from;
 
from = binder_get_txn_from(t);
- 

[PATCH 3/3] binder: filter out nodes when showing binder procs

2018-12-05 Thread Todd Kjos
When dumping out binder transactions via a debug node,
the output is too verbose if a process has many nodes.
Change the output for transaction dumps to only display
nodes with pending async transactions.

Signed-off-by: Todd Kjos 
---
v2: no change, just resubmitted as #3 of 3 patches instead of by itself
There is no actual dependancy on patches 1 and 2 of the series

 drivers/android/binder.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 172c207fbf99d..cbaef3b0d3078 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -5440,6 +5440,9 @@ static void print_binder_proc(struct seq_file *m,
for (n = rb_first(>nodes); n != NULL; n = rb_next(n)) {
struct binder_node *node = rb_entry(n, struct binder_node,
rb_node);
+   if (!print_all && !node->has_async_transaction)
+   continue;
+
/*
 * take a temporary reference on the node so it
 * survives and isn't removed from the tree
-- 
2.20.0.rc1.387.gf8505762e3-goog

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: octeon-ethernet: delete redundant include

2018-12-05 Thread Aaro Koskinen
cvmx-smix-defs.h is not needed by this driver.

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon/ethernet-mdio.c | 1 -
 drivers/staging/octeon/ethernet.c  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-mdio.c 
b/drivers/staging/octeon/ethernet-mdio.c
index f67f95043887..2848fa71a33d 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -21,7 +21,6 @@
 #include "ethernet-util.h"
 
 #include 
-#include 
 
 static void cvm_oct_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
diff --git a/drivers/staging/octeon/ethernet.c 
b/drivers/staging/octeon/ethernet.c
index 9b15c9ed844b..0f70da4963ca 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #define OCTEON_MAX_MTU 65392
 
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] binder: fix use-after-free due to fdget() optimization

2018-12-05 Thread Al Viro
On Wed, Dec 05, 2018 at 01:16:01PM -0800, Todd Kjos wrote:
> 44d8047f1d87a ("binder: use standard functions to allocate fds")
> exposed a pre-existing issue in the binder driver.
> 
> fdget() is used in ksys_ioctl() as a performance optimization.
> One of the rules associated with fdget() is that ksys_close() must
> not be called between the fdget() and the fdput(). There is a case
> where this requirement is not met in the binder driver (and possibly
> other drivers) which results in the reference count dropping to 0
> when the device is still in use. This can result in use-after-free
> or other issues.
> 
> This was observed with the following sequence of events:
> 
> Task A and task B are connected via binder; task A has /dev/binder open at
> file descriptor number X. Both tasks are single-threaded.
> 
> 1. task B sends a binder message with a file descriptor array
>(BINDER_TYPE_FDA) containing one file descriptor to task A
> 2. task A reads the binder message with the translated file
>descriptor number Y
> 3. task A uses dup2(X, Y) to overwrite file descriptor Y with
>the /dev/binder file
> 4. task A unmaps the userspace binder memory mapping; the reference
>count on task A's /dev/binder is now 2
> 5. task A closes file descriptor X; the reference count on task
>A's /dev/binder is now 1
> 6. task A forks off a child, task C, duplicating the file descriptor
>table; the reference count on task A's /dev/binder is now 2
> 7. task A invokes the BC_FREE_BUFFER command on file descriptor X
>to release the incoming binder message
> 8. fdget() in ksys_ioctl() suppresses the reference count increment,
>since the file descriptor table is not shared
> 9. the BC_FREE_BUFFER handler removes the file descriptor table
>entry for X and decrements the reference count of task A's
>/dev/binder file to 1
> 10.task C calls close(X), which drops the reference count of
>task A's /dev/binder to 0 and frees it
> 11.task A continues processing of the ioctl and accesses some
>property of e.g. the binder_proc => KASAN-detectable UAF
> 
> Fixed by using get_file() / fput() in binder_ioctl().

Note that this patch does *not* remove the nasty trap caused by the garbage
in question - struct file can be freed before we even return from
->unlocked_ioctl().  Could you describe in details the desired behaviour
of this interface?

How about grabbing the references to all victims (*before* screwing with
ksys_close()), sticking them into a structure with embedded callback_head
and using task_work_add() on it, the callback doing those fput()?

The callback would trigger before the return to userland, so observable
timing of the final close wouldn't be changed.  And it would avoid the
kludges like this.

Of course, the proper fix would require TARDIS and set of instruments for
treating severe case of retrocranial inversion, so that this "ABI" would've
never existed, but...
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: android: ion: Remove unused header files

2018-12-05 Thread Laura Abbott

On 11/30/18 6:43 AM, Yangtao Li wrote:

seq_file.h does not need to be included,so remove it.



Acked-by: Laura Abbott 


Signed-off-by: Yangtao Li 
---
  drivers/staging/android/ion/ion.c | 1 -
  drivers/staging/android/ion/ion_system_heap.c | 1 -
  2 files changed, 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 99073325b0c0..0d61e9cd0887 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -23,7 +23,6 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
  #include 
diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 548bb02c0ca6..9ce2c0d7ac17 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -11,7 +11,6 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
  #include "ion.h"



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Revert "Staging: iio: adt7316: Add an extra check for 'ret' equals to 0"

2018-12-05 Thread Jeremy Fertic
On Thu, Dec 06, 2018 at 01:25:55AM +0530, Shreeya Patel wrote:
> On Tue, 2018-12-04 at 18:49 -0700, Jeremy Fertic wrote:
> > This reverts commit 00426e99789357dbff7e719a092ce36a3ce49d94.
> > 
> > i2c_smbus_read_byte() returns 0 when a byte with the value 0 is read
> > from
> > the device. This is a valid read so revert the check for 0.
> > 
> > Signed-off-by: Jeremy Fertic 
> > ---
> 
> Hi Jeremy,
> 
> As per my understanding, 0 value indicates no error but no data read.
> Then how can this be a valid case?
> 
> Can you please make me understand that how can we consider this as a
> valid case even when no data has been read?
> 
> 
> Thanks

I'm not sure I understand why the value 0 would indicate no data read.
Doesn't that just mean a byte was read with the value 0. For instance,
if the input to the adc is 0V. Can you point me to where you're seeing
that this would indicate no data read?

> 
> >  drivers/staging/iio/addac/adt7316-i2c.c | 4 
> >  1 file changed, 4 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/addac/adt7316-i2c.c
> > b/drivers/staging/iio/addac/adt7316-i2c.c
> > index ac91163656b5..2d51bd425662 100644
> > --- a/drivers/staging/iio/addac/adt7316-i2c.c
> > +++ b/drivers/staging/iio/addac/adt7316-i2c.c
> > @@ -30,10 +30,6 @@ static int adt7316_i2c_read(void *client, u8 reg,
> > u8 *data)
> > }
> >  
> > ret = i2c_smbus_read_byte(client);
> > -
> > -   if (!ret)
> > -   return -EIO;
> > -
> > if (ret < 0) {
> > dev_err(>dev, "I2C read error\n");
> > return ret;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] binder: implement binderfs

2018-12-05 Thread Christian Brauner
On Wed, Dec 05, 2018 at 09:01:45PM +0100, Greg KH wrote:
> On Tue, Dec 04, 2018 at 02:12:39PM +0100, Christian Brauner wrote:
> > As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the
> > implementation of binderfs. If you want to skip reading and just see how it
> > works, please go to [2].
> 
> First off, thanks for doing this so quickly.  I think the overall idea
> and implementation is great, I just have some minor issues with the user
> api:

Thanks! :)

> 
> > /* binder-control */
> > Each new binderfs instance comes with a binder-control device. No other
> > devices will be present at first. The binder-control device can be used to
> > dynamically allocate binder devices. All requests operate on the binderfs
> > mount the binder-control device resides in:
> > - BINDER_CTL_ADD
> >   Allocate a new binder device.
> > Assuming a new instance of binderfs has been mounted at /dev/binderfs via
> > mount -t binderfs binderfs /dev/binderfs. Then a request to create a new
> > binder device can be made via:
> > 
> > struct binderfs_device device = {0};
> > int fd = open("/dev/binderfs/binder-control", O_RDWR);
> > ioctl(fd, BINDER_CTL_ADD, );
> > 
> > The struct binderfs_device will be used to return the major and minor
> > number, as well as the index used as the new name for the device.
> > Binderfs devices can simply be removed via unlink().
> 
> I think you should provide a name in the BINDER_CTL_ADD command.  That
> way you can easily emulate the existing binder queues, and it saves you
> a create/rename sequence that you will be forced to do otherwise.  Why
> not do it just in a single command?

Sounds reasonable. How do you feel about capping the name length at 255
bytes aka the standard Linux file name length (e.g. xfs, ext4 etc.)?

#define BINDERFS_NAME_MAX 255

struct binderfs_device {
char name[BINDERFS_NAME_MAX + 1];
__u32 major;
__u32 minor;
}

> 
> That way also you don't need to care about the major/minor number at
> all.  Userspace should never need to worry about that, use a name,
> that's the best thing.  Also, it allows you to drop the use of the idr,
> making the kernel code simpler overall.
> 
> > /* Implementation details */
> > - When binderfs is registered as a new filesystem it will dynamically
> >   allocate a new major number. The allocated major number will be returned
> >   in struct binderfs_device when a new binder device is allocated.
> 
> Why does userspace care about major/minor numbers at all?  You should

Userspace cares for the sake of the devices cgroup which operates on
device numnbers to restrict access to devices. Since binderfs doesn't
have a static major number returning that information is helpful.
One example is a managining process sharing a binderfs mounts between
multiple ipc+mount namespaces via bind-mounts to avoid having separate
binderfs mounts. If the managing process only wants to grant access to binder0
and no other device for a given ipc+mnt namespace combination then it
can use the devices cgroup but for that it needs to know the major and
minor number.

> just be able to deal with the binder "names", that's all that userspace
> uses normally as you are not calling mknod() yourself.
> 
> >   Minor numbers that have been given out are tracked in a global idr struct
> >   that is capped at BINDERFS_MAX_MINOR. The minor number tracker is
> >   protected by a global mutex. This is the only point of contention between
> >   binderfs mounts.
> 
> I doubt this will be any real contention given that setting up / tearing
> down binder mounts is going to be rare, right?  Well, hopefully, who
> knows with some container systems...

Yeah, it's very unlikely. Device allocation is a rare event that is
basically done once for most interesting use-cases. If one cares so much
about performance bind-mounts + device cgroup restrictions are possible
solution to this problem.

> 
> > - The naming scheme for binder devices is binder%d. Each binderfs mount
> >   starts numbering of new binder devices at 0 up to n. The indeces used in
> >   constructing the name are tracked in a struct idr that is per-binderfs
> >   super block.
> 
> Again, let userspace pick the name, as you will have to rename it anyway
> to get userspace to work properly with it.
> 
> I'll stop repeating myself now :)

Thanks for the feedback! :)

Christian
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] binder: fix use-after-free due to fdget() optimization

2018-12-05 Thread Todd Kjos
44d8047f1d87a ("binder: use standard functions to allocate fds")
exposed a pre-existing issue in the binder driver.

fdget() is used in ksys_ioctl() as a performance optimization.
One of the rules associated with fdget() is that ksys_close() must
not be called between the fdget() and the fdput(). There is a case
where this requirement is not met in the binder driver (and possibly
other drivers) which results in the reference count dropping to 0
when the device is still in use. This can result in use-after-free
or other issues.

This was observed with the following sequence of events:

Task A and task B are connected via binder; task A has /dev/binder open at
file descriptor number X. Both tasks are single-threaded.

1. task B sends a binder message with a file descriptor array
   (BINDER_TYPE_FDA) containing one file descriptor to task A
2. task A reads the binder message with the translated file
   descriptor number Y
3. task A uses dup2(X, Y) to overwrite file descriptor Y with
   the /dev/binder file
4. task A unmaps the userspace binder memory mapping; the reference
   count on task A's /dev/binder is now 2
5. task A closes file descriptor X; the reference count on task
   A's /dev/binder is now 1
6. task A forks off a child, task C, duplicating the file descriptor
   table; the reference count on task A's /dev/binder is now 2
7. task A invokes the BC_FREE_BUFFER command on file descriptor X
   to release the incoming binder message
8. fdget() in ksys_ioctl() suppresses the reference count increment,
   since the file descriptor table is not shared
9. the BC_FREE_BUFFER handler removes the file descriptor table
   entry for X and decrements the reference count of task A's
   /dev/binder file to 1
10.task C calls close(X), which drops the reference count of
   task A's /dev/binder to 0 and frees it
11.task A continues processing of the ioctl and accesses some
   property of e.g. the binder_proc => KASAN-detectable UAF

Fixed by using get_file() / fput() in binder_ioctl().

Fixes: 44d8047f1d87a ("binder: use standard functions to allocate fds")
Suggested-by: Jann Horn 
Signed-off-by: Todd Kjos 
Acked-by: Martijn Coenen 
---
v2: added "Fixes:" tag
Should be added to 4.20-final if possible

 drivers/android/binder.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 9f1000d2a40c7..d6979cf7b2dad 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -4733,6 +4733,13 @@ static long binder_ioctl(struct file *filp, unsigned int 
cmd, unsigned long arg)
unsigned int size = _IOC_SIZE(cmd);
void __user *ubuf = (void __user *)arg;
 
+   /*
+* Need a reference on filp since ksys_close() could
+* be called on binder fd and the fdget() used in
+* ksys_ioctl() might have optimized out the reference.
+*/
+   get_file(filp);
+
/*pr_info("binder_ioctl: %d:%d %x %lx\n",
proc->pid, current->pid, cmd, arg);*/
 
@@ -4844,6 +4851,7 @@ static long binder_ioctl(struct file *filp, unsigned int 
cmd, unsigned long arg)
pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, 
current->pid, cmd, arg, ret);
 err_unlocked:
trace_binder_ioctl_done(ret);
+   fput(filp);
return ret;
 }
 
-- 
2.20.0.rc1.387.gf8505762e3-goog

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 10/12] staging: rtl8188eu: correct indentation in update_wireless_mode()

2018-12-05 Thread Joe Perches
On Wed, 2018-12-05 at 18:02 +0100, Michael Straube wrote:
> Correct indentation in update_wireless_mode() to clear a checkpatch
> warning. WARNING: Statements should start on a tabstop
[]
> diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
[]
> @@ -1442,7 +1442,7 @@ void update_wireless_mode(struct adapter *padapter)
>  
>   if (pmlmeext->cur_wireless_mode & WIRELESS_11B)
>   update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB);
> -  else
> + else
>   update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
>  }
.
gcc generally emits smaller code by using a single
call and a ternary.

$ size drivers/staging/rtl8188eu/core/rtw_wlan_util.o*
   textdata bss dec hex filename
  14974  36   0   150103aa2 
drivers/staging/rtl8188eu/core/rtw_wlan_util.o.new
  14990  36   0   150263ab2 
drivers/staging/rtl8188eu/core/rtw_wlan_util.o.old
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 24918223499b..acad30f53f5d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1440,10 +1440,9 @@ void update_wireless_mode(struct adapter *padapter)
 
rtw_hal_set_hwreg(padapter, HW_VAR_RESP_SIFS,  (u8 *)_Timer);
 
-   if (pmlmeext->cur_wireless_mode & WIRELESS_11B)
-   update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB);
-else
-   update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
+   update_mgnt_tx_rate(padapter,
+   pmlmeext->cur_wireless_mode & WIRELESS_11B ?
+   IEEE80211_CCK_RATE_1MB : IEEE80211_OFDM_RATE_6MB);
 }
 
 void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id)


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: android: ion: Add chunk heap initialization

2018-12-05 Thread Alexey Skidanov


On 11/29/18 8:25 AM, Alexey Skidanov wrote:
> 
> 
> On 11/29/18 3:30 AM, Laura Abbott wrote:
>> On 11/27/18 12:07 PM, Alexey Skidanov wrote:
>>>
>>>
>>> On 11/27/18 9:20 PM, Laura Abbott wrote:
 On 11/26/18 10:43 AM, Alexey Skidanov wrote:
>
>
> On 11/26/18 6:39 PM, Laura Abbott wrote:
>> On 11/25/18 2:02 PM, Alexey Skidanov wrote:
>>>
>>>
>>> On 11/25/18 11:40 PM, Laura Abbott wrote:
 On 11/25/18 1:22 PM, Alexey Skidanov wrote:
>
>
> On 11/25/18 10:51 PM, Laura Abbott wrote:
>> On 11/11/18 11:29 AM, Alexey Skidanov wrote:
>>> Create chunk heap of specified size and base address by adding
>>> "ion_chunk_heap=size@start" kernel boot parameter.
>>>
>>> Signed-off-by: Alexey Skidanov 
>>> ---
>>>   drivers/staging/android/ion/ion_chunk_heap.c | 40
>>> 
>>>   1 file changed, 40 insertions(+)
>>>
>>> diff --git a/drivers/staging/android/ion/ion_chunk_heap.c
>>> b/drivers/staging/android/ion/ion_chunk_heap.c
>>> index 159d72f..67573aa4 100644
>>> --- a/drivers/staging/android/ion/ion_chunk_heap.c
>>> +++ b/drivers/staging/android/ion/ion_chunk_heap.c
>>> @@ -135,6 +135,7 @@ struct ion_heap *ion_chunk_heap_create(struct
>>> ion_platform_heap *heap_data)
>>>   }
>>>   chunk_heap->base = heap_data->base;
>>>   chunk_heap->size = heap_data->size;
>>> +    chunk_heap->heap.name = heap_data->name;
>>>   chunk_heap->allocated = 0;
>>>     gen_pool_add(chunk_heap->pool, chunk_heap->base,
>>> heap_data->size, -1);
>>> @@ -151,3 +152,42 @@ struct ion_heap
>>> *ion_chunk_heap_create(struct
>>> ion_platform_heap *heap_data)
>>>   return ERR_PTR(ret);
>>>   }
>>>   +static u64 base;
>>> +static u64 size;
>>> +
>>> +static int __init setup_heap(char *param)
>>> +{
>>> +    char *p, *pp;
>>> +
>>> +    size = memparse(param, );
>>> +    if (param == p)
>>> +    return -EINVAL;
>>> +
>>> +    if (*p == '@')
>>> +    base = memparse(p + 1, );
>>> +    else
>>> +    return -EINVAL;
>>> +
>>> +    if (p == pp)
>>> +    return -EINVAL;
>>> +
>>> +    return 0;
>>> +}
>>> +
>>> +__setup("ion_chunk_heap=", setup_heap);
>>> +
>>> +static int ion_add_chunk_heap(void)
>>> +{
>>> +    struct ion_heap *heap;
>>> +    struct ion_platform_heap plat_heap = {.base = base,
>>> +  .size = size,
>>> +  .name = "chunk_heap",
>>> +  .priv = (void *)PAGE_SIZE};
>>> +    heap = ion_chunk_heap_create(_heap);
>>> +    if (heap)
>>> +    ion_device_add_heap(heap);
>>> +
>>> +    return 0;
>>> +}
>>> +device_initcall(ion_add_chunk_heap);
>>> +
>>>
>>
>> This solves a problem but not enough of the problem.
>>
>> We need to be able to support more than one chunk/carveout
>> heap.
> This is easy to support.
> This also assumes that the memory has already been
>> reserved/placed and that you know the base and size to
>> pass on the command line. Part of the issue with the carveout
>> heaps is that we need a way to tell the kernel to reserve
>> the memory early enough and then get that information to
>> Ion. Hard coding memory locations tends to be buggy from
>> my past experience with Ion.
> memmap= kernel option marks the memory region(s) as reserved (Zone
> Allocator doesn't use this memory region(s)). So the heap(s) may
> manage
> this memory region(s).

 memmap= is x86 only. I really don't like using the command line for
 specifying the base/size as it seems likely to conflict with
 platforms
 that rely on devicetree for reserving memory regions.

 Thanks,
 Laura

>>> I see ... So probably the better way is the one similar to this
>>> https://elixir.bootlin.com/linux/latest/source/kernel/dma/contiguous.c#L245
>>>
>>>
>>>
>>> ?
>>>
>>
>> Correct. For platforms that need devicetree, we need a way to specify
>> that a region should become an Ion heap. I went through a similar
>> exercise with CMA heaps before I kind of gave up on figuring out a
>> binding and just had Ion enumerate all CMA heaps. We do still need
>> a solution to work with non-DT platforms as well so whatever we
>> come up with needs to 

Re: [PATCH 1/2] staging: greybus: Align function call parameters to parenthesis

2018-12-05 Thread Sicilia Cristian
On Wed, Dec 05, 2018 at 09:46:03AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 04, 2018 at 09:58:14PM +0100, Cristian Sicilia wrote:
> > Aligned some parameters to the previous parenthesis.
> > 
> > Signed-off-by: Cristian Sicilia 
> > ---
> >  drivers/staging/greybus/loopback.c | 10 ++
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/loopback.c 
> > b/drivers/staging/greybus/loopback.c
> > index e4d42c1..1085e06 100644
> > --- a/drivers/staging/greybus/loopback.c
> > +++ b/drivers/staging/greybus/loopback.c
> > @@ -638,7 +638,8 @@ static int gb_loopback_async_transfer(struct 
> > gb_loopback *gb, u32 len)
> > retval = gb_loopback_async_operation(gb, GB_LOOPBACK_TYPE_TRANSFER,
> >  request, len + sizeof(*request),
> >  len + response_len,
> > -
> > gb_loopback_async_transfer_complete);
> > +gb_loopback_async_transfer_complete
> > +);
> 
> Ick, why do this?  That's not really needed.
> 

Ok, better to leave it unchanged

> thanks,
> 
> greg k-h


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: mt7621-mmc: Remove missed lines of the #if 0 block in sd.c

2018-12-05 Thread NeilBrown
On Wed, Dec 05 2018, Nishad Kamdar wrote:

> The below patch
> https://lore.kernel.org/patchwork/patch/995533/
> does not completely remove an #if 0 block in sd.c.

Standard practice is to identify patches by their commit id.
In this case you could
  git log --oneline  drivers/staging/mt7621-mmc/sd.c

choose the right patch, and copy/paste with a bit of editing, so:

  Commit 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in
  sd.c") does not completely 

I have

  [alias]
cm = !git --no-pager show -s --format=cm
fx = !git --no-pager show -s --format=fixes
  [pretty]
fixes = Fixes: %h (\"%s\")
cm = Commit %h (\"%s\")

in my $HOME/.gitconfig so I can get the text with, e.g.,

  $ git cm 2a54e3259e2a
  Commit 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")

Then as that commit introduced a problem, it is best-practice to also do

  $ git fx 2a54e3259e2a
  Fixes: 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")

and add the "Fixes" near the Signed-off-by line.

Thanks,
NeilBrown


> This causes the function msdc_select_clksrc()
> which was earler not compiled, to be compiled.
> That causes an error - MSDC_CLKSRC_REG is not
> defined.
>
> This patch completely removes the #if 0 block
>
> Signed-off-by: Nishad Kamdar 
> ---
>  drivers/staging/mt7621-mmc/sd.c | 20 
>  1 file changed, 20 deletions(-)
>
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index 7b66f9b0a094..3d918e481bd8 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -216,26 +216,6 @@ static void msdc_tasklet_card(struct work_struct *work)
>   spin_unlock(>lock);
>  }
>  
> -static void msdc_select_clksrc(struct msdc_host *host, unsigned char clksrc)
> -{
> - u32 val;
> -
> - BUG_ON(clksrc > 3);
> -
> - val = readl(host->base + MSDC_CLKSRC_REG);
> - if (readl(host->base + MSDC_ECO_VER) >= 4) {
> - val &= ~(0x3  << clk_src_bit[host->id]);
> - val |= clksrc << clk_src_bit[host->id];
> - } else {
> - val &= ~0x3; val |= clksrc;
> - }
> - writel(val, host->base + MSDC_CLKSRC_REG);
> -
> - host->hclk = hclks[clksrc];
> - host->hw->clk_src = clksrc;
> -}
> -#endif /* end of --- */
> -
>  static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
>  {
>   //struct msdc_hw *hw = host->hw;
> -- 
> 2.17.1


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 01/17] power: supply: olpc_battery: correct the temperature units

2018-12-05 Thread Sebastian Reichel
Hi,

On Fri, Nov 16, 2018 at 05:23:47PM +0100, Lubomir Rintel wrote:
> According to [1] and [2], the temperature values are in tenths of degree
> Celsius. Exposing the Celsius value makes the battery appear on fire:
> 
>   $ upower -i /org/freedesktop/UPower/devices/battery_olpc_battery
>   ...
>   temperature: 236.9 degrees C
> 
> Tested on OLPC XO-1 and OLPC XO-1.75 laptops.
> 
> [1] include/linux/power_supply.h
> [2] Documentation/power/power_supply_class.txt
> 
> Fixes: fb972873a767 ("[BATTERY] One Laptop Per Child power/battery driver")
> Cc: sta...@vger.kernel.org
> Signed-off-by: Lubomir Rintel 
> Acked-by: Pavel Machek 
> 
> ---

This is queued to next.

-- Sebastian

> Changes since v1:
> - Add Fixes tag and an Ack
> 
>  drivers/power/supply/olpc_battery.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/olpc_battery.c 
> b/drivers/power/supply/olpc_battery.c
> index 6da79ae14860..5a97e42a3547 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -428,14 +428,14 @@ static int olpc_bat_get_property(struct power_supply 
> *psy,
>   if (ret)
>   return ret;
>  
> - val->intval = (s16)be16_to_cpu(ec_word) * 100 / 256;
> + val->intval = (s16)be16_to_cpu(ec_word) * 10 / 256;
>   break;
>   case POWER_SUPPLY_PROP_TEMP_AMBIENT:
>   ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)_word, 2);
>   if (ret)
>   return ret;
>  
> - val->intval = (int)be16_to_cpu(ec_word) * 100 / 256;
> + val->intval = (int)be16_to_cpu(ec_word) * 10 / 256;
>   break;
>   case POWER_SUPPLY_PROP_CHARGE_COUNTER:
>   ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)_word, 2);
> -- 
> 2.19.1
> 


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

2018-12-05 Thread Sicilia Cristian
On Wed, Dec 05, 2018 at 10:12:24AM +, Bryan O'Donoghue wrote:
> On 04/12/2018 20:58, Cristian Sicilia wrote:
> >Some concatenated strings are now spaced.
> >
> >Signed-off-by: Cristian Sicilia 
> >---
> >  drivers/staging/greybus/loopback.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> >diff --git a/drivers/staging/greybus/loopback.c 
> >b/drivers/staging/greybus/loopback.c
> >index 1085e06..acfa392 100644
> >--- a/drivers/staging/greybus/loopback.c
> >+++ b/drivers/staging/greybus/loopback.c
> >@@ -141,7 +141,7 @@ static ssize_t name##_##field##_show(struct device *dev, 
> >\
> > /* Report 0 for min and max if no transfer successed */ \
> > if (!gb->requests_completed)\
> > return sprintf(buf, "0\n"); \
> >-return sprintf(buf, "%"#type"\n", gb->name.field);  \
> >+return sprintf(buf, "%" #type "\n", gb->name.field);\
> >  }  \
> >  static DEVICE_ATTR_RO(name##_##field)
> >@@ -176,7 +176,7 @@ static ssize_t field##_show(struct device *dev,  
> >\
> > char *buf)  \
> >  {  \
> > struct gb_loopback *gb = dev_get_drvdata(dev);  \
> >-return sprintf(buf, "%"#type"\n", gb->field);   \
> >+return sprintf(buf, "%" #type "\n", gb->field); \
> >  }  \
> >  static ssize_t field##_store(struct device *dev,   \
> > struct device_attribute *attr,  \
> >@@ -212,7 +212,7 @@ static ssize_t field##_show(struct device *dev,  
> >\
> > char *buf)  \
> >  {  \
> > struct gb_loopback *gb = dev_get_drvdata(dev);  \
> >-return sprintf(buf, "%"#type"\n", gb->field);   \
> >+return sprintf(buf, "%" #type "\n", gb->field); \
> >  }  \
> >  static ssize_t field##_store(struct device *dev,   \
> > struct device_attribute *attr,  \
> >
> Eh.
> 
> But doesn't all of this add an extra two space to the resultant string ?
> 
> Not what we want.

It doesn't change the result string, if I well understand the question your
doubt is if there are some space between % and type or between type and
end of line:

This (supposing type=u and field=min):
 return sprintf(buf, "%"#type"\n", gb->field);
Will expanded in this
 return sprintf(buf, "%""u""\n", gb->min);
That's is like:
 return sprintf(buf, "%u\n", gb->min);

This (supposing type=u and field=min):
return sprintf(buf, "%" #type "\n", gb->field);
Will expanded in this
 return sprintf(buf, "%" "u" "\n", gb->min);
That's is like:
 return sprintf(buf, "%u\n", gb->min);

> 
> ---
> bod


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 16/17] power: supply: olpc_battery: Avoid using platform_info

2018-12-05 Thread Sebastian Reichel
Hi,

On Fri, Nov 16, 2018 at 05:24:02PM +0100, Lubomir Rintel wrote:
> This wouldn't work on the DT-based ARM platform. Let's read the EC version
> directly from the EC driver instead.
> 
> This makes the driver no longer x86 specific.
> 
> Signed-off-by: Lubomir Rintel 
> Acked-by: Pavel Machek 
> 
> ---
> Changes since v1:
> - Use uint8_t instead of unsigned char [1] for ecver
> 
>  drivers/power/supply/Kconfig|  2 +-
>  drivers/power/supply/olpc_battery.c | 35 +
>  2 files changed, 27 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
> index f27cf0709500..dd7ae1431098 100644
> --- a/drivers/power/supply/Kconfig
> +++ b/drivers/power/supply/Kconfig
> @@ -151,7 +151,7 @@ config BATTERY_PMU
>  
>  config BATTERY_OLPC
>   tristate "One Laptop Per Child battery"
> - depends on X86_32 && OLPC
> + depends on OLPC
>   help
> Say Y to enable support for the battery on the OLPC laptop.
>  
> diff --git a/drivers/power/supply/olpc_battery.c 
> b/drivers/power/supply/olpc_battery.c
> index 4433eb10a23d..ec5dfb8fcb8a 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -20,8 +20,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
> -
>  
>  #define EC_BAT_VOLTAGE   0x10/* uint16_t,*9.76/32,mV   */
>  #define EC_BAT_CURRENT   0x11/* int16_t, *15.625/120, mA   */
> @@ -57,6 +55,7 @@ struct olpc_battery_data {
>   struct power_supply *olpc_ac;
>   struct power_supply *olpc_bat;
>   char bat_serial[17];
> + int new_proto;
>  };
>  
>  /*
> @@ -100,7 +99,7 @@ static const struct power_supply_desc olpc_ac_desc = {
>  static int olpc_bat_get_status(struct olpc_battery_data *data,
>   union power_supply_propval *val, uint8_t ec_byte)
>  {
> - if (olpc_platform_info.ecver > 0x44) {
> + if (data->new_proto) {
>   if (ec_byte & (BAT_STAT_CHARGING | BAT_STAT_TRICKLE))
>   val->intval = POWER_SUPPLY_STATUS_CHARGING;
>   else if (ec_byte & BAT_STAT_DISCHARGING)
> @@ -608,14 +607,32 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>   struct power_supply_config psy_cfg = {};
>   struct olpc_battery_data *data;
>   uint8_t status;
> + uint8_t ecver;
> + int ret;
> +
> + data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> + platform_set_drvdata(pdev, data);

This ended up in the wrong patch. Otherwise

Reviewed-by: Sebastian Reichel 

-- Sebastian

> + /* See if the EC is already there and get the EC revision */
> + ret = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, , 1);
> + if (ret) {
> + if (ret == -ENODEV)
> + return -EPROBE_DEFER;
> + return ret;
> + }
>  
> - /*
> -  * We've seen a number of EC protocol changes; this driver requires
> -  * the latest EC protocol, supported by 0x44 and above.
> -  */
> - if (olpc_platform_info.ecver < 0x44) {
> + if (ecver > 0x44) {
> + /* XO 1 or 1.5 with a new EC firmware. */
> + data->new_proto = 1;
> + } else if (ecver < 0x44) {
> + /*
> +  * We've seen a number of EC protocol changes; this driver
> +  * requires the latest EC protocol, supported by 0x44 and above.
> +  */
>   printk(KERN_NOTICE "OLPC EC version 0x%02x too old for "
> - "battery driver.\n", olpc_platform_info.ecver);
> + "battery driver.\n", ecver);
>   return -ENXIO;
>   }
>  
> -- 
> 2.19.1
> 


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [linux-sunxi] [PATCH v2 1/2] media: v4l: Add definitions for the HEVC slice format and controls

2018-12-05 Thread Jernej Škrabec
Hi!

Dne petek, 23. november 2018 ob 14:02:08 CET je Paul Kocialkowski napisal(a):
> This introduces the required definitions for HEVC decoding support with
> stateless VPUs. The controls associated to the HEVC slice format provide
> the required meta-data for decoding slices extracted from the bitstream.
> 
> This interface comes with the following limitations:
> * No custom quantization matrices (scaling lists);
> * Support for a single temporal layer only;
> * No slice entry point offsets support;
> * No conformance window support;
> * No VUI parameters support;
> * No support for SPS extensions: range, multilayer, 3d, scc, 4 bits;
> * No support for PPS extensions: range, multilayer, 3d, scc, 4 bits.
> 
> Signed-off-by: Paul Kocialkowski 
> ---



> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c
> b/drivers/media/v4l2-core/v4l2-ctrls.c index e96c453208e8..9af17815ecc3
> 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -913,6 +913,9 @@ const char *v4l2_ctrl_get_name(u32 id)
>   case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD: return "HEVC 
> Size of
> Length Field"; case V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES:   return
> "Reference Frames for a P-Frame"; case
> V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR:return "Prepend SPS and 
> PPS 
to
> IDR"; +   case V4L2_CID_MPEG_VIDEO_HEVC_SPS:  return 
> "HEVC Sequence
> Parameter Set"; + case V4L2_CID_MPEG_VIDEO_HEVC_PPS:  
> return "HEVC 
Picture
> Parameter Set"; + case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: 
> return 
"HEVC
> Slice Parameters";
> 
>   /* CAMERA controls */
>   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
> @@ -1320,6 +1323,15 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum
> v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS:
>   *type = V4L2_CTRL_TYPE_H264_DECODE_PARAMS;
>   break;
> + case V4L2_CID_MPEG_VIDEO_HEVC_SPS:
> + *type = V4L2_CTRL_TYPE_HEVC_SPS;
> + break;
> + case V4L2_CID_MPEG_VIDEO_HEVC_PPS:
> + *type = V4L2_CTRL_TYPE_HEVC_PPS;
> + break;
> + case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS:
> + *type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS;
> + break;
>   default:
>   *type = V4L2_CTRL_TYPE_INTEGER;
>   break;
> @@ -1692,6 +1704,11 @@ static int std_validate(const struct v4l2_ctrl *ctrl,
> u32 idx, case V4L2_CTRL_TYPE_H264_DECODE_PARAMS:
>   return 0;
> 
> + case V4L2_CTRL_TYPE_HEVC_SPS:
> + case V4L2_CTRL_TYPE_HEVC_PPS:
> + case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
> + return 0;
> +
>   default:
>   return -EINVAL;
>   }
> @@ -2287,6 +2304,15 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct
> v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_H264_DECODE_PARAMS:
>   elem_size = sizeof(struct v4l2_ctrl_h264_decode_param);
>   break;
> + case V4L2_CTRL_TYPE_HEVC_SPS:
> + elem_size = sizeof(struct v4l2_ctrl_hevc_sps);
> + break;
> + case V4L2_CTRL_TYPE_HEVC_PPS:
> + elem_size = sizeof(struct v4l2_ctrl_hevc_pps);
> + break;
> + case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
> + elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params);
> + break;
>   default:
>   if (type < V4L2_CTRL_COMPOUND_TYPES)
>   elem_size = sizeof(s32);
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c
> b/drivers/media/v4l2-core/v4l2-ioctl.c index aa63f1794272..7bec91c6effe
> 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1321,6 +1321,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_PIX_FMT_VP8:descr = "VP8"; break;
>   case V4L2_PIX_FMT_VP9:  descr = "VP9"; break;
>   case V4L2_PIX_FMT_HEVC: descr = "HEVC"; break; /* aka 
> H.265 */
> + case V4L2_PIX_FMT_HEVC_SLICE:   descr = "HEVC Parsed Slice 
> Data"; break;
>   case V4L2_PIX_FMT_FWHT: descr = "FWHT"; break; /* used 
> in vicodec */
>   case V4L2_PIX_FMT_CPIA1:descr = "GSPCA CPiA YUV"; break;
>   case V4L2_PIX_FMT_WNVA: descr = "WNVA"; break;
> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> index b4ca95710d2d..11664c5c3706 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -48,6 +48,9 @@ struct poll_table_struct;
>   * @p_h264_scal_mtrx:Pointer to a struct 
v4l2_ctrl_h264_scaling_matrix.
>   * @p_h264_slice_param:  Pointer to a struct 
> v4l2_ctrl_h264_slice_param.
>   * @p_h264_decode_param: Pointer to a struct v4l2_ctrl_h264_decode_param.
> + * @p_hevc_sps:  Pointer to an HEVC sequence 

Re: [PATCH v2 15/17] power: supply: olpc_battery: Use devm_power_supply_register()

2018-12-05 Thread Sebastian Reichel
Hi,

On Fri, Nov 16, 2018 at 05:24:01PM +0100, Lubomir Rintel wrote:
> This simplifies the error handling.
> 
> Signed-off-by: Lubomir Rintel 
> 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

> Changes since v1:
> - This was split off the "power: supply: olpc_battery: Move priv data to
>   a struct" patch.
> 
>  drivers/power/supply/olpc_battery.c | 19 +--
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/power/supply/olpc_battery.c 
> b/drivers/power/supply/olpc_battery.c
> index b091f897c1d4..4433eb10a23d 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -628,7 +628,7 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>   psy_cfg.of_node = pdev->dev.of_node;
>   psy_cfg.drv_data = data;
>  
> - data->olpc_ac = power_supply_register(>dev, _ac_desc, 
> _cfg);
> + data->olpc_ac = devm_power_supply_register(>dev, _ac_desc, 
> _cfg);
>   if (IS_ERR(data->olpc_ac))
>   return PTR_ERR(data->olpc_ac);
>  
> @@ -643,15 +643,13 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
>   }
>  
> - data->olpc_bat = power_supply_register(>dev, _bat_desc, 
> _cfg);
> - if (IS_ERR(olpc_bat)) {
> - ret = PTR_ERR(olpc_bat);
> - goto battery_failed;
> - }
> + data->olpc_bat = devm_power_supply_register(>dev, _bat_desc, 
> _cfg);
> + if (IS_ERR(data->olpc_bat))
> + return PTR_ERR(data->olpc_bat);
>  
>   ret = device_create_bin_file(>olpc_bat->dev, _bat_eeprom);
>   if (ret)
> - goto eeprom_failed;
> + return ret;
>  
>   ret = device_create_file(>olpc_bat->dev, _bat_error);
>   if (ret)
> @@ -666,10 +664,6 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>  
>  error_failed:
>   device_remove_bin_file(>olpc_bat->dev, _bat_eeprom);
> -eeprom_failed:
> - power_supply_unregister(data->olpc_bat);
> -battery_failed:
> - power_supply_unregister(data->olpc_ac);
>   return ret;
>  }
>  
> @@ -679,9 +673,6 @@ static int olpc_battery_remove(struct platform_device 
> *pdev)
>  
>   device_remove_file(>olpc_bat->dev, _bat_error);
>   device_remove_bin_file(>olpc_bat->dev, _bat_eeprom);
> - power_supply_unregister(data->olpc_bat);
> - power_supply_unregister(data->olpc_ac);
> -
>   return 0;
>  }
>  
> -- 
> 2.19.1
> 


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 14/17] power: supply: olpc_battery: Move priv data to a struct

2018-12-05 Thread Sebastian Reichel
On Fri, Nov 16, 2018 at 05:24:00PM +0100, Lubomir Rintel wrote:
> The global variables for private data are not too nice. I'd like some
> more, and that would clutter the global name space even further.
> 
> Signed-off-by: Lubomir Rintel 
> Reviewed-by: Andy Shevchenko 
> 
> ---
> Changes since v1:
> - Split out the move to devm_* into a separate patch
> 
>  drivers/power/supply/olpc_battery.c | 68 +
>  1 file changed, 40 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/power/supply/olpc_battery.c 
> b/drivers/power/supply/olpc_battery.c
> index 5323987d9284..b091f897c1d4 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -53,6 +53,12 @@
>  
>  #define BAT_ADDR_MFR_TYPE0x5F
>  
> +struct olpc_battery_data {
> + struct power_supply *olpc_ac;
> + struct power_supply *olpc_bat;
> + char bat_serial[17];
> +};
> +
>  /*
>   *   Power
>   */
> @@ -91,11 +97,8 @@ static const struct power_supply_desc olpc_ac_desc = {
>   .get_property = olpc_ac_get_prop,
>  };
>  
> -static struct power_supply *olpc_ac;
> -
> -static char bat_serial[17]; /* Ick */
> -
> -static int olpc_bat_get_status(union power_supply_propval *val, uint8_t 
> ec_byte)
> +static int olpc_bat_get_status(struct olpc_battery_data *data,
> + union power_supply_propval *val, uint8_t ec_byte)
>  {
>   if (olpc_platform_info.ecver > 0x44) {
>   if (ec_byte & (BAT_STAT_CHARGING | BAT_STAT_TRICKLE))
> @@ -326,6 +329,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
>enum power_supply_property psp,
>union power_supply_propval *val)
>  {
> + struct olpc_battery_data *data = power_supply_get_drvdata(psy);
>   int ret = 0;
>   __be16 ec_word;
>   uint8_t ec_byte;
> @@ -347,7 +351,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
>  
>   switch (psp) {
>   case POWER_SUPPLY_PROP_STATUS:
> - ret = olpc_bat_get_status(val, ec_byte);
> + ret = olpc_bat_get_status(data, val, ec_byte);
>   if (ret)
>   return ret;
>   break;
> @@ -450,8 +454,8 @@ static int olpc_bat_get_property(struct power_supply *psy,
>   if (ret)
>   return ret;
>  
> - sprintf(bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf));
> - val->strval = bat_serial;
> + sprintf(data->bat_serial, "%016llx", (long 
> long)be64_to_cpu(ser_buf));
> + val->strval = data->bat_serial;
>   break;
>   case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
>   ret = olpc_bat_get_voltage_max_design(val);
> @@ -579,17 +583,17 @@ static struct power_supply_desc olpc_bat_desc = {
>   .use_for_apm = 1,
>  };
>  
> -static struct power_supply *olpc_bat;
> -
>  static int olpc_battery_suspend(struct platform_device *pdev,
>   pm_message_t state)
>  {
> - if (device_may_wakeup(_ac->dev))
> + struct olpc_battery_data *data = platform_get_drvdata(pdev);
> +
> + if (device_may_wakeup(>olpc_ac->dev))
>   olpc_ec_wakeup_set(EC_SCI_SRC_ACPWR);
>   else
>   olpc_ec_wakeup_clear(EC_SCI_SRC_ACPWR);
>  
> - if (device_may_wakeup(_bat->dev))
> + if (device_may_wakeup(>olpc_bat->dev))
>   olpc_ec_wakeup_set(EC_SCI_SRC_BATTERY | EC_SCI_SRC_BATSOC
>  | EC_SCI_SRC_BATERR);
>   else
> @@ -601,7 +605,8 @@ static int olpc_battery_suspend(struct platform_device 
> *pdev,
>  
>  static int olpc_battery_probe(struct platform_device *pdev)
>  {
> - int ret;
> + struct power_supply_config psy_cfg = {};
> + struct olpc_battery_data *data;

^ uninitialized pointer

>   uint8_t status;
>  
>   /*
> @@ -620,9 +625,13 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>  
>   /* Ignore the status. It doesn't actually matter */
>  
> - olpc_ac = power_supply_register(>dev, _ac_desc, NULL);
> - if (IS_ERR(olpc_ac))
> - return PTR_ERR(olpc_ac);
> + psy_cfg.of_node = pdev->dev.of_node;
> + psy_cfg.drv_data = data;

^ usage of uninitialized pointer. You are missing a kmalloc call.

-- Sebastian

> + data->olpc_ac = power_supply_register(>dev, _ac_desc, 
> _cfg);
> + if (IS_ERR(data->olpc_ac))
> + return PTR_ERR(data->olpc_ac);
> +
>   if (of_property_match_string(pdev->dev.of_node, "compatible",
>   "olpc,xo1.5-battery") >= 0) {
>   /* XO-1.5 */
> @@ -634,42 +643,45 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
>   }
>  
> - 

Re: [PATCH v2 13/17] power: supply: olpc_battery: Use DT to get battery version

2018-12-05 Thread Sebastian Reichel
Hi,

On Fri, Nov 16, 2018 at 05:23:59PM +0100, Lubomir Rintel wrote:
> Avoid using the x86 OLPC platform specific call to get the board
> version. It won't work on FDT-based ARM MMP2 platform.
> 
> Signed-off-by: Lubomir Rintel 
> Reviewed-by: Andy Shevchenko 
> Acked-by: Pavel Machek 
> 
> ---

Reviewed-by: Sebastian Reichel 

I assume this patch cannot be applied to power-supply without patch
12 having been merged to avoid breaking XO1.5 devices temporarily?

-- Sebastian

> Changes since v1:
> - Sort the new include a bit higher
> 
>  drivers/power/supply/olpc_battery.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/supply/olpc_battery.c 
> b/drivers/power/supply/olpc_battery.c
> index 5a97e42a3547..5323987d9284 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -622,11 +623,13 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>   olpc_ac = power_supply_register(>dev, _ac_desc, NULL);
>   if (IS_ERR(olpc_ac))
>   return PTR_ERR(olpc_ac);
> -
> - if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
> + if (of_property_match_string(pdev->dev.of_node, "compatible",
> + "olpc,xo1.5-battery") >= 0) {
> + /* XO-1.5 */
>   olpc_bat_desc.properties = olpc_xo15_bat_props;
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo15_bat_props);
> - } else { /* XO-1 */
> + } else {
> + /* XO-1 */
>   olpc_bat_desc.properties = olpc_xo1_bat_props;
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
>   }
> @@ -672,6 +675,7 @@ static int olpc_battery_remove(struct platform_device 
> *pdev)
>  
>  static const struct of_device_id olpc_battery_ids[] = {
>   { .compatible = "olpc,xo1-battery" },
> + { .compatible = "olpc,xo1.5-battery" },
>   {}
>  };
>  MODULE_DEVICE_TABLE(of, olpc_battery_ids);
> -- 
> 2.19.1
> 


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 11/17] dt-bindings: olpc_battery: Add XO-1.5 battery

2018-12-05 Thread Sebastian Reichel
Hi,

On Fri, Nov 16, 2018 at 05:23:57PM +0100, Lubomir Rintel wrote:
> The XO-1 and XO-1.5 batteries apparently differ in an ability to report
> ambient temperature.
> 
> Signed-off-by: Lubomir Rintel 
> Reviewed-by: Rob Herring 
> Acked-by: Pavel Machek 
> 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

> Changes since v1:
> - Collected Reviewed-by and Acked-by tags
> 
>  Documentation/devicetree/bindings/power/supply/olpc_battery.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/olpc_battery.txt 
> b/Documentation/devicetree/bindings/power/supply/olpc_battery.txt
> index c8901b3992d9..8d87d6b35a98 100644
> --- a/Documentation/devicetree/bindings/power/supply/olpc_battery.txt
> +++ b/Documentation/devicetree/bindings/power/supply/olpc_battery.txt
> @@ -2,4 +2,4 @@ OLPC battery
>  
>  
>  Required properties:
> -  - compatible : "olpc,xo1-battery"
> +  - compatible : "olpc,xo1-battery" or "olpc,xo1.5-battery"
> -- 
> 2.19.1
> 


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: rockchip/vpu: fix a few alignments

2018-12-05 Thread Mauro Carvalho Chehab
Em Wed, 5 Dec 2018 19:48:25 +0100
Hans Verkuil  escreveu:

> On 12/05/2018 07:43 PM, Mauro Carvalho Chehab wrote:
> > As reported by checkpatch.pl, some function calls have a wrong
> > alignment.
> > 
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> >  drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 4 ++--
> >  drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c 
> > b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
> > index 8919151e1631..e27c10855de5 100644
> > --- a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
> > +++ b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
> > @@ -106,8 +106,8 @@ void rk3288_vpu_jpeg_enc_run(struct rockchip_vpu_ctx 
> > *ctx)
> > rk3288_vpu_set_src_img_ctrl(vpu, ctx);
> > rk3288_vpu_jpeg_enc_set_buffers(vpu, ctx, src_buf);
> > rk3288_vpu_jpeg_enc_set_qtable(vpu,
> > -   rockchip_vpu_jpeg_get_qtable(_ctx, 0),
> > -   rockchip_vpu_jpeg_get_qtable(_ctx, 1));
> > +  rockchip_vpu_jpeg_get_qtable(_ctx, 
> > 0),
> > +  rockchip_vpu_jpeg_get_qtable(_ctx, 
> > 1));  
> 
> But now you get warnings because this is > 80 columns.
> 
> I think the 'cure' is worse than the disease.
> 
> I see this is already merged, but I don't think this patch improves 
> readability,
> which is more important than a checkpatch warning IMHO.

IMHO, it is a way more readable if things got aligned. Very very few
people nowadays (if any) write patches directly at a 80 columns console.

Btw, speaking about 80 cols, usually your commit messages are longer
than that (the limit is actually 80 cols - 4). I keep fixing the
corresponding checkpatch.pl warnings from your patches
(when I have time) :-)

> 
> Regards,
> 
>   Hans
> 
> >  
> > reg = VEPU_REG_AXI_CTRL_OUTPUT_SWAP16
> > | VEPU_REG_AXI_CTRL_INPUT_SWAP16
> > diff --git a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c 
> > b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
> > index 8afa2162bf9f..5f75e4d11d76 100644
> > --- a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
> > +++ b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
> > @@ -137,8 +137,8 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx 
> > *ctx)
> > rk3399_vpu_set_src_img_ctrl(vpu, ctx);
> > rk3399_vpu_jpeg_enc_set_buffers(vpu, ctx, src_buf);
> > rk3399_vpu_jpeg_enc_set_qtable(vpu,
> > -   rockchip_vpu_jpeg_get_qtable(_ctx, 0),
> > -   rockchip_vpu_jpeg_get_qtable(_ctx, 1));
> > +  rockchip_vpu_jpeg_get_qtable(_ctx, 
> > 0),
> > +  rockchip_vpu_jpeg_get_qtable(_ctx, 
> > 1));
> >  
> > reg = VEPU_REG_OUTPUT_SWAP32
> > | VEPU_REG_OUTPUT_SWAP16
> >   
> 



Thanks,
Mauro
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] binder: implement binderfs

2018-12-05 Thread Greg KH
On Tue, Dec 04, 2018 at 02:12:39PM +0100, Christian Brauner wrote:
> As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the
> implementation of binderfs. If you want to skip reading and just see how it
> works, please go to [2].

First off, thanks for doing this so quickly.  I think the overall idea
and implementation is great, I just have some minor issues with the user
api:

> /* binder-control */
> Each new binderfs instance comes with a binder-control device. No other
> devices will be present at first. The binder-control device can be used to
> dynamically allocate binder devices. All requests operate on the binderfs
> mount the binder-control device resides in:
> - BINDER_CTL_ADD
>   Allocate a new binder device.
> Assuming a new instance of binderfs has been mounted at /dev/binderfs via
> mount -t binderfs binderfs /dev/binderfs. Then a request to create a new
> binder device can be made via:
> 
> struct binderfs_device device = {0};
> int fd = open("/dev/binderfs/binder-control", O_RDWR);
> ioctl(fd, BINDER_CTL_ADD, );
> 
> The struct binderfs_device will be used to return the major and minor
> number, as well as the index used as the new name for the device.
> Binderfs devices can simply be removed via unlink().

I think you should provide a name in the BINDER_CTL_ADD command.  That
way you can easily emulate the existing binder queues, and it saves you
a create/rename sequence that you will be forced to do otherwise.  Why
not do it just in a single command?

That way also you don't need to care about the major/minor number at
all.  Userspace should never need to worry about that, use a name,
that's the best thing.  Also, it allows you to drop the use of the idr,
making the kernel code simpler overall.

> /* Implementation details */
> - When binderfs is registered as a new filesystem it will dynamically
>   allocate a new major number. The allocated major number will be returned
>   in struct binderfs_device when a new binder device is allocated.

Why does userspace care about major/minor numbers at all?  You should
just be able to deal with the binder "names", that's all that userspace
uses normally as you are not calling mknod() yourself.

>   Minor numbers that have been given out are tracked in a global idr struct
>   that is capped at BINDERFS_MAX_MINOR. The minor number tracker is
>   protected by a global mutex. This is the only point of contention between
>   binderfs mounts.

I doubt this will be any real contention given that setting up / tearing
down binder mounts is going to be rare, right?  Well, hopefully, who
knows with some container systems...

> - The naming scheme for binder devices is binder%d. Each binderfs mount
>   starts numbering of new binder devices at 0 up to n. The indeces used in
>   constructing the name are tracked in a struct idr that is per-binderfs
>   super block.

Again, let userspace pick the name, as you will have to rename it anyway
to get userspace to work properly with it.

I'll stop repeating myself now :)

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Revert "Staging: iio: adt7316: Add an extra check for 'ret' equals to 0"

2018-12-05 Thread Shreeya Patel
On Tue, 2018-12-04 at 18:49 -0700, Jeremy Fertic wrote:
> This reverts commit 00426e99789357dbff7e719a092ce36a3ce49d94.
> 
> i2c_smbus_read_byte() returns 0 when a byte with the value 0 is read
> from
> the device. This is a valid read so revert the check for 0.
> 
> Signed-off-by: Jeremy Fertic 
> ---

Hi Jeremy,

As per my understanding, 0 value indicates no error but no data read.
Then how can this be a valid case?

Can you please make me understand that how can we consider this as a
valid case even when no data has been read?


Thanks

>  drivers/staging/iio/addac/adt7316-i2c.c | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/addac/adt7316-i2c.c
> b/drivers/staging/iio/addac/adt7316-i2c.c
> index ac91163656b5..2d51bd425662 100644
> --- a/drivers/staging/iio/addac/adt7316-i2c.c
> +++ b/drivers/staging/iio/addac/adt7316-i2c.c
> @@ -30,10 +30,6 @@ static int adt7316_i2c_read(void *client, u8 reg,
> u8 *data)
>   }
>  
>   ret = i2c_smbus_read_byte(client);
> -
> - if (!ret)
> - return -EIO;
> -
>   if (ret < 0) {
>   dev_err(>dev, "I2C read error\n");
>   return ret;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: media: imx: Use of_node_name_eq for node name comparisons

2018-12-05 Thread Rob Herring
Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For instances using of_node_cmp, this has the side effect of now using
case sensitive comparisons. This should not matter for any FDT based
system which this is.

Cc: Steve Longerbeam 
Cc: Philipp Zabel 
Cc: Mauro Carvalho Chehab 
Cc: Greg Kroah-Hartman 
Cc: linux-me...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Rob Herring 
---
 drivers/staging/media/imx/imx-media-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx-media-of.c 
b/drivers/staging/media/imx/imx-media-of.c
index b2e840f96c50..a01327f6e045 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -162,7 +162,7 @@ int imx_media_create_csi_of_links(struct imx_media_dev 
*imxmd,
fwnode_property_read_u32(fwnode, "reg", _port);
fwnode = fwnode_get_next_parent(fwnode);
if (is_of_node(fwnode) &&
-   of_node_cmp(to_of_node(fwnode)->name, "ports") == 0)
+   of_node_name_eq(to_of_node(fwnode), "ports"))
fwnode = fwnode_get_next_parent(fwnode);
link.remote_node = fwnode;
 
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 0/8] Pass extack to NETDEV_PRE_UP

2018-12-05 Thread David Miller


Your CC list is so huge that vger.kernel.org dropped all of your postings.

That CC list is not reasonable at all, trim it down to the most minimum
set.  Probably 2 or 3 mailing lists, primarily netdev, and maybe a small
handful of specific developers.

Nothing more.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: rockchip/vpu: fix a few alignments

2018-12-05 Thread Hans Verkuil
On 12/05/2018 07:43 PM, Mauro Carvalho Chehab wrote:
> As reported by checkpatch.pl, some function calls have a wrong
> alignment.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 4 ++--
>  drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c 
> b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
> index 8919151e1631..e27c10855de5 100644
> --- a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
> +++ b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
> @@ -106,8 +106,8 @@ void rk3288_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx)
>   rk3288_vpu_set_src_img_ctrl(vpu, ctx);
>   rk3288_vpu_jpeg_enc_set_buffers(vpu, ctx, src_buf);
>   rk3288_vpu_jpeg_enc_set_qtable(vpu,
> - rockchip_vpu_jpeg_get_qtable(_ctx, 0),
> - rockchip_vpu_jpeg_get_qtable(_ctx, 1));
> +rockchip_vpu_jpeg_get_qtable(_ctx, 
> 0),
> +rockchip_vpu_jpeg_get_qtable(_ctx, 
> 1));

But now you get warnings because this is > 80 columns.

I think the 'cure' is worse than the disease.

I see this is already merged, but I don't think this patch improves readability,
which is more important than a checkpatch warning IMHO.

Regards,

Hans

>  
>   reg = VEPU_REG_AXI_CTRL_OUTPUT_SWAP16
>   | VEPU_REG_AXI_CTRL_INPUT_SWAP16
> diff --git a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c 
> b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
> index 8afa2162bf9f..5f75e4d11d76 100644
> --- a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
> +++ b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
> @@ -137,8 +137,8 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx)
>   rk3399_vpu_set_src_img_ctrl(vpu, ctx);
>   rk3399_vpu_jpeg_enc_set_buffers(vpu, ctx, src_buf);
>   rk3399_vpu_jpeg_enc_set_qtable(vpu,
> - rockchip_vpu_jpeg_get_qtable(_ctx, 0),
> - rockchip_vpu_jpeg_get_qtable(_ctx, 1));
> +rockchip_vpu_jpeg_get_qtable(_ctx, 
> 0),
> +rockchip_vpu_jpeg_get_qtable(_ctx, 
> 1));
>  
>   reg = VEPU_REG_OUTPUT_SWAP32
>   | VEPU_REG_OUTPUT_SWAP16
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] media: rockchip/vpu: fix a few alignments

2018-12-05 Thread Mauro Carvalho Chehab
As reported by checkpatch.pl, some function calls have a wrong
alignment.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 4 ++--
 drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c 
b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
index 8919151e1631..e27c10855de5 100644
--- a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
+++ b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c
@@ -106,8 +106,8 @@ void rk3288_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx)
rk3288_vpu_set_src_img_ctrl(vpu, ctx);
rk3288_vpu_jpeg_enc_set_buffers(vpu, ctx, src_buf);
rk3288_vpu_jpeg_enc_set_qtable(vpu,
-   rockchip_vpu_jpeg_get_qtable(_ctx, 0),
-   rockchip_vpu_jpeg_get_qtable(_ctx, 1));
+  rockchip_vpu_jpeg_get_qtable(_ctx, 
0),
+  rockchip_vpu_jpeg_get_qtable(_ctx, 
1));
 
reg = VEPU_REG_AXI_CTRL_OUTPUT_SWAP16
| VEPU_REG_AXI_CTRL_INPUT_SWAP16
diff --git a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c 
b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
index 8afa2162bf9f..5f75e4d11d76 100644
--- a/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
+++ b/drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c
@@ -137,8 +137,8 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx)
rk3399_vpu_set_src_img_ctrl(vpu, ctx);
rk3399_vpu_jpeg_enc_set_buffers(vpu, ctx, src_buf);
rk3399_vpu_jpeg_enc_set_qtable(vpu,
-   rockchip_vpu_jpeg_get_qtable(_ctx, 0),
-   rockchip_vpu_jpeg_get_qtable(_ctx, 1));
+  rockchip_vpu_jpeg_get_qtable(_ctx, 
0),
+  rockchip_vpu_jpeg_get_qtable(_ctx, 
1));
 
reg = VEPU_REG_OUTPUT_SWAP32
| VEPU_REG_OUTPUT_SWAP16
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 10/12] staging: rtl8188eu: correct indentation in update_wireless_mode()

2018-12-05 Thread Michael Straube

On 12/5/18 6:37 PM, Joe Perches wrote:

On Wed, 2018-12-05 at 18:02 +0100, Michael Straube wrote:

Correct indentation in update_wireless_mode() to clear a checkpatch
warning. WARNING: Statements should start on a tabstop

[]

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c

[]

@@ -1442,7 +1442,7 @@ void update_wireless_mode(struct adapter *padapter)
  
  	if (pmlmeext->cur_wireless_mode & WIRELESS_11B)

update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB);
-else
+   else
update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
  }

.
gcc generally emits smaller code by using a single
call and a ternary.


Good to know, thank you.



$ size drivers/staging/rtl8188eu/core/rtw_wlan_util.o*
text   data bss dec hex filename
   14974 36   0   150103aa2 
drivers/staging/rtl8188eu/core/rtw_wlan_util.o.new
   14990 36   0   150263ab2 
drivers/staging/rtl8188eu/core/rtw_wlan_util.o.old
---
  drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 24918223499b..acad30f53f5d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1440,10 +1440,9 @@ void update_wireless_mode(struct adapter *padapter)
  
  	rtw_hal_set_hwreg(padapter, HW_VAR_RESP_SIFS,  (u8 *)_Timer);
  
-	if (pmlmeext->cur_wireless_mode & WIRELESS_11B)

-   update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB);
-else
-   update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
+   update_mgnt_tx_rate(padapter,
+   pmlmeext->cur_wireless_mode & WIRELESS_11B ?
+   IEEE80211_CCK_RATE_1MB : IEEE80211_OFDM_RATE_6MB);
  }
  
  void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id)




___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 04/12] staging: rtl8188eu: remove unnecessary parentheses in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Remove unnecessary parentheses reported by checkpatch.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 64 +--
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 76c7010c3a5c..0e2653a68f4f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -377,7 +377,7 @@ int is_client_associated_to_ap(struct adapter *padapter)
return _FAIL;
 
pmlmeext = >mlmeextpriv;
-   pmlmeinfo = &(pmlmeext->mlmext_info);
+   pmlmeinfo = >mlmext_info;
 
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE))
return true;
@@ -388,7 +388,7 @@ int is_client_associated_to_ap(struct adapter *padapter)
 int is_client_associated_to_ibss(struct adapter *padapter)
 {
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
return true;
@@ -400,7 +400,7 @@ int is_IBSS_empty(struct adapter *padapter)
 {
unsigned int i;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) {
if (pmlmeinfo->FW_sta_info[i].status == 1)
@@ -465,7 +465,7 @@ int allocate_fw_sta_entry(struct adapter *padapter)
 {
unsigned int mac_id;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) {
if (pmlmeinfo->FW_sta_info[mac_id].status == 0) {
@@ -481,7 +481,7 @@ int allocate_fw_sta_entry(struct adapter *padapter)
 void flush_all_cam_entry(struct adapter *padapter)
 {
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL);
 
@@ -491,9 +491,9 @@ void flush_all_cam_entry(struct adapter *padapter)
 int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
 {
/* struct registry_priv *pregpriv = >registrypriv; */
-   struct mlme_priv*pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv*pmlmepriv = >mlmepriv;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
if (pmlmepriv->qospriv.qos_option == 0) {
pmlmeinfo->WMM_enable = 0;
@@ -501,7 +501,7 @@ int WMM_param_handler(struct adapter *padapter, struct 
ndis_802_11_var_ie *pIE)
}
 
pmlmeinfo->WMM_enable = 1;
-   memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct 
WMM_para_element));
+   memcpy(>WMM_param, pIE->data + 6, sizeof(struct 
WMM_para_element));
return true;
 }
 
@@ -513,7 +513,7 @@ void WMMOnAssocRsp(struct adapter *padapter)
u32 acParm, i;
u32 edca[4], inx[4];
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
struct xmit_priv*pxmitpriv = >xmitpriv;
struct registry_priv*pregpriv = >registrypriv;
 
@@ -609,9 +609,9 @@ static void bwmode_update_check(struct adapter *padapter, 
struct ndis_802_11_var
unsigned charnew_bwmode;
unsigned char  new_ch_offset;
struct HT_info_element   *pHT_info;
-   struct mlme_priv*pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv*pmlmepriv = >mlmepriv;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
struct registry_priv *pregistrypriv = >registrypriv;
struct ht_priv  *phtpriv = >htpriv;
 
@@ -660,7 +660,7 @@ static void bwmode_update_check(struct adapter *padapter, 
struct ndis_802_11_var
 
if (pmlmeinfo->bwmode_updated) {
struct sta_info *psta;
-   struct wlan_bssid_ex*cur_network = &(pmlmeinfo->network);
+   struct wlan_bssid_ex*cur_network = >network;
struct sta_priv *pstapriv = >stapriv;
 
/* 

[PATCH v2 11/12] staging: rtl8188eu: rename struct field Wifi_Error_Status

2018-12-05 Thread Michael Straube
Rename struct field Wifi_Error_Status to avoid CamelCase.
Wifi_Error_Status -> wifi_error_status

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_sreset.c  | 4 ++--
 drivers/staging/rtl8188eu/include/rtw_sreset.h   | 2 +-
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sreset.c 
b/drivers/staging/rtl8188eu/core/rtw_sreset.c
index fb5adaf4a42c..a8397b132002 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sreset.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sreset.c
@@ -12,10 +12,10 @@ void rtw_hal_sreset_init(struct adapter *padapter)
 {
struct sreset_priv *psrtpriv = >HalData->srestpriv;
 
-   psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
+   psrtpriv->wifi_error_status = WIFI_STATUS_SUCCESS;
 }
 
 void sreset_set_wifi_error_status(struct adapter *padapter, u32 status)
 {
-   padapter->HalData->srestpriv.Wifi_Error_Status = status;
+   padapter->HalData->srestpriv.wifi_error_status = status;
 }
diff --git a/drivers/staging/rtl8188eu/include/rtw_sreset.h 
b/drivers/staging/rtl8188eu/include/rtw_sreset.h
index 3ee6a4a7847d..ea3c0d93bf0b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_sreset.h
+++ b/drivers/staging/rtl8188eu/include/rtw_sreset.h
@@ -11,7 +11,7 @@
 #include 
 
 struct sreset_priv {
-   u8  Wifi_Error_Status;
+   u8 wifi_error_status;
 };
 
 #include 
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 7dc7028c1cd5..e4f2af2974ed 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -263,7 +263,7 @@ static int usbctrl_vendorreq(struct adapter *adapt, u8 
request, u16 value, u16 i
if (status == (-ESHUTDOWN) || status == -ENODEV)
adapt->bSurpriseRemoved = true;
else
-   
adapt->HalData->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL;
+   
adapt->HalData->srestpriv.wifi_error_status = USB_VEN_REQ_CMD_FAIL;
} else { /*  status != len && status >= 0 */
if (status > 0) {
if (requesttype == 0x01) {
@@ -410,7 +410,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
break;
case -EPROTO:
case -EOVERFLOW:
-   adapt->HalData->srestpriv.Wifi_Error_Status = 
USB_READ_PORT_FAIL;
+   adapt->HalData->srestpriv.wifi_error_status = 
USB_READ_PORT_FAIL;
precvbuf->reuse = true;
usb_read_port(adapt, RECV_BULK_IN_ADDR, precvbuf);
break;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 08/12] staging: rtl8188eu: add spaces around operators in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Add spaces around '+', '-', '&' and '>>' to follow kernel coding
style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 21 +++
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 2ffa0332bf32..0eb904317118 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -444,7 +444,8 @@ void write_cam(struct adapter *padapter, u8 entry, u16 
ctrl, u8 *mac, u8 *key)
break;
default:
i = (j - 2) << 2;
-   val = key[i] | (key[i+1] << 8) | (key[i+2] << 16) | 
(key[i+3] << 24);
+   val = key[i] | (key[i + 1] << 8) | (key[i + 2] << 16) |
+ (key[i + 3] << 24);
break;
}
 
@@ -580,7 +581,7 @@ void WMMOnAssocRsp(struct adapter *padapter)
 
/* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
for (i = 0; i < 4; i++) {
-   for (j = i+1; j < 4; j++) {
+   for (j = i + 1; j < 4; j++) {
/* compare CW and AIFS */
if ((edca[j] & 0x) < (edca[i] & 0x)) {
change_inx = true;
@@ -894,7 +895,7 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 
*pframe, u32 packet_len)
ht_info_infos_0 = 0;
}
if (ht_cap_info != cur_network->BcnInfo.ht_cap_info ||
-   ((ht_info_infos_0&0x03) != 
(cur_network->BcnInfo.ht_info_infos_0&0x03))) {
+   ((ht_info_infos_0 & 0x03) != (cur_network->BcnInfo.ht_info_infos_0 
& 0x03))) {
DBG_88E("%s bcn now: ht_cap_info:%x 
ht_info_infos_0:%x\n", __func__,
ht_cap_info, ht_info_infos_0);
DBG_88E("%s bcn link: ht_cap_info:%x 
ht_info_infos_0:%x\n", __func__,
@@ -983,18 +984,20 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 
*pframe, u32 packet_len)
}
 
if (encryp_protocol == ENCRYP_PROTOCOL_WPA || encryp_protocol == 
ENCRYP_PROTOCOL_WPA2) {
-   pbuf = rtw_get_wpa_ie(>ies[12], _ielen, 
bssid->ie_length-12);
+   pbuf = rtw_get_wpa_ie(>ies[12], _ielen,
+ bssid->ie_length - 12);
if (pbuf && (wpa_ielen > 0)) {
-   if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, 
_cipher, _cipher, _8021x)) {
+   if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen + 2, 
_cipher, _cipher, _8021x)) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
 ("%s pnetwork->pairwise_cipher: %d, 
group_cipher is %d, is_8021x is %d\n", __func__,
 pairwise_cipher, group_cipher, 
is_8021x));
}
} else {
-   pbuf = rtw_get_wpa2_ie(>ies[12], _ielen, 
bssid->ie_length-12);
+   pbuf = rtw_get_wpa2_ie(>ies[12], _ielen,
+  bssid->ie_length - 12);
 
if (pbuf && (wpa_ielen > 0)) {
-   if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, 
wpa_ielen+2, _cipher, _cipher, _8021x)) {
+   if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, 
wpa_ielen + 2, _cipher, _cipher, _8021x)) {
RT_TRACE(_module_rtl871x_mlme_c_, 
_drv_info_,
 ("%s 
pnetwork->pairwise_cipher: %d, pnetwork->group_cipher is %d, is_802x is %d\n",
  __func__, pairwise_cipher, 
group_cipher, is_8021x));
@@ -1498,7 +1501,7 @@ void process_addba_req(struct adapter *padapter, u8 
*paddba_req, u8 *addr)
 
if (psta) {
param = le16_to_cpu(preq->BA_para_set);
-   tid = (param>>2)&0x0f;
+   tid = (param >> 2) & 0x0f;
preorder_ctrl = >recvreorder_ctrl[tid];
preorder_ctrl->indicate_seq = 0x;
preorder_ctrl->enable = pmlmeinfo->accept_addba_req;
@@ -1513,7 +1516,7 @@ void update_TSF(struct mlme_ext_priv *pmlmeext, u8 
*pframe, uint len)
pIE = pframe + sizeof(struct ieee80211_hdr_3addr);
pbuf = (__le32 *)pIE;
 
-   pmlmeext->TSFValue = le32_to_cpu(*(pbuf+1));
+   pmlmeext->TSFValue = le32_to_cpu(*(pbuf + 1));
 
pmlmeext->TSFValue = pmlmeext->TSFValue << 32;
 
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 02/12] staging: rtl8188eu: refactor cckratesonly_included()

2018-12-05 Thread Michael Straube
Refactor cckratesonly_included() to improve readability and slightly
reduce object file size. Also change the return type to bool.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 10 +-
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 90160d5fc292..fac1c1c20b2f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -69,16 +69,16 @@ bool cckrates_included(unsigned char *rate, int ratelen)
return false;
 }
 
-int cckratesonly_included(unsigned char *rate, int ratelen)
+bool cckratesonly_included(unsigned char *rate, int ratelen)
 {
-   int i;
+   int i;
 
for (i = 0; i < ratelen; i++) {
-   if  rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
-  (((rate[i]) & 0x7f) != 11)  && (((rate[i]) & 0x7f) 
!= 22))
+   u8 r = rate[i] & 0x7f;
+
+   if (r != 2 && r != 4 && r != 11 && r != 22)
return false;
}
-
return true;
 }
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index c86dec12dec2..0ade33df16d2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -581,7 +581,7 @@ void addba_timer_hdl(struct timer_list *t);
  msecs_to_jiffies(ms))
 
 bool cckrates_included(unsigned char *rate, int ratelen);
-int cckratesonly_included(unsigned char *rate, int ratelen);
+bool cckratesonly_included(unsigned char *rate, int ratelen);
 
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
 
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 05/12] staging: rtl8188eu: cleanup declarations in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Replace tabs with spaces and/or remove spaces in declarations
to cleanup whitespace. Remove unused/commented declarations.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 175 +-
 1 file changed, 86 insertions(+), 89 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 0e2653a68f4f..e61fc7ce65e8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -177,7 +177,7 @@ static unsigned int ratetbl2rateset(struct adapter 
*padapter, unsigned char *rat
 {
int i;
unsigned char rate;
-   unsigned intlen = 0;
+   unsigned int len = 0;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
 
for (i = 0; i < NumRates; i++) {
@@ -213,8 +213,8 @@ void get_rate_set(struct adapter *padapter, unsigned char 
*pbssrate, int *bssrat
 
 void UpdateBrateTbl(struct adapter *Adapter, u8 *mbrate)
 {
-   u8  i;
-   u8  rate;
+   u8 i;
+   u8 rate;
 
/*  1M, 2M, 5.5M, 11M, 6M, 12M, 24M are mandatory. */
for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
@@ -235,8 +235,8 @@ void UpdateBrateTbl(struct adapter *Adapter, u8 *mbrate)
 
 void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen)
 {
-   u8  i;
-   u8  rate;
+   u8 i;
+   u8 rate;
 
for (i = 0; i < bssratelen; i++) {
rate = bssrateset[i] & 0x7f;
@@ -253,14 +253,14 @@ void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 
bssratelen)
 
 void Save_DM_Func_Flag(struct adapter *padapter)
 {
-   u8  saveflag = true;
+   u8 saveflag = true;
 
rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_OP, (u8 *)());
 }
 
 void Restore_DM_Func_Flag(struct adapter *padapter)
 {
-   u8  saveflag = false;
+   u8 saveflag = false;
 
rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_OP, (u8 *)());
 }
@@ -370,8 +370,8 @@ u16 get_beacon_interval(struct wlan_bssid_ex *bss)
 
 int is_client_associated_to_ap(struct adapter *padapter)
 {
-   struct mlme_ext_priv*pmlmeext;
-   struct mlme_ext_info*pmlmeinfo;
+   struct mlme_ext_priv *pmlmeext;
+   struct mlme_ext_info *pmlmeinfo;
 
if (!padapter)
return _FAIL;
@@ -387,8 +387,8 @@ int is_client_associated_to_ap(struct adapter *padapter)
 
 int is_client_associated_to_ibss(struct adapter *padapter)
 {
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
return true;
@@ -399,8 +399,8 @@ int is_client_associated_to_ibss(struct adapter *padapter)
 int is_IBSS_empty(struct adapter *padapter)
 {
unsigned int i;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) {
if (pmlmeinfo->FW_sta_info[i].status == 1)
@@ -426,9 +426,9 @@ void invalidate_cam_all(struct adapter *padapter)
 
 void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key)
 {
-   unsigned inti, val, addr;
+   unsigned int i, val, addr;
int j;
-   u32 cam_val[2];
+   u32 cam_val[2];
 
addr = entry << 3;
 
@@ -464,8 +464,8 @@ void clear_cam_entry(struct adapter *padapter, u8 entry)
 int allocate_fw_sta_entry(struct adapter *padapter)
 {
unsigned int mac_id;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) {
if (pmlmeinfo->FW_sta_info[mac_id].status == 0) {
@@ -480,8 +480,8 @@ int allocate_fw_sta_entry(struct adapter *padapter)
 
 void flush_all_cam_entry(struct adapter *padapter)
 {
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL);
 
@@ -490,10 +490,9 @@ void flush_all_cam_entry(struct adapter *padapter)
 
 int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
 {
-   /* struct registry_priv *pregpriv = >registrypriv; */
-   struct mlme_priv*pmlmepriv = >mlmepriv;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info

[PATCH v2 09/12] staging: rtl8188eu: write out multiplying in wifirate2_ratetbl_inx()

2018-12-05 Thread Michael Straube
Write out multiplying in wifirate2_ratetbl_inx() to improve
readabilitiy and clear checkpatch issues with missing spaces
around '*' operator.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 22 +--
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 0eb904317118..7af3dd910c93 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1123,29 +1123,29 @@ static int wifirate2_ratetbl_inx(unsigned char rate)
rate = rate & 0x7f;
 
switch (rate) {
-   case 54*2:
+   case 108:
return 11;
-   case 48*2:
+   case 96:
return 10;
-   case 36*2:
+   case 72:
return 9;
-   case 24*2:
+   case 48:
return 8;
-   case 18*2:
+   case 36:
return 7;
-   case 12*2:
+   case 24:
return 6;
-   case 9*2:
+   case 18:
return 5;
-   case 6*2:
+   case 12:
return 4;
-   case 11*2:
+   case 22:
return 3;
case 11:
return 2;
-   case 2*2:
+   case 4:
return 1;
-   case 1*2:
+   case 2:
return 0;
default:
return 0;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 12/12] staging: rtl8188eu: remove unused code in rtw_cmd.c

2018-12-05 Thread Michael Straube
Remove unused/commented code in rtw_cmd.c.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index e3e46f7ac834..f9cdd1da8add 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -215,8 +215,6 @@ int rtw_cmd_thread(void *context)
 
/*  free all cmd_obj resources */
while ((pcmd = rtw_dequeue_cmd(>cmd_queue))) {
-   /* DBG_88E("%s: leaving... drop cmdcode:%u\n", __func__, 
pcmd->cmdcode); */
-
rtw_free_cmd_obj(pcmd);
}
 
@@ -259,7 +257,6 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct 
ndis_802_11_ssid *ssid,
 
init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, _SiteSurvey_CMD_);
 
-   /* psurveyPara->bsslimit = 48; */
psurveyPara->scan_mode = pmlmepriv->scan_mode;
 
/* prepare ssid list */
@@ -660,9 +657,6 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 
*addr)
 
init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, _AddBAReq_CMD_);
 
-   /* DBG_88E("rtw_addbareq_cmd, tid =%d\n", tid); */
-
-   /* rtw_enqueue_cmd(pcmdpriv, ph2c); */
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
 
 exit:
@@ -696,7 +690,6 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
_Set_Drv_Extra_CMD_);
 
-   /* rtw_enqueue_cmd(pcmdpriv, ph2c); */
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
 exit:
return res;
@@ -862,7 +855,6 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 
lps_ctrl_type)
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 
*)());
break;
case LPS_CTRL_SPECIAL_PACKET:
-   /* DBG_88E("LPS_CTRL_SPECIAL_PACKET\n"); */
pwrpriv->DelayLPSLastTimeStamp = jiffies;
LPS_Leave(padapter);
break;
@@ -879,7 +871,6 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 
lps_ctrl_type, u8 enqueue)
struct cmd_obj  *ph2c;
struct drvextra_cmd_parm*pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = >cmdpriv;
-   /* struct pwrctrl_priv *pwrctrlpriv = >pwrctrlpriv; */
u8  res = _SUCCESS;
 
if (enqueue) {
@@ -1029,9 +1020,6 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
if (psta_bmc->sleepq_len == 0) {
u8 val = 0;
 
-   /* while ((rtw_read32(padapter, 0x414)&0x0000)!= 0) */
-   /* while ((rtw_read32(padapter, 0x414)&0xff00)!= 0) */
-
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, );
 
while (!val) {
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 07/12] staging: rtl8188eu: cleanup long lines in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Cleanup some lines over 80 characters by adding appropriate
line breaks and removing commented code.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 956a331beda2..2ffa0332bf32 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -379,7 +379,8 @@ int is_client_associated_to_ap(struct adapter *padapter)
pmlmeext = >mlmeextpriv;
pmlmeinfo = >mlmext_info;
 
-   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE))
+   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
+   (pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE)
return true;
else
return _FAIL;
@@ -390,7 +391,8 @@ int is_client_associated_to_ibss(struct adapter *padapter)
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
-   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
+   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
+   (pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE)
return true;
else
return _FAIL;
@@ -662,8 +664,6 @@ static void bwmode_update_check(struct adapter *padapter, 
struct ndis_802_11_var
struct wlan_bssid_ex*cur_network = >network;
struct sta_priv *pstapriv = >stapriv;
 
-   /* set_channel_bwmode(padapter, pmlmeext->cur_channel, 
pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
-
/* update ap's stainfo */
psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress);
if (psta) {
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 10/12] staging: rtl8188eu: replace if else with ternary operator

2018-12-05 Thread Michael Straube
Replace if else with a single call and ternary operator to
slightly reduce object file size. Also clears a checkpatch
warning: WARNING: Statements should start on a tabstop

Suggested-by: Joe Perches 
Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 7af3dd910c93..9a20faad96c9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1440,10 +1440,9 @@ void update_wireless_mode(struct adapter *padapter)
 
rtw_hal_set_hwreg(padapter, HW_VAR_RESP_SIFS,  (u8 *)_Timer);
 
-   if (pmlmeext->cur_wireless_mode & WIRELESS_11B)
-   update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB);
-else
-   update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
+   update_mgnt_tx_rate(padapter,
+   pmlmeext->cur_wireless_mode & WIRELESS_11B ?
+   IEEE80211_CCK_RATE_1MB : IEEE80211_OFDM_RATE_6MB);
 }
 
 void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id)
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 06/12] staging: rtl8188eu: cleanup block comment in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Cleanup a block comment to clear a checkpatch warning.
WARNING: Block comments use * on subsequent lines

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index e61fc7ce65e8..956a331beda2 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -760,11 +760,11 @@ void HTOnAssocRsp(struct adapter *padapter)
return;
}
 
-   /* handle A-MPDU parameter field */
-   /*
-   AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
-   AMPDU_para [4:2]:Min MPDU Start Spacing
-   */
+   /* handle A-MPDU parameter field
+*
+* AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
+* AMPDU_para [4:2]:Min MPDU Start Spacing
+*/
max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
 
min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 01/12] staging: rtl8188eu: refactor cckrates_included()

2018-12-05 Thread Michael Straube
Refactor cckrates_included() to improve readability and slightly
reduce object file size. Also change the return type to bool.

Signed-off-by: Michael Straube 
---
v1 -> v2
Changed patch 10/12 in the series.
v1: staging: rtl8188eu: correct indentation in update_wireless_mode()
v2: staging: rtl8188eu: replace if else with ternary

 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 9 +
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 24918223499b..90160d5fc292 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -56,13 +56,14 @@ static u8 rtw_basic_rate_mix[7] = {
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
-int cckrates_included(unsigned char *rate, int ratelen)
+bool cckrates_included(unsigned char *rate, int ratelen)
 {
-   int i;
+   int i;
 
for (i = 0; i < ratelen; i++) {
-   if  rate[i]) & 0x7f) == 2)  || (((rate[i]) & 0x7f) == 4) ||
-(((rate[i]) & 0x7f) == 11)  || (((rate[i]) & 0x7f) == 22))
+   u8 r = rate[i] & 0x7f;
+
+   if (r == 2 || r == 4 || r == 11 || r == 22)
return true;
}
return false;
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 9526da3efcc4..c86dec12dec2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -580,7 +580,7 @@ void addba_timer_hdl(struct timer_list *t);
mod_timer(>link_timer, jiffies +   \
  msecs_to_jiffies(ms))
 
-int cckrates_included(unsigned char *rate, int ratelen);
+bool cckrates_included(unsigned char *rate, int ratelen);
 int cckratesonly_included(unsigned char *rate, int ratelen);
 
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 03/12] staging: rtl8188eu: simplify array initializations

2018-12-05 Thread Michael Straube
Simplfy initialization of arrays with zero only values
to improve readability and save a line.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index fac1c1c20b2f..76c7010c3a5c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -455,9 +455,8 @@ void write_cam(struct adapter *padapter, u8 entry, u16 
ctrl, u8 *mac, u8 *key)
 
 void clear_cam_entry(struct adapter *padapter, u8 entry)
 {
-   u8 null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-   u8 null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+   u8 null_sta[ETH_ALEN] = {};
+   u8 null_key[16] = {};
 
write_cam(padapter, entry, 0, null_sta, null_key);
 }
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/12] staging: rtl8188eu: write out multiplying in wifirate2_ratetbl_inx()

2018-12-05 Thread Michael Straube
Write out multiplying in wifirate2_ratetbl_inx() to improve
readabilitiy and clear checkpatch issues with missing spaces
around '*' operator.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 22 +--
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 0eb904317118..7af3dd910c93 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1123,29 +1123,29 @@ static int wifirate2_ratetbl_inx(unsigned char rate)
rate = rate & 0x7f;
 
switch (rate) {
-   case 54*2:
+   case 108:
return 11;
-   case 48*2:
+   case 96:
return 10;
-   case 36*2:
+   case 72:
return 9;
-   case 24*2:
+   case 48:
return 8;
-   case 18*2:
+   case 36:
return 7;
-   case 12*2:
+   case 24:
return 6;
-   case 9*2:
+   case 18:
return 5;
-   case 6*2:
+   case 12:
return 4;
-   case 11*2:
+   case 22:
return 3;
case 11:
return 2;
-   case 2*2:
+   case 4:
return 1;
-   case 1*2:
+   case 2:
return 0;
default:
return 0;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/12] staging: rtl8188eu: remove unnecessary parentheses in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Remove unnecessary parentheses reported by checkpatch.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 64 +--
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 76c7010c3a5c..0e2653a68f4f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -377,7 +377,7 @@ int is_client_associated_to_ap(struct adapter *padapter)
return _FAIL;
 
pmlmeext = >mlmeextpriv;
-   pmlmeinfo = &(pmlmeext->mlmext_info);
+   pmlmeinfo = >mlmext_info;
 
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE))
return true;
@@ -388,7 +388,7 @@ int is_client_associated_to_ap(struct adapter *padapter)
 int is_client_associated_to_ibss(struct adapter *padapter)
 {
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
return true;
@@ -400,7 +400,7 @@ int is_IBSS_empty(struct adapter *padapter)
 {
unsigned int i;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) {
if (pmlmeinfo->FW_sta_info[i].status == 1)
@@ -465,7 +465,7 @@ int allocate_fw_sta_entry(struct adapter *padapter)
 {
unsigned int mac_id;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) {
if (pmlmeinfo->FW_sta_info[mac_id].status == 0) {
@@ -481,7 +481,7 @@ int allocate_fw_sta_entry(struct adapter *padapter)
 void flush_all_cam_entry(struct adapter *padapter)
 {
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL);
 
@@ -491,9 +491,9 @@ void flush_all_cam_entry(struct adapter *padapter)
 int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
 {
/* struct registry_priv *pregpriv = >registrypriv; */
-   struct mlme_priv*pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv*pmlmepriv = >mlmepriv;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
 
if (pmlmepriv->qospriv.qos_option == 0) {
pmlmeinfo->WMM_enable = 0;
@@ -501,7 +501,7 @@ int WMM_param_handler(struct adapter *padapter, struct 
ndis_802_11_var_ie *pIE)
}
 
pmlmeinfo->WMM_enable = 1;
-   memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct 
WMM_para_element));
+   memcpy(>WMM_param, pIE->data + 6, sizeof(struct 
WMM_para_element));
return true;
 }
 
@@ -513,7 +513,7 @@ void WMMOnAssocRsp(struct adapter *padapter)
u32 acParm, i;
u32 edca[4], inx[4];
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
struct xmit_priv*pxmitpriv = >xmitpriv;
struct registry_priv*pregpriv = >registrypriv;
 
@@ -609,9 +609,9 @@ static void bwmode_update_check(struct adapter *padapter, 
struct ndis_802_11_var
unsigned charnew_bwmode;
unsigned char  new_ch_offset;
struct HT_info_element   *pHT_info;
-   struct mlme_priv*pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv*pmlmepriv = >mlmepriv;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
struct registry_priv *pregistrypriv = >registrypriv;
struct ht_priv  *phtpriv = >htpriv;
 
@@ -660,7 +660,7 @@ static void bwmode_update_check(struct adapter *padapter, 
struct ndis_802_11_var
 
if (pmlmeinfo->bwmode_updated) {
struct sta_info *psta;
-   struct wlan_bssid_ex*cur_network = &(pmlmeinfo->network);
+   struct wlan_bssid_ex*cur_network = >network;
struct sta_priv *pstapriv = >stapriv;
 
/* 

[PATCH 01/12] staging: rtl8188eu: refactor cckrates_included()

2018-12-05 Thread Michael Straube
Refactor cckrates_included() to improve readability and slightly
reduce object file size. Also change the return type to bool.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 9 +
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 24918223499b..90160d5fc292 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -56,13 +56,14 @@ static u8 rtw_basic_rate_mix[7] = {
IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
-int cckrates_included(unsigned char *rate, int ratelen)
+bool cckrates_included(unsigned char *rate, int ratelen)
 {
-   int i;
+   int i;
 
for (i = 0; i < ratelen; i++) {
-   if  rate[i]) & 0x7f) == 2)  || (((rate[i]) & 0x7f) == 4) ||
-(((rate[i]) & 0x7f) == 11)  || (((rate[i]) & 0x7f) == 22))
+   u8 r = rate[i] & 0x7f;
+
+   if (r == 2 || r == 4 || r == 11 || r == 22)
return true;
}
return false;
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 9526da3efcc4..c86dec12dec2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -580,7 +580,7 @@ void addba_timer_hdl(struct timer_list *t);
mod_timer(>link_timer, jiffies +   \
  msecs_to_jiffies(ms))
 
-int cckrates_included(unsigned char *rate, int ratelen);
+bool cckrates_included(unsigned char *rate, int ratelen);
 int cckratesonly_included(unsigned char *rate, int ratelen);
 
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/12] staging: rtl8188eu: correct indentation in update_wireless_mode()

2018-12-05 Thread Michael Straube
Correct indentation in update_wireless_mode() to clear a checkpatch
warning. WARNING: Statements should start on a tabstop

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 7af3dd910c93..42b9974fab8a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1442,7 +1442,7 @@ void update_wireless_mode(struct adapter *padapter)
 
if (pmlmeext->cur_wireless_mode & WIRELESS_11B)
update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB);
-else
+   else
update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
 }
 
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/12] staging: rtl8188eu: remove unused code in rtw_cmd.c

2018-12-05 Thread Michael Straube
Remove unused/commented code in rtw_cmd.c.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index e3e46f7ac834..f9cdd1da8add 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -215,8 +215,6 @@ int rtw_cmd_thread(void *context)
 
/*  free all cmd_obj resources */
while ((pcmd = rtw_dequeue_cmd(>cmd_queue))) {
-   /* DBG_88E("%s: leaving... drop cmdcode:%u\n", __func__, 
pcmd->cmdcode); */
-
rtw_free_cmd_obj(pcmd);
}
 
@@ -259,7 +257,6 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct 
ndis_802_11_ssid *ssid,
 
init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, _SiteSurvey_CMD_);
 
-   /* psurveyPara->bsslimit = 48; */
psurveyPara->scan_mode = pmlmepriv->scan_mode;
 
/* prepare ssid list */
@@ -660,9 +657,6 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 
*addr)
 
init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, _AddBAReq_CMD_);
 
-   /* DBG_88E("rtw_addbareq_cmd, tid =%d\n", tid); */
-
-   /* rtw_enqueue_cmd(pcmdpriv, ph2c); */
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
 
 exit:
@@ -696,7 +690,6 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, 
_Set_Drv_Extra_CMD_);
 
-   /* rtw_enqueue_cmd(pcmdpriv, ph2c); */
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
 exit:
return res;
@@ -862,7 +855,6 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 
lps_ctrl_type)
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 
*)());
break;
case LPS_CTRL_SPECIAL_PACKET:
-   /* DBG_88E("LPS_CTRL_SPECIAL_PACKET\n"); */
pwrpriv->DelayLPSLastTimeStamp = jiffies;
LPS_Leave(padapter);
break;
@@ -879,7 +871,6 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 
lps_ctrl_type, u8 enqueue)
struct cmd_obj  *ph2c;
struct drvextra_cmd_parm*pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = >cmdpriv;
-   /* struct pwrctrl_priv *pwrctrlpriv = >pwrctrlpriv; */
u8  res = _SUCCESS;
 
if (enqueue) {
@@ -1029,9 +1020,6 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
if (psta_bmc->sleepq_len == 0) {
u8 val = 0;
 
-   /* while ((rtw_read32(padapter, 0x414)&0x0000)!= 0) */
-   /* while ((rtw_read32(padapter, 0x414)&0xff00)!= 0) */
-
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, );
 
while (!val) {
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/12] staging: rtl8188eu: simplify array initializations

2018-12-05 Thread Michael Straube
Simplfy initialization of arrays with zero only values
to improve readability and save a line.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index fac1c1c20b2f..76c7010c3a5c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -455,9 +455,8 @@ void write_cam(struct adapter *padapter, u8 entry, u16 
ctrl, u8 *mac, u8 *key)
 
 void clear_cam_entry(struct adapter *padapter, u8 entry)
 {
-   u8 null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-   u8 null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+   u8 null_sta[ETH_ALEN] = {};
+   u8 null_key[16] = {};
 
write_cam(padapter, entry, 0, null_sta, null_key);
 }
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/12] staging: rtl8188eu: rename struct field Wifi_Error_Status

2018-12-05 Thread Michael Straube
Rename struct field Wifi_Error_Status to avoid CamelCase.
Wifi_Error_Status -> wifi_error_status

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_sreset.c  | 4 ++--
 drivers/staging/rtl8188eu/include/rtw_sreset.h   | 2 +-
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sreset.c 
b/drivers/staging/rtl8188eu/core/rtw_sreset.c
index fb5adaf4a42c..a8397b132002 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sreset.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sreset.c
@@ -12,10 +12,10 @@ void rtw_hal_sreset_init(struct adapter *padapter)
 {
struct sreset_priv *psrtpriv = >HalData->srestpriv;
 
-   psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
+   psrtpriv->wifi_error_status = WIFI_STATUS_SUCCESS;
 }
 
 void sreset_set_wifi_error_status(struct adapter *padapter, u32 status)
 {
-   padapter->HalData->srestpriv.Wifi_Error_Status = status;
+   padapter->HalData->srestpriv.wifi_error_status = status;
 }
diff --git a/drivers/staging/rtl8188eu/include/rtw_sreset.h 
b/drivers/staging/rtl8188eu/include/rtw_sreset.h
index 3ee6a4a7847d..ea3c0d93bf0b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_sreset.h
+++ b/drivers/staging/rtl8188eu/include/rtw_sreset.h
@@ -11,7 +11,7 @@
 #include 
 
 struct sreset_priv {
-   u8  Wifi_Error_Status;
+   u8 wifi_error_status;
 };
 
 #include 
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 7dc7028c1cd5..e4f2af2974ed 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -263,7 +263,7 @@ static int usbctrl_vendorreq(struct adapter *adapt, u8 
request, u16 value, u16 i
if (status == (-ESHUTDOWN) || status == -ENODEV)
adapt->bSurpriseRemoved = true;
else
-   
adapt->HalData->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL;
+   
adapt->HalData->srestpriv.wifi_error_status = USB_VEN_REQ_CMD_FAIL;
} else { /*  status != len && status >= 0 */
if (status > 0) {
if (requesttype == 0x01) {
@@ -410,7 +410,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
break;
case -EPROTO:
case -EOVERFLOW:
-   adapt->HalData->srestpriv.Wifi_Error_Status = 
USB_READ_PORT_FAIL;
+   adapt->HalData->srestpriv.wifi_error_status = 
USB_READ_PORT_FAIL;
precvbuf->reuse = true;
usb_read_port(adapt, RECV_BULK_IN_ADDR, precvbuf);
break;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/12] staging: rtl8188eu: cleanup block comment in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Cleanup a block comment to clear a checkpatch warning.
WARNING: Block comments use * on subsequent lines

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index e61fc7ce65e8..956a331beda2 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -760,11 +760,11 @@ void HTOnAssocRsp(struct adapter *padapter)
return;
}
 
-   /* handle A-MPDU parameter field */
-   /*
-   AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
-   AMPDU_para [4:2]:Min MPDU Start Spacing
-   */
+   /* handle A-MPDU parameter field
+*
+* AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
+* AMPDU_para [4:2]:Min MPDU Start Spacing
+*/
max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
 
min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/12] staging: rtl8188eu: add spaces around operators in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Add spaces around '+', '-', '&' and '>>' to follow kernel coding
style. Reported by checkpatch.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 21 +++
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 2ffa0332bf32..0eb904317118 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -444,7 +444,8 @@ void write_cam(struct adapter *padapter, u8 entry, u16 
ctrl, u8 *mac, u8 *key)
break;
default:
i = (j - 2) << 2;
-   val = key[i] | (key[i+1] << 8) | (key[i+2] << 16) | 
(key[i+3] << 24);
+   val = key[i] | (key[i + 1] << 8) | (key[i + 2] << 16) |
+ (key[i + 3] << 24);
break;
}
 
@@ -580,7 +581,7 @@ void WMMOnAssocRsp(struct adapter *padapter)
 
/* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
for (i = 0; i < 4; i++) {
-   for (j = i+1; j < 4; j++) {
+   for (j = i + 1; j < 4; j++) {
/* compare CW and AIFS */
if ((edca[j] & 0x) < (edca[i] & 0x)) {
change_inx = true;
@@ -894,7 +895,7 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 
*pframe, u32 packet_len)
ht_info_infos_0 = 0;
}
if (ht_cap_info != cur_network->BcnInfo.ht_cap_info ||
-   ((ht_info_infos_0&0x03) != 
(cur_network->BcnInfo.ht_info_infos_0&0x03))) {
+   ((ht_info_infos_0 & 0x03) != (cur_network->BcnInfo.ht_info_infos_0 
& 0x03))) {
DBG_88E("%s bcn now: ht_cap_info:%x 
ht_info_infos_0:%x\n", __func__,
ht_cap_info, ht_info_infos_0);
DBG_88E("%s bcn link: ht_cap_info:%x 
ht_info_infos_0:%x\n", __func__,
@@ -983,18 +984,20 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 
*pframe, u32 packet_len)
}
 
if (encryp_protocol == ENCRYP_PROTOCOL_WPA || encryp_protocol == 
ENCRYP_PROTOCOL_WPA2) {
-   pbuf = rtw_get_wpa_ie(>ies[12], _ielen, 
bssid->ie_length-12);
+   pbuf = rtw_get_wpa_ie(>ies[12], _ielen,
+ bssid->ie_length - 12);
if (pbuf && (wpa_ielen > 0)) {
-   if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, 
_cipher, _cipher, _8021x)) {
+   if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen + 2, 
_cipher, _cipher, _8021x)) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
 ("%s pnetwork->pairwise_cipher: %d, 
group_cipher is %d, is_8021x is %d\n", __func__,
 pairwise_cipher, group_cipher, 
is_8021x));
}
} else {
-   pbuf = rtw_get_wpa2_ie(>ies[12], _ielen, 
bssid->ie_length-12);
+   pbuf = rtw_get_wpa2_ie(>ies[12], _ielen,
+  bssid->ie_length - 12);
 
if (pbuf && (wpa_ielen > 0)) {
-   if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, 
wpa_ielen+2, _cipher, _cipher, _8021x)) {
+   if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, 
wpa_ielen + 2, _cipher, _cipher, _8021x)) {
RT_TRACE(_module_rtl871x_mlme_c_, 
_drv_info_,
 ("%s 
pnetwork->pairwise_cipher: %d, pnetwork->group_cipher is %d, is_802x is %d\n",
  __func__, pairwise_cipher, 
group_cipher, is_8021x));
@@ -1498,7 +1501,7 @@ void process_addba_req(struct adapter *padapter, u8 
*paddba_req, u8 *addr)
 
if (psta) {
param = le16_to_cpu(preq->BA_para_set);
-   tid = (param>>2)&0x0f;
+   tid = (param >> 2) & 0x0f;
preorder_ctrl = >recvreorder_ctrl[tid];
preorder_ctrl->indicate_seq = 0x;
preorder_ctrl->enable = pmlmeinfo->accept_addba_req;
@@ -1513,7 +1516,7 @@ void update_TSF(struct mlme_ext_priv *pmlmeext, u8 
*pframe, uint len)
pIE = pframe + sizeof(struct ieee80211_hdr_3addr);
pbuf = (__le32 *)pIE;
 
-   pmlmeext->TSFValue = le32_to_cpu(*(pbuf+1));
+   pmlmeext->TSFValue = le32_to_cpu(*(pbuf + 1));
 
pmlmeext->TSFValue = pmlmeext->TSFValue << 32;
 
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/12] staging: rtl8188eu: cleanup declarations in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Replace tabs with spaces and/or remove spaces in declarations
to cleanup whitespace. Remove unused/commented declarations.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_wlan_util.c| 175 +-
 1 file changed, 86 insertions(+), 89 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 0e2653a68f4f..e61fc7ce65e8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -177,7 +177,7 @@ static unsigned int ratetbl2rateset(struct adapter 
*padapter, unsigned char *rat
 {
int i;
unsigned char rate;
-   unsigned intlen = 0;
+   unsigned int len = 0;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
 
for (i = 0; i < NumRates; i++) {
@@ -213,8 +213,8 @@ void get_rate_set(struct adapter *padapter, unsigned char 
*pbssrate, int *bssrat
 
 void UpdateBrateTbl(struct adapter *Adapter, u8 *mbrate)
 {
-   u8  i;
-   u8  rate;
+   u8 i;
+   u8 rate;
 
/*  1M, 2M, 5.5M, 11M, 6M, 12M, 24M are mandatory. */
for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
@@ -235,8 +235,8 @@ void UpdateBrateTbl(struct adapter *Adapter, u8 *mbrate)
 
 void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen)
 {
-   u8  i;
-   u8  rate;
+   u8 i;
+   u8 rate;
 
for (i = 0; i < bssratelen; i++) {
rate = bssrateset[i] & 0x7f;
@@ -253,14 +253,14 @@ void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 
bssratelen)
 
 void Save_DM_Func_Flag(struct adapter *padapter)
 {
-   u8  saveflag = true;
+   u8 saveflag = true;
 
rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_OP, (u8 *)());
 }
 
 void Restore_DM_Func_Flag(struct adapter *padapter)
 {
-   u8  saveflag = false;
+   u8 saveflag = false;
 
rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_OP, (u8 *)());
 }
@@ -370,8 +370,8 @@ u16 get_beacon_interval(struct wlan_bssid_ex *bss)
 
 int is_client_associated_to_ap(struct adapter *padapter)
 {
-   struct mlme_ext_priv*pmlmeext;
-   struct mlme_ext_info*pmlmeinfo;
+   struct mlme_ext_priv *pmlmeext;
+   struct mlme_ext_info *pmlmeinfo;
 
if (!padapter)
return _FAIL;
@@ -387,8 +387,8 @@ int is_client_associated_to_ap(struct adapter *padapter)
 
 int is_client_associated_to_ibss(struct adapter *padapter)
 {
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
return true;
@@ -399,8 +399,8 @@ int is_client_associated_to_ibss(struct adapter *padapter)
 int is_IBSS_empty(struct adapter *padapter)
 {
unsigned int i;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) {
if (pmlmeinfo->FW_sta_info[i].status == 1)
@@ -426,9 +426,9 @@ void invalidate_cam_all(struct adapter *padapter)
 
 void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key)
 {
-   unsigned inti, val, addr;
+   unsigned int i, val, addr;
int j;
-   u32 cam_val[2];
+   u32 cam_val[2];
 
addr = entry << 3;
 
@@ -464,8 +464,8 @@ void clear_cam_entry(struct adapter *padapter, u8 entry)
 int allocate_fw_sta_entry(struct adapter *padapter)
 {
unsigned int mac_id;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) {
if (pmlmeinfo->FW_sta_info[mac_id].status == 0) {
@@ -480,8 +480,8 @@ int allocate_fw_sta_entry(struct adapter *padapter)
 
 void flush_all_cam_entry(struct adapter *padapter)
 {
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = >mlmext_info;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL);
 
@@ -490,10 +490,9 @@ void flush_all_cam_entry(struct adapter *padapter)
 
 int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
 {
-   /* struct registry_priv *pregpriv = >registrypriv; */
-   struct mlme_priv*pmlmepriv = >mlmepriv;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info

[PATCH 07/12] staging: rtl8188eu: cleanup long lines in rtw_wlan_util.c

2018-12-05 Thread Michael Straube
Cleanup some lines over 80 characters by adding appropriate
line breaks and removing commented code.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 956a331beda2..2ffa0332bf32 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -379,7 +379,8 @@ int is_client_associated_to_ap(struct adapter *padapter)
pmlmeext = >mlmeextpriv;
pmlmeinfo = >mlmext_info;
 
-   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE))
+   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
+   (pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE)
return true;
else
return _FAIL;
@@ -390,7 +391,8 @@ int is_client_associated_to_ibss(struct adapter *padapter)
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = >mlmext_info;
 
-   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && 
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
+   if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
+   (pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE)
return true;
else
return _FAIL;
@@ -662,8 +664,6 @@ static void bwmode_update_check(struct adapter *padapter, 
struct ndis_802_11_var
struct wlan_bssid_ex*cur_network = >network;
struct sta_priv *pstapriv = >stapriv;
 
-   /* set_channel_bwmode(padapter, pmlmeext->cur_channel, 
pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
-
/* update ap's stainfo */
psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress);
if (psta) {
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/12] staging: rtl8188eu: refactor cckratesonly_included()

2018-12-05 Thread Michael Straube
Refactor cckratesonly_included() to improve readability and slightly
reduce object file size. Also change the return type to bool.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 10 +-
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 90160d5fc292..fac1c1c20b2f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -69,16 +69,16 @@ bool cckrates_included(unsigned char *rate, int ratelen)
return false;
 }
 
-int cckratesonly_included(unsigned char *rate, int ratelen)
+bool cckratesonly_included(unsigned char *rate, int ratelen)
 {
-   int i;
+   int i;
 
for (i = 0; i < ratelen; i++) {
-   if  rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
-  (((rate[i]) & 0x7f) != 11)  && (((rate[i]) & 0x7f) 
!= 22))
+   u8 r = rate[i] & 0x7f;
+
+   if (r != 2 && r != 4 && r != 11 && r != 22)
return false;
}
-
return true;
 }
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index c86dec12dec2..0ade33df16d2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -581,7 +581,7 @@ void addba_timer_hdl(struct timer_list *t);
  msecs_to_jiffies(ms))
 
 bool cckrates_included(unsigned char *rate, int ratelen);
-int cckratesonly_included(unsigned char *rate, int ratelen);
+bool cckratesonly_included(unsigned char *rate, int ratelen);
 
 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
 
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 7/8] net: core: dev: Attach extack to NETDEV_PRE_UP

2018-12-05 Thread David Ahern
On 12/5/18 3:52 AM, Petr Machata wrote:
> Drivers may need to validate configuration of a device that's about to
> be upped. Should the validation fail, there's currently no way to
> communicate details of the failure to the user, beyond an error number.
> 
> To mend that, change __dev_open() to take an extack argument and pass it
> from __dev_change_flags() and dev_open(), where it was propagated in the
> previous patches.
> 
> Change __dev_open() to call call_netdevice_notifiers_extack() so that
> the passed-in extack is attached to the NETDEV_PRE_UP notifier.
> 
> Signed-off-by: Petr Machata 
> Acked-by: Jiri Pirko 
> Reviewed-by: Ido Schimmel 
> ---
>  net/core/dev.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Reviewed-by: David Ahern 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 4/8] net: core: dev: Add extack argument to dev_change_flags()

2018-12-05 Thread David Ahern
On 12/5/18 3:51 AM, Petr Machata wrote:
> In order to pass extack together with NETDEV_PRE_UP notifications, it's
> necessary to route the extack to __dev_open() from diverse (possibly
> indirect) callers. One prominent API through which the notification is
> invoked is dev_change_flags().
> 
> Therefore extend dev_change_flags() with and extra extack argument and
> update all users. Most of the calls end up just encoding NULL, but
> several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.
> 
> Since the function declaration line is changed anyway, name the other
> function arguments to placate checkpatch.
> 
> Signed-off-by: Petr Machata 
> Acked-by: Jiri Pirko 
> Reviewed-by: Ido Schimmel 
> ---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c |  6 +++---
>  drivers/net/hyperv/netvsc_drv.c   |  2 +-
>  drivers/net/ipvlan/ipvlan_main.c  | 12 
>  drivers/net/vrf.c |  4 ++--
>  include/linux/netdevice.h |  3 ++-
>  net/8021q/vlan.c  |  4 +++-
>  net/core/dev.c|  4 +++-
>  net/core/dev_ioctl.c  |  2 +-
>  net/core/net-sysfs.c  |  2 +-
>  net/core/rtnetlink.c  |  3 ++-
>  net/ipv4/devinet.c|  2 +-
>  net/ipv4/ipconfig.c   |  6 +++---
>  net/openvswitch/vport-geneve.c|  2 +-
>  net/openvswitch/vport-gre.c   |  2 +-
>  net/openvswitch/vport-vxlan.c |  2 +-
>  15 files changed, 33 insertions(+), 23 deletions(-)
> 

Reviewed-by: David Ahern 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 6/8] net: core: dev: Add call_netdevice_notifiers_extack()

2018-12-05 Thread David Ahern
On 12/5/18 3:51 AM, Petr Machata wrote:
> In order to propagate extack through NETDEV_PRE_UP, add a new function
> call_netdevice_notifiers_extack() that primes the extack field of the
> notifier info. Convert call_netdevice_notifiers() to a simple wrapper
> around the new function that passes NULL for extack.
> 
> Signed-off-by: Petr Machata 
> Acked-by: Jiri Pirko 
> Reviewed-by: Ido Schimmel 
> ---
>  net/core/dev.c | 21 -
>  1 file changed, 16 insertions(+), 5 deletions(-)

Reviewed-by: David Ahern 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 2/8] net: vrf: cycle_netdev(): Add an extack argument

2018-12-05 Thread David Ahern
On 12/5/18 3:51 AM, Petr Machata wrote:
> A follow-up patch will extend dev_change_flags() with an extack
> argument. Extend cycle_netdev() to have that argument available for the
> conversion.
> 
> Signed-off-by: Petr Machata 
> Acked-by: Jiri Pirko 
> Reviewed-by: Ido Schimmel 
> ---
>  drivers/net/vrf.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 

Reviewed-by: David Ahern 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 1/8] net: core: dev: Add extack argument to dev_open()

2018-12-05 Thread David Ahern
On 12/5/18 3:51 AM, Petr Machata wrote:
> In order to pass extack together with NETDEV_PRE_UP notifications, it's
> necessary to route the extack to __dev_open() from diverse (possibly
> indirect) callers. One prominent API through which the notification is
> invoked is dev_open().
> 
> Therefore extend dev_open() with and extra extack argument and update
> all users. Most of the calls end up just encoding NULL, but bond and
> team drivers have the extack readily available.
> 
> Signed-off-by: Petr Machata 
> Acked-by: Jiri Pirko 
> Reviewed-by: Ido Schimmel 
> ---
>  drivers/net/bonding/bond_main.c | 2 +-
>  drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | 2 +-
>  drivers/net/ethernet/cisco/enic/enic_ethtool.c  | 2 +-
>  drivers/net/ethernet/hisilicon/hns/hns_ethtool.c| 2 +-
>  drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c  | 2 +-
>  drivers/net/ethernet/sfc/ethtool.c  | 2 +-
>  drivers/net/ethernet/sfc/falcon/ethtool.c   | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c   | 2 +-
>  drivers/net/hyperv/netvsc_drv.c | 4 ++--
>  drivers/net/net_failover.c  | 8 
>  drivers/net/team/team.c | 2 +-
>  drivers/net/wireless/intersil/hostap/hostap_main.c  | 2 +-
>  drivers/s390/net/qeth_l2_main.c | 2 +-
>  drivers/s390/net/qeth_l3_main.c | 2 +-
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 2 +-
>  drivers/staging/unisys/visornic/visornic_main.c | 2 +-
>  include/linux/netdevice.h   | 2 +-
>  net/bluetooth/6lowpan.c | 2 +-
>  net/core/dev.c  | 5 +++--
>  net/core/netpoll.c  | 2 +-
>  net/ipv4/ipmr.c | 4 ++--
>  net/ipv6/addrconf.c | 2 +-
>  net/ipv6/ip6mr.c| 2 +-
>  23 files changed, 30 insertions(+), 29 deletions(-)

Reviewed-by: David Ahern 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 5/8] net: core: dev: Add extack argument to __dev_change_flags()

2018-12-05 Thread David Ahern
On 12/5/18 3:51 AM, Petr Machata wrote:
> In order to pass extack together with NETDEV_PRE_UP notifications, it's
> necessary to route the extack to __dev_open() from diverse (possibly
> indirect) callers. The last missing API is __dev_change_flags().
> 
> Therefore extend __dev_change_flags() with and extra extack argument and
> update the two existing users.
> 
> Since the function declaration line is changed anyway, name the struct
> net_device argument to placate checkpatch.
> 
> Signed-off-by: Petr Machata 
> Acked-by: Jiri Pirko 
> Reviewed-by: Ido Schimmel 
> ---
>  include/linux/netdevice.h | 3 ++-
>  net/core/dev.c| 5 +++--
>  net/core/rtnetlink.c  | 3 ++-
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 

Reviewed-by: David Ahern 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] binder: fix sparse warnings on locking context

2018-12-05 Thread Greg Kroah-Hartman
On Wed, Dec 05, 2018 at 06:02:22AM -0800, Todd Kjos wrote:
> On Wed, Dec 5, 2018 at 2:57 AM Greg KH  wrote:
> 
> > On Mon, Dec 03, 2018 at 12:24:54PM -0800, Todd Kjos wrote:
> > > Add __acquire()/__release() annnotations to fix warnings
> > > in sparse context checking
> > >
> > > There is one case where the warning was due to a lack of
> > > a "default:" case in a switch statement where a lock was
> > > being released in each of the cases, so the default
> > > case was added.
> > >
> > > Signed-off-by: Todd Kjos 
> >
> > You sent out 4 patches here, as a series, but with no numbering so I
> > don't know what order to put them in :(
> >
> > Can you resend them properly numbered so I have a chance to get it
> > right?
> >
> 
> I didn't number them because they are independent and can go in any order.

Ah, that wasn't obvious :)

> They are not really a series. I can resend with numbers though if you want
> to reflect the order I sent them in.

Ok, no need for numbering them, but they do need to be resent based on
the feedback I gave.  I've dropped them all from my queue because of
that.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6 1/3] staging: mt7621-mmc: Remove #if 0 blocks in sd.c

2018-12-05 Thread Nishad Kamdar
On Sun, Nov 18, 2018 at 08:33:03AM +1100, NeilBrown wrote:
> On Thu, Oct 04 2018, Nishad Kamdar wrote:
> 
> > This patch removes #if 0 code blocks and usages of
> > functions defined in the #if 0 blocks in sd.c.
> >
> > Signed-off-by: Nishad Kamdar 
> 
> Hi Nishad,
>  thanks for this patch (and others) and apologies for not
>  reviewing/testing it earlier.
>  Unfortunately there is a problem - see below.
>  
> >  
> > -#if 0 /* --- by chhung */
> > -/* For E2 only */
> > -static u8 clk_src_bit[4] = {
> > -   0, 3, 5, 7
> > -};
> > -
> >  static void msdc_select_clksrc(struct msdc_host *host, unsigned char 
> > clksrc)
> >  {
> > u32 val;
> 
> Above you removed the first few lines of a "#if 0" block, but not all of
> it.  Previously the function msdc_select_clksrc() was not compiled at
> all.  Now it is, and that causes an error - MSDC_CLKSRC_REG is not
> defined.
> 
> Would you be able to send a follow-patch patch which removes this
> function and the "#endif /* end of --- */" at the end?
> 
> Thanks,
> NeilBrown

Sure, I'll send the updated patch.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: mt7621-mmc: Remove missed lines of the #if 0 block in sd.c

2018-12-05 Thread Nishad Kamdar
The below patch
https://lore.kernel.org/patchwork/patch/995533/
does not completely remove an #if 0 block in sd.c.
This causes the function msdc_select_clksrc()
which was earler not compiled, to be compiled.
That causes an error - MSDC_CLKSRC_REG is not
defined.

This patch completely removes the #if 0 block

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/mt7621-mmc/sd.c | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 7b66f9b0a094..3d918e481bd8 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -216,26 +216,6 @@ static void msdc_tasklet_card(struct work_struct *work)
spin_unlock(>lock);
 }
 
-static void msdc_select_clksrc(struct msdc_host *host, unsigned char clksrc)
-{
-   u32 val;
-
-   BUG_ON(clksrc > 3);
-
-   val = readl(host->base + MSDC_CLKSRC_REG);
-   if (readl(host->base + MSDC_ECO_VER) >= 4) {
-   val &= ~(0x3  << clk_src_bit[host->id]);
-   val |= clksrc << clk_src_bit[host->id];
-   } else {
-   val &= ~0x3; val |= clksrc;
-   }
-   writel(val, host->base + MSDC_CLKSRC_REG);
-
-   host->hclk = hclks[clksrc];
-   host->hw->clk_src = clksrc;
-}
-#endif /* end of --- */
-
 static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
 {
//struct msdc_hw *hw = host->hw;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: mt7621-spi: drop the broken full-duplex mode

2018-12-05 Thread Chuanhong Guo
forgot to reply to mailing list...
NeilBrown  于2018年12月5日周三 上午8:06写道:
>
> On Tue, Dec 04 2018, Chuanhong Guo wrote:
>
> > Hi!
> > NeilBrown  于2018年12月4日周二 上午5:55写道:
> >>
> >> On Mon, Dec 03 2018, Chuanhong Guo wrote:
> >>
> >> > Under MORE_BUF_MODE the controller will always shift one bit out of
> >> > spi_opcode if (mosi_bit_cnt > 0) && (cmd_bit_cnt == 0) so the full-
> >> > duplex mode is broken since we can't read anything from MISO during
> >> > writing spi_opcode.
> >> > This piece of code also make CS1 unavailable since it forces the
> >> > broken full-duplex mode to be enabled on CS1.
> >>
> >> Hi,
> >>  How do you know these details of the hardware?  Do you have detailed
> >>  specs for the hardware or have you experimented with it or are you one
> >>  of the designers or ?
> >>  It would be nice to have the source of this information documented.
> > Those info are provided by John Crispin on IRC #openwrt-devel. Here is
> > the quoted reply:
> > ---
> > Nov 26 17:00:15  gch981213[w]: so basically i made cs1 work
> > for MTK/labs when i built the linkit smart for them. the req-sheet
> > said that cs1 should be proper duplex spi. however 
> > Nov 26 17:00:34  1) the core will always send 1 byte before
> > any transfer, this is the m25p80 command.
> > Nov 26 17:00:49  2) mode 3 is broken and bit reversed (?)
> > Nov 26 17:01:01  3) some bit are incorrectly wired in hw for mode2/3
> > Nov 26 17:01:50  we wrote a test script and test for
> > [0-0x] on all modes and certain bits are swizzled under certain
> > conditions and it was not possible to fix this even using a hack.
> > Nov 26 17:02:06  we then decided to use spi-gpio and i never
> > removed the errornous code
> > Nov 26 17:02:38  basically the spi is fecked for anything but
> > half duplex spi mode0 running a sflash on it
>
> I think this is useful information that is worth preserving in the
> commit message.  I would strip the time stamps, and make it something
> like this:
>
>  According to John Crispin (aka blogic) on IRC on Nov 26 2018:
>so basically i made cs1 work for MTK/labs when i built
>the linkit smart for them. the req-sheet said that cs1 should be proper
> duplex spi. however 
> 1) the core will always send 1 byte before any transfer, this is the
>m25p80 command.
> 2) mode 3 is broken and bit reversed (?)
> 3) some bit are incorrectly wired in hw for mode2/3
>we wrote a test script and test for [0-0x] on all modes and certain
>bits are swizzled under certain conditions and it was not possible to
>fix this even using a hack.
>we then decided to use spi-gpio and i never removed the errornous code
>basically the spi is fecked for anything but half duplex spi mode0
>running a sflash on it
>
> If you add that to the commit message, I would be quite happy to Ack it.
I'll do that tomorrow.
Should I duplicate the above message in the other patch (the one
dropping SPI_MODE1/2/3) or squash the two patches together or just
keep that one untouched?
>
>
> Thanks,
> NeilBrown
>
>
> > ---
> > And another guy told me that his experiment shows there will be one
> > extra bit if we set cmd_bit_cnt to 0 and mosi_bit_cnt > 0.
> > I guess it doesn't matter whether it's an extra "byte" or "bit" since
> > there are always some data that have to be sent under half-duplex.
> >
> > Do I need to add "some experiment shows that" at the beginning of my
> > commit message?
> >>
> >> Thanks,
> >> NeilBrown
> >>
> >>
> >> >
> >> > Signed-off-by: Chuanhong Guo 
> >> > ---
> >> >  drivers/staging/mt7621-spi/spi-mt7621.c | 120 +++-
> >> >  1 file changed, 15 insertions(+), 105 deletions(-)
> >> >
> >> > diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
> >> > b/drivers/staging/mt7621-spi/spi-mt7621.c
> >> > index d045b5568e0f..8af6f307e176 100644
> >> > --- a/drivers/staging/mt7621-spi/spi-mt7621.c
> >> > +++ b/drivers/staging/mt7621-spi/spi-mt7621.c
> >> > @@ -86,16 +86,13 @@ static inline void mt7621_spi_write(struct 
> >> > mt7621_spi *rs, u32 reg, u32 val)
> >> >   iowrite32(val, rs->base + reg);
> >> >  }
> >> >
> >> > -static void mt7621_spi_reset(struct mt7621_spi *rs, int duplex)
> >> > +static void mt7621_spi_reset(struct mt7621_spi *rs)
> >> >  {
> >> >   u32 master = mt7621_spi_read(rs, MT7621_SPI_MASTER);
> >> >
> >> >   master |= 7 << 29;
> >> >   master |= 1 << 2;
> >> > - if (duplex)
> >> > - master |= 1 << 10;
> >> > - else
> >> > - master &= ~(1 << 10);
> >> > + master &= ~(1 << 10);
> >> >
> >> >   mt7621_spi_write(rs, MT7621_SPI_MASTER, master);
> >> >   rs->pending_write = 0;
> >> > @@ -107,7 +104,7 @@ static void mt7621_spi_set_cs(struct spi_device 
> >> > *spi, int enable)
> >> >   int cs = spi->chip_select;
> >> >   u32 polar = 0;
> >> >
> >> > - mt7621_spi_reset(rs, cs);
> >> > + mt7621_spi_reset(rs);
> >> >   if (enable)
> >> >   polar = BIT(cs);
> >> > 

Re: [PATCH v2 1/2] media: v4l: Add definitions for the HEVC slice format and controls

2018-12-05 Thread Hans Verkuil
On 11/23/18 14:02, Paul Kocialkowski wrote:
> This introduces the required definitions for HEVC decoding support with
> stateless VPUs. The controls associated to the HEVC slice format provide
> the required meta-data for decoding slices extracted from the bitstream.
> 
> This interface comes with the following limitations:
> * No custom quantization matrices (scaling lists);
> * Support for a single temporal layer only;
> * No slice entry point offsets support;
> * No conformance window support;
> * No VUI parameters support;
> * No support for SPS extensions: range, multilayer, 3d, scc, 4 bits;
> * No support for PPS extensions: range, multilayer, 3d, scc, 4 bits.

So if support for one or more of these items would have to be added,
would that be just new controls, or would it affect existing controls?

> 
> Signed-off-by: Paul Kocialkowski 
> ---
>  Documentation/media/uapi/v4l/biblio.rst   |   9 +
>  .../media/uapi/v4l/extended-controls.rst  | 417 ++
>  .../media/uapi/v4l/pixfmt-compressed.rst  |  15 +
>  .../media/uapi/v4l/vidioc-queryctrl.rst   |  18 +
>  .../media/videodev2.h.rst.exceptions  |   3 +
>  drivers/media/v4l2-core/v4l2-ctrls.c  |  26 ++
>  drivers/media/v4l2-core/v4l2-ioctl.c  |   1 +
>  include/media/v4l2-ctrls.h|   6 +
>  include/uapi/linux/v4l2-controls.h| 155 +++
>  include/uapi/linux/v4l2-controls.h.rej| 187 

Huh? .rej?

>  include/uapi/linux/videodev2.h|   7 +
>  11 files changed, 657 insertions(+), 187 deletions(-)
>  delete mode 100644 include/uapi/linux/v4l2-controls.h.rej
> 
> diff --git a/Documentation/media/uapi/v4l/biblio.rst 
> b/Documentation/media/uapi/v4l/biblio.rst
> index 73aeb7ce47d2..59a98feca3a1 100644
> --- a/Documentation/media/uapi/v4l/biblio.rst
> +++ b/Documentation/media/uapi/v4l/biblio.rst
> @@ -124,6 +124,15 @@ ITU H.264
>  
>  :author:International Telecommunication Union (http://www.itu.ch)
>  
> +.. _hevc:
> +
> +ITU H.265/HEVC
> +==
> +
> +:title: ITU-T Rec. H.265 | ISO/IEC 23008-2 "High Efficiency Video Coding"
> +
> +:author:International Telecommunication Union (http://www.itu.ch), 
> International Organisation for Standardisation (http://www.iso.ch)
> +
>  .. _jfif:
>  
>  JFIF
> diff --git a/Documentation/media/uapi/v4l/extended-controls.rst 
> b/Documentation/media/uapi/v4l/extended-controls.rst
> index 87c0d151577f..906ff4f32634 100644
> --- a/Documentation/media/uapi/v4l/extended-controls.rst
> +++ b/Documentation/media/uapi/v4l/extended-controls.rst
> @@ -2038,6 +2038,423 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
>- ``flags``
>-
>  
> +.. _v4l2-mpeg-hevc:
> +
> +``V4L2_CID_MPEG_VIDEO_HEVC_SPS (struct)``
> +Specifies the Sequence Parameter Set fields (as extracted from the
> +bitstream) for the associated HEVC slice data.
> +These bitstream parameters are defined according to :ref:`hevc`.
> +Refer to the specification for the documentation of these fields.

Same as for h264: if possible, refer to the section(s) in the spec that deal
with these fields.

> +
> +.. c:type:: v4l2_ctrl_hevc_sps
> +
> +.. cssclass:: longtable
> +
> +.. flat-table:: struct v4l2_ctrl_hevc_sps
> +:header-rows:  0
> +:stub-columns: 0
> +:widths:   1 1 2
> +
> +* - __u8
> +  - ``chroma_format_idc``
> +  -
> +* - __u8
> +  - ``separate_colour_plane_flag``
> +  -
> +* - __u16
> +  - ``pic_width_in_luma_samples``
> +  -
> +* - __u16
> +  - ``pic_height_in_luma_samples``
> +  -
> +* - __u8
> +  - ``bit_depth_luma_minus8``
> +  -
> +* - __u8
> +  - ``bit_depth_chroma_minus8``
> +  -
> +* - __u8
> +  - ``log2_max_pic_order_cnt_lsb_minus4``
> +  -
> +* - __u8
> +  - ``sps_max_dec_pic_buffering_minus1``
> +  -
> +* - __u8
> +  - ``sps_max_num_reorder_pics``
> +  -
> +* - __u8
> +  - ``sps_max_latency_increase_plus1``
> +  -
> +* - __u8
> +  - ``log2_min_luma_coding_block_size_minus3``
> +  -
> +* - __u8
> +  - ``log2_diff_max_min_luma_coding_block_size``
> +  -
> +* - __u8
> +  - ``log2_min_luma_transform_block_size_minus2``
> +  -
> +* - __u8
> +  - ``log2_diff_max_min_luma_transform_block_size``
> +  -
> +* - __u8
> +  - ``max_transform_hierarchy_depth_inter``
> +  -
> +* - __u8
> +  - ``max_transform_hierarchy_depth_intra``
> +  -
> +* - __u8
> +  - ``scaling_list_enabled_flag``
> +  -
> +* - __u8
> +  - ``amp_enabled_flag``
> +  -
> +* - __u8
> +  - ``sample_adaptive_offset_enabled_flag``
> +  -
> +* - __u8
> +  - ``pcm_enabled_flag``
> +  -
> +* - __u8
> +  - ``pcm_sample_bit_depth_luma_minus1``
> +  -
> +* - __u8
> +  - ``pcm_sample_bit_depth_chroma_minus1``
> +  -
> +* - __u8
> +  - 

[PATCH 2/2] staging: erofs: update erofs-utils information in TODO

2018-12-05 Thread Gao Xiang
erofs-utils was released by the original author Li Guifu
weeks ago in the linux-erofs mailing list [1], update
information in TODO and let's wait the original author
finish all open source works.

[1] https://lists.ozlabs.org/pipermail/linux-erofs/2018-November/001004.html

Cc: Li Guifu 
Cc: Fang Wei 
Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/TODO | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/erofs/TODO b/drivers/staging/erofs/TODO
index f99ddb842f99..a8608b2f72bd 100644
--- a/drivers/staging/erofs/TODO
+++ b/drivers/staging/erofs/TODO
@@ -23,13 +23,14 @@ TODO List:
 
  - data deduplication and other useful features.
 
-erofs-mkfs (preview version) binaries for i386 / x86_64 are available at:
-
-   https://github.com/hsiangkao/erofs_mkfs_binary
-
-It is still in progress opening mkfs source code to public,
-in any case an open-source mkfs will be released in the near future.
-
+The following git tree provides the file system user-space
+tools under development (ex, formatting tool mkfs.erofs):
+>> git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git
+
+The open-source development of erofs-utils is at the early stage.
+Contact the original author Li Guifu  and
+the co-maintainer Fang Wei  for the latest news
+and more details.
 
 Code, suggestions, etc, are welcome. Please feel free to
 ask and send patches,
-- 
2.14.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: erofs: {dir,inode,super}.c: rectify BUG_ONs

2018-12-05 Thread Gao Xiang
remove all redundant BUG_ONs, and turn the rest
useful usages to DBG_BUGONs.

Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/dir.c   |  7 +--
 drivers/staging/erofs/inode.c | 10 --
 drivers/staging/erofs/super.c | 13 ++---
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
index d1cb0d78ab84..e44ca93dcdc6 100644
--- a/drivers/staging/erofs/dir.c
+++ b/drivers/staging/erofs/dir.c
@@ -53,8 +53,11 @@ static int erofs_fill_dentries(struct dir_context *ctx,
strnlen(de_name, maxsize - nameoff) :
le16_to_cpu(de[1].nameoff) - nameoff;
 
-   /* the corrupted directory found */
-   BUG_ON(de_namelen < 0);
+   /* a corrupted entry is found */
+   if (unlikely(de_namelen < 0)) {
+   DBG_BUGON(1);
+   return -EIO;
+   }
 
 #ifdef CONFIG_EROFS_FS_DEBUG
dbg_namelen = min(EROFS_NAME_LEN - 1, de_namelen);
diff --git a/drivers/staging/erofs/inode.c b/drivers/staging/erofs/inode.c
index 04c61a9d7b76..d7fbf5f4600f 100644
--- a/drivers/staging/erofs/inode.c
+++ b/drivers/staging/erofs/inode.c
@@ -133,7 +133,13 @@ static int fill_inline_data(struct inode *inode, void 
*data,
return -ENOMEM;
 
m_pofs += vi->inode_isize + vi->xattr_isize;
-   BUG_ON(m_pofs + inode->i_size > PAGE_SIZE);
+
+   /* inline symlink data shouldn't across page boundary as well */
+   if (unlikely(m_pofs + inode->i_size > PAGE_SIZE)) {
+   DBG_BUGON(1);
+   kfree(lnk);
+   return -EIO;
+   }
 
/* get in-page inline data */
memcpy(lnk, data + m_pofs, inode->i_size);
@@ -171,7 +177,7 @@ static int fill_inode(struct inode *inode, int isdir)
return PTR_ERR(page);
}
 
-   BUG_ON(!PageUptodate(page));
+   DBG_BUGON(!PageUptodate(page));
data = page_address(page);
 
err = read_inode(inode, data + ofs);
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 1ab3553c839b..1c2eb69682ef 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -40,7 +40,6 @@ static int __init erofs_init_inode_cache(void)
 
 static void erofs_exit_inode_cache(void)
 {
-   BUG_ON(erofs_inode_cachep == NULL);
kmem_cache_destroy(erofs_inode_cachep);
 }
 
@@ -303,8 +302,8 @@ static int managed_cache_releasepage(struct page *page, 
gfp_t gfp_mask)
int ret = 1;/* 0 - busy */
struct address_space *const mapping = page->mapping;
 
-   BUG_ON(!PageLocked(page));
-   BUG_ON(mapping->a_ops != _cache_aops);
+   DBG_BUGON(!PageLocked(page));
+   DBG_BUGON(mapping->a_ops != _cache_aops);
 
if (PagePrivate(page))
ret = erofs_try_to_free_cached_page(mapping, page);
@@ -317,10 +316,10 @@ static void managed_cache_invalidatepage(struct page 
*page,
 {
const unsigned int stop = length + offset;
 
-   BUG_ON(!PageLocked(page));
+   DBG_BUGON(!PageLocked(page));
 
-   /* Check for overflow */
-   BUG_ON(stop > PAGE_SIZE || stop < length);
+   /* Check for potential overflow in debug mode */
+   DBG_BUGON(stop > PAGE_SIZE || stop < length);
 
if (offset == 0 && stop == PAGE_SIZE)
while (!managed_cache_releasepage(page, GFP_NOFS))
@@ -649,7 +648,7 @@ static int erofs_remount(struct super_block *sb, int 
*flags, char *data)
unsigned int org_inject_rate = erofs_get_fault_rate(sbi);
int err;
 
-   BUG_ON(!sb_rdonly(sb));
+   DBG_BUGON(!sb_rdonly(sb));
err = parse_options(sb, data);
if (err)
goto out;
-- 
2.14.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 0/8] Pass extack to NETDEV_PRE_UP

2018-12-05 Thread Petr Machata
Drivers may need to validate configuration of a device that's about to
be upped. An example is mlxsw, which needs to check the configuration of
a VXLAN device attached to an offloaded bridge. Should the validation
fail, there's currently no way to communicate details of the failure to
the user, beyond an error number.

Therefore this patch set extends the NETDEV_PRE_UP event to include
extack, if available.

There are three vectors through which NETDEV_PRE_UP invocation can be
reached. The two major ones are dev_open() and dev_change_flags(), the
last is then __dev_change_flags().

In patch #1, the first access vector, dev_open() is addressed. An extack
parameter is added and all users converted to use it.

Before addressing the second vector, two preparatory patches propagate
extack argument to the proximity of the dev_change_flags() call in VRF
and IPVLAN drivers. That happens in patches #2 and #3. Then in patch #4,
dev_change_flags() is treated similarly to dev_open().

Likewise in patch #5, __dev_change_flags() is extended.

Then in patches #6 and #7, the extack is finally propagated all the way
to the point where the notification is emitted.

This change allows particularly mlxsw (which already has code to
leverage extack if available) to communicate to the user error messages
regarding VXLAN configuration. In patch #8, add a test case that
exercises this code and checks that an error message is propagated.

For example:

# ip link add name br1 up type bridge vlan_filtering 0 mcast_snooping 0
# ip link add name vx1 up type vxlan id 1000 \
local 192.0.2.17 remote 192.0.2.18 \
dstport 4789 nolearning noudpcsum tos inherit ttl 100
# ip link set dev vx1 master br1
# ip link set dev sw1p1 master br1
# ip link add name br2 up type bridge vlan_filtering 0 mcast_snooping 0
# ip link add name vx2 up type vxlan id 2000 \
local 192.0.2.17 remote 192.0.2.18 \
dstport 4789 nolearning noudpcsum tos inherit ttl 100
# ip link set dev vx2 master br2
# ip link set dev sw1p2 master br2
# ip link set dev vx2 down
# ip link set dev vx2 type vxlan ttl 200
# ip link set dev vx2 up
Error: mlxsw_spectrum: Conflicting NVE tunnels configuration.

Petr Machata (8):
  net: core: dev: Add extack argument to dev_open()
  net: vrf: cycle_netdev(): Add an extack argument
  net: ipvlan: ipvlan_set_port_mode(): Add an extack argument
  net: core: dev: Add extack argument to dev_change_flags()
  net: core: dev: Add extack argument to __dev_change_flags()
  net: core: dev: Add call_netdevice_notifiers_extack()
  net: core: dev: Attach extack to NETDEV_PRE_UP
  selftests: mlxsw: Add a new test extack.sh

 drivers/infiniband/ulp/ipoib/ipoib_main.c  |  6 +-
 drivers/net/bonding/bond_main.c|  2 +-
 .../net/ethernet/aquantia/atlantic/aq_ethtool.c|  2 +-
 drivers/net/ethernet/cisco/enic/enic_ethtool.c |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c   |  2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c |  2 +-
 drivers/net/ethernet/sfc/ethtool.c |  2 +-
 drivers/net/ethernet/sfc/falcon/ethtool.c  |  2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  2 +-
 drivers/net/hyperv/netvsc_drv.c|  6 +-
 drivers/net/ipvlan/ipvlan_main.c   | 19 +++--
 drivers/net/net_failover.c |  8 +--
 drivers/net/team/team.c|  2 +-
 drivers/net/vrf.c  | 11 +--
 drivers/net/wireless/intersil/hostap/hostap_main.c |  2 +-
 drivers/s390/net/qeth_l2_main.c|  2 +-
 drivers/s390/net/qeth_l3_main.c|  2 +-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c|  2 +-
 drivers/staging/unisys/visornic/visornic_main.c|  2 +-
 include/linux/netdevice.h  |  8 ++-
 net/8021q/vlan.c   |  4 +-
 net/bluetooth/6lowpan.c|  2 +-
 net/core/dev.c | 43 +++
 net/core/dev_ioctl.c   |  2 +-
 net/core/net-sysfs.c   |  2 +-
 net/core/netpoll.c |  2 +-
 net/core/rtnetlink.c   |  6 +-
 net/ipv4/devinet.c |  2 +-
 net/ipv4/ipconfig.c|  6 +-
 net/ipv4/ipmr.c|  4 +-
 net/ipv6/addrconf.c|  2 +-
 net/ipv6/ip6mr.c   |  2 +-
 net/openvswitch/vport-geneve.c |  2 +-
 net/openvswitch/vport-gre.c|  2 +-
 net/openvswitch/vport-vxlan.c  |  2 +-
 .../testing/selftests/drivers/net/mlxsw/extack.sh  | 84 ++
 36 files changed, 182 insertions(+), 71 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/mlxsw/extack.sh

-- 
2.4.11


[PATCH net-next 6/8] net: core: dev: Add call_netdevice_notifiers_extack()

2018-12-05 Thread Petr Machata
In order to propagate extack through NETDEV_PRE_UP, add a new function
call_netdevice_notifiers_extack() that primes the extack field of the
notifier info. Convert call_netdevice_notifiers() to a simple wrapper
around the new function that passes NULL for extack.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 net/core/dev.c | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index b37e320def13..4b033af8e6cd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -162,6 +162,9 @@ static struct list_head offload_base __read_mostly;
 static int netif_rx_internal(struct sk_buff *skb);
 static int call_netdevice_notifiers_info(unsigned long val,
 struct netdev_notifier_info *info);
+static int call_netdevice_notifiers_extack(unsigned long val,
+  struct net_device *dev,
+  struct netlink_ext_ack *extack);
 static struct napi_struct *napi_by_id(unsigned int napi_id);
 
 /*
@@ -1734,6 +1737,18 @@ static int call_netdevice_notifiers_info(unsigned long 
val,
return raw_notifier_call_chain(_chain, val, info);
 }
 
+static int call_netdevice_notifiers_extack(unsigned long val,
+  struct net_device *dev,
+  struct netlink_ext_ack *extack)
+{
+   struct netdev_notifier_info info = {
+   .dev = dev,
+   .extack = extack,
+   };
+
+   return call_netdevice_notifiers_info(val, );
+}
+
 /**
  * call_netdevice_notifiers - call all network notifier blocks
  *  @val: value passed unmodified to notifier function
@@ -1745,11 +1760,7 @@ static int call_netdevice_notifiers_info(unsigned long 
val,
 
 int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
 {
-   struct netdev_notifier_info info = {
-   .dev = dev,
-   };
-
-   return call_netdevice_notifiers_info(val, );
+   return call_netdevice_notifiers_extack(val, dev, NULL);
 }
 EXPORT_SYMBOL(call_netdevice_notifiers);
 
-- 
2.4.11

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 7/8] net: core: dev: Attach extack to NETDEV_PRE_UP

2018-12-05 Thread Petr Machata
Drivers may need to validate configuration of a device that's about to
be upped. Should the validation fail, there's currently no way to
communicate details of the failure to the user, beyond an error number.

To mend that, change __dev_open() to take an extack argument and pass it
from __dev_change_flags() and dev_open(), where it was propagated in the
previous patches.

Change __dev_open() to call call_netdevice_notifiers_extack() so that
the passed-in extack is attached to the NETDEV_PRE_UP notifier.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 net/core/dev.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 4b033af8e6cd..068b60db35ae 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1364,7 +1364,7 @@ void netdev_notify_peers(struct net_device *dev)
 }
 EXPORT_SYMBOL(netdev_notify_peers);
 
-static int __dev_open(struct net_device *dev)
+static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
 {
const struct net_device_ops *ops = dev->netdev_ops;
int ret;
@@ -1380,7 +1380,7 @@ static int __dev_open(struct net_device *dev)
 */
netpoll_poll_disable(dev);
 
-   ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev);
+   ret = call_netdevice_notifiers_extack(NETDEV_PRE_UP, dev, extack);
ret = notifier_to_errno(ret);
if (ret)
return ret;
@@ -1427,7 +1427,7 @@ int dev_open(struct net_device *dev, struct 
netlink_ext_ack *extack)
if (dev->flags & IFF_UP)
return 0;
 
-   ret = __dev_open(dev);
+   ret = __dev_open(dev, extack);
if (ret < 0)
return ret;
 
@@ -7547,7 +7547,7 @@ int __dev_change_flags(struct net_device *dev, unsigned 
int flags,
if (old_flags & IFF_UP)
__dev_close(dev);
else
-   ret = __dev_open(dev);
+   ret = __dev_open(dev, extack);
}
 
if ((flags ^ dev->gflags) & IFF_PROMISC) {
-- 
2.4.11

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 1/8] net: core: dev: Add extack argument to dev_open()

2018-12-05 Thread Petr Machata
In order to pass extack together with NETDEV_PRE_UP notifications, it's
necessary to route the extack to __dev_open() from diverse (possibly
indirect) callers. One prominent API through which the notification is
invoked is dev_open().

Therefore extend dev_open() with and extra extack argument and update
all users. Most of the calls end up just encoding NULL, but bond and
team drivers have the extack readily available.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 drivers/net/bonding/bond_main.c | 2 +-
 drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | 2 +-
 drivers/net/ethernet/cisco/enic/enic_ethtool.c  | 2 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c| 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c  | 2 +-
 drivers/net/ethernet/sfc/ethtool.c  | 2 +-
 drivers/net/ethernet/sfc/falcon/ethtool.c   | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c   | 2 +-
 drivers/net/hyperv/netvsc_drv.c | 4 ++--
 drivers/net/net_failover.c  | 8 
 drivers/net/team/team.c | 2 +-
 drivers/net/wireless/intersil/hostap/hostap_main.c  | 2 +-
 drivers/s390/net/qeth_l2_main.c | 2 +-
 drivers/s390/net/qeth_l3_main.c | 2 +-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 2 +-
 drivers/staging/unisys/visornic/visornic_main.c | 2 +-
 include/linux/netdevice.h   | 2 +-
 net/bluetooth/6lowpan.c | 2 +-
 net/core/dev.c  | 5 +++--
 net/core/netpoll.c  | 2 +-
 net/ipv4/ipmr.c | 4 ++--
 net/ipv6/addrconf.c | 2 +-
 net/ipv6/ip6mr.c| 2 +-
 23 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 87f1f1fe..6b34dbefa7dd 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1538,7 +1538,7 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev,
slave_dev->flags |= IFF_SLAVE;
 
/* open the slave since the application closed it */
-   res = dev_open(slave_dev);
+   res = dev_open(slave_dev, extack);
if (res) {
netdev_dbg(bond_dev, "Opening slave %s failed\n", 
slave_dev->name);
goto err_restore_mac;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c 
b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
index a5fd71692c8b..43b42615ad84 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
@@ -525,7 +525,7 @@ static int aq_set_ringparam(struct net_device *ndev,
}
}
if (ndev_running)
-   err = dev_open(ndev);
+   err = dev_open(ndev, NULL);
 
 err_exit:
return err;
diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c 
b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index f42f7a6e1559..ebd5c2cf1efe 100644
--- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
+++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
@@ -241,7 +241,7 @@ static int enic_set_ringparam(struct net_device *netdev,
}
enic_init_vnic_resources(enic);
if (running) {
-   err = dev_open(netdev);
+   err = dev_open(netdev, NULL);
if (err)
goto err_out;
}
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c 
b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 774beda040a1..8e9b95871d30 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -624,7 +624,7 @@ static void hns_nic_self_test(struct net_device *ndev,
clear_bit(NIC_STATE_TESTING, >state);
 
if (if_running)
-   (void)dev_open(ndev);
+   (void)dev_open(ndev, NULL);
}
/* Online tests aren't run; pass by default */
 
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 4563638367ac..e678b6939da3 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -821,7 +821,7 @@ static int hns3_set_ringparam(struct net_device *ndev,
}
 
if (if_running)
-   ret = dev_open(ndev);
+   ret = dev_open(ndev, NULL);
 
return ret;
 }
diff --git a/drivers/net/ethernet/sfc/ethtool.c 
b/drivers/net/ethernet/sfc/ethtool.c
index 3143588ffd77..600d7b895cf2 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -539,7 +539,7 @@ static void 

[PATCH net-next 2/8] net: vrf: cycle_netdev(): Add an extack argument

2018-12-05 Thread Petr Machata
A follow-up patch will extend dev_change_flags() with an extack
argument. Extend cycle_netdev() to have that argument available for the
conversion.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 drivers/net/vrf.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 21ad4b1d7f03..1e9f2dc0de07 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -747,7 +747,8 @@ static int vrf_rtable_create(struct net_device *dev)
 / device handling /
 
 /* cycle interface to flush neighbor cache and move routes across tables */
-static void cycle_netdev(struct net_device *dev)
+static void cycle_netdev(struct net_device *dev,
+struct netlink_ext_ack *extack)
 {
unsigned int flags = dev->flags;
int ret;
@@ -785,7 +786,7 @@ static int do_vrf_add_slave(struct net_device *dev, struct 
net_device *port_dev,
if (ret < 0)
goto err;
 
-   cycle_netdev(port_dev);
+   cycle_netdev(port_dev, extack);
 
return 0;
 
@@ -815,7 +816,7 @@ static int do_vrf_del_slave(struct net_device *dev, struct 
net_device *port_dev)
netdev_upper_dev_unlink(port_dev, dev);
port_dev->priv_flags &= ~IFF_L3MDEV_SLAVE;
 
-   cycle_netdev(port_dev);
+   cycle_netdev(port_dev, NULL);
 
return 0;
 }
-- 
2.4.11

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 00/15] Cedrus H5 and A64 support with A33 and H3 updates

2018-12-05 Thread Maxime Ripard
On Wed, Dec 05, 2018 at 05:48:34PM +0800, Chen-Yu Tsai wrote:
> On Wed, Dec 5, 2018 at 5:25 PM Paul Kocialkowski
>  wrote:
> >
> > This series adds support for the Allwinner H5 and A64 platforms to the
> > cedrus stateless video codec driver, with minor updates to the A33 and
> > H3 platforms.
> >
> > It requires changes to the SRAM driver bindings and driver, to properly
> > support the H5 and the A64 C1 SRAM section. Because a H5-specific
> > system-control node is introduced, the dummy syscon node that was shared
> > between the H3 and H5 is removed in favor of each platform-specific node.
> > A few fixes are included to ensure that the EMAC clock configuration
> > register is still accessible through the sunxi SRAM driver (instead of the
> > dummy syscon node, that was there for this purpose) on the H3 and H5.
> >
> > The reserved memory nodes for the A33 and H3 are also removed in this
> > series, since they are not actually necessary.
> >
> > Changes since v1:
> > * Removed the reserved-memory nodes for the A64 and H5;
> > * Removed the reserved-memory nodes for the A33 and H3;
> > * Corrected the SRAM bases and sizes to the best of our knowledge;
> > * Dropped cosmetic dt changes already included in the sunxi tree.
> >
> > Paul Kocialkowski (15):
> >   ARM: dts: sun8i: h3: Fix the system-control register range
> >   ARM: dts: sun8i: a33: Remove unnecessary reserved memory node
> >   ARM: dts: sun8i: h3: Remove unnecessary reserved memory node
> >   soc: sunxi: sram: Enable EMAC clock access for H3 variant
> >   dt-bindings: sram: sunxi: Add bindings for the H5 with SRAM C1
> >   soc: sunxi: sram: Add support for the H5 SoC system control
> >   arm64: dts: allwinner: h5: Add system-control node with SRAM C1
> >   ARM/arm64: sunxi: Move H3/H5 syscon label over to soc-specific nodes
> >   dt-bindings: sram: sunxi: Add compatible for the A64 SRAM C1
> >   arm64: dts: allwinner: a64: Add support for the SRAM C1 section
> >   dt-bindings: media: cedrus: Add compatibles for the A64 and H5
> >   media: cedrus: Add device-tree compatible and variant for H5 support
> >   media: cedrus: Add device-tree compatible and variant for A64 support
> >   arm64: dts: allwinner: h5: Add Video Engine node
> >   arm64: dts: allwinner: a64: Add Video Engine node
> 
> Other than the error in patch 7,
> 
> Acked-by: Chen-Yu Tsai 

Applied all the patches but 11-13, with the changes discussed on patch 7 fixed.

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 4/8] net: core: dev: Add extack argument to dev_change_flags()

2018-12-05 Thread Petr Machata
In order to pass extack together with NETDEV_PRE_UP notifications, it's
necessary to route the extack to __dev_open() from diverse (possibly
indirect) callers. One prominent API through which the notification is
invoked is dev_change_flags().

Therefore extend dev_change_flags() with and extra extack argument and
update all users. Most of the calls end up just encoding NULL, but
several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.

Since the function declaration line is changed anyway, name the other
function arguments to placate checkpatch.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c |  6 +++---
 drivers/net/hyperv/netvsc_drv.c   |  2 +-
 drivers/net/ipvlan/ipvlan_main.c  | 12 
 drivers/net/vrf.c |  4 ++--
 include/linux/netdevice.h |  3 ++-
 net/8021q/vlan.c  |  4 +++-
 net/core/dev.c|  4 +++-
 net/core/dev_ioctl.c  |  2 +-
 net/core/net-sysfs.c  |  2 +-
 net/core/rtnetlink.c  |  3 ++-
 net/ipv4/devinet.c|  2 +-
 net/ipv4/ipconfig.c   |  6 +++---
 net/openvswitch/vport-geneve.c|  2 +-
 net/openvswitch/vport-gre.c   |  2 +-
 net/openvswitch/vport-vxlan.c |  2 +-
 15 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c 
b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 8710214594d8..6214d8c0d546 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -167,7 +167,7 @@ int ipoib_open(struct net_device *dev)
if (flags & IFF_UP)
continue;
 
-   dev_change_flags(cpriv->dev, flags | IFF_UP);
+   dev_change_flags(cpriv->dev, flags | IFF_UP, NULL);
}
up_read(>vlan_rwsem);
}
@@ -207,7 +207,7 @@ static int ipoib_stop(struct net_device *dev)
if (!(flags & IFF_UP))
continue;
 
-   dev_change_flags(cpriv->dev, flags & ~IFF_UP);
+   dev_change_flags(cpriv->dev, flags & ~IFF_UP, NULL);
}
up_read(>vlan_rwsem);
}
@@ -1823,7 +1823,7 @@ static void ipoib_parent_unregister_pre(struct net_device 
*ndev)
 * running ensures the it will not add more work.
 */
rtnl_lock();
-   dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP);
+   dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP, NULL);
rtnl_unlock();
 
/* ipoib_event() cannot be running once this returns */
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index c65620adab52..18b5584d6377 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1993,7 +1993,7 @@ static void __netvsc_vf_setup(struct net_device *ndev,
"unable to change mtu to %u\n", ndev->mtu);
 
/* set multicast etc flags on VF */
-   dev_change_flags(vf_netdev, ndev->flags | IFF_SLAVE);
+   dev_change_flags(vf_netdev, ndev->flags | IFF_SLAVE, NULL);
 
/* sync address list from ndev to VF */
netif_addr_lock_bh(ndev);
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 14f1cbd3b96f..c3d3e458f541 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -85,10 +85,12 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 
nval,
flags = ipvlan->dev->flags;
if (nval == IPVLAN_MODE_L3 || nval == IPVLAN_MODE_L3S) {
err = dev_change_flags(ipvlan->dev,
-  flags | IFF_NOARP);
+  flags | IFF_NOARP,
+  extack);
} else {
err = dev_change_flags(ipvlan->dev,
-  flags & ~IFF_NOARP);
+  flags & ~IFF_NOARP,
+  extack);
}
if (unlikely(err))
goto fail;
@@ -117,9 +119,11 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, 
u16 nval,
flags = ipvlan->dev->flags;
if (port->mode == IPVLAN_MODE_L3 ||
port->mode == IPVLAN_MODE_L3S)
-   dev_change_flags(ipvlan->dev, flags | IFF_NOARP);
+   dev_change_flags(ipvlan->dev, flags | IFF_NOARP,
+

[PATCH net-next 8/8] selftests: mlxsw: Add a new test extack.sh

2018-12-05 Thread Petr Machata
Add a testsuite dedicated to testing extack propagation and related
functionality.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 .../testing/selftests/drivers/net/mlxsw/extack.sh  | 84 ++
 1 file changed, 84 insertions(+)
 create mode 100755 tools/testing/selftests/drivers/net/mlxsw/extack.sh

diff --git a/tools/testing/selftests/drivers/net/mlxsw/extack.sh 
b/tools/testing/selftests/drivers/net/mlxsw/extack.sh
new file mode 100755
index ..101a5508bdfd
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/mlxsw/extack.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Test operations that we expect to report extended ack.
+
+lib_dir=$(dirname $0)/../../../net/forwarding
+
+ALL_TESTS="
+   netdev_pre_up_test
+"
+NUM_NETIFS=2
+source $lib_dir/lib.sh
+
+setup_prepare()
+{
+   swp1=${NETIFS[p1]}
+   swp2=${NETIFS[p2]}
+
+   ip link set dev $swp1 up
+   ip link set dev $swp2 up
+}
+
+cleanup()
+{
+   pre_cleanup
+
+   ip link set dev $swp2 down
+   ip link set dev $swp1 down
+}
+
+netdev_pre_up_test()
+{
+   RET=0
+
+   ip link add name br1 up type bridge vlan_filtering 0 mcast_snooping 0
+   ip link add name vx1 up type vxlan id 1000 \
+   local 192.0.2.17 remote 192.0.2.18 \
+   dstport 4789 nolearning noudpcsum tos inherit ttl 100
+
+   ip link set dev vx1 master br1
+   check_err $?
+
+   ip link set dev $swp1 master br1
+   check_err $?
+
+   ip link add name br2 up type bridge vlan_filtering 0 mcast_snooping 0
+   ip link add name vx2 up type vxlan id 2000 \
+   local 192.0.2.17 remote 192.0.2.18 \
+   dstport 4789 nolearning noudpcsum tos inherit ttl 100
+
+   ip link set dev vx2 master br2
+   check_err $?
+
+   ip link set dev $swp2 master br2
+   check_err $?
+
+   # Unsupported configuration: mlxsw demands that all offloaded VXLAN
+   # devices have the same TTL.
+   ip link set dev vx2 down
+   ip link set dev vx2 type vxlan ttl 200
+
+   ip link set dev vx2 up &>/dev/null
+   check_fail $?
+
+   ip link set dev vx2 up 2>&1 >/dev/null | grep -q mlxsw_spectrum
+   check_err $?
+
+   log_test "extack - NETDEV_PRE_UP"
+
+   ip link del dev vx2
+   ip link del dev br2
+
+   ip link del dev vx1
+   ip link del dev br1
+}
+
+trap cleanup EXIT
+
+setup_prepare
+setup_wait
+
+tests_run
+
+exit $EXIT_STATUS
-- 
2.4.11

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 3/8] net: ipvlan: ipvlan_set_port_mode(): Add an extack argument

2018-12-05 Thread Petr Machata
A follow-up patch will extend dev_change_flags() with an extack
argument. Extend ipvlan_set_port_mode() to have that argument available
for the conversion.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 drivers/net/ipvlan/ipvlan_main.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 4a949569ec4c..14f1cbd3b96f 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -71,7 +71,8 @@ static void ipvlan_unregister_nf_hook(struct net *net)
ARRAY_SIZE(ipvl_nfops));
 }
 
-static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
+static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval,
+   struct netlink_ext_ack *extack)
 {
struct ipvl_dev *ipvlan;
struct net_device *mdev = port->dev;
@@ -498,7 +499,7 @@ static int ipvlan_nl_changelink(struct net_device *dev,
if (data[IFLA_IPVLAN_MODE]) {
u16 nmode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
 
-   err = ipvlan_set_port_mode(port, nmode);
+   err = ipvlan_set_port_mode(port, nmode, extack);
}
 
if (!err && data[IFLA_IPVLAN_FLAGS]) {
@@ -672,7 +673,7 @@ int ipvlan_link_new(struct net *src_net, struct net_device 
*dev,
if (data && data[IFLA_IPVLAN_MODE])
mode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
 
-   err = ipvlan_set_port_mode(port, mode);
+   err = ipvlan_set_port_mode(port, mode, extack);
if (err)
goto unlink_netdev;
 
-- 
2.4.11

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 5/8] net: core: dev: Add extack argument to __dev_change_flags()

2018-12-05 Thread Petr Machata
In order to pass extack together with NETDEV_PRE_UP notifications, it's
necessary to route the extack to __dev_open() from diverse (possibly
indirect) callers. The last missing API is __dev_change_flags().

Therefore extend __dev_change_flags() with and extra extack argument and
update the two existing users.

Since the function declaration line is changed anyway, name the struct
net_device argument to placate checkpatch.

Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
---
 include/linux/netdevice.h | 3 ++-
 net/core/dev.c| 5 +++--
 net/core/rtnetlink.c  | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 18cf464450ee..fc6ba71513be 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3611,7 +3611,8 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct 
ifreq *ifr,
 int dev_ifconf(struct net *net, struct ifconf *, int);
 int dev_ethtool(struct net *net, struct ifreq *);
 unsigned int dev_get_flags(const struct net_device *);
-int __dev_change_flags(struct net_device *, unsigned int flags);
+int __dev_change_flags(struct net_device *dev, unsigned int flags,
+  struct netlink_ext_ack *extack);
 int dev_change_flags(struct net_device *dev, unsigned int flags,
 struct netlink_ext_ack *extack);
 void __dev_notify_flags(struct net_device *, unsigned int old_flags,
diff --git a/net/core/dev.c b/net/core/dev.c
index 8bba6f98b545..b37e320def13 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7498,7 +7498,8 @@ unsigned int dev_get_flags(const struct net_device *dev)
 }
 EXPORT_SYMBOL(dev_get_flags);
 
-int __dev_change_flags(struct net_device *dev, unsigned int flags)
+int __dev_change_flags(struct net_device *dev, unsigned int flags,
+  struct netlink_ext_ack *extack)
 {
unsigned int old_flags = dev->flags;
int ret;
@@ -7606,7 +7607,7 @@ int dev_change_flags(struct net_device *dev, unsigned int 
flags,
int ret;
unsigned int changes, old_flags = dev->flags, old_gflags = dev->gflags;
 
-   ret = __dev_change_flags(dev, flags);
+   ret = __dev_change_flags(dev, flags, extack);
if (ret < 0)
return ret;
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4c9e4e187600..91a0f7477f8e 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2871,7 +2871,8 @@ int rtnl_configure_link(struct net_device *dev, const 
struct ifinfomsg *ifm)
 
old_flags = dev->flags;
if (ifm && (ifm->ifi_flags || ifm->ifi_change)) {
-   err = __dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm));
+   err = __dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm),
+NULL);
if (err < 0)
return err;
}
-- 
2.4.11

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 12/15] media: cedrus: Add device-tree compatible and variant for H5 support

2018-12-05 Thread Maxime Ripard
On Wed, Dec 05, 2018 at 10:24:41AM +0100, Paul Kocialkowski wrote:
> Add the necessary compatible for supporting the H5 SoC along with a
> description of the capabilities of this variant.
> 
> Signed-off-by: Paul Kocialkowski 

Acked-by: Maxime Ripard 

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 13/15] media: cedrus: Add device-tree compatible and variant for A64 support

2018-12-05 Thread Maxime Ripard
65;5402;1c
On Wed, Dec 05, 2018 at 10:24:42AM +0100, Paul Kocialkowski wrote:
> Add the necessary compatible for supporting the A64 SoC along with a
> description of the capabilities of this variant.
> 
> Signed-off-by: Paul Kocialkowski 

Acked-by: Maxime Ripard 

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 11/15] dt-bindings: media: cedrus: Add compatibles for the A64 and H5

2018-12-05 Thread Maxime Ripard
On Wed, Dec 05, 2018 at 10:24:40AM +0100, Paul Kocialkowski wrote:
> This introduces two new compatibles for the cedrus driver, for the
> A64 and H5 platforms.
> 
> Signed-off-by: Paul Kocialkowski 
> Reviewed-by: Rob Herring 

Acked-by: Maxime Ripard 

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] binder: fix kerneldoc header for struct binder_buffer

2018-12-05 Thread Greg KH
On Mon, Dec 03, 2018 at 12:24:55PM -0800, Todd Kjos wrote:
> Fix the incomplete kerneldoc header for struct binder_buffer.
> 
> Change-Id: If3ca10cf6d90f605a0c078e4cdce28f02a475877

No need for this here :)

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] binder: fix use-after-free due to fdget() optimization

2018-12-05 Thread Greg KH
On Mon, Dec 03, 2018 at 12:24:57PM -0800, Todd Kjos wrote:
> 44d8047f1d87a ("binder: use standard functions to allocate fds")
> exposed a pre-existing issue in the binder driver.
> 
> fdget() is used in ksys_ioctl() as a performance optimization.
> One of the rules associated with fdget() is that ksys_close() must
> not be called between the fdget() and the fdput(). There is a case
> where this requirement is not met in the binder driver (and possibly
> other drivers) which results in the reference count dropping to 0
> when the device is still in use. This can result in use-after-free
> or other issues.
> 
> This was observed with the following sequence of events:
> 
> Task A and task B are connected via binder; task A has /dev/binder open at
> file descriptor number X. Both tasks are single-threaded.
> 
> 1. task B sends a binder message with a file descriptor array
>(BINDER_TYPE_FDA) containing one file descriptor to task A
> 2. task A reads the binder message with the translated file
>descriptor number Y
> 3. task A uses dup2(X, Y) to overwrite file descriptor Y with
>the /dev/binder file
> 4. task A unmaps the userspace binder memory mapping; the reference
>count on task A's /dev/binder is now 2
> 5. task A closes file descriptor X; the reference count on task
>A's /dev/binder is now 1
> 6. task A forks off a child, task C, duplicating the file descriptor
>table; the reference count on task A's /dev/binder is now 2
> 7. task A invokes the BC_FREE_BUFFER command on file descriptor X
>to release the incoming binder message
> 8. fdget() in ksys_ioctl() suppresses the reference count increment,
>since the file descriptor table is not shared
> 9. the BC_FREE_BUFFER handler removes the file descriptor table
>entry for X and decrements the reference count of task A's
>/dev/binder file to 1
> 10.task C calls close(X), which drops the reference count of
>task A's /dev/binder to 0 and frees it
> 11.task A continues processing of the ioctl and accesses some
>property of e.g. the binder_proc => KASAN-detectable UAF
> 
> Fixed by using get_file() / fput() in binder_ioctl().
> 
> Suggested-by: Jann Horn 
> Signed-off-by: Todd Kjos 
> Acked-by: Martijn Coenen 

Shouldn't this go to 4.20-final?  And have a stable@ tag?
And a "Fixes:" tag?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] binder: fix sparse warnings on locking context

2018-12-05 Thread Greg KH
On Mon, Dec 03, 2018 at 12:24:54PM -0800, Todd Kjos wrote:
> Add __acquire()/__release() annnotations to fix warnings
> in sparse context checking
> 
> There is one case where the warning was due to a lack of
> a "default:" case in a switch statement where a lock was
> being released in each of the cases, so the default
> case was added.
> 
> Signed-off-by: Todd Kjos 

You sent out 4 patches here, as a series, but with no numbering so I
don't know what order to put them in :(

Can you resend them properly numbered so I have a chance to get it
right?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

2018-12-05 Thread Bryan O'Donoghue

On 04/12/2018 20:58, Cristian Sicilia wrote:

Some concatenated strings are now spaced.

Signed-off-by: Cristian Sicilia 
---
  drivers/staging/greybus/loopback.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/loopback.c 
b/drivers/staging/greybus/loopback.c
index 1085e06..acfa392 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -141,7 +141,7 @@ static ssize_t name##_##field##_show(struct device *dev,
\
/* Report 0 for min and max if no transfer successed */ \
if (!gb->requests_completed) \
return sprintf(buf, "0\n");   \
-   return sprintf(buf, "%"#type"\n", gb->name.field);   \
+   return sprintf(buf, "%" #type "\n", gb->name.field); \
  } \
  static DEVICE_ATTR_RO(name##_##field)
  
@@ -176,7 +176,7 @@ static ssize_t field##_show(struct device *dev,\

char *buf)  \
  { \
struct gb_loopback *gb = dev_get_drvdata(dev);  \
-   return sprintf(buf, "%"#type"\n", gb->field);\
+   return sprintf(buf, "%" #type "\n", gb->field);  \
  } \
  static ssize_t field##_store(struct device *dev,  \
struct device_attribute *attr,  \
@@ -212,7 +212,7 @@ static ssize_t field##_show(struct device *dev, 
\
char *buf)  \
  { \
struct gb_loopback *gb = dev_get_drvdata(dev);  \
-   return sprintf(buf, "%"#type"\n", gb->field);\
+   return sprintf(buf, "%" #type "\n", gb->field);  \
  } \
  static ssize_t field##_store(struct device *dev,  \
struct device_attribute *attr,  \


Eh.

But doesn't all of this add an extra two space to the resultant string ?

Not what we want.

---
bod
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 07/15] arm64: dts: allwinner: h5: Add system-control node with SRAM C1

2018-12-05 Thread Paul Kocialkowski
Hi,

On Wed, 2018-12-05 at 17:49 +0800, Chen-Yu Tsai wrote:
> On Wed, Dec 5, 2018 at 5:48 PM Paul Kocialkowski
>  wrote:
> > Hi,
> > 
> > On Wed, 2018-12-05 at 17:45 +0800, Chen-Yu Tsai wrote:
> > > On Wed, Dec 5, 2018 at 5:25 PM Paul Kocialkowski
> > >  wrote:
> > > > Add the H5-specific system control node description to its device-tree
> > > > with support for the SRAM C1 section, that will be used by the video
> > > > codec node later on.
> > > > 
> > > > The CPU-side SRAM address was obtained empirically while the size was
> > > > taken from the documentation. They may not be entirely accurate.
> > > > 
> > > > Signed-off-by: Paul Kocialkowski 
> > > > ---
> > > >  arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 22 
> > > >  1 file changed, 22 insertions(+)
> > > > 
> > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi 
> > > > b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > > > index b41dc1aab67d..42bfb560b367 100644
> > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > > > @@ -94,6 +94,28 @@
> > > > };
> > > > 
> > > > soc {
> > > > +   system-control@1c0 {
> > > > +   compatible = 
> > > > "allwinner,sun50i-h5-system-control";
> > > > +   reg = <0x01c0 0x1000>;
> > > > +   #address-cells = <1>;
> > > > +   #size-cells = <1>;
> > > > +   ranges;
> > > > +
> > > > +   sram_c1: sram@1d0 {
> > > > +   compatible = "mmio-sram";
> > > > +   reg = <0x00018000 0x1c000>;
> > > 
> > > 0x1d0 or 0x18000?
> > 
> > For the H5, I found the VE SRAM area to be mapped to 0x18000 on the CPU
> > side (when testing with devmem), unlike the A64, H3 and others. I was
> > rather surprised about this as well!
> 
> I'm actually referring to the node name that still says 1d0.

Oh I totally missed that, sorry. Thanks for pointing it out!

Cheers,

Paul

> ChenYu
> 
> > > > +   #address-cells = <1>;
> > > > +   #size-cells = <1>;
> > > > +   ranges = <0 0x00018000 0x1c000>;
> > > 
> > > Same here.
> > > 
> > > > +
> > > > +   ve_sram: sram-section@0 {
> > > > +   compatible = 
> > > > "allwinner,sun50i-h5-sram-c1",
> > > > +
> > > > "allwinner,sun4i-a10-sram-c1";
> > > > +   reg = <0x00 0x1c000>;
> > > > +   };
> > > > +   };
> > > > +   };
> > > > +
> > > > mali: gpu@1e8 {
> > > > compatible = "allwinner,sun50i-h5-mali", 
> > > > "arm,mali-450";
> > > > reg = <0x01e8 0x3>;
> > > > --
> > > > 2.19.2
> > 
> > Cheers,
> > 
> > Paul
> > 
> > --
> > Paul Kocialkowski, Bootlin (formerly Free Electrons)
> > Embedded Linux and kernel engineering
> > https://bootlin.com
> > 
-- 
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 07/15] arm64: dts: allwinner: h5: Add system-control node with SRAM C1

2018-12-05 Thread Chen-Yu Tsai
On Wed, Dec 5, 2018 at 5:48 PM Paul Kocialkowski
 wrote:
>
> Hi,
>
> On Wed, 2018-12-05 at 17:45 +0800, Chen-Yu Tsai wrote:
> > On Wed, Dec 5, 2018 at 5:25 PM Paul Kocialkowski
> >  wrote:
> > > Add the H5-specific system control node description to its device-tree
> > > with support for the SRAM C1 section, that will be used by the video
> > > codec node later on.
> > >
> > > The CPU-side SRAM address was obtained empirically while the size was
> > > taken from the documentation. They may not be entirely accurate.
> > >
> > > Signed-off-by: Paul Kocialkowski 
> > > ---
> > >  arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 22 
> > >  1 file changed, 22 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi 
> > > b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > > index b41dc1aab67d..42bfb560b367 100644
> > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > > @@ -94,6 +94,28 @@
> > > };
> > >
> > > soc {
> > > +   system-control@1c0 {
> > > +   compatible = "allwinner,sun50i-h5-system-control";
> > > +   reg = <0x01c0 0x1000>;
> > > +   #address-cells = <1>;
> > > +   #size-cells = <1>;
> > > +   ranges;
> > > +
> > > +   sram_c1: sram@1d0 {
> > > +   compatible = "mmio-sram";
> > > +   reg = <0x00018000 0x1c000>;
> >
> > 0x1d0 or 0x18000?
>
> For the H5, I found the VE SRAM area to be mapped to 0x18000 on the CPU
> side (when testing with devmem), unlike the A64, H3 and others. I was
> rather surprised about this as well!

I'm actually referring to the node name that still says 1d0.

ChenYu

>
> > > +   #address-cells = <1>;
> > > +   #size-cells = <1>;
> > > +   ranges = <0 0x00018000 0x1c000>;
> >
> > Same here.
> >
> > > +
> > > +   ve_sram: sram-section@0 {
> > > +   compatible = 
> > > "allwinner,sun50i-h5-sram-c1",
> > > +
> > > "allwinner,sun4i-a10-sram-c1";
> > > +   reg = <0x00 0x1c000>;
> > > +   };
> > > +   };
> > > +   };
> > > +
> > > mali: gpu@1e8 {
> > > compatible = "allwinner,sun50i-h5-mali", 
> > > "arm,mali-450";
> > > reg = <0x01e8 0x3>;
> > > --
> > > 2.19.2
>
> Cheers,
>
> Paul
>
> --
> Paul Kocialkowski, Bootlin (formerly Free Electrons)
> Embedded Linux and kernel engineering
> https://bootlin.com
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 00/15] Cedrus H5 and A64 support with A33 and H3 updates

2018-12-05 Thread Chen-Yu Tsai
On Wed, Dec 5, 2018 at 5:25 PM Paul Kocialkowski
 wrote:
>
> This series adds support for the Allwinner H5 and A64 platforms to the
> cedrus stateless video codec driver, with minor updates to the A33 and
> H3 platforms.
>
> It requires changes to the SRAM driver bindings and driver, to properly
> support the H5 and the A64 C1 SRAM section. Because a H5-specific
> system-control node is introduced, the dummy syscon node that was shared
> between the H3 and H5 is removed in favor of each platform-specific node.
> A few fixes are included to ensure that the EMAC clock configuration
> register is still accessible through the sunxi SRAM driver (instead of the
> dummy syscon node, that was there for this purpose) on the H3 and H5.
>
> The reserved memory nodes for the A33 and H3 are also removed in this
> series, since they are not actually necessary.
>
> Changes since v1:
> * Removed the reserved-memory nodes for the A64 and H5;
> * Removed the reserved-memory nodes for the A33 and H3;
> * Corrected the SRAM bases and sizes to the best of our knowledge;
> * Dropped cosmetic dt changes already included in the sunxi tree.
>
> Paul Kocialkowski (15):
>   ARM: dts: sun8i: h3: Fix the system-control register range
>   ARM: dts: sun8i: a33: Remove unnecessary reserved memory node
>   ARM: dts: sun8i: h3: Remove unnecessary reserved memory node
>   soc: sunxi: sram: Enable EMAC clock access for H3 variant
>   dt-bindings: sram: sunxi: Add bindings for the H5 with SRAM C1
>   soc: sunxi: sram: Add support for the H5 SoC system control
>   arm64: dts: allwinner: h5: Add system-control node with SRAM C1
>   ARM/arm64: sunxi: Move H3/H5 syscon label over to soc-specific nodes
>   dt-bindings: sram: sunxi: Add compatible for the A64 SRAM C1
>   arm64: dts: allwinner: a64: Add support for the SRAM C1 section
>   dt-bindings: media: cedrus: Add compatibles for the A64 and H5
>   media: cedrus: Add device-tree compatible and variant for H5 support
>   media: cedrus: Add device-tree compatible and variant for A64 support
>   arm64: dts: allwinner: h5: Add Video Engine node
>   arm64: dts: allwinner: a64: Add Video Engine node

Other than the error in patch 7,

Acked-by: Chen-Yu Tsai 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 04/13] media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7

2018-12-05 Thread Rui Miguel Silva

Hi Sakari,
Thanks for the review.

On Mon 03 Dec 2018 at 12:10, Sakari Ailus wrote:

Hi Rui,

On Thu, Nov 22, 2018 at 03:18:25PM +, Rui Miguel Silva 
wrote:
Adds MIPI CSI-2 subdev for i.MX7 to connect with sensors with a 
MIPI

CSI-2 interface.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/Makefile |1 +
 drivers/staging/media/imx/imx7-mipi-csis.c | 1135 
 

 2 files changed, 1136 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx7-mipi-csis.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile

index 074f016d3519..d2d909a36239 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += 
imx-media-csi.o

 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
 
 obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o

+obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-mipi-csis.o
diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
b/drivers/staging/media/imx/imx7-mipi-csis.c

new file mode 100644
index ..56963d0c2043
--- /dev/null
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -0,0 +1,1135 @@
+// SPDX-License-Identifier: GPL
+/*
+ * Freescale i.MX7 SoC series MIPI-CSI V3.3 receiver driver
+ *
+ * Copyright (C) 2018 Linaro Ltd
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. All 
Rights Reserved.

+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "imx-media.h"
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "Debug level (0-2)");


Could you rely on dynamic debug instead?


Yeah, I will maybe add some debugfs entry.




+
+#define CSIS_DRIVER_NAME   "imx7-mipi-csis"
+#define CSIS_SUBDEV_NAME   CSIS_DRIVER_NAME
+
+#define CSIS_PAD_SINK  0
+#define CSIS_PAD_SOURCE1
+#define CSIS_PADS_NUM  2
+
+#define MIPI_CSIS_DEF_PIX_WIDTH640
+#define MIPI_CSIS_DEF_PIX_HEIGHT   480
+
+/* Register map definition */
+
+/* CSIS common control */
+#define MIPI_CSIS_CMN_CTRL 0x04
+#define MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW   BIT(16)
+#define MIPI_CSIS_CMN_CTRL_INTER_MODE  BIT(10)
+#define MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW_CTRL  BIT(2)
+#define MIPI_CSIS_CMN_CTRL_RESET   BIT(1)
+#define MIPI_CSIS_CMN_CTRL_ENABLE  BIT(0)
+
+#define MIPI_CSIS_CMN_CTRL_LANE_NR_OFFSET  8
+#define MIPI_CSIS_CMN_CTRL_LANE_NR_MASK(3 << 8)
+
+/* CSIS clock control */
+#define MIPI_CSIS_CLK_CTRL 0x08
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH3(x)	((x) << 
28)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH2(x)	((x) << 
24)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH1(x)	((x) << 
20)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH0(x)	((x) << 
16)

+#define MIPI_CSIS_CLK_CTRL_CLKGATE_EN_MSK  (0xf << 4)
+#define MIPI_CSIS_CLK_CTRL_WCLK_SRCBIT(0)
+
+/* CSIS Interrupt mask */
+#define MIPI_CSIS_INTMSK   0x10
+#define MIPI_CSIS_INTMSK_EVEN_BEFORE   BIT(31)
+#define MIPI_CSIS_INTMSK_EVEN_AFTERBIT(30)
+#define MIPI_CSIS_INTMSK_ODD_BEFOREBIT(29)
+#define MIPI_CSIS_INTMSK_ODD_AFTER BIT(28)
+#define MIPI_CSIS_INTMSK_FRAME_START   BIT(24)
+#define MIPI_CSIS_INTMSK_FRAME_END BIT(20)
+#define MIPI_CSIS_INTMSK_ERR_SOT_HSBIT(16)
+#define MIPI_CSIS_INTMSK_ERR_LOST_FS   BIT(12)
+#define MIPI_CSIS_INTMSK_ERR_LOST_FE   BIT(8)
+#define MIPI_CSIS_INTMSK_ERR_OVER  BIT(4)
+#define MIPI_CSIS_INTMSK_ERR_WRONG_CFG BIT(3)
+#define MIPI_CSIS_INTMSK_ERR_ECC   BIT(2)
+#define MIPI_CSIS_INTMSK_ERR_CRC   BIT(1)
+#define MIPI_CSIS_INTMSK_ERR_UNKNOWN   BIT(0)
+
+/* CSIS Interrupt source */
+#define MIPI_CSIS_INTSRC   0x14
+#define MIPI_CSIS_INTSRC_EVEN_BEFORE   BIT(31)
+#define MIPI_CSIS_INTSRC_EVEN_AFTERBIT(30)
+#define MIPI_CSIS_INTSRC_EVEN  BIT(30)
+#define MIPI_CSIS_INTSRC_ODD_BEFOREBIT(29)
+#define MIPI_CSIS_INTSRC_ODD_AFTER BIT(28)
+#define MIPI_CSIS_INTSRC_ODD   (0x3 << 28)
+#define MIPI_CSIS_INTSRC_NON_IMAGE_DATA(0xf << 28)
+#define MIPI_CSIS_INTSRC_FRAME_START   BIT(24)
+#define MIPI_CSIS_INTSRC_FRAME_END BIT(20)
+#define MIPI_CSIS_INTSRC_ERR_SOT_HSBIT(16)
+#define MIPI_CSIS_INTSRC_ERR_LOST_FS   BIT(12)
+#define MIPI_CSIS_INTSRC_ERR_LOST_FE   BIT(8)
+#define MIPI_CSIS_INTSRC_ERR_OVER  BIT(4)
+#define MIPI_CSIS_INTSRC_ERR_WRONG_CFG BIT(3)
+#define MIPI_CSIS_INTSRC_ERR_ECC   BIT(2)
+#define MIPI_CSIS_INTSRC_ERR_CRC   BIT(1)
+#define MIPI_CSIS_INTSRC_ERR_UNKNOWN   BIT(0)
+#define MIPI_CSIS_INTSRC_ERRORS0xf
+
+/* D-PHY status control */
+#define MIPI_CSIS_DPHYSTATUS   0x20
+#define MIPI_CSIS_DPHYSTATUS_ULPS_DAT  BIT(8)
+#define 

Re: [PATCH v2 07/15] arm64: dts: allwinner: h5: Add system-control node with SRAM C1

2018-12-05 Thread Paul Kocialkowski
Hi,

On Wed, 2018-12-05 at 17:45 +0800, Chen-Yu Tsai wrote:
> On Wed, Dec 5, 2018 at 5:25 PM Paul Kocialkowski
>  wrote:
> > Add the H5-specific system control node description to its device-tree
> > with support for the SRAM C1 section, that will be used by the video
> > codec node later on.
> > 
> > The CPU-side SRAM address was obtained empirically while the size was
> > taken from the documentation. They may not be entirely accurate.
> > 
> > Signed-off-by: Paul Kocialkowski 
> > ---
> >  arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 22 
> >  1 file changed, 22 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi 
> > b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > index b41dc1aab67d..42bfb560b367 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> > @@ -94,6 +94,28 @@
> > };
> > 
> > soc {
> > +   system-control@1c0 {
> > +   compatible = "allwinner,sun50i-h5-system-control";
> > +   reg = <0x01c0 0x1000>;
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +   ranges;
> > +
> > +   sram_c1: sram@1d0 {
> > +   compatible = "mmio-sram";
> > +   reg = <0x00018000 0x1c000>;
> 
> 0x1d0 or 0x18000?

For the H5, I found the VE SRAM area to be mapped to 0x18000 on the CPU
side (when testing with devmem), unlike the A64, H3 and others. I was
rather surprised about this as well!

> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +   ranges = <0 0x00018000 0x1c000>;
> 
> Same here.
> 
> > +
> > +   ve_sram: sram-section@0 {
> > +   compatible = 
> > "allwinner,sun50i-h5-sram-c1",
> > +
> > "allwinner,sun4i-a10-sram-c1";
> > +   reg = <0x00 0x1c000>;
> > +   };
> > +   };
> > +   };
> > +
> > mali: gpu@1e8 {
> > compatible = "allwinner,sun50i-h5-mali", 
> > "arm,mali-450";
> > reg = <0x01e8 0x3>;
> > --
> > 2.19.2

Cheers,

Paul

-- 
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 07/15] arm64: dts: allwinner: h5: Add system-control node with SRAM C1

2018-12-05 Thread Chen-Yu Tsai
On Wed, Dec 5, 2018 at 5:25 PM Paul Kocialkowski
 wrote:
>
> Add the H5-specific system control node description to its device-tree
> with support for the SRAM C1 section, that will be used by the video
> codec node later on.
>
> The CPU-side SRAM address was obtained empirically while the size was
> taken from the documentation. They may not be entirely accurate.
>
> Signed-off-by: Paul Kocialkowski 
> ---
>  arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 22 
>  1 file changed, 22 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi 
> b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> index b41dc1aab67d..42bfb560b367 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
> @@ -94,6 +94,28 @@
> };
>
> soc {
> +   system-control@1c0 {
> +   compatible = "allwinner,sun50i-h5-system-control";
> +   reg = <0x01c0 0x1000>;
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +   ranges;
> +
> +   sram_c1: sram@1d0 {
> +   compatible = "mmio-sram";
> +   reg = <0x00018000 0x1c000>;

0x1d0 or 0x18000?

> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +   ranges = <0 0x00018000 0x1c000>;

Same here.

> +
> +   ve_sram: sram-section@0 {
> +   compatible = 
> "allwinner,sun50i-h5-sram-c1",
> +
> "allwinner,sun4i-a10-sram-c1";
> +   reg = <0x00 0x1c000>;
> +   };
> +   };
> +   };
> +
> mali: gpu@1e8 {
> compatible = "allwinner,sun50i-h5-mali", 
> "arm,mali-450";
> reg = <0x01e8 0x3>;
> --
> 2.19.2
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH AUTOSEL 4.14 04/69] staging: rtl8723bs: Fix the return value in case of error in 'rtw_wx_read32()'

2018-12-05 Thread Sasha Levin
From: Christophe JAILLET 

[ Upstream commit c3e43d8b958bd6849817393483e805d8638a8ab7 ]

We return 0 unconditionally in 'rtw_wx_read32()'.
However, 'ret' is set to some error codes in several error handling paths.

Return 'ret' instead to propagate the error code.

Fixes: 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Christophe JAILLET 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index d5e5f830f2a1..1b61da61690b 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -2383,7 +2383,7 @@ static int rtw_wx_read32(struct net_device *dev,
 exit:
kfree(ptmp);
 
-   return 0;
+   return ret;
 }
 
 static int rtw_wx_write32(struct net_device *dev,
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH AUTOSEL 4.19 007/123] staging: rtl8723bs: Fix the return value in case of error in 'rtw_wx_read32()'

2018-12-05 Thread Sasha Levin
From: Christophe JAILLET 

[ Upstream commit c3e43d8b958bd6849817393483e805d8638a8ab7 ]

We return 0 unconditionally in 'rtw_wx_read32()'.
However, 'ret' is set to some error codes in several error handling paths.

Return 'ret' instead to propagate the error code.

Fixes: 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Christophe JAILLET 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index c38298d960ff..4f120e72c7d2 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -2289,7 +2289,7 @@ static int rtw_wx_read32(struct net_device *dev,
 exit:
kfree(ptmp);
 
-   return 0;
+   return ret;
 }
 
 static int rtw_wx_write32(struct net_device *dev,
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 09/15] dt-bindings: sram: sunxi: Add compatible for the A64 SRAM C1

2018-12-05 Thread Paul Kocialkowski
This introduces a new compatible for the A64 SRAM C1 section, that is
compatible with the SRAM C1 section as found on the A10.

Signed-off-by: Paul Kocialkowski 
Reviewed-by: Rob Herring 
---
 Documentation/devicetree/bindings/sram/sunxi-sram.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/sram/sunxi-sram.txt 
b/Documentation/devicetree/bindings/sram/sunxi-sram.txt
index 5c9a54ad3b53..ab5a70bb9a64 100644
--- a/Documentation/devicetree/bindings/sram/sunxi-sram.txt
+++ b/Documentation/devicetree/bindings/sram/sunxi-sram.txt
@@ -56,6 +56,7 @@ The valid sections compatible for H3 are:
 
 The valid sections compatible for A64 are:
 - allwinner,sun50i-a64-sram-c
+- allwinner,sun50i-a64-sram-c1, allwinner,sun4i-a10-sram-c1
 
 The valid sections compatible for H5 are:
 - allwinner,sun50i-h5-sram-c1, allwinner,sun4i-a10-sram-c1
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 15/15] arm64: dts: allwinner: a64: Add Video Engine node

2018-12-05 Thread Paul Kocialkowski
This adds the Video Engine node for the A64. Since it can map the whole
DRAM range, there is no particular need for a reserved memory node
(unlike platforms preceding the A33).

Signed-off-by: Paul Kocialkowski 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 8557d52c7c99..8d024c10d7cb 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -397,6 +397,17 @@
};
};
 
+   video-codec@1c0e000 {
+   compatible = "allwinner,sun50i-h5-video-engine";
+   reg = <0x01c0e000 0x1000>;
+   clocks = < CLK_BUS_VE>, < CLK_VE>,
+< CLK_DRAM_VE>;
+   clock-names = "ahb", "mod", "ram";
+   resets = < RST_BUS_VE>;
+   interrupts = ;
+   allwinner,sram = <_sram 1>;
+   };
+
mmc0: mmc@1c0f000 {
compatible = "allwinner,sun50i-a64-mmc";
reg = <0x01c0f000 0x1000>;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 06/15] soc: sunxi: sram: Add support for the H5 SoC system control

2018-12-05 Thread Paul Kocialkowski
This adds the H5 SoC compatible to the list of device-tree matches for
the SRAM driver. Since the variant is the same as the A64 (that precedes
the H5), the same variant description is used.

Signed-off-by: Paul Kocialkowski 
---
 drivers/soc/sunxi/sunxi_sram.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index fd81a3c0db45..1b0d50f36349 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -383,6 +383,10 @@ static const struct of_device_id sunxi_sram_dt_match[] = {
.compatible = "allwinner,sun50i-a64-system-control",
.data = _a64_sramc_variant,
},
+   {
+   .compatible = "allwinner,sun50i-h5-system-control",
+   .data = _a64_sramc_variant,
+   },
{ },
 };
 MODULE_DEVICE_TABLE(of, sunxi_sram_dt_match);
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 11/15] dt-bindings: media: cedrus: Add compatibles for the A64 and H5

2018-12-05 Thread Paul Kocialkowski
This introduces two new compatibles for the cedrus driver, for the
A64 and H5 platforms.

Signed-off-by: Paul Kocialkowski 
Reviewed-by: Rob Herring 
---
 Documentation/devicetree/bindings/media/cedrus.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/cedrus.txt 
b/Documentation/devicetree/bindings/media/cedrus.txt
index 33833a43fff8..bce0705df953 100644
--- a/Documentation/devicetree/bindings/media/cedrus.txt
+++ b/Documentation/devicetree/bindings/media/cedrus.txt
@@ -11,6 +11,8 @@ Required properties:
- "allwinner,sun7i-a20-video-engine"
- "allwinner,sun8i-a33-video-engine"
- "allwinner,sun8i-h3-video-engine"
+   - "allwinner,sun50i-a64-video-engine"
+   - "allwinner,sun50i-h5-video-engine"
 - reg  : register base and length of VE;
 - clocks   : list of clock specifiers, corresponding to entries in
  the clock-names property;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 14/15] arm64: dts: allwinner: h5: Add Video Engine node

2018-12-05 Thread Paul Kocialkowski
This adds the Video Engine node for the H5. Since it can map the whole
DRAM range, there is no particular need for a reserved memory node
(unlike platforms preceding the A33).

Signed-off-by: Paul Kocialkowski 
---
 arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
index 4e9025431e9f..dc7b5a8ef348 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
@@ -116,6 +116,17 @@
};
};
 
+   video-codec@1c0e000 {
+   compatible = "allwinner,sun50i-h5-video-engine";
+   reg = <0x01c0e000 0x1000>;
+   clocks = < CLK_BUS_VE>, < CLK_VE>,
+< CLK_DRAM_VE>;
+   clock-names = "ahb", "mod", "ram";
+   resets = < RST_BUS_VE>;
+   interrupts = ;
+   allwinner,sram = <_sram 1>;
+   };
+
mali: gpu@1e8 {
compatible = "allwinner,sun50i-h5-mali", "arm,mali-450";
reg = <0x01e8 0x3>;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 08/15] ARM/arm64: sunxi: Move H3/H5 syscon label over to soc-specific nodes

2018-12-05 Thread Paul Kocialkowski
The EMAC driver requires a syscon node to access the EMAC clock
configuration register (that is part of the system-control register
range and controlled). For this purpose, a dummy syscon node was
introduced to let the driver access the register freely.

Recently, the EMAC driver was tuned to get access to the register when
the SRAM driver is registered (as used on the A64). As a result, it is
no longer necessary to have a dummy syscon node for that purpose.

Now that we have a proper system-control node for both the H3 and H5,
we can get rid of that dummy syscon node and have the EMAC driver use
the node corresponding to the proper SRAM driver (by switching the
syscon label over to each dtsi). This way, we no longer have two
separate nodes for the same register space.

Signed-off-by: Paul Kocialkowski 
---
 arch/arm/boot/dts/sun8i-h3.dtsi  | 2 +-
 arch/arm/boot/dts/sunxi-h3-h5.dtsi   | 6 --
 arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 2 +-
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index e438e54580e1..a858d91dd4c6 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -120,7 +120,7 @@
};
 
soc {
-   system-control@1c0 {
+   syscon: system-control@1c0 {
compatible = "allwinner,sun8i-h3-system-control";
reg = <0x01c0 0x1000>;
#address-cells = <1>;
diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi 
b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
index 0d9e9eac518c..ed5846982685 100644
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
@@ -152,12 +152,6 @@
};
};
 
-   syscon: syscon@1c0 {
-   compatible = "allwinner,sun8i-h3-system-controller",
-   "syscon";
-   reg = <0x01c0 0x1000>;
-   };
-
dma: dma-controller@1c02000 {
compatible = "allwinner,sun8i-h3-dma";
reg = <0x01c02000 0x1000>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
index 42bfb560b367..4e9025431e9f 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
@@ -94,7 +94,7 @@
};
 
soc {
-   system-control@1c0 {
+   syscon: system-control@1c0 {
compatible = "allwinner,sun50i-h5-system-control";
reg = <0x01c0 0x1000>;
#address-cells = <1>;
-- 
2.19.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  1   2   >