[PATCH v5 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-03-13 Thread Deepa Dinamani
All the current architecture specific defines for these
are the same. Refactor these common defines to a common
header file.

The new common linux/compat_time.h is also useful as it
will eventually be used to hold all the defines that
are needed for compat time types that support non y2038
safe types. New architectures need not have to define these
new types as they will only use new y2038 safe syscalls.
This file can be deleted after y2038 when we stop supporting
non y2038 safe syscalls.

The patch also requires an operation similar to:

git grep "asm/compat\.h" | cut -d ":" -f 1 |  xargs -n 1 sed -i -e 
"s%asm/compat.h%linux/compat.h%g"

Cc: a...@kernel.org
Cc: b...@kernel.crashing.org
Cc: borntrae...@de.ibm.com
Cc: catalin.mari...@arm.com
Cc: cmetc...@mellanox.com
Cc: coh...@redhat.com
Cc: da...@davemloft.net
Cc: del...@gmx.de
Cc: de...@driverdev.osuosl.org
Cc: gerald.schae...@de.ibm.com
Cc: gre...@linuxfoundation.org
Cc: heiko.carst...@de.ibm.com
Cc: hoepp...@linux.vnet.ibm.com
Cc: h...@zytor.com
Cc: j...@parisc-linux.org
Cc: j...@linux.vnet.ibm.com
Cc: linux-ker...@vger.kernel.org
Cc: linux-m...@linux-mips.org
Cc: linux-par...@vger.kernel.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: linux-s...@vger.kernel.org
Cc: mark.rutl...@arm.com
Cc: mi...@redhat.com
Cc: m...@ellerman.id.au
Cc: ober...@linux.vnet.ibm.com
Cc: oprofile-l...@lists.sf.net
Cc: pau...@samba.org
Cc: pet...@infradead.org
Cc: r...@linux-mips.org
Cc: rost...@goodmis.org
Cc: r...@kernel.org
Cc: schwidef...@de.ibm.com
Cc: seb...@linux.vnet.ibm.com
Cc: sparcli...@vger.kernel.org
Cc: s...@linux.vnet.ibm.com
Cc: ubr...@linux.vnet.ibm.com
Cc: will.dea...@arm.com
Cc: x...@kernel.org
Signed-off-by: Arnd Bergmann 
Signed-off-by: Deepa Dinamani 
Acked-by: Steven Rostedt (VMware) 
Acked-by: Catalin Marinas 
Acked-by: James Hogan 
Acked-by: Helge Deller 
---
 arch/arm64/include/asm/compat.h   | 11 ---
 arch/arm64/include/asm/stat.h |  1 +
 arch/arm64/kernel/hw_breakpoint.c |  1 -
 arch/arm64/kernel/perf_regs.c |  2 +-
 arch/mips/include/asm/compat.h| 11 ---
 arch/mips/kernel/signal32.c   |  2 +-
 arch/parisc/include/asm/compat.h  | 11 ---
 arch/powerpc/include/asm/compat.h | 11 ---
 arch/powerpc/kernel/asm-offsets.c |  2 +-
 arch/powerpc/oprofile/backtrace.c |  1 +
 arch/s390/hypfs/hypfs_sprp.c  |  1 -
 arch/s390/include/asm/compat.h| 11 ---
 arch/s390/include/asm/elf.h   |  4 ++--
 arch/s390/kvm/priv.c  |  1 -
 arch/s390/pci/pci_clp.c   |  1 -
 arch/sparc/include/asm/compat.h   | 11 ---
 arch/tile/include/asm/compat.h| 11 ---
 arch/x86/events/core.c|  2 +-
 arch/x86/include/asm/compat.h | 11 ---
 arch/x86/include/asm/ftrace.h |  2 +-
 arch/x86/include/asm/sys_ia32.h   |  2 +-
 arch/x86/kernel/sys_x86_64.c  |  2 +-
 drivers/s390/block/dasd_ioctl.c   |  1 -
 drivers/s390/char/fs3270.c|  1 -
 drivers/s390/char/sclp_ctl.c  |  1 -
 drivers/s390/char/vmcp.c  |  1 -
 drivers/s390/cio/chsc_sch.c   |  1 -
 drivers/s390/net/qeth_core_main.c |  2 +-
 include/linux/compat.h|  1 +
 include/linux/compat_time.h   | 19 +++
 30 files changed, 32 insertions(+), 107 deletions(-)
 create mode 100644 include/linux/compat_time.h

diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index c00c62e1a4a3..0030f79808b3 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -34,7 +34,6 @@
 
 typedef u32compat_size_t;
 typedef s32compat_ssize_t;
-typedef s32compat_time_t;
 typedef s32compat_clock_t;
 typedef s32compat_pid_t;
 typedef u16__compat_uid_t;
@@ -66,16 +65,6 @@ typedef u32  compat_ulong_t;
 typedef u64compat_u64;
 typedef u32compat_uptr_t;
 
-struct compat_timespec {
-   compat_time_t   tv_sec;
-   s32 tv_nsec;
-};
-
-struct compat_timeval {
-   compat_time_t   tv_sec;
-   s32 tv_usec;
-};
-
 struct compat_stat {
 #ifdef __AARCH64EB__
short   st_dev;
diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h
index 15e35598ac40..eab738019707 100644
--- a/arch/arm64/include/asm/stat.h
+++ b/arch/arm64/include/asm/stat.h
@@ -20,6 +20,7 @@
 
 #ifdef CONFIG_COMPAT
 
+#include 
 #include 
 
 /*
diff --git a/arch/arm64/kernel/hw_breakpoint.c 
b/arch/arm64/kernel/hw_breakpoint.c
index 74bb56f656ef..413dbe530da8 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -30,7 +30,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
index 1d091d048d04..0bbac612146e 100644
--- a/arch/arm64/kernel/perf_regs.c
+++ 

[PATCH v5 00/10] posix_clocks: Prepare syscalls for 64 bit time_t conversion

2018-03-13 Thread Deepa Dinamani
The series is a preparation series for individual architectures
to use 64 bit time_t syscalls in compat and 32 bit emulation modes.

This is a follow up to the series Arnd Bergmann posted:
https://sourceware.org/ml/libc-alpha/2015-05/msg00070.html [1]

Thomas, Arnd, this seems ready to be merged now.
Can you help get this merged?

Big picture is as per the lwn article:
https://lwn.net/Articles/643234/ [2]

The series is directed at converting posix clock syscalls:
clock_gettime, clock_settime, clock_getres and clock_nanosleep
to use a new data structure __kernel_timespec at syscall boundaries.
__kernel_timespec maintains 64 bit time_t across all execution modes.

vdso will be handled as part of each architecture when they enable
support for 64 bit time_t.

The compat syscalls are repurposed to provide backward compatibility
by using them as native syscalls as well for 32 bit architectures.
They will continue to use timespec at syscall boundaries.

CONFIG_64_BIT_TIME controls whether the syscalls use __kernel_timespec
or timespec at syscall boundaries.

The series does the following:
1. Enable compat syscalls on 32 bit architectures.
2. Add a new __kernel_timespec type to be used as the data structure
   for all the new syscalls.
3. Add new config CONFIG_64BIT_TIME(intead of the CONFIG_COMPAT_TIME in
   [1] and [2] to switch to new definition of __kernel_timespec. It is
   the same as struct timespec otherwise.
4. Add new CONFIG_32BIT_TIME to conditionally compile compat syscalls.

* Changes since v4:
 * Fixed up kbuild errors for arm64 and powerpc non compat configs
* Changes since v3:
 * Updated include file ordering
* Changes since v2:
 * Dropped the ARCH_HAS_64BIT_TIME config.
 * Fixed zeroing out of higher order bits of tv_nsec for real.
 * Addressed minor review comments from v1.
* Changes since v1:
 * Introduce CONFIG_32BIT_TIME
 * Fixed zeroing out of higher order bits of tv_nsec
 * Included Arnd's changes to fix up use of compat headers

I decided against using LEGACY_TIME_SYSCALLS to conditionally compile
legacy time syscalls such as sys_nanosleep because this will need to
enclose compat_sys_nanosleep as well. So, defining it as 

config LEGACY_TIME_SYSCALLS
 def_bool 64BIT || !64BIT_TIME

will not include compat_sys_nanosleep. We will instead need a new config to
exclusively mark legacy syscalls.

Deepa Dinamani (10):
  compat: Make compat helpers independent of CONFIG_COMPAT
  include: Move compat_timespec/ timeval to compat_time.h
  compat: enable compat_get/put_timespec64 always
  arch: introduce CONFIG_64BIT_TIME
  arch: Introduce CONFIG_COMPAT_32BIT_TIME
  posix-clocks: Make compat syscalls depend on CONFIG_COMPAT_32BIT_TIME
  include: Add new y2038 safe __kernel_timespec
  fix get_timespec64() for y2038 safe compat interfaces
  change time types to new y2038 safe __kernel_* types
  nanosleep: change time types to safe __kernel_* types

 arch/Kconfig   | 15 +
 arch/arm64/include/asm/compat.h| 11 ---
 arch/arm64/include/asm/stat.h  |  1 +
 arch/arm64/kernel/hw_breakpoint.c  |  1 -
 arch/arm64/kernel/perf_regs.c  |  2 +-
 arch/mips/include/asm/compat.h | 11 ---
 arch/mips/kernel/signal32.c|  2 +-
 arch/parisc/include/asm/compat.h   | 11 ---
 arch/powerpc/include/asm/compat.h  | 11 ---
 arch/powerpc/kernel/asm-offsets.c  |  2 +-
 arch/powerpc/oprofile/backtrace.c  |  1 +
 arch/s390/hypfs/hypfs_sprp.c   |  1 -
 arch/s390/include/asm/compat.h | 11 ---
 arch/s390/include/asm/elf.h|  4 +--
 arch/s390/kvm/priv.c   |  1 -
 arch/s390/pci/pci_clp.c|  1 -
 arch/sparc/include/asm/compat.h| 11 ---
 arch/tile/include/asm/compat.h | 11 ---
 arch/x86/events/core.c |  2 +-
 arch/x86/include/asm/compat.h  | 11 ---
 arch/x86/include/asm/ftrace.h  |  2 +-
 arch/x86/include/asm/sys_ia32.h|  2 +-
 arch/x86/kernel/sys_x86_64.c   |  2 +-
 drivers/s390/block/dasd_ioctl.c|  1 -
 drivers/s390/char/fs3270.c |  1 -
 drivers/s390/char/sclp_ctl.c   |  1 -
 drivers/s390/char/vmcp.c   |  1 -
 drivers/s390/cio/chsc_sch.c|  1 -
 drivers/s390/net/qeth_core_main.c  |  2 +-
 include/linux/compat.h | 11 ---
 include/linux/compat_time.h| 23 ++
 include/linux/restart_block.h  |  7 ++--
 include/linux/syscalls.h   | 12 +++
 include/linux/time.h   |  4 +--
 include/linux/time64.h | 10 +-
 include/uapi/asm-generic/posix_types.h |  1 +
 include/uapi/linux/time.h  |  7 
 kernel/compat.c| 52 +-
 kernel/time/hrtimer.c  | 10 --
 kernel/time/posix-stubs.c  | 12 ---
 kernel/time/posix-timers.c | 24 ++
 

Re: [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-03-13 Thread Deepa Dinamani
This is again a tricky include file ordering when linux/compat.h is
included instead of asm/compat.h. is_compat_task() is unconditionally
defined in linux/compat.h as a macro which conflicts with inline
function define in asm/compat.h for this arch.
As before, I will do the simple thing here and leave the asm/compat.h
to keep this series simple.
I will submit follow up patches to eliminate direct inclusion asm/compat.h.

I will include this also in the update.

-Deepa

On Tue, Mar 13, 2018 at 8:30 AM, kbuild test robot <l...@intel.com> wrote:
> Hi Deepa,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on ]
>
> url:
> https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305
> base:
> config: powerpc-iss476-smp_defconfig (attached as .config)
> compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
> wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=powerpc
>
> All errors (new ones prefixed by >>):
>
>arch/powerpc/oprofile/backtrace.c: In function 'user_getsp32':
>>> arch/powerpc/oprofile/backtrace.c:31:19: error: implicit declaration of 
>>> function 'compat_ptr'; did you mean 'complete'? 
>>> [-Werror=implicit-function-declaration]
>  void __user *p = compat_ptr(sp);
>   ^~
>   complete
>>> arch/powerpc/oprofile/backtrace.c:31:19: error: initialization makes 
>>> pointer from integer without a cast [-Werror=int-conversion]
>cc1: all warnings being treated as errors
>
> vim +31 arch/powerpc/oprofile/backtrace.c
>
> 6c6bd754 Brian Rogan 2006-03-27  27
> 6c6bd754 Brian Rogan 2006-03-27  28  static unsigned int 
> user_getsp32(unsigned int sp, int is_first)
> 6c6bd754 Brian Rogan 2006-03-27  29  {
> 6c6bd754 Brian Rogan 2006-03-27  30 unsigned int stack_frame[2];
> 62034f03 Al Viro 2006-09-23 @31 void __user *p = compat_ptr(sp);
> 6c6bd754 Brian Rogan 2006-03-27  32
> 62034f03 Al Viro 2006-09-23  33 if (!access_ok(VERIFY_READ, p, 
> sizeof(stack_frame)))
> 6c6bd754 Brian Rogan 2006-03-27  34 return 0;
> 6c6bd754 Brian Rogan 2006-03-27  35
> 6c6bd754 Brian Rogan 2006-03-27  36 /*
> 6c6bd754 Brian Rogan 2006-03-27  37  * The most likely reason for this is 
> that we returned -EFAULT,
> 6c6bd754 Brian Rogan 2006-03-27  38  * which means that we've done all 
> that we can do from
> 6c6bd754 Brian Rogan 2006-03-27  39  * interrupt context.
> 6c6bd754 Brian Rogan 2006-03-27  40  */
> 62034f03 Al Viro 2006-09-23  41 if 
> (__copy_from_user_inatomic(stack_frame, p, sizeof(stack_frame)))
> 6c6bd754 Brian Rogan 2006-03-27  42 return 0;
> 6c6bd754 Brian Rogan 2006-03-27  43
> 6c6bd754 Brian Rogan 2006-03-27  44 if (!is_first)
> 6c6bd754 Brian Rogan 2006-03-27  45 
> oprofile_add_trace(STACK_LR32(stack_frame));
> 6c6bd754 Brian Rogan 2006-03-27  46
> 6c6bd754 Brian Rogan 2006-03-27  47 /*
> 6c6bd754 Brian Rogan 2006-03-27  48  * We do not enforce increasing stack 
> addresses here because
> 6c6bd754 Brian Rogan 2006-03-27  49  * we may transition to a different 
> stack, eg a signal handler.
> 6c6bd754 Brian Rogan 2006-03-27  50  */
> 6c6bd754 Brian Rogan 2006-03-27  51 return STACK_SP(stack_frame);
> 6c6bd754 Brian Rogan 2006-03-27  52  }
> 6c6bd754 Brian Rogan 2006-03-27  53
>
> :: The code at line 31 was first introduced by commit
> :: 62034f03380a64c0144b6721f4a2aa55d65346c1 [POWERPC] powerpc oprofile 
> __user annotations
>
> :: TO: Al Viro <v...@ftp.linux.org.uk>
> :: CC: Paul Mackerras <pau...@samba.org>
>
> ---
> 0-DAY kernel test infrastructureOpen Source Technology Center
> https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-03-13 Thread Deepa Dinamani
The file arch/arm64/kernel/process.c needs asm/compat.h also to be
included directly since this is included conditionally from
include/compat.h. This does seem to be typical of arm64 as I was not
completely able to get rid of asm/compat.h includes for arm64 in this
series. My plan is to have separate patches to get rid of asm/compat.h
includes for the architectures that are not straight forward to keep
this series simple.
I will fix this and update the series.

-Deepa


On Tue, Mar 13, 2018 at 8:22 AM, kbuild test robot <l...@intel.com> wrote:
> Hi Deepa,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on ]
>
> url:
> https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305
> base:
> config: arm64-allnoconfig (attached as .config)
> compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
> wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=arm64
>
> All errors (new ones prefixed by >>):
>
>arch/arm64/kernel/process.c: In function 'copy_thread':
>>> arch/arm64/kernel/process.c:342:8: error: implicit declaration of function 
>>> 'is_compat_thread'; did you mean 'is_compat_task'? 
>>> [-Werror=implicit-function-declaration]
>if (is_compat_thread(task_thread_info(p)))
>^~~~
>is_compat_task
>cc1: some warnings being treated as errors
>
> vim +342 arch/arm64/kernel/process.c
>
> b3901d54d Catalin Marinas  2012-03-05  307
> b3901d54d Catalin Marinas  2012-03-05  308  int copy_thread(unsigned long 
> clone_flags, unsigned long stack_start,
> afa86fc42 Al Viro  2012-10-22  309  unsigned long stk_sz, 
> struct task_struct *p)
> b3901d54d Catalin Marinas  2012-03-05  310  {
> b3901d54d Catalin Marinas  2012-03-05  311  struct pt_regs *childregs = 
> task_pt_regs(p);
> b3901d54d Catalin Marinas  2012-03-05  312
> c34501d21 Catalin Marinas  2012-10-05  313  
> memset(>thread.cpu_context, 0, sizeof(struct cpu_context));
> c34501d21 Catalin Marinas  2012-10-05  314
> bc0ee4760 Dave Martin  2017-10-31  315  /*
> bc0ee4760 Dave Martin  2017-10-31  316   * Unalias 
> p->thread.sve_state (if any) from the parent task
> bc0ee4760 Dave Martin  2017-10-31  317   * and disable discard SVE 
> state for p:
> bc0ee4760 Dave Martin  2017-10-31  318   */
> bc0ee4760 Dave Martin  2017-10-31  319  clear_tsk_thread_flag(p, 
> TIF_SVE);
> bc0ee4760 Dave Martin  2017-10-31  320  p->thread.sve_state = NULL;
> bc0ee4760 Dave Martin  2017-10-31  321
> 071b6d4a5 Dave Martin  2017-12-05  322  /*
> 071b6d4a5 Dave Martin  2017-12-05  323   * In case p was allocated 
> the same task_struct pointer as some
> 071b6d4a5 Dave Martin  2017-12-05  324   * other recently-exited 
> task, make sure p is disassociated from
> 071b6d4a5 Dave Martin  2017-12-05  325   * any cpu that may have run 
> that now-exited task recently.
> 071b6d4a5 Dave Martin  2017-12-05  326   * Otherwise we could 
> erroneously skip reloading the FPSIMD
> 071b6d4a5 Dave Martin  2017-12-05  327   * registers for p.
> 071b6d4a5 Dave Martin  2017-12-05  328   */
> 071b6d4a5 Dave Martin  2017-12-05  329  fpsimd_flush_task_state(p);
> 071b6d4a5 Dave Martin  2017-12-05  330
> 9ac080021 Al Viro  2012-10-21  331  if (likely(!(p->flags & 
> PF_KTHREAD))) {
> 9ac080021 Al Viro  2012-10-21  332  *childregs = 
> *current_pt_regs();
> b3901d54d Catalin Marinas  2012-03-05  333  childregs->regs[0] = 
> 0;
> d00a3810c Will Deacon  2015-05-27  334
> b3901d54d Catalin Marinas  2012-03-05  335  /*
> b3901d54d Catalin Marinas  2012-03-05  336   * Read the current 
> TLS pointer from tpidr_el0 as it may be
> b3901d54d Catalin Marinas  2012-03-05  337   * out-of-sync with 
> the saved value.
> b3901d54d Catalin Marinas  2012-03-05  338   */
> adf758999 Mark Rutland 2016-09-08  339  *task_user_tls(p) = 
> read_sysreg(tpidr_el0);
> d00a3810c Will Deacon  2015-05-27  340
> e0fd18ce1 Al Viro  2012-10-18  341  if (stack_start) {
> d00a3810c Will Deacon  2015-05-27 @342  if 
> (is_compat_thread(task_thread_info(p)))
> d00a3810c Will Deacon  2015-05-27  343  
> childregs->compat_sp = stack_start;
> d00a3

Re: [PATCH v2] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Fabio Estevam
Hi Peter,

On Tue, Mar 13, 2018 at 7:34 PM, Peter Seiderer  wrote:
> Signed-off-by: Peter Seiderer 

Could you please resend with a commit log explaining the reason for this patch?

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


Re: [PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Steve Longerbeam



On 03/13/2018 03:24 PM, Peter Seiderer wrote:

Hello Steve,

On Tue, 13 Mar 2018 15:03:07 -0700, Steve Longerbeam  
wrote:


Hi Peter,

Thanks for the patch.

This needs to be done in imx-ic-prpencvf.c as well, see
prp_vb2_buf_done().

Ahh, I see, would you prefer an follow up patch or
an v2 patch doing the changes on mx-media-csi.c and
imx-ic-prpencvf.c at once?


Hi Peter, a v2 patch would be fine.

Steve



On 03/13/2018 01:00 PM, Peter Seiderer wrote:

Signed-off-by: Peter Seiderer 
---
   drivers/staging/media/imx/imx-media-csi.c | 5 +
   1 file changed, 5 insertions(+)

diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..3a6a645b9dce 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
   
   	int stream_count; /* streaming counter */

+   __u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
   
+	priv->frame_sequence++;

+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
   
   	/* init EOF completion waitq */

init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
 


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


Re: [PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Peter Seiderer
Hello Steve,

On Tue, 13 Mar 2018 15:03:07 -0700, Steve Longerbeam  
wrote:

> Hi Peter,
> 
> Thanks for the patch.
> 
> This needs to be done in imx-ic-prpencvf.c as well, see
> prp_vb2_buf_done().

Ahh, I see, would you prefer an follow up patch or
an v2 patch doing the changes on mx-media-csi.c and
imx-ic-prpencvf.c at once?

Regards,
Peter

> 
> Steve
> 
> 
> On 03/13/2018 01:00 PM, Peter Seiderer wrote:
> > Signed-off-by: Peter Seiderer 
> > ---
> >   drivers/staging/media/imx/imx-media-csi.c | 5 +
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/staging/media/imx/imx-media-csi.c 
> > b/drivers/staging/media/imx/imx-media-csi.c
> > index 5a195f80a24d..3a6a645b9dce 100644
> > --- a/drivers/staging/media/imx/imx-media-csi.c
> > +++ b/drivers/staging/media/imx/imx-media-csi.c
> > @@ -111,6 +111,7 @@ struct csi_priv {
> > struct v4l2_ctrl_handler ctrl_hdlr;
> >   
> > int stream_count; /* streaming counter */
> > +   __u32 frame_sequence; /* frame sequence counter */
> > bool last_eof;   /* waiting for last EOF at stream off */
> > bool nfb4eof;/* NFB4EOF encountered during streaming */
> > struct completion last_eof_comp;
> > @@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
> > struct vb2_buffer *vb;
> > dma_addr_t phys;
> >   
> > +   priv->frame_sequence++;
> > +
> > done = priv->active_vb2_buf[priv->ipu_buf_num];
> > if (done) {
> > +   done->vbuf.sequence = priv->frame_sequence;
> > vb = >vbuf.vb2_buf;
> > vb->timestamp = ktime_get_ns();
> > vb2_buffer_done(vb, priv->nfb4eof ?
> > @@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
> >   
> > /* init EOF completion waitq */
> > init_completion(>last_eof_comp);
> > +   priv->frame_sequence = 0;
> > priv->last_eof = false;
> > priv->nfb4eof = false;
> > 
> 

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


Re: [PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Steve Longerbeam

Hi Peter,

Thanks for the patch.

This needs to be done in imx-ic-prpencvf.c as well, see
prp_vb2_buf_done().

Steve


On 03/13/2018 01:00 PM, Peter Seiderer wrote:

Signed-off-by: Peter Seiderer 
---
  drivers/staging/media/imx/imx-media-csi.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..3a6a645b9dce 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
  
  	int stream_count; /* streaming counter */

+   __u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
  
+	priv->frame_sequence++;

+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
  
  	/* init EOF completion waitq */

init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
  


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


Re: [PATCH] staging: lustre: use module_name() macro for debug printf

2018-03-13 Thread NeilBrown
On Tue, Mar 13 2018, Arnd Bergmann wrote:

> We now allow lustre to be built when CONFIG_MODULES is disabled,
> but that causes a build failure:
>
> In file included from drivers/staging/lustre/include/linux/libcfs/libcfs.h:42,
>  from drivers/staging/lustre/lustre/obdclass/lu_object.c:44:
> drivers/staging/lustre/lustre/obdclass/lu_object.c: In function 
> 'lu_context_key_degister':
> drivers/staging/lustre/lustre/obdclass/lu_object.c:1410:51: error: 
> dereferencing pointer to incomplete type 'struct module'
>
> This particular case can be avoided by using the module_name()
> macro that was designed exactly to handle printing the name of
> a module in all configurations.

Learn something new every day :-)

Reviewed-by: NeilBrown 

Thanks,
NeilBrown

>
> Cc: NeilBrown 
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/staging/lustre/lustre/obdclass/lu_object.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c 
> b/drivers/staging/lustre/lustre/obdclass/lu_object.c
> index 8ddf23b82a2c..3ae16e8501c2 100644
> --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
> +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
> @@ -1407,7 +1407,7 @@ void lu_context_key_degister(struct lu_context_key *key)
>   while (atomic_read(>lct_used) > 1) {
>   spin_unlock(_keys_guard);
>   CDEBUG(D_INFO, "%s: \"%s\" %p, %d\n",
> -__func__, key->lct_owner ? key->lct_owner->name : "",
> +__func__, module_name(key->lct_owner),
>  key, atomic_read(>lct_used));
>   schedule();
>   spin_lock(_keys_guard);
> @@ -1547,7 +1547,7 @@ void lu_context_key_quiesce(struct lu_context_key *key)
>   spin_unlock(_keys_guard);
>   CDEBUG(D_INFO, "%s: \"%s\" %p, %d (%d)\n",
>  __func__,
> -key->lct_owner ? key->lct_owner->name : "",
> +module_name(key->lct_owner),
>  key, atomic_read(>lct_used),
>   atomic_read(_key_initing_cnt));
>   schedule();
> -- 
> 2.9.0


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


Re: [PATCH] staging: lustre: fid: avoid false-positive uninitialized variable warning

2018-03-13 Thread NeilBrown
On Tue, Mar 13 2018, Arnd Bergmann wrote:

> One of Neil's recent cleanups apparently has led the code to get
> to a state where gcc tracks the 'seqnr' variable just enough to
> see that it is sometimes initialized in seq_client_alloc_seq(),
> but not enough that it can prove this initialization to be reliable
> before the use of that variable:
>
> drivers/staging/lustre/lustre/fid/fid_request.c: In function 
> 'seq_client_alloc_fid':
> drivers/staging/lustre/lustre/fid/fid_request.c:245:22: error: 'seqnr' may be 
> used uninitialized in this function [-Werror=maybe-uninitialized]
>
> The code seems to be otherwise correct, and I could not come
> up with a good way to simplify it further, so this adds a fake
> initialization to shut up that warning.

We could possibly have seq_client_alloc_seq return the seqnr,
or U64_MAX+rc.

Then if (seqnr >= U64MAX-MAX_ERRNO) there is an error.

I'm not sure that is actually an improvement though, and I'm happy with
your approach

 Reviewed-by: NeilBrown 

Thanks,
NeilBrown

>
> Cc: NeilBrown 
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/staging/lustre/lustre/fid/fid_request.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
> b/drivers/staging/lustre/lustre/fid/fid_request.c
> index fa23423eb8b3..030680f37c79 100644
> --- a/drivers/staging/lustre/lustre/fid/fid_request.c
> +++ b/drivers/staging/lustre/lustre/fid/fid_request.c
> @@ -174,6 +174,7 @@ static int seq_client_alloc_seq(const struct lu_env *env,
>   if (rc) {
>   CERROR("%s: Can't allocate new meta-sequence, rc %d\n",
>  seq->lcs_name, rc);
> + *seqnr = U64_MAX;
>   return rc;
>   }
>   CDEBUG(D_INFO, "%s: New range - " DRANGE "\n",
> -- 
> 2.9.0


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


Re: [PATCH v2] staging: bcm2835-audio: Release resources on module_exit()

2018-03-13 Thread Andy Shevchenko
On Tue, Mar 13, 2018 at 9:34 PM, Kirill Marinushkin
 wrote:
> In the current implementation, `rmmod snd_bcm2835` does not release
> resources properly. It causes an oops when trying to list sound devices.
>
> This commit fixes it.

Nice catch!

See my comments below.

>  static void snd_devm_unregister_child(struct device *dev, void *res)
>  {
> struct device *childdev = *(struct device **)res;
> +   struct bcm2835_chip *chip = dev_get_drvdata(childdev);
> +   struct snd_card *card = chip->card;
> +
> +   snd_card_free(card);

> +   dev_set_drvdata(childdev, NULL);

AFAIU this is done by device core.

> device_unregister(childdev);
>  }

> +static void snd_devm_release(struct device *dev)
> +{
> +   struct bcm2835_chip *chip = dev_get_drvdata(dev);
> +
> +   kfree(chip);
> +}


>  /* chip-specific constructor
> @@ -122,7 +136,7 @@ static int snd_bcm2835_create(struct snd_card *card,
>
> err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, );
> if (err) {
> -   snd_bcm2835_free(chip);
> +   kfree(chip);

Do you call device_register() inside snd_device_new()?
In this case you might need put_device() here instead of simple kfree().

> return err;
> }

-- 
With Best Regards,
Andy Shevchenko
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vme: vme_user: Fix some error handling paths in 'vme_user_probe()'

2018-03-13 Thread Christophe JAILLET
2 gotos in error handling paths branch to the wrong label.
Fix it.

Signed-off-by: Christophe JAILLET 
---
 drivers/staging/vme/devices/vme_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_user.c 
b/drivers/staging/vme/devices/vme_user.c
index 3242dee8246f..6a33aaa1a49f 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -558,7 +558,7 @@ static int vme_user_probe(struct vme_dev *vdev)
vme_user_cdev->owner = THIS_MODULE;
err = cdev_add(vme_user_cdev, MKDEV(VME_MAJOR, 0), VME_DEVS);
if (err)
-   goto err_char;
+   goto err_class;
 
/* Request slave resources and allocate buffers (128kB wide) */
for (i = SLAVE_MINOR; i < (SLAVE_MAX + 1); i++) {
@@ -618,7 +618,7 @@ static int vme_user_probe(struct vme_dev *vdev)
if (IS_ERR(vme_user_sysfs_class)) {
dev_err(>dev, "Error creating vme_user class.\n");
err = PTR_ERR(vme_user_sysfs_class);
-   goto err_class;
+   goto err_master;
}
 
/* Add sysfs Entries */
-- 
2.14.1

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


[PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Peter Seiderer
Signed-off-by: Peter Seiderer 
---
 drivers/staging/media/imx/imx-media-csi.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..3a6a645b9dce 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
 
int stream_count; /* streaming counter */
+   __u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
 
-- 
2.16.2

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


[PATCH v2] staging: bcm2835-audio: Release resources on module_exit()

2018-03-13 Thread Kirill Marinushkin
In the current implementation, `rmmod snd_bcm2835` does not release
resources properly. It causes an oops when trying to list sound devices.

This commit fixes it.

The details WRT allocation / free are described below.

Device structure WRT allocation:

pdev
  \childdev[]
\card
  \chip
\pcm
\ctl

Allocation / register sequence:

* childdev: devm_kzalloc  - freed during driver detach
* childdev: device_initialize - freed during device_unregister
* pdev: devres_alloc  - freed during driver detach
* childdev: device_add- removed during device_unregister
* pdev, childdev: devres_add  - freed during driver detach
* card: snd_card_new  - freed during snd_card_free
* chip: kzalloc   - freed during kfree
* card, chip: snd_device_new  - freed during snd_device_free
* chip: new_pcm   - TODO: free pcm
* chip: new_ctl   - TODO: free ctl
* card: snd_card_register - unregistered during snd_card_free

Free / unregister sequence:

* card: snd_card_free
* card, chip: snd_device_free
* childdev: device_unregister
* chip: kfree

Steps to reproduce the issue before this commit:


$ rmmod snd_bcm2835
$ aplay -L
[  138.648130] Unable to handle kernel paging request at virtual address 
7f1343c0
[  138.660415] pgd = ad8f
[  138.665567] [7f1343c0] *pgd=3864c811, *pte=, *ppte=
[  138.674887] Internal error: Oops: 7 [#1] SMP ARM
[  138.683571] Modules linked in: sha256_generic cfg80211 rfkill snd_pcm 
snd_timer
 snd fixed uio_pdrv_genirq uio ip_tables x_tables ipv6 [last unloaded: 
snd_bcm2835
]
[  138.706594] CPU: 3 PID: 463 Comm: aplay Tainted: GWC   
4.15.0-rc1-v
7+ #6
[  138.719833] Hardware name: BCM2835
[  138.726016] task: b877ac00 task.stack: aebec000
[  138.733408] PC is at try_module_get+0x38/0x24c
[  138.740813] LR is at snd_ctl_open+0x58/0x194 [snd]
[  138.748485] pc : [<801c4d5c>]lr : [<7f0e6b2c>]psr: 2013
[  138.757709] sp : aebedd60  ip : aebedd88  fp : aebedd84
[  138.765884] r10:   r9 : 0004  r8 : 7f0ed440
[  138.774040] r7 : b7e469b0  r6 : 7f0e6b2c  r5 : afd91900  r4 : 7f1343c0
[  138.783571] r3 : aebec000  r2 : 0001  r1 : b877ac00  r0 : 7f1343c0
[  138.793084] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  138.803300] Control: 10c5387d  Table: 2d8f006a  DAC: 0055
[  138.812064] Process aplay (pid: 463, stack limit = 0xaebec210)
[  138.820868] Stack: (0xaebedd60 to 0xaebee000)
[  138.828207] dd60:  b848d000 afd91900  b7e469b0 7f0ed440 
aebedda4 aebedd88
[  138.842371] dd80: 7f0e6b2c 801c4d30 afd91900 7f0ea4dc  b7e469b0 
aebeddcc aebedda8
[  138.856611] dda0: 7f0e250c 7f0e6ae0 7f0e2464 b8478ec0 b7e469b0 afd91900 
7f0ea388 
[  138.870864] ddc0: aebeddf4 aebeddd0 802ce590 7f0e2470 8090ab64 afd91900 
afd91900 b7e469b0
[  138.885301] dde0: afd91908 802ce4e4 aebede1c aebeddf8 802c57b4 802ce4f0 
afd91900 aebedea8
[  138.900110] de00: b7fa4c00   0004 aebede3c aebede20 
802c6ba8 802c56b4
[  138.915260] de20: aebedea8  aebedf5c  aebedea4 aebede40 
802d9a68 802c6b58
[  138.930661] de40: b874ddd0   0001 0041  
afd91900 aebede70
[  138.946402] de60:   0002 b7e469b0 b8a87610 b8d6ab80 
801852f8 0008
[  138.962314] de80: aebedf5c aebedea8 0001 80108464 aebec000  
aebedf4c aebedea8
[  138.978414] dea0: 802dacd4 802d970c b8a87610 b8d6ab80 a7982bc6 0009 
af363019 b9231480
[  138.994617] dec0:  b8c038a0 b7e469b0 0101 0002 0238 
 
[  139.010823] dee0:  aebedee8 0008 000f aebedf3c aebedf00 
802ed7e4 80843f94
[  139.027025] df00: 0003 0008 b9231490 b9231480  0008 
af363000 
[  139.043229] df20: 0005 0002 ff9c  0008 ff9c 
af363000 0003
[  139.059430] df40: aebedf94 aebedf50 802c6f70 802dac70 aebec000  
0001 
[  139.075629] df60: 0002 0004 0100 0001 7ebe577c 0002e038 
 0005
[  139.091828] df80: 80108464 aebec000 aebedfa4 aebedf98 802c7060 802c6e6c 
 aebedfa8
[  139.108025] dfa0: 801082c0 802c7040 7ebe577c 0002e038 7ebe577c 0008 
0b98 e81c8400
[  139.124222] dfc0: 7ebe577c 0002e038  0005 7ebe57e4 00a20af8 
7ebe57f0 76f87394
[  139.140419] dfe0:  7ebe55c4 76ec88e8 76df1d9c 6010 7ebe577c 
 
[  139.156715] [<801c4d5c>] (try_module_get) from [<7f0e6b2c>] 
(snd_ctl_open+0x58/0x194 [snd])
[  139.173222] [<7f0e6b2c>] (snd_ctl_open [snd]) from [<7f0e250c>] 
(snd_open+0xa8/0x14c [snd])
[  139.189683] [<7f0e250c>] (snd_open [snd]) from [<802ce590>] 
(chrdev_open+0xac/0x188)
[  139.205465] [<802ce590>] (chrdev_open) from [<802c57b4>] 
(do_dentry_open+0x10c/0x314)
[  139.221347] [<802c57b4>] (do_dentry_open) from [<802c6ba8>] 
(vfs_open+0x5c/0x88)
[  139.236788] [<802c6ba8>] (vfs_open) from [<802d9a68>] 

Re: [PATCH] hv_netvsc: Make sure out channel is fully opened on send

2018-03-13 Thread Stephen Hemminger
On Tue, 13 Mar 2018 20:06:50 +0100
Mohammed Gamal  wrote:

> Dring high network traffic changes to network interface parameters
> such as number of channels or MTU can cause a kernel panic with a NULL
> pointer dereference. This is due to netvsc_device_remove() being
> called and deallocating the channel ring buffers, which can then be
> accessed by netvsc_send_pkt() before they're allocated on calling
> netvsc_device_add()
> 
> The patch fixes this problem by checking the channel state and returning
> ENODEV if not yet opened. We also move the call to hv_ringbuf_avail_percent()
> which may access the uninitialized ring buffer.
> 
> Signed-off-by: Mohammed Gamal 
> ---
>  drivers/net/hyperv/netvsc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> index 0265d70..44a8358 100644
> --- a/drivers/net/hyperv/netvsc.c
> +++ b/drivers/net/hyperv/netvsc.c
> @@ -757,7 +757,7 @@ static inline int netvsc_send_pkt(
>   struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet->q_idx);
>   u64 req_id;
>   int ret;
> - u32 ring_avail = hv_ringbuf_avail_percent(_channel->outbound);
> + u32 ring_avail;
>  
>   nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT;
>   if (skb)
> @@ -773,7 +773,7 @@ static inline int netvsc_send_pkt(
>  
>   req_id = (ulong)skb;
>  
> - if (out_channel->rescind)
> + if (out_channel->rescind || out_channel->state != CHANNEL_OPENED_STATE)
>   return -ENODEV;
>  
>   if (packet->page_buf_cnt) {
> @@ -791,6 +791,7 @@ static inline int netvsc_send_pkt(
>  
> VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
>   }
>  
> + ring_avail = hv_ringbuf_avail_percent(_channel->outbound);
>   if (ret == 0) {
>   atomic_inc_return(>queue_sends);
>  

Thanks for your patch. Yes there are races with the current update
logic. The root cause goes higher up in the flow; the send queues should
be stopped before netvsc_device_remove is called. Solving it where you tried
to is racy and not going to work reliably.

Network patches should go to net...@vger.kernel.org

You can't move the ring_avail check until after the vmbus_sendpacket because
that will break the flow control logic.

Instead, you should just move the avail_read check until just after the 
existing rescind
check.

Also, you shouldn't need to check for OPENED_STATE, just rescind is enough.




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


RE: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()

2018-03-13 Thread Dexuan Cui
> From: Dexuan Cui
> Sent: Wednesday, March 7, 2018 13:40
> To: Lorenzo Pieralisi 
> Cc: bhelg...@google.com; linux-...@vger.kernel.org; KY Srinivasan
> ; Stephen Hemminger ;
> o...@aepfle.de; a...@canonical.com; jasow...@redhat.com; linux-
> ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Haiyang
> Zhang ; vkuzn...@redhat.com;
> marcelo.ce...@canonical.com; Michael Kelley (EOSG)
> ; sta...@vger.kernel.org; Jack
> Morgenstein 
> Subject: RE: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()
> 
> > From: Lorenzo Pieralisi 
> > Sent: Wednesday, March 7, 2018 04:35
> > On Tue, Mar 06, 2018 at 06:21:56PM +, Dexuan Cui wrote:
> > > 1. With the patch "x86/vector/msi: Switch to global reservation mode"
> > > (4900be8360), the recent v4.15 and newer kernels always hang for 1-vCPU
> > > Hyper-V VM with SR-IOV. This is because when we reach
> > hv_compose_msi_msg()
> > > by request_irq()  -> request_threaded_irq() -> 
> > > __setup_irq()->irq_startup()
> > >  -> __irq_startup() -> irq_domain_activate_irq() -> ... ->
> > > msi_domain_activate() -> ... -> hv_compose_msi_msg(), local irq is
> > > disabled in __setup_irq().
> > >
> > > Fix this by polling the channel.
> > >
> > > 2. If the host is ejecting the VF device before we reach
> > > hv_compose_msi_msg(), in a UP VM, we can hang in
> hv_compose_msi_msg()
> > > forever, because at this time the host doesn't respond to the
> > > CREATE_INTERRUPT request. This issue also happens to old kernels like
> > > v4.14, v4.13, etc.
> >
> > If you are fixing a problem you should report what commit you are fixing
> > with a Fixes: tag and add a CC: sta...@vger.kernel.org to the commit log
> > to send it to stable kernels to which it should be applied; mentioning
> > kernel versions in the commit log is useless and should be omitted.
> 
> Hi Lorenzo,
> Thanks for your comments!
> This patch does have a "Cc: sta...@vger.kernel.org" in the sign-off area. :-)
> 
> Here the patch is made to resolve 2 issues:
> #1 is triggered by the x86 global reservation mode (4900be8360) patch.
> 4900be8360 in itself is good. It's just that drivers/pci/host/pci-hyperv.c
> should be fixed.
> 
> #2 is a longstanding issue since the first day the pci-hyperv driver was
> accepted into the kernel.
> 
> So IMO actually we don't really need to add a Fixes: tag, which is usually
> used to specify a specific commit that introduces a bug that is being fixed.
> 
> > Side note: you should not have sta...@vger.kernel.org in the email
> > addresses CC list you are sending the patches to (you mark patches for
> > stable by adding an appropriate CC tag in the commit log).
> 
> Sorry, I didn't know this, but actually I didn't add sta...@vger.kernel.org
> manually. Instead I used "git send-email" to send this patchset, and it told
> me "The Cc list above has been expanded by additional addresses found
> in the patch commit message."
> 
> I didn't find a way to disable this behavior of "git send-email" by checking
> its manual and googling it. This is strange.
> 
> > Here:
> >
> > git.kernel.org/.../Documentation/process/stable-kernel-rules.rst
> >
> > Last but not least, most of the patches in this series do not justify
> > sending them to stable kernels at all so you should remove the
> > corresponding tag from the patches.
> 
> I hope at least these 2 patches can go into the stable kernels:
> [PATCH v3 3/6] PCI: hv: serialize the present/eject work items
> [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()
> Especially the second one, which fixes a real hang issue for UP virtual
> machines running v4.15 and newer.
> And,  IMO the patches are small enough (<100 lines) , but definitely
> the maintainers make the final call.
> 
> >
> > Thanks,
> > Lorenzo
> >
> > > Fix this by polling the channel for the PCI_EJECT message and
> > > hpdev->state, and by checking the PCI vendor ID.
> > >
> > > Note: actually the above issues also happen to a SMP VM, if
> > > "hbus->hdev->channel->target_cpu == smp_processor_id()" is true.
> > >
> > > Signed-off-by: Dexuan Cui 
> > > Tested-by: Adrian Suhov 
> > > Tested-by: Chris Valean 
> > > Cc: sta...@vger.kernel.org
> > > Cc: Stephen Hemminger 
> > > Cc: K. Y. Srinivasan 
> > > Cc: Vitaly Kuznetsov 
> > > Cc: Jack Morgenstein 
> > > ---
> > >  drivers/pci/host/pci-hyperv.c | 58
> 
> 
> Thanks,
> -- Dexuan

Hi Lorenzo, Bjorn, and all,
Do you need more ACKs? Currently Michael and Haiyang reviewed and ack'd 
the patchset.

Should I send a v4 that just removes the "CC: sta...@vger.kernel.org" tag
for patches 1, 2, 4 and 5? I tend to avoid a v4 as I supppose it would be 
easier if you just remove the tags if 

Re: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()

2018-03-13 Thread Lorenzo Pieralisi
On Tue, Mar 13, 2018 at 06:23:39PM +, Dexuan Cui wrote:
> > From: Dexuan Cui
> > Sent: Wednesday, March 7, 2018 13:40
> > To: Lorenzo Pieralisi 
> > Cc: bhelg...@google.com; linux-...@vger.kernel.org; KY Srinivasan
> > ; Stephen Hemminger ;
> > o...@aepfle.de; a...@canonical.com; jasow...@redhat.com; linux-
> > ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Haiyang
> > Zhang ; vkuzn...@redhat.com;
> > marcelo.ce...@canonical.com; Michael Kelley (EOSG)
> > ; sta...@vger.kernel.org; Jack
> > Morgenstein 
> > Subject: RE: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in 
> > hv_compose_msi_msg()
> > 
> > > From: Lorenzo Pieralisi 
> > > Sent: Wednesday, March 7, 2018 04:35
> > > On Tue, Mar 06, 2018 at 06:21:56PM +, Dexuan Cui wrote:
> > > > 1. With the patch "x86/vector/msi: Switch to global reservation mode"
> > > > (4900be8360), the recent v4.15 and newer kernels always hang for 1-vCPU
> > > > Hyper-V VM with SR-IOV. This is because when we reach
> > > hv_compose_msi_msg()
> > > > by request_irq()  -> request_threaded_irq() -> 
> > > > __setup_irq()->irq_startup()
> > > >  -> __irq_startup() -> irq_domain_activate_irq() -> ... ->
> > > > msi_domain_activate() -> ... -> hv_compose_msi_msg(), local irq is
> > > > disabled in __setup_irq().
> > > >
> > > > Fix this by polling the channel.
> > > >
> > > > 2. If the host is ejecting the VF device before we reach
> > > > hv_compose_msi_msg(), in a UP VM, we can hang in
> > hv_compose_msi_msg()
> > > > forever, because at this time the host doesn't respond to the
> > > > CREATE_INTERRUPT request. This issue also happens to old kernels like
> > > > v4.14, v4.13, etc.
> > >
> > > If you are fixing a problem you should report what commit you are fixing
> > > with a Fixes: tag and add a CC: sta...@vger.kernel.org to the commit log
> > > to send it to stable kernels to which it should be applied; mentioning
> > > kernel versions in the commit log is useless and should be omitted.
> > 
> > Hi Lorenzo,
> > Thanks for your comments!
> > This patch does have a "Cc: sta...@vger.kernel.org" in the sign-off area. 
> > :-)
> > 
> > Here the patch is made to resolve 2 issues:
> > #1 is triggered by the x86 global reservation mode (4900be8360) patch.
> > 4900be8360 in itself is good. It's just that drivers/pci/host/pci-hyperv.c
> > should be fixed.
> > 
> > #2 is a longstanding issue since the first day the pci-hyperv driver was
> > accepted into the kernel.
> > 
> > So IMO actually we don't really need to add a Fixes: tag, which is usually
> > used to specify a specific commit that introduces a bug that is being fixed.
> > 
> > > Side note: you should not have sta...@vger.kernel.org in the email
> > > addresses CC list you are sending the patches to (you mark patches for
> > > stable by adding an appropriate CC tag in the commit log).
> > 
> > Sorry, I didn't know this, but actually I didn't add sta...@vger.kernel.org
> > manually. Instead I used "git send-email" to send this patchset, and it told
> > me "The Cc list above has been expanded by additional addresses found
> > in the patch commit message."
> > 
> > I didn't find a way to disable this behavior of "git send-email" by checking
> > its manual and googling it. This is strange.
> > 
> > > Here:
> > >
> > > git.kernel.org/.../Documentation/process/stable-kernel-rules.rst
> > >
> > > Last but not least, most of the patches in this series do not justify
> > > sending them to stable kernels at all so you should remove the
> > > corresponding tag from the patches.
> > 
> > I hope at least these 2 patches can go into the stable kernels:
> > [PATCH v3 3/6] PCI: hv: serialize the present/eject work items
> > [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()
> > Especially the second one, which fixes a real hang issue for UP virtual
> > machines running v4.15 and newer.
> > And,  IMO the patches are small enough (<100 lines) , but definitely
> > the maintainers make the final call.
> > 
> > >
> > > Thanks,
> > > Lorenzo
> > >
> > > > Fix this by polling the channel for the PCI_EJECT message and
> > > > hpdev->state, and by checking the PCI vendor ID.
> > > >
> > > > Note: actually the above issues also happen to a SMP VM, if
> > > > "hbus->hdev->channel->target_cpu == smp_processor_id()" is true.
> > > >
> > > > Signed-off-by: Dexuan Cui 
> > > > Tested-by: Adrian Suhov 
> > > > Tested-by: Chris Valean 
> > > > Cc: sta...@vger.kernel.org
> > > > Cc: Stephen Hemminger 
> > > > Cc: K. Y. Srinivasan 
> > > > Cc: Vitaly Kuznetsov 
> > > > Cc: Jack Morgenstein 
> > > > ---
> > > >  drivers/pci/host/pci-hyperv.c | 58
> > 
> > 
> > Thanks,
> > -- Dexuan
> 
> Hi Lorenzo, 

[PATCH 2/3] staging: ks7010: replace DPRINTK traces in favour of netdev_*

2018-03-13 Thread Sergio Paracuellos
This commit removes custom defined DPRINTK macro and replaces all the
associated debug and other traces for preferred ones netdev_*.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c |  84 ++---
 drivers/staging/ks7010/ks_hostif.c   | 142 ++-
 drivers/staging/ks7010/ks_wlan.h |  10 ---
 drivers/staging/ks7010/ks_wlan_net.c |  34 -
 4 files changed, 132 insertions(+), 138 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index beb689b..50a7a15 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -118,7 +118,7 @@ static void ks_wlan_hw_sleep_doze_request(struct 
ks_wlan_private *priv)
if (atomic_read(>sleepstatus.status) == 0) {
ret = ks7010_sdio_writeb(priv, GCR_B, GCR_B_DOZE);
if (ret) {
-   DPRINTK(1, " error : GCR_B\n");
+   netdev_err(priv->net_dev, " error : GCR_B\n");
goto set_sleep_mode;
}
atomic_set(>sleepstatus.status, 1);
@@ -139,7 +139,7 @@ static void ks_wlan_hw_sleep_wakeup_request(struct 
ks_wlan_private *priv)
if (atomic_read(>sleepstatus.status) == 1) {
ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ);
if (ret) {
-   DPRINTK(1, " error : WAKEUP\n");
+   netdev_err(priv->net_dev, " error : WAKEUP\n");
goto set_sleep_mode;
}
atomic_set(>sleepstatus.status, 0);
@@ -158,7 +158,7 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv)
if (atomic_read(>psstatus.status) == PS_SNOOZE) {
ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ);
if (ret)
-   DPRINTK(1, " error : WAKEUP\n");
+   netdev_err(priv->net_dev, " error : WAKEUP\n");
 
priv->last_wakeup = jiffies;
++priv->wakeup_count;
@@ -185,11 +185,11 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
if (atomic_read(>psstatus.status) == PS_SNOOZE)
return;
 
-   DPRINTK(5, 
"\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n",
-   atomic_read(>psstatus.status),
-   atomic_read(>psstatus.confirm_wait),
-   atomic_read(>psstatus.snooze_guard),
-   cnt_txqbody(priv));
+   netdev_dbg(priv->net_dev, 
"\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n",
+  atomic_read(>psstatus.status),
+  atomic_read(>psstatus.confirm_wait),
+  atomic_read(>psstatus.snooze_guard),
+  cnt_txqbody(priv));
 
if (atomic_read(>psstatus.confirm_wait) ||
atomic_read(>psstatus.snooze_guard) ||
@@ -200,7 +200,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
 
ret = ks7010_sdio_readb(priv, INT_PENDING, );
if (ret) {
-   DPRINTK(1, " error : INT_PENDING\n");
+   netdev_err(priv->net_dev, " error : INT_PENDING\n");
goto queue_delayed_work;
}
if (byte)
@@ -208,7 +208,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
 
ret = ks7010_sdio_writeb(priv, GCR_B, GCR_B_DOZE);
if (ret) {
-   DPRINTK(1, " error : GCR_B\n");
+   netdev_err(priv->net_dev, " error : GCR_B\n");
goto queue_delayed_work;
}
atomic_set(>psstatus.status, PS_SNOOZE);
@@ -240,7 +240,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, 
unsigned char *p,
}
 
if ((TX_DEVICE_BUFF_SIZE - 1) <= cnt_txqbody(priv)) {
-   DPRINTK(1, "tx buffer overflow\n");
+   netdev_err(priv->net_dev, "tx buffer overflow\n");
ret = -EOVERFLOW;
goto err_complete;
}
@@ -273,19 +273,19 @@ static int write_to_device(struct ks_wlan_private *priv, 
unsigned char *buffer,
 
if (le16_to_cpu(hdr->event) < HIF_DATA_REQ ||
le16_to_cpu(hdr->event) > HIF_REQ_MAX) {
-   DPRINTK(1, "unknown event=%04X\n", hdr->event);
+   netdev_err(priv->net_dev, "unknown event=%04X\n", hdr->event);
return 0;
}
 
ret = ks7010_sdio_write(priv, DATA_WINDOW, buffer, size);
if (ret) {
-   DPRINTK(1, " write error : retval=%d\n", ret);
+   netdev_err(priv->net_dev, " write error : retval=%d\n", ret);
return ret;
}
 
ret = ks7010_sdio_writeb(priv, WRITE_STATUS, REG_STATUS_BUSY);
if (ret) {
-   DPRINTK(1, " error : WRITE_STATUS\n");
+   netdev_err(priv->net_dev, " error : 

[PATCH 0/3] staging: ks7010: some traces cleanups and replaces

2018-03-13 Thread Sergio Paracuellos
The following patch series includes some cleanups of useless traces as well
as some replaces in order to use preferred macros for debugging and others.

Sergio Paracuellos (3):
  staging: ks7010: remove useless DPRINTK traces
  staging: ks7010: replace DPRINTK traces in favour of netdev_*
  staging: ks7010: replace KS_WLAN_DEBUG with DEBUG preprocessor
directive

 drivers/staging/ks7010/ks7010_sdio.c | 151 ++
 drivers/staging/ks7010/ks_hostif.c   | 291 ++-
 drivers/staging/ks7010/ks_wlan.h |  10 --
 drivers/staging/ks7010/ks_wlan_net.c |  90 +++
 4 files changed, 145 insertions(+), 397 deletions(-)

-- 
2.7.4

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


[PATCH 1/3] staging: ks7010: remove useless DPRINTK traces

2018-03-13 Thread Sergio Paracuellos
This commit removes some useless traces in some source files

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c |  58 --
 drivers/staging/ks7010/ks_hostif.c   | 149 ++-
 drivers/staging/ks7010/ks_wlan_net.c |  56 +
 3 files changed, 9 insertions(+), 254 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 7de78d1..beb689b 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -112,8 +112,6 @@ static void ks_wlan_hw_sleep_doze_request(struct 
ks_wlan_private *priv)
 {
int ret;
 
-   DPRINTK(4, "\n");
-
/* clear request */
atomic_set(>sleepstatus.doze_request, 0);
 
@@ -123,11 +121,8 @@ static void ks_wlan_hw_sleep_doze_request(struct 
ks_wlan_private *priv)
DPRINTK(1, " error : GCR_B\n");
goto set_sleep_mode;
}
-   DPRINTK(3, "sleep_mode=SLP_SLEEP\n");
atomic_set(>sleepstatus.status, 1);
priv->last_doze = jiffies;
-   } else {
-   DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode);
}
 
 set_sleep_mode:
@@ -138,8 +133,6 @@ static void ks_wlan_hw_sleep_wakeup_request(struct 
ks_wlan_private *priv)
 {
int ret;
 
-   DPRINTK(4, "\n");
-
/* clear request */
atomic_set(>sleepstatus.wakeup_request, 0);
 
@@ -149,12 +142,9 @@ static void ks_wlan_hw_sleep_wakeup_request(struct 
ks_wlan_private *priv)
DPRINTK(1, " error : WAKEUP\n");
goto set_sleep_mode;
}
-   DPRINTK(4, "wake up : WAKEUP\n");
atomic_set(>sleepstatus.status, 0);
priv->last_wakeup = jiffies;
++priv->wakeup_count;
-   } else {
-   DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode);
}
 
 set_sleep_mode:
@@ -165,19 +155,13 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private 
*priv)
 {
int ret;
 
-   DPRINTK(4, "\n");
if (atomic_read(>psstatus.status) == PS_SNOOZE) {
ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ);
if (ret)
DPRINTK(1, " error : WAKEUP\n");
-   else
-   DPRINTK(4, "wake up : WAKEUP\n");
 
priv->last_wakeup = jiffies;
++priv->wakeup_count;
-   } else {
-   DPRINTK(1, "psstatus=%d\n",
-   atomic_read(>psstatus.status));
}
 }
 
@@ -228,7 +212,6 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
goto queue_delayed_work;
}
atomic_set(>psstatus.status, PS_SNOOZE);
-   DPRINTK(3, "psstatus.status=PS_SNOOZE\n");
 
return;
 
@@ -288,7 +271,6 @@ static int write_to_device(struct ks_wlan_private *priv, 
unsigned char *buffer,
 
hdr = (struct hostif_hdr *)buffer;
 
-   DPRINTK(4, "size=%d\n", hdr->size);
if (le16_to_cpu(hdr->event) < HIF_DATA_REQ ||
le16_to_cpu(hdr->event) > HIF_REQ_MAX) {
DPRINTK(1, "unknown event=%04X\n", hdr->event);
@@ -315,7 +297,6 @@ static void tx_device_task(struct ks_wlan_private *priv)
struct tx_device_buffer *sp;
int ret;
 
-   DPRINTK(4, "\n");
if (cnt_txqbody(priv) <= 0 ||
atomic_read(>psstatus.status) == PS_SNOOZE)
return;
@@ -358,7 +339,6 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, 
unsigned long size,
priv->hostt.buff[priv->hostt.qtail] = le16_to_cpu(hdr->event);
priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE;
 
-   DPRINTK(4, "event=%04X\n", hdr->event);
spin_lock(>tx_dev.tx_dev_lock);
result = enqueue_txdev(priv, p, size, complete_handler, skb);
spin_unlock(>tx_dev.tx_dev_lock);
@@ -374,8 +354,6 @@ static void rx_event_task(unsigned long dev)
struct ks_wlan_private *priv = (struct ks_wlan_private *)dev;
struct rx_device_buffer *rp;
 
-   DPRINTK(4, "\n");
-
if (cnt_rxqbody(priv) > 0 && priv->dev_state >= DEVICE_STATE_BOOT) {
rp = >rx_dev.rx_dev_buff[priv->rx_dev.qhead];
hostif_receive(priv, rp->data, rp->size);
@@ -393,8 +371,6 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, 
uint16_t size)
struct hostif_hdr *hdr;
unsigned short event = 0;
 
-   DPRINTK(4, "\n");
-
/* receive data */
if (cnt_rxqbody(priv) >= (RX_DEVICE_BUFF_SIZE - 1)) {
DPRINTK(1, "rx buffer overflow\n");
@@ -450,8 +426,6 @@ static void ks7010_rw_function(struct work_struct *work)
 
priv = container_of(work, struct ks_wlan_private, rw_dwork.work);
 
-   DPRINTK(4, "\n");
-
/* wait after DOZE */
if (time_after(priv->last_doze + ((30 * HZ) / 

[PATCH 3/3] staging: ks7010: replace KS_WLAN_DEBUG with DEBUG preprocessor directive

2018-03-13 Thread Sergio Paracuellos
This commit replaces custom KS_WLAN_DEBUG which is not being used anymore
in favour of DEBUG which is the one included when debugging is enabled.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 50a7a15..b8f55a1 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -385,11 +385,10 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, 
uint16_t size)
 
/* length check */
if (size > 2046 || size == 0) {
-#ifdef KS_WLAN_DEBUG
-   if (KS_WLAN_DEBUG > 5)
-   print_hex_dump_bytes("INVALID DATA dump: ",
-DUMP_PREFIX_OFFSET,
-rx_buffer->data, 32);
+#ifdef DEBUG
+   print_hex_dump_bytes("INVALID DATA dump: ",
+DUMP_PREFIX_OFFSET,
+rx_buffer->data, 32);
 #endif
ret = ks7010_sdio_writeb(priv, READ_STATUS, REG_STATUS_IDLE);
if (ret)
-- 
2.7.4

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


[PATCH v2 3/3] staging:iio:ad2s1210: Add write_raw to handle frequency

2018-03-13 Thread Rodrigo Siqueira
The write interface of AD2S1210 utilizes IIO_DEVICE_ATTR, which violate
the official IIO ABI. This patch, add the write_raw function responsible
for handling the fclkin and fexcit channel; also it removes the use of
IIO_DEVICE_ATTR for fclkin and fexcit.

Signed-off-by: Rodrigo Siqueira 
---
Changes in v2:
 - Removes unnecessary switch case in the write_raw function.
 - Replaces the use of goto for direct return.
 - Removes definition with string.
 - Removes unecessary label.

 drivers/staging/iio/resolver/ad2s1210.c | 107 ++--
 1 file changed, 45 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c 
b/drivers/staging/iio/resolver/ad2s1210.c
index 27a42ed10fcd..001ddca92e8f 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -210,64 +210,6 @@ static inline int ad2s1210_soft_reset(struct 
ad2s1210_state *st)
return ad2s1210_config_write(st, 0x0);
 }
 
-static ssize_t ad2s1210_store_fclkin(struct device *dev,
-struct device_attribute *attr,
-const char *buf,
-size_t len)
-{
-   struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
-   unsigned int fclkin;
-   int ret;
-
-   ret = kstrtouint(buf, 10, );
-   if (ret)
-   return ret;
-   if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
-   dev_err(dev, "ad2s1210: fclkin out of range\n");
-   return -EINVAL;
-   }
-
-   mutex_lock(>lock);
-   st->fclkin = fclkin;
-
-   ret = ad2s1210_update_frequency_control_word(st);
-   if (ret < 0)
-   goto error_ret;
-   ret = ad2s1210_soft_reset(st);
-error_ret:
-   mutex_unlock(>lock);
-
-   return ret < 0 ? ret : len;
-}
-
-static ssize_t ad2s1210_store_fexcit(struct device *dev,
-struct device_attribute *attr,
-const char *buf, size_t len)
-{
-   struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
-   unsigned int fexcit;
-   int ret;
-
-   ret = kstrtouint(buf, 10, );
-   if (ret < 0)
-   return ret;
-   if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
-   dev_err(dev,
-   "ad2s1210: excitation frequency out of range\n");
-   return -EINVAL;
-   }
-   mutex_lock(>lock);
-   st->fexcit = fexcit;
-   ret = ad2s1210_update_frequency_control_word(st);
-   if (ret < 0)
-   goto error_ret;
-   ret = ad2s1210_soft_reset(st);
-error_ret:
-   mutex_unlock(>lock);
-
-   return ret < 0 ? ret : len;
-}
-
 static ssize_t ad2s1210_show_control(struct device *dev,
 struct device_attribute *attr,
 char *buf)
@@ -545,8 +487,50 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
return ret;
 }
 
-static IIO_DEVICE_ATTR(fclkin, 0644, NULL, ad2s1210_store_fclkin, 0);
-static IIO_DEVICE_ATTR(fexcit, 0644, NULL, ad2s1210_store_fexcit, 0);
+static int ad2s1210_write_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan, int val,
+ int val2, long mask)
+{
+   struct ad2s1210_state *st = iio_priv(indio_dev);
+   unsigned int clk = val;
+   int ret;
+
+   if (mask != IIO_CHAN_INFO_FREQUENCY)
+   return -EINVAL;
+
+   switch (chan->channel) {
+   case FCLKIN:
+   if (clk < AD2S1210_MIN_CLKIN ||
+   clk > AD2S1210_MAX_CLKIN) {
+   dev_err(_dev->dev,
+   "ad2s1210: fclkin out of range\n");
+   return -EINVAL;
+   }
+   mutex_lock(>lock);
+   st->fclkin = clk;
+   break;
+   case FEXCIT:
+   if (clk < AD2S1210_MIN_EXCIT ||
+   clk > AD2S1210_MAX_EXCIT) {
+   dev_err(_dev->dev,
+   "ad2s1210: excitation frequency out of 
range\n");
+   return -EINVAL;
+   }
+   mutex_lock(>lock);
+   st->fexcit = clk;
+   break;
+   default:
+   return -EINVAL;
+   }
+   ret = ad2s1210_update_frequency_control_word(st);
+   if (ret < 0)
+   goto error_unlock_mutex;
+   ret = ad2s1210_soft_reset(st);
+error_unlock_mutex:
+   mutex_unlock(>lock);
+   return ret;
+}
+
 static IIO_DEVICE_ATTR(control, 0644,
   ad2s1210_show_control, ad2s1210_store_control, 0);
 static IIO_DEVICE_ATTR(bits, 0644,
@@ -577,8 +561,6 @@ static IIO_DEVICE_ATTR(lot_low_thrd, 0644,
   AD2S1210_REG_LOT_LOW_THRD);
 
 static struct attribute 

[PATCH v2 2/3] staging:iio:ad2s1210: Add frequency handler in read_raw

2018-03-13 Thread Rodrigo Siqueira
Read data from fclkin and fexcit does not utilize the ad2s1210_read_raw
function. This patch, append the required handler in the
ad2s1210_read_raw to return the correct value. Also, this patch removes
the legacy code related to the read function

Signed-off-by: Rodrigo Siqueira 
---
 drivers/staging/iio/resolver/ad2s1210.c | 45 +++--
 1 file changed, 20 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c 
b/drivers/staging/iio/resolver/ad2s1210.c
index 28c3fd439663..27a42ed10fcd 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -210,15 +210,6 @@ static inline int ad2s1210_soft_reset(struct 
ad2s1210_state *st)
return ad2s1210_config_write(st, 0x0);
 }
 
-static ssize_t ad2s1210_show_fclkin(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
-{
-   struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
-
-   return sprintf(buf, "%u\n", st->fclkin);
-}
-
 static ssize_t ad2s1210_store_fclkin(struct device *dev,
 struct device_attribute *attr,
 const char *buf,
@@ -249,15 +240,6 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,
return ret < 0 ? ret : len;
 }
 
-static ssize_t ad2s1210_show_fexcit(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
-{
-   struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
-
-   return sprintf(buf, "%u\n", st->fexcit);
-}
-
 static ssize_t ad2s1210_store_fexcit(struct device *dev,
 struct device_attribute *attr,
 const char *buf, size_t len)
@@ -486,7 +468,7 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
 struct iio_chan_spec const *chan,
 int *val,
 int *val2,
-long m)
+long mask)
 {
struct ad2s1210_state *st = iio_priv(indio_dev);
u16 negative;
@@ -535,23 +517,36 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
*val = vel;
ret = IIO_VAL_INT;
break;
+   case IIO_CHAN_INFO_FREQUENCY:
+   ret = IIO_VAL_INT;
+   switch (chan->channel) {
+   case FCLKIN:
+   *val = st->fclkin;
+   goto unlock_mutex;
+   case FEXCIT:
+   *val = st->fexcit;
+   goto unlock_mutex;
+   default:
+   ret = -EINVAL;
+   goto unlock_mutex;
+   }
+   break;
default:
-   mutex_unlock(>lock);
-   return -EINVAL;
+   ret = -EINVAL;
+   goto unlock_mutex;
}
 
 error_ret:
gpio_set_value(st->pdata->sample, 1);
/* delay (2 * tck + 20) nano seconds */
udelay(1);
+unlock_mutex:
mutex_unlock(>lock);
return ret;
 }
 
-static IIO_DEVICE_ATTR(fclkin, 0644,
-  ad2s1210_show_fclkin, ad2s1210_store_fclkin, 0);
-static IIO_DEVICE_ATTR(fexcit, 0644,
-  ad2s1210_show_fexcit,ad2s1210_store_fexcit, 0);
+static IIO_DEVICE_ATTR(fclkin, 0644, NULL, ad2s1210_store_fclkin, 0);
+static IIO_DEVICE_ATTR(fexcit, 0644, NULL, ad2s1210_store_fexcit, 0);
 static IIO_DEVICE_ATTR(control, 0644,
   ad2s1210_show_control, ad2s1210_store_control, 0);
 static IIO_DEVICE_ATTR(bits, 0644,
-- 
2.16.2

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


[PATCH v2 0/3] staging:iio:ad2s1210: Rework read/write operation for fclkin and fexin

2018-03-13 Thread Rodrigo Siqueira
This patchset changes the way that frequency of clock input (fclkin) and
the excitation frequency (fexcit) are exposed to the userspace. The
original code uses the IIO_DEVICE_ATTR to export the configuration of
fclkin and fexcit to the userspace which is not in agreement with the
current ABI. This patchset adds one channel per clock configuration,
updating the read_raw function by adding a handler for the new channels,
and introduces the write_raw function.  Furthermore, this patchset
removes the legacy code responsible for the read and write operation
related to fclkin and fexcit. Finally, this patchset uses parts of the
original code for handling frequency configuration as an attempt to
avoid problems.

Changes in v2:
 - Removes unnecessary switch case in the write_raw function.
 - Replaces the use of goto for direct return.
 - Removes definition with string.
 - Removes unecessary label.

Rodrigo Siqueira (3):
  staging:iio:ad2s1210: Add channel for fclkin and fexcit
  staging:iio:ad2s1210: Add frequency handler in read_raw
  staging:iio:ad2s1210: Add write_raw to handle frequency

 drivers/staging/iio/resolver/ad2s1210.c | 191 +++-
 1 file changed, 92 insertions(+), 99 deletions(-)

-- 
2.16.2

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


Re: [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-03-13 Thread kbuild test robot
Hi Deepa,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on ]

url:
https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305
base:
config: powerpc-iss476-smp_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/oprofile/backtrace.c: In function 'user_getsp32':
>> arch/powerpc/oprofile/backtrace.c:31:19: error: implicit declaration of 
>> function 'compat_ptr'; did you mean 'complete'? 
>> [-Werror=implicit-function-declaration]
 void __user *p = compat_ptr(sp);
  ^~
  complete
>> arch/powerpc/oprofile/backtrace.c:31:19: error: initialization makes pointer 
>> from integer without a cast [-Werror=int-conversion]
   cc1: all warnings being treated as errors

vim +31 arch/powerpc/oprofile/backtrace.c

6c6bd754 Brian Rogan 2006-03-27  27  
6c6bd754 Brian Rogan 2006-03-27  28  static unsigned int user_getsp32(unsigned 
int sp, int is_first)
6c6bd754 Brian Rogan 2006-03-27  29  {
6c6bd754 Brian Rogan 2006-03-27  30 unsigned int stack_frame[2];
62034f03 Al Viro 2006-09-23 @31 void __user *p = compat_ptr(sp);
6c6bd754 Brian Rogan 2006-03-27  32  
62034f03 Al Viro 2006-09-23  33 if (!access_ok(VERIFY_READ, p, 
sizeof(stack_frame)))
6c6bd754 Brian Rogan 2006-03-27  34 return 0;
6c6bd754 Brian Rogan 2006-03-27  35  
6c6bd754 Brian Rogan 2006-03-27  36 /*
6c6bd754 Brian Rogan 2006-03-27  37  * The most likely reason for this is 
that we returned -EFAULT,
6c6bd754 Brian Rogan 2006-03-27  38  * which means that we've done all that 
we can do from
6c6bd754 Brian Rogan 2006-03-27  39  * interrupt context.
6c6bd754 Brian Rogan 2006-03-27  40  */
62034f03 Al Viro 2006-09-23  41 if 
(__copy_from_user_inatomic(stack_frame, p, sizeof(stack_frame)))
6c6bd754 Brian Rogan 2006-03-27  42 return 0;
6c6bd754 Brian Rogan 2006-03-27  43  
6c6bd754 Brian Rogan 2006-03-27  44 if (!is_first)
6c6bd754 Brian Rogan 2006-03-27  45 
oprofile_add_trace(STACK_LR32(stack_frame));
6c6bd754 Brian Rogan 2006-03-27  46  
6c6bd754 Brian Rogan 2006-03-27  47 /*
6c6bd754 Brian Rogan 2006-03-27  48  * We do not enforce increasing stack 
addresses here because
6c6bd754 Brian Rogan 2006-03-27  49  * we may transition to a different 
stack, eg a signal handler.
6c6bd754 Brian Rogan 2006-03-27  50  */
6c6bd754 Brian Rogan 2006-03-27  51 return STACK_SP(stack_frame);
6c6bd754 Brian Rogan 2006-03-27  52  }
6c6bd754 Brian Rogan 2006-03-27  53  

:: The code at line 31 was first introduced by commit
:: 62034f03380a64c0144b6721f4a2aa55d65346c1 [POWERPC] powerpc oprofile 
__user annotations

:: TO: Al Viro <v...@ftp.linux.org.uk>
:: CC: Paul Mackerras <pau...@samba.org>

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2018-03-13 Thread Andrew Lunn
> Hello Andrew,
> 
> The current driver implementation uses only a single FDB for the switch,
> so  it is not possible configure multiple flooding domains to accommodate
> ports partitioning.

Ah, O.K. Rather than break somebodies network by wrongly flooding, it
would be better to return -EOPNOTSUPP when the requirement for the
second FDB is met. The offload to hardware will then not happen, and
the software bridge will do all the work.

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


Re: [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-03-13 Thread kbuild test robot
Hi Deepa,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on ]

url:
https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305
base:
config: arm64-allnoconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   arch/arm64/kernel/process.c: In function 'copy_thread':
>> arch/arm64/kernel/process.c:342:8: error: implicit declaration of function 
>> 'is_compat_thread'; did you mean 'is_compat_task'? 
>> [-Werror=implicit-function-declaration]
   if (is_compat_thread(task_thread_info(p)))
   ^~~~
   is_compat_task
   cc1: some warnings being treated as errors

vim +342 arch/arm64/kernel/process.c

b3901d54d Catalin Marinas  2012-03-05  307  
b3901d54d Catalin Marinas  2012-03-05  308  int copy_thread(unsigned long 
clone_flags, unsigned long stack_start,
afa86fc42 Al Viro  2012-10-22  309  unsigned long stk_sz, 
struct task_struct *p)
b3901d54d Catalin Marinas  2012-03-05  310  {
b3901d54d Catalin Marinas  2012-03-05  311  struct pt_regs *childregs = 
task_pt_regs(p);
b3901d54d Catalin Marinas  2012-03-05  312  
c34501d21 Catalin Marinas  2012-10-05  313  memset(>thread.cpu_context, 
0, sizeof(struct cpu_context));
c34501d21 Catalin Marinas  2012-10-05  314  
bc0ee4760 Dave Martin  2017-10-31  315  /*
bc0ee4760 Dave Martin  2017-10-31  316   * Unalias p->thread.sve_state 
(if any) from the parent task
bc0ee4760 Dave Martin  2017-10-31  317   * and disable discard SVE 
state for p:
bc0ee4760 Dave Martin  2017-10-31  318   */
bc0ee4760 Dave Martin  2017-10-31  319  clear_tsk_thread_flag(p, 
TIF_SVE);
bc0ee4760 Dave Martin  2017-10-31  320  p->thread.sve_state = NULL;
bc0ee4760 Dave Martin  2017-10-31  321  
071b6d4a5 Dave Martin  2017-12-05  322  /*
071b6d4a5 Dave Martin  2017-12-05  323   * In case p was allocated the 
same task_struct pointer as some
071b6d4a5 Dave Martin  2017-12-05  324   * other recently-exited task, 
make sure p is disassociated from
071b6d4a5 Dave Martin  2017-12-05  325   * any cpu that may have run 
that now-exited task recently.
071b6d4a5 Dave Martin  2017-12-05  326   * Otherwise we could 
erroneously skip reloading the FPSIMD
071b6d4a5 Dave Martin  2017-12-05  327   * registers for p.
071b6d4a5 Dave Martin  2017-12-05  328   */
071b6d4a5 Dave Martin  2017-12-05  329  fpsimd_flush_task_state(p);
071b6d4a5 Dave Martin  2017-12-05  330  
9ac080021 Al Viro  2012-10-21  331  if (likely(!(p->flags & 
PF_KTHREAD))) {
9ac080021 Al Viro  2012-10-21  332  *childregs = 
*current_pt_regs();
b3901d54d Catalin Marinas  2012-03-05  333  childregs->regs[0] = 0;
d00a3810c Will Deacon  2015-05-27  334  
b3901d54d Catalin Marinas  2012-03-05  335  /*
b3901d54d Catalin Marinas  2012-03-05  336   * Read the current TLS 
pointer from tpidr_el0 as it may be
b3901d54d Catalin Marinas  2012-03-05  337   * out-of-sync with the 
saved value.
b3901d54d Catalin Marinas  2012-03-05  338   */
adf758999 Mark Rutland 2016-09-08  339  *task_user_tls(p) = 
read_sysreg(tpidr_el0);
d00a3810c Will Deacon  2015-05-27  340  
e0fd18ce1 Al Viro  2012-10-18  341  if (stack_start) {
d00a3810c Will Deacon  2015-05-27 @342  if 
(is_compat_thread(task_thread_info(p)))
d00a3810c Will Deacon  2015-05-27  343  
childregs->compat_sp = stack_start;
d00a3810c Will Deacon  2015-05-27  344  else
b3901d54d Catalin Marinas  2012-03-05  345  
childregs->sp = stack_start;
b3901d54d Catalin Marinas  2012-03-05  346  }
d00a3810c Will Deacon  2015-05-27  347  
c34501d21 Catalin Marinas  2012-10-05  348  /*
c34501d21 Catalin Marinas  2012-10-05  349   * If a TLS pointer was 
passed to clone (4th argument), use it
c34501d21 Catalin Marinas  2012-10-05  350   * for the new thread.
c34501d21 Catalin Marinas  2012-10-05  351   */
b3901d54d Catalin Marinas  2012-03-05  352  if (clone_flags & 
CLONE_SETTLS)
d00a3810c Will Deacon  2015-05-27  353  
p->thread.tp_value = childregs->regs[3];
c34501d21 Catalin Marinas  2012-10-05  354  } else {
c34501d21 Catalin Marinas  2012-10-05  355  memset(childregs, 0, 
sizeof(struct pt_regs));
c34501d21 Cata

RE: [PATCH v5 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2018-03-13 Thread Razvan Stefanescu


> -Original Message-
> From: Andrew Lunn [mailto:and...@lunn.ch]
> Sent: Tuesday, March 13, 2018 4:23 PM
> To: Razvan Stefanescu 
> Cc: gre...@linuxfoundation.org; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; net...@vger.kernel.org; Alexander Graf
> ; a...@arndb.de; Alexandru Marginean
> ; Ruxandra Ioana Ciocoi Radulescu
> ; Ioana Ciornei ;
> Laurentiu Tudor ; stuyo...@gmail.com
> Subject: Re: [PATCH v5 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2
> Ethernet Switch driver
> 
> > +/* For the moment, only flood setting needs to be updated */
> > +static int port_bridge_join(struct net_device *netdev,
> > +   struct net_device *upper_dev)
> > +{
> > +   struct ethsw_port_priv *port_priv = netdev_priv(netdev);
> > +   struct ethsw_core *ethsw = port_priv->ethsw_data;
> > +   int i, err;
> > +
> > +   for (i = 0; i < ethsw->sw_attr.num_ifs; i++)
> > +   if (ethsw->ports[i]->bridge_dev &&
> > +   (ethsw->ports[i]->bridge_dev != upper_dev)) {
> > +   netdev_err(netdev,
> > +  "Another switch port is connected to %s\n",
> > +  ethsw->ports[i]->bridge_dev->name);
> > +   return -EINVAL;
> > +   }
> > +
> > +   /* Enable flooding */
> > +   err = ethsw_port_set_flood(port_priv, 1);
> > +   if (!err)
> > +   port_priv->bridge_dev = upper_dev;
> > +
> > +   return err;
> > +}
> 
> Hi Razvan
> 
> That is not what i was meaning.
> 
> brctl addbr br0
> brctl addbr br1
> brctl addif br0 lan0
> brctl addif br0 lan1
> brctl addif br1 lan2
> brctl addif br1 lan3
> 
> Is there somewhere in the code which sets the scope for the flooding?
> lan0 can flood to lan1, but it should not flood to lan2 or lan3, since
> they are in a different bridge. I was expecting that
> ethsw_port_set_flood() takes upper_dev, in order to configure which
> ports it should flood to.
> 
>   Andrew

Hello Andrew,

The current driver implementation uses only a single FDB for the switch,
so  it is not possible configure multiple flooding domains to accommodate
ports partitioning.
 
The configuration that you mentioned will be possible when support for
multiple FDBs in the switch is added. Ports added to the same bridge
will have their flooding domain limited to a specific FDB.

Switch ports partitioning is a feature on the roadmap. I will add this
information to the TODO list.

Best regards,
Razvan Stefanescu
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging:iio:ad2s1210: Add write_raw to handle frequency

2018-03-13 Thread Rodrigo Siqueira
On 03/13, Dan Carpenter wrote:
> On Tue, Mar 13, 2018 at 10:06:29AM -0300, Rodrigo Siqueira wrote:
> > On 03/13, Dan Carpenter wrote:
> >
> > > Ah...  I see why you did the ERROR_MESSAGE define, to get around the 80
> > > character limit.  Don't do that.  Just go over 80 characters if you need
> > > to.
> > > 
> > > 
> > > > +   "fclkin");
> > > > +   ret = -EINVAL;
> > > > +   goto error_ret;
> > > 
> > > Direct returns are better.  Less chance of bugs statistically.
> > 
> > I totally get your point here, and I will fix it. However, just for
> > curiosity, why goto in this situation has more chance to generate bugs
> > statically?
> > 
> 
> This is a do-nothing goto.  I normally consider do-nothing gotos and
> do-everything gotos basically cousins but in this case it's probably
> unfair since it already has other labels.
> 
> Do-everything gotos are the most error prone way of doing error
> handling.  I've reviewed a lot of static checker warnings and it really
> is true.  I can't give you like a percent figure but do-everything error
> handling is a lot buggier than normal kernel style.
> 
> This style of error handling is supposed to prevent returning without
> unlocking bugs.  I once looked through the git log and counted missing
> unlock bugs and my conclusion was that it basically doesn't work for
> preventing bugs.  The kind of people who just add random returns will do
> it regardless of the error handling style.  There was even one driver
> that indented locked code like this:
> 
>   lock(); {
>   blah blah blah;
>   } unlock();
> 
> When the driver was first submitted, it already had a missing unlock
> bug.  I don't think style helps slow people down who are in a hurry.
> 
> The other thing about do-nothing gotos is that you introduce the
> possibility of "forgot to set the error code" bugs which wasn't there
> before.
> 
> regards,
> dan carpenter
> 
> 
> 
> 
> 
> 
> 
> 
> So actually "error_ret" seems like a pretty reasonable name for a
> do-nothing goto.  I no
> 
> I've looked at a lot of error handling and this kind of error handling
> is more error prone.  The single exit path thing is supposed to prevent
> bugs like not dropping the lock on exit and I've looked through the logs
> and counted bugs to see if it works and I don't think it does.  The
> people who forget to unlock will forget to unlock regardless of the
> error handling style.
> 

Thanks for the great explanation :)
 
> 
> 
> 
> > I will send a v2 with your recommendantions.
> > Thanks for the review and feedbacks :)
> >  
> > > regards,
> > > dan carpenter
> > > 
> > ___
> > devel mailing list
> > de...@linuxdriverproject.org
> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2018-03-13 Thread Andrew Lunn
> +/* For the moment, only flood setting needs to be updated */
> +static int port_bridge_join(struct net_device *netdev,
> + struct net_device *upper_dev)
> +{
> + struct ethsw_port_priv *port_priv = netdev_priv(netdev);
> + struct ethsw_core *ethsw = port_priv->ethsw_data;
> + int i, err;
> +
> + for (i = 0; i < ethsw->sw_attr.num_ifs; i++)
> + if (ethsw->ports[i]->bridge_dev &&
> + (ethsw->ports[i]->bridge_dev != upper_dev)) {
> + netdev_err(netdev,
> +"Another switch port is connected to %s\n",
> +ethsw->ports[i]->bridge_dev->name);
> + return -EINVAL;
> + }
> +
> + /* Enable flooding */
> + err = ethsw_port_set_flood(port_priv, 1);
> + if (!err)
> + port_priv->bridge_dev = upper_dev;
> +
> + return err;
> +}

Hi Razvan

That is not what i was meaning.

brctl addbr br0
brctl addbr br1
brctl addif br0 lan0
brctl addif br0 lan1
brctl addif br1 lan2
brctl addif br1 lan3

Is there somewhere in the code which sets the scope for the flooding?
lan0 can flood to lan1, but it should not flood to lan2 or lan3, since
they are in a different bridge. I was expecting that
ethsw_port_set_flood() takes upper_dev, in order to configure which
ports it should flood to.

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


Re: [PATCH 3/3] staging:iio:ad2s1210: Add write_raw to handle frequency

2018-03-13 Thread Dan Carpenter
On Tue, Mar 13, 2018 at 10:06:29AM -0300, Rodrigo Siqueira wrote:
> On 03/13, Dan Carpenter wrote:
>
> > Ah...  I see why you did the ERROR_MESSAGE define, to get around the 80
> > character limit.  Don't do that.  Just go over 80 characters if you need
> > to.
> > 
> > 
> > > + "fclkin");
> > > + ret = -EINVAL;
> > > + goto error_ret;
> > 
> > Direct returns are better.  Less chance of bugs statistically.
> 
> I totally get your point here, and I will fix it. However, just for
> curiosity, why goto in this situation has more chance to generate bugs
> statically?
> 

This is a do-nothing goto.  I normally consider do-nothing gotos and
do-everything gotos basically cousins but in this case it's probably
unfair since it already has other labels.

Do-everything gotos are the most error prone way of doing error
handling.  I've reviewed a lot of static checker warnings and it really
is true.  I can't give you like a percent figure but do-everything error
handling is a lot buggier than normal kernel style.

This style of error handling is supposed to prevent returning without
unlocking bugs.  I once looked through the git log and counted missing
unlock bugs and my conclusion was that it basically doesn't work for
preventing bugs.  The kind of people who just add random returns will do
it regardless of the error handling style.  There was even one driver
that indented locked code like this:

lock(); {
blah blah blah;
} unlock();

When the driver was first submitted, it already had a missing unlock
bug.  I don't think style helps slow people down who are in a hurry.

The other thing about do-nothing gotos is that you introduce the
possibility of "forgot to set the error code" bugs which wasn't there
before.

regards,
dan carpenter








So actually "error_ret" seems like a pretty reasonable name for a
do-nothing goto.  I no

I've looked at a lot of error handling and this kind of error handling
is more error prone.  The single exit path thing is supposed to prevent
bugs like not dropping the lock on exit and I've looked through the logs
and counted bugs to see if it works and I don't think it does.  The
people who forget to unlock will forget to unlock regardless of the
error handling style.





> I will send a v2 with your recommendantions.
> Thanks for the review and feedbacks :)
>  
> > regards,
> > dan carpenter
> > 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 1/6] staging: fsl-dpaa2/ethsw: Add APIs for DPSW object

2018-03-13 Thread Razvan Stefanescu
Add the command build/parse APIs for operating on DPSW objects through
the DPAA2 Management Complex.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- use u8 for en parameter of dpsw_if_set_flooding/broadcast()
 v3:
- no changes
 v4:
- adjust to moving MC-bus out of staging
- fix sparse warnings
 v5:
   - no changes

 drivers/staging/fsl-dpaa2/Kconfig  |8 +
 drivers/staging/fsl-dpaa2/Makefile |1 +
 drivers/staging/fsl-dpaa2/ethsw/Makefile   |7 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h |  358 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 1116 
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h |  579 +++
 6 files changed, 2069 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/Makefile
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.h

diff --git a/drivers/staging/fsl-dpaa2/Kconfig 
b/drivers/staging/fsl-dpaa2/Kconfig
index dfff675..8a508ef 100644
--- a/drivers/staging/fsl-dpaa2/Kconfig
+++ b/drivers/staging/fsl-dpaa2/Kconfig
@@ -16,3 +16,11 @@ config FSL_DPAA2_ETH
---help---
  Ethernet driver for Freescale DPAA2 SoCs, using the
  Freescale MC bus driver
+
+config FSL_DPAA2_ETHSW
+   tristate "Freescale DPAA2 Ethernet Switch"
+   depends on FSL_DPAA2
+   depends on NET_SWITCHDEV
+   ---help---
+   Driver for Freescale DPAA2 Ethernet Switch. Select
+   BRIDGE to have support for bridge tools.
diff --git a/drivers/staging/fsl-dpaa2/Makefile 
b/drivers/staging/fsl-dpaa2/Makefile
index 0836ba8..6cfd76b 100644
--- a/drivers/staging/fsl-dpaa2/Makefile
+++ b/drivers/staging/fsl-dpaa2/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_FSL_DPAA2_ETH)+= ethernet/
+obj-$(CONFIG_FSL_DPAA2_ETHSW)  += ethsw/
diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile 
b/drivers/staging/fsl-dpaa2/ethsw/Makefile
new file mode 100644
index 000..db137f7
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
@@ -0,0 +1,7 @@
+#
+# Makefile for the Freescale DPAA2 Ethernet Switch
+#
+
+obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
+
+dpaa2-ethsw-objs := dpsw.o
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
new file mode 100644
index 000..36edef6
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
@@ -0,0 +1,358 @@
+/* Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2017-2018 NXP
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ * * Neither the name of the above-listed copyright holders nor the
+ *  names of any contributors may be used to endorse or promote products
+ *  derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __FSL_DPSW_CMD_H
+#define __FSL_DPSW_CMD_H
+
+/* DPSW Version */
+#define DPSW_VER_MAJOR 8
+#define DPSW_VER_MINOR 0
+
+#define DPSW_CMD_BASE_VERSION  1
+#define DPSW_CMD_ID_OFFSET 4
+
+#define DPSW_CMD_ID(id)(((id) << DPSW_CMD_ID_OFFSET) | 
DPSW_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPSW_CMDID_CLOSEDPSW_CMD_ID(0x800)
+#define DPSW_CMDID_OPEN DPSW_CMD_ID(0x802)
+
+#define DPSW_CMDID_GET_API_VERSION  DPSW_CMD_ID(0xa02)
+
+#define DPSW_CMDID_ENABLE   

[PATCH v5 5/6] staging: fsl-dpaa2/ethsw: Add README

2018-03-13 Thread Razvan Stefanescu
Add a README file describing the driver architecture, components and
interfaces.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- no changes
 v4:
- no changes
 v5:
- no changes

 drivers/staging/fsl-dpaa2/ethsw/README | 106 +
 1 file changed, 106 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/README

diff --git a/drivers/staging/fsl-dpaa2/ethsw/README 
b/drivers/staging/fsl-dpaa2/ethsw/README
new file mode 100644
index 000..f6fc07f
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/README
@@ -0,0 +1,106 @@
+DPAA2 Ethernet Switch driver
+
+
+This file provides documentation for the DPAA2 Ethernet Switch driver
+
+
+Contents
+
+   Supported Platforms
+   Architecture Overview
+   Creating an Ethernet Switch
+   Features
+
+
+   Supported Platforms
+===
+This driver provides networking support for Freescale LS2085A, LS2088A
+DPAA2 SoCs.
+
+
+Architecture Overview
+=
+The Ethernet Switch in the DPAA2 architecture consists of several hardware
+resources that provide the functionality. These are allocated and
+configured via the Management Complex (MC) portals. MC abstracts most of
+these resources as DPAA2 objects and exposes ABIs through which they can
+be configured and controlled.
+
+For a more detailed description of the DPAA2 architecture and its object
+abstractions see:
+   drivers/staging/fsl-mc/README.txt
+
+The Ethernet Switch is built on top of a Datapath Switch (DPSW) object.
+
+Configuration interface:
+
+  -
+ | DPAA2 Switch driver |
+  -
+   .
+   .
+  --
+ | DPSW API |
+  --
+   .   software
+ = . ==
+   .   hardware
+  -
+ | MC hardware portals |
+  -
+   .
+   .
+ --
+| DPSW |
+ --
+
+Driver uses the switch device driver model and exposes each switch port as
+a network interface, which can be included in a bridge. Traffic switched
+between ports is offloaded into the hardware. Exposed network interfaces
+are not used for I/O, they are used just for configuration. This
+limitation is going to be addressed in the future.
+
+The DPSW can have ports connected to DPNIs or to PHYs via DPMACs.
+
+
+ [ethA] [ethB] [ethC] [ethD] [ethE] [ethF]
+:  :  :  :  :  :
+:  :  :  :  :  :
+[eth drv]  [eth drv]  [ethsw drv  ]
+:  :  :  :  :  :kernel
+
+:  :  :  :  :  :hardware
+ [DPNI]  [DPNI] [= DPSW =]
+|  |  |  |  |  |
+|   --   |   [DPMAC][DPMAC]
+ ---|  |
+|  |
+  [PHY]  [PHY]
+
+For a more detailed description of the Ethernet switch device driver model
+see:
+   Documentation/networking/switchdev.txt
+
+Creating an Ethernet Switch
+===
+A device is created for the switch objects probed on the MC bus. Each DPSW
+has a number of properties which determine the configuration options and
+associated hardware resources.
+
+A DPSW object (and the other DPAA2 objects needed for a DPAA2 switch) can
+be added to a container on the MC bus in one of two ways: statically,
+through a Datapath Layout Binary file (DPL) that is parsed by MC at boot
+time; or created dynamically at runtime, via the DPAA2 objects APIs.
+
+Features
+
+Driver configures DPSW to perform hardware switching offload of
+unicast/multicast/broadcast (VLAN tagged or untagged) traffic between its
+ports.
+
+It allows configuration of hardware learning, flooding, multicast groups,
+port VLAN configuration and STP state.
+
+Static entries can be added/removed from the FDB.
+
+Hardware statistics for each port are provided through ethtool -S option.
-- 
1.9.1

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


[PATCH v5 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2018-03-13 Thread Razvan Stefanescu
Introduce the DPAA2 Ethernet Switch driver, which manages Datapath Switch
(DPSW) objects discovered on the MC bus.

Suggested-by: Alexandru Marginean 
Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- fix PVID cleanup in ethsw_port_add_vlan()
- rename err2 to ret in ethsw_port_add/del_vlan()
- avoid duplicate code in ethsw_probe()
- move destroy_workqueue to ethsw_takedown()
- have a function for unregistering notifiers
- above changes implement review comments for v1 from Bogdan P.
 v3:
- no changes
 v4:
- adjust to moving MC-bus out of staging
- support adding/deleting multicast entries to/from FDB
- selectively discard benign MC errors for calling add/delete fdb entries
  multiple times to avoid spamming console with stack traces
- refactor setting TCI to avoid code duplication
- clean probe code error path
 v5:
- replace ethsw_irq0_handler() with NULL
- do not allow adding ports of the same switch to multiple bridge devices

 drivers/staging/fsl-dpaa2/ethsw/Makefile |2 +-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c  | 1531 ++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h  |   89 ++
 3 files changed, 1621 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h

diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile 
b/drivers/staging/fsl-dpaa2/ethsw/Makefile
index db137f7..a6d72d1 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/Makefile
+++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
@@ -4,4 +4,4 @@
 
 obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
 
-dpaa2-ethsw-objs := dpsw.o
+dpaa2-ethsw-objs := ethsw.o dpsw.o
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
new file mode 100644
index 000..2127037
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -0,0 +1,1531 @@
+/* Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2017-2018 NXP
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ * * Neither the name of the above-listed copyright holders nor the
+ *  names of any contributors may be used to endorse or promote products
+ *  derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "ethsw.h"
+
+static struct workqueue_struct *ethsw_owq;
+
+/* Minimal supported DPSW version */
+#define DPSW_MIN_VER_MAJOR 8
+#define DPSW_MIN_VER_MINOR 0
+
+#define DEFAULT_VLAN_ID1
+
+static int ethsw_add_vlan(struct ethsw_core *ethsw, u16 vid)
+{
+   int err;
+
+   struct dpsw_vlan_cfgvcfg = {
+   .fdb_id = 0,
+   };
+
+   if (ethsw->vlans[vid]) {
+   dev_err(ethsw->dev, "VLAN already configured\n");
+   return -EEXIST;
+   }
+
+   err = dpsw_vlan_add(ethsw->mc_io, 0,
+   ethsw->dpsw_handle, vid, );
+   if (err) {
+   dev_err(ethsw->dev, "dpsw_vlan_add err %d\n", err);
+   return err;
+   }
+   ethsw->vlans[vid] = ETHSW_VLAN_MEMBER;
+
+   return 0;
+}
+
+static int ethsw_port_set_tci(struct ethsw_port_priv *port_priv,
+ struct dpsw_tci_cfg *tci_cfg)
+{
+   struct ethsw_core *ethsw = 

[PATCH v5 4/6] staging: fsl-dpaa2/ethsw: Add maintainer for Ethernet Switch driver

2018-03-13 Thread Razvan Stefanescu
Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- no changes
 v4:
- no changes
 v5:
- no changes

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c3c2b75..20d7bf2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4410,6 +4410,12 @@ L:   linux-ker...@vger.kernel.org
 S: Maintained
 F: drivers/staging/fsl-dpaa2/ethernet
 
+DPAA2 ETHERNET SWITCH DRIVER
+M: Razvan Stefanescu 
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/staging/fsl-dpaa2/ethsw
+
 DPT_I2O SCSI RAID DRIVER
 M: Adaptec OEM Raid Solutions 
 L: linux-s...@vger.kernel.org
-- 
1.9.1

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


[PATCH v5 0/6] staging: Introduce DPAA2 Ethernet Switch driver

2018-03-13 Thread Razvan Stefanescu
This patchset introduces the Ethernet Switch Driver for Freescale/NXP SoCs
with DPAA2 (DataPath Acceleration Architecture v2). The driver manages
switch objects discovered on the fsl-mc bus. A description of the driver
can be found in the associated README file.

The patchset consists of:
* A set of libraries containing APIs for configuring and controlling
  Management Complex (MC) switch objects
* The DPAA2 Ethernet Switch driver
* Patch adding ethtool support

Limitations:
* no support for control traffic to/from CPU
* only DPSW ports can be added to a bridge

Changelog:
 v2: addressed comments from Bogdan P.

 v3: addressed comments from Andrew L. (patch 3/6 updated)

 v4: adjust to moving MC-bus out of staging
 support adding/deleting multicast entries to/from FDB
 avoid triggering console stack traces due to benign MC errors
 refactor TCI setting code to avoid code duplication
 fix sparse warning

 v5: addresed comments from Andrew L. (patch 2/6 updated)
 replace ethsw_irq0_handler() with NULL
 do not allow adding ports of the same switch to multiple bridges

Razvan Stefanescu (6):
  staging: fsl-dpaa2/ethsw: Add APIs for DPSW object
  staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver
  staging: fsl-dpaa2/ethsw: Add ethtool support
  staging: fsl-dpaa2/ethsw: Add maintainer for Ethernet Switch driver
  staging: fsl-dpaa2/ethsw: Add README
  staging: fsl-dpaa2/ethsw: Add TODO

 MAINTAINERS |6 +
 drivers/staging/fsl-dpaa2/Kconfig   |8 +
 drivers/staging/fsl-dpaa2/Makefile  |1 +
 drivers/staging/fsl-dpaa2/ethsw/Makefile|7 +
 drivers/staging/fsl-dpaa2/ethsw/README  |  106 ++
 drivers/staging/fsl-dpaa2/ethsw/TODO|   13 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h  |  371 ++
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c  | 1148 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h  |  611 +
 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c |  206 +++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 1532 +++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h |   91 ++
 12 files changed, 4100 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/Makefile
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/README
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/TODO
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.h
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h

-- 
1.9.1

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


[PATCH v5 3/6] staging: fsl-dpaa2/ethsw: Add ethtool support

2018-03-13 Thread Razvan Stefanescu
Add driver information, link details and hardware statistics to be
reported via ethtool -S.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- removed driver version
 v4:
- no changes
 v5:
- no changes

 drivers/staging/fsl-dpaa2/ethsw/Makefile|   2 +-
 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h  |  13 ++
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c  |  32 
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h  |  32 
 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c | 206 
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c |   1 +
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h |   2 +
 7 files changed, 287 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c

diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile 
b/drivers/staging/fsl-dpaa2/ethsw/Makefile
index a6d72d1..de92cd9 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/Makefile
+++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
@@ -4,4 +4,4 @@
 
 obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
 
-dpaa2-ethsw-objs := ethsw.o dpsw.o
+dpaa2-ethsw-objs := ethsw.o ethsw-ethtool.o dpsw.o
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
index 36edef6..c45f001 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
@@ -74,6 +74,8 @@
 #define DPSW_CMDID_IF_SET_FLOODING  DPSW_CMD_ID(0x047)
 #define DPSW_CMDID_IF_SET_BROADCAST DPSW_CMD_ID(0x048)
 
+#define DPSW_CMDID_IF_SET_LINK_CFG  DPSW_CMD_ID(0x04C)
+
 #define DPSW_CMDID_VLAN_ADD DPSW_CMD_ID(0x060)
 #define DPSW_CMDID_VLAN_ADD_IF  DPSW_CMD_ID(0x061)
 #define DPSW_CMDID_VLAN_ADD_IF_UNTAGGED DPSW_CMD_ID(0x062)
@@ -262,6 +264,17 @@ struct dpsw_cmd_if_set_max_frame_length {
__le16 frame_length;
 };
 
+struct dpsw_cmd_if_set_link_cfg {
+   /* cmd word 0 */
+   __le16 if_id;
+   u8 pad[6];
+   /* cmd word 1 */
+   __le32 rate;
+   __le32 pad1;
+   /* cmd word 2 */
+   __le64 options;
+};
+
 struct dpsw_cmd_if_get_link_state {
__le16 if_id;
 };
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
index 8e52d74..e63531d 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
@@ -383,6 +383,38 @@ int dpsw_get_attributes(struct fsl_mc_io *mc_io,
 }
 
 /**
+ * dpsw_if_set_link_cfg() - Set the link configuration.
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token: Token of DPSW object
+ * @if_id: Interface id
+ * @cfg:   Link configuration
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpsw_if_set_link_cfg(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
+u16 token,
+u16 if_id,
+struct dpsw_link_cfg *cfg)
+{
+   struct mc_command cmd = { 0 };
+   struct dpsw_cmd_if_set_link_cfg *cmd_params;
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPSW_CMDID_IF_SET_LINK_CFG,
+ cmd_flags,
+ token);
+   cmd_params = (struct dpsw_cmd_if_set_link_cfg *)cmd.params;
+   cmd_params->if_id = cpu_to_le16(if_id);
+   cmd_params->rate = cpu_to_le32(cfg->rate);
+   cmd_params->options = cpu_to_le64(cfg->options);
+
+   /* send command to mc*/
+   return mc_send_command(mc_io, );
+}
+
+/**
  * dpsw_if_get_link_state - Return the link state
  * @mc_io: Pointer to MC portal's I/O object
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
index d13970c..5a0c7ad 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
@@ -245,6 +245,38 @@ enum dpsw_action {
 };
 
 /**
+ * Enable auto-negotiation
+ */
+#define DPSW_LINK_OPT_AUTONEG  0x0001ULL
+/**
+ * Enable half-duplex mode
+ */
+#define DPSW_LINK_OPT_HALF_DUPLEX  0x0002ULL
+/**
+ * Enable pause frames
+ */
+#define DPSW_LINK_OPT_PAUSE0x0004ULL
+/**
+ * Enable a-symmetric pause frames
+ */
+#define DPSW_LINK_OPT_ASYM_PAUSE   0x0008ULL
+
+/**
+ * struct dpsw_link_cfg - Structure representing DPSW link configuration
+ * @rate: Rate
+ * @options: Mask of available options; use 'DPSW_LINK_OPT_' values
+ */
+struct dpsw_link_cfg {
+   u32 rate;
+   u64 options;
+};
+
+int dpsw_if_set_link_cfg(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
+u16 token,
+u16 if_id,
+struct dpsw_link_cfg *cfg);
+/**
  * struct dpsw_link_state - Structure 

[PATCH v5 6/6] staging: fsl-dpaa2/ethsw: Add TODO

2018-03-13 Thread Razvan Stefanescu
Add a TODO file describing what needs to be added/changed before the driver
can be moved out of staging.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- no changes
 v4:
- remove fsl-mc bus driver dependency as it is out of staging
 v5:
- no changes

 drivers/staging/fsl-dpaa2/ethsw/TODO | 13 +
 1 file changed, 13 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/TODO

diff --git a/drivers/staging/fsl-dpaa2/ethsw/TODO 
b/drivers/staging/fsl-dpaa2/ethsw/TODO
new file mode 100644
index 000..d186875
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/TODO
@@ -0,0 +1,13 @@
+* Add I/O capabilities on switch port netdevices. This will allow control
+traffic to reach the CPU.
+* Add ACL to redirect control traffic to CPU.
+* Add support for displaying learned FDB entries
+* MC firmware uprev; the DPAA2 objects used by the Ethernet Switch driver
+need to   be kept in sync with binary interface changes in MC
+* refine README file
+* cleanup
+
+NOTE: At least first three of the above are required before getting the
+DPAA2 Ethernet Switch driver out of staging. Another requirement is that
+dpio driver is moved to drivers/soc (this is required for I/O).
+
-- 
1.9.1

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


[PATCH] media: imx: work around false-positive warning

2018-03-13 Thread Arnd Bergmann
The IS_ERR()/PTR_ERR() combination confuses gcc to the point that it
cannot prove the upstream_ep variable to be initialized:

drivers/staging/media/imx/imx-media-csi.c: In function 'csi_link_validate':
drivers/staging/media/imx/imx-media-csi.c:1025:20: error: 'upstream_ep' may be 
used uninitialized in this function [-Werror=maybe-uninitialized]
  priv->upstream_ep = upstream_ep;
  ~~^
drivers/staging/media/imx/imx-media-csi.c:1026:24: error: 
'upstream_ep.bus_type' may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
  is_csi2 = (upstream_ep.bus_type == V4L2_MBUS_CSI2);
 ~~~^
drivers/staging/media/imx/imx-media-csi.c:127:19: error: 
'upstream_ep.bus.parallel.bus_width' may be used uninitialized in this function 
[-Werror=maybe-uninitialized]

I could come up with no good way to rewrite this function, as a last
resort, this adds an explicit zero-intialization of the structure.

Fixes: 52e17089d185 ("media: imx: Don't initialize vars that won't be used")
Signed-off-by: Arnd Bergmann 
---
 drivers/staging/media/imx/imx-media-csi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..887fed0c3ce0 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -1004,7 +1004,7 @@ static int csi_link_validate(struct v4l2_subdev *sd,
 struct v4l2_subdev_format *sink_fmt)
 {
struct csi_priv *priv = v4l2_get_subdevdata(sd);
-   struct v4l2_fwnode_endpoint upstream_ep;
+   struct v4l2_fwnode_endpoint upstream_ep = {};
const struct imx_media_pixfmt *incc;
bool is_csi2;
int ret;
-- 
2.9.0

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


Re: [PATCH 3/3] staging:iio:ad2s1210: Add write_raw to handle frequency

2018-03-13 Thread Rodrigo Siqueira
On 03/13, Dan Carpenter wrote:
> On Mon, Mar 12, 2018 at 03:21:52PM -0300, Rodrigo Siqueira wrote:
> > The write interface of AD2S1210 utilizes IIO_DEVICE_ATTR, which violate
> > the official IIO ABI. This patch, add the write_raw function responsible
> > for handling the fclkin and fexcit channel; also it removes the use of
> > IIO_DEVICE_ATTR for fclkin and fexcit.
> > 
> > Signed-off-by: Rodrigo Siqueira 
> > ---
> >  drivers/staging/iio/resolver/ad2s1210.c | 117 
> > +++-
> >  1 file changed, 55 insertions(+), 62 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/resolver/ad2s1210.c 
> > b/drivers/staging/iio/resolver/ad2s1210.c
> > index 27a42ed10fcd..ea6ade4e563c 100644
> > --- a/drivers/staging/iio/resolver/ad2s1210.c
> > +++ b/drivers/staging/iio/resolver/ad2s1210.c
> > @@ -60,6 +60,8 @@
> >  
> >  #define AD2S1210_DEF_EXCIT 1
> >  
> > +#define ERROR_MESSAGE "ad2s1210: %s out of range\n"
> > +
> 
> Don't make this a define.  That's horrible.  It's a pointless layer of
> abstraction.
> 
> 
> >  enum ad2s1210_mode {
> > MOD_POS = 0,
> > MOD_VEL,
> > @@ -210,64 +212,6 @@ static inline int ad2s1210_soft_reset(struct 
> > ad2s1210_state *st)
> > return ad2s1210_config_write(st, 0x0);
> >  }
> >  
> > -static ssize_t ad2s1210_store_fclkin(struct device *dev,
> > -struct device_attribute *attr,
> > -const char *buf,
> > -size_t len)
> > -{
> > -   struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
> > -   unsigned int fclkin;
> > -   int ret;
> > -
> > -   ret = kstrtouint(buf, 10, );
> > -   if (ret)
> > -   return ret;
> > -   if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
> > -   dev_err(dev, "ad2s1210: fclkin out of range\n");
> > -   return -EINVAL;
> > -   }
> > -
> > -   mutex_lock(>lock);
> > -   st->fclkin = fclkin;
> > -
> > -   ret = ad2s1210_update_frequency_control_word(st);
> > -   if (ret < 0)
> > -   goto error_ret;
> > -   ret = ad2s1210_soft_reset(st);
> > -error_ret:
> > -   mutex_unlock(>lock);
> > -
> > -   return ret < 0 ? ret : len;
> > -}
> > -
> > -static ssize_t ad2s1210_store_fexcit(struct device *dev,
> > -struct device_attribute *attr,
> > -const char *buf, size_t len)
> > -{
> > -   struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
> > -   unsigned int fexcit;
> > -   int ret;
> > -
> > -   ret = kstrtouint(buf, 10, );
> > -   if (ret < 0)
> > -   return ret;
> > -   if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
> > -   dev_err(dev,
> > -   "ad2s1210: excitation frequency out of range\n");
> > -   return -EINVAL;
> > -   }
> > -   mutex_lock(>lock);
> > -   st->fexcit = fexcit;
> > -   ret = ad2s1210_update_frequency_control_word(st);
> > -   if (ret < 0)
> > -   goto error_ret;
> > -   ret = ad2s1210_soft_reset(st);
> > -error_ret:
> > -   mutex_unlock(>lock);
> > -
> > -   return ret < 0 ? ret : len;
> > -}
> > -
> >  static ssize_t ad2s1210_show_control(struct device *dev,
> >  struct device_attribute *attr,
> >  char *buf)
> > @@ -545,8 +489,58 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
> > return ret;
> >  }
> >  
> > -static IIO_DEVICE_ATTR(fclkin, 0644, NULL, ad2s1210_store_fclkin, 0);
> > -static IIO_DEVICE_ATTR(fexcit, 0644, NULL, ad2s1210_store_fexcit, 0);
> > +static int ad2s1210_write_raw(struct iio_dev *indio_dev,
> > + struct iio_chan_spec const *chan, int val,
> > + int val2, long mask)
> > +{
> > +   struct ad2s1210_state *st = iio_priv(indio_dev);
> > +   unsigned int clk = val;
> > +   int ret;
> > +
> > +   switch (mask) {
> > +   case IIO_CHAN_INFO_FREQUENCY:
> > +   switch (chan->channel) {
> 
> This is a switch statement with only one case.  Make it an if statement
> and chop out some indenting.
> 
>   if (mask != IIO_CHAN_INFO_FREQUENCY)
>   return -EINVAL;
> 
> > +   case FCLKIN:
> > +   if (clk < AD2S1210_MIN_CLKIN ||
> > +   clk > AD2S1210_MAX_CLKIN) {
> > +   dev_err(_dev->dev, ERROR_MESSAGE,

Hi Dan,

Just a note, I did it because I will add more things to this function.
However, I agree with you, and I will follow your recommendation for
keep things simple and focused on the present. 

> Ah...  I see why you did the ERROR_MESSAGE define, to get around the 80
> character limit.  Don't do that.  Just go over 80 characters if you need
> to.
> 
> 
> > +   "fclkin");
> > +   ret = -EINVAL;
> > +   goto error_ret;
> 
> Direct returns are better.  Less chance of bugs statistically.

I 

[PATCH] staging: lustre: fid: avoid false-positive uninitialized variable warning

2018-03-13 Thread Arnd Bergmann
One of Neil's recent cleanups apparently has led the code to get
to a state where gcc tracks the 'seqnr' variable just enough to
see that it is sometimes initialized in seq_client_alloc_seq(),
but not enough that it can prove this initialization to be reliable
before the use of that variable:

drivers/staging/lustre/lustre/fid/fid_request.c: In function 
'seq_client_alloc_fid':
drivers/staging/lustre/lustre/fid/fid_request.c:245:22: error: 'seqnr' may be 
used uninitialized in this function [-Werror=maybe-uninitialized]

The code seems to be otherwise correct, and I could not come
up with a good way to simplify it further, so this adds a fake
initialization to shut up that warning.

Cc: NeilBrown 
Signed-off-by: Arnd Bergmann 
---
 drivers/staging/lustre/lustre/fid/fid_request.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index fa23423eb8b3..030680f37c79 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -174,6 +174,7 @@ static int seq_client_alloc_seq(const struct lu_env *env,
if (rc) {
CERROR("%s: Can't allocate new meta-sequence, rc %d\n",
   seq->lcs_name, rc);
+   *seqnr = U64_MAX;
return rc;
}
CDEBUG(D_INFO, "%s: New range - " DRANGE "\n",
-- 
2.9.0

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


[PATCH] staging: lustre: use module_name() macro for debug printf

2018-03-13 Thread Arnd Bergmann
We now allow lustre to be built when CONFIG_MODULES is disabled,
but that causes a build failure:

In file included from drivers/staging/lustre/include/linux/libcfs/libcfs.h:42,
 from drivers/staging/lustre/lustre/obdclass/lu_object.c:44:
drivers/staging/lustre/lustre/obdclass/lu_object.c: In function 
'lu_context_key_degister':
drivers/staging/lustre/lustre/obdclass/lu_object.c:1410:51: error: 
dereferencing pointer to incomplete type 'struct module'

This particular case can be avoided by using the module_name()
macro that was designed exactly to handle printing the name of
a module in all configurations.

Cc: NeilBrown 
Signed-off-by: Arnd Bergmann 
---
 drivers/staging/lustre/lustre/obdclass/lu_object.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c 
b/drivers/staging/lustre/lustre/obdclass/lu_object.c
index 8ddf23b82a2c..3ae16e8501c2 100644
--- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
@@ -1407,7 +1407,7 @@ void lu_context_key_degister(struct lu_context_key *key)
while (atomic_read(>lct_used) > 1) {
spin_unlock(_keys_guard);
CDEBUG(D_INFO, "%s: \"%s\" %p, %d\n",
-  __func__, key->lct_owner ? key->lct_owner->name : "",
+  __func__, module_name(key->lct_owner),
   key, atomic_read(>lct_used));
schedule();
spin_lock(_keys_guard);
@@ -1547,7 +1547,7 @@ void lu_context_key_quiesce(struct lu_context_key *key)
spin_unlock(_keys_guard);
CDEBUG(D_INFO, "%s: \"%s\" %p, %d (%d)\n",
   __func__,
-  key->lct_owner ? key->lct_owner->name : "",
+  module_name(key->lct_owner),
   key, atomic_read(>lct_used),
atomic_read(_key_initing_cnt));
schedule();
-- 
2.9.0

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


[PATCH] staging: wilc1000: use kmemdup to replace kmalloc/memcpy

2018-03-13 Thread hariprasath . elango
From: HariPrasath Elango 

kmalloc followed by memcpy can be replaced by kmemdup.Also added the
related error handling part

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/host_interface.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0fac8e1..4ae2da6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -992,9 +992,13 @@ static s32 handle_connect(struct wilc_vif *vif,
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
info_element_size = hif_drv->usr_conn_req.ies_len;
-   info_element = kmalloc(info_element_size, GFP_KERNEL);
-   memcpy(info_element, hif_drv->usr_conn_req.ies,
-   info_element_size);
+   info_element = kmemdup(hif_drv->usr_conn_req.ies,
+  info_element_size,
+  GFP_KERNEL);
+   if (!info_element) {
+   result = -ENOMEM;
+   goto ERRORHANDLER;
+   }
}
 
wid_list[wid_cnt].id = (u16)WID_11I_MODE;
-- 
2.10.0.GIT

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


Re: [PATCH] staging: ks7010: replace DPRINTK traces in favour of preferred netdev_*

2018-03-13 Thread Dan Carpenter
On Tue, Mar 13, 2018 at 11:57:35AM +0100, Sergio Paracuellos wrote:
> On Tue, Mar 13, 2018 at 11:04 AM, Dan Carpenter
>  wrote:
> > It takes a long time to review this, not because it's hard but because
> > I have to look at each line and think "Is this really a worthwhile line
> > to keep?" and a lot of them are marginal but perhaps not necessarily
> > bad?
> 
> I see. I though if they were there, it might be useful traces for
> somebody in any kind of way :-).
> 

Yeah.  I know, right?  It feels like the original author must have
thought they were super useful and you and I probably don't even have
this hardware (I don't) so it feels wrong to delete too much stuff...

But it's probably the right thing.

I can bet that I will automatically approve of almost anything error
message deletion but it's hard for me to delete the stuff myself because
I am a hoarder by nature.

regards,
dan carpenter

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


Re: [PATCHv2] staging: wilc1000: use pre-defined macro is_broadcast_ether_addr

2018-03-13 Thread Ajay Singh
On Tue, 13 Mar 2018 10:58:16 +0100
Greg Kroah-Hartman  wrote:

> On Tue, Mar 13, 2018 at 01:00:51PM +0530, Ajay Singh wrote:
> > 
> > Reviewed-by: Ajay Singh 
> > 
> > On Mon, 12 Mar 2018 15:09:03 +0530
> >  wrote:
> >   
> > > From: HariPrasath Elango 
> > >  
> > 
> > Please avoid use of 'From' tag specially when there is only one
> > 'Signed-off-by' tag and its same.  
> 
> But the email client isn't putting the correct info in the email header,
> so this line is needed.
> 
> And if it's redundant, not a problem, git handles it just fine, better
> to be safe.


Thanks Greg, for giving the information.
In that case, we can keep the 'From:' tag to be on safe side.


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


Re: [PATCH] staging: ks7010: replace DPRINTK traces in favour of preferred netdev_*

2018-03-13 Thread Sergio Paracuellos
On Tue, Mar 13, 2018 at 11:04 AM, Dan Carpenter
 wrote:
> It takes a long time to review this, not because it's hard but because
> I have to look at each line and think "Is this really a worthwhile line
> to keep?" and a lot of them are marginal but perhaps not necessarily
> bad?

I see. I though if they were there, it might be useful traces for
somebody in any kind of way :-).

>
> You've deleted some obviously rubbish printks but I feel you could have
> gone much further.  That would be an easy patch to review if it just
> deleted printks.  Maybe say [PATCH 1/2] delete stuff.  [PATCH 2/2] Use
> netdev_*.
>

I'll review these changes in the way you are saying and resend a new
patchset with this fixed.


> On Tue, Mar 13, 2018 at 07:42:22AM +0100, Sergio Paracuellos wrote:
>> @@ -767,20 +753,20 @@ static int ks7010_upload_firmware(struct ks_sdio_card 
>> *card)
>>
>>  static void ks7010_card_init(struct ks_wlan_private *priv)
>>  {
>> - DPRINTK(5, "\ncard_init_task()\n");
>> + netdev_dbg(priv->net_dev, "\ncard_init_task()\n");
>>
>
> This one is obviously useless.  We already have ftrace to tell use when
> functions are called.  And also the \n at the start is wrong because
> it messes up the dmesg log levels.

Agreed. Thanks for pointing this out.

>
> regards,
> dan carpenter

Best regards,
Sergio Paracuellos
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: wilc1000: remove unwanted braces and correct code alignment

2018-03-13 Thread hariprasath . elango
From: HariPrasath Elango 

Remove the unwated brace and corrected the code block alignment
accordingly

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/host_interface.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a4ee175..0fac8e1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -984,20 +984,19 @@ static s32 handle_connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)(&(dummyval));
wid_cnt++;
 
-   {
-   wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
-   wid_list[wid_cnt].type = WID_BIN_DATA;
-   wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
-   wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
-   wid_cnt++;
-
-   if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
-   info_element_size = hif_drv->usr_conn_req.ies_len;
-   info_element = kmalloc(info_element_size, GFP_KERNEL);
-   memcpy(info_element, hif_drv->usr_conn_req.ies,
-  info_element_size);
-   }
+   wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
+   wid_list[wid_cnt].type = WID_BIN_DATA;
+   wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
+   wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
+   wid_cnt++;
+
+   if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+   info_element_size = hif_drv->usr_conn_req.ies_len;
+   info_element = kmalloc(info_element_size, GFP_KERNEL);
+   memcpy(info_element, hif_drv->usr_conn_req.ies,
+   info_element_size);
}
+
wid_list[wid_cnt].id = (u16)WID_11I_MODE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
-- 
2.10.0.GIT

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


Re: [PATCH] staging: comedi: adl_pci6208: remove redundant initialization of 'val'

2018-03-13 Thread Ian Abbott

On 12/03/18 23:36, Colin King wrote:

From: Colin Ian King 

Variable 'val' is initialized with a value that is never read, it is
updated with a new value again after intitialization. Remove the
redundant initialization and move the declaration and assignment into
the scope of the for-loop.

Cleans up clang warning:
drivers/staging/comedi/drivers/adl_pci6208.c:61:15: warning: Value
stored to 'val' during its initialization is never read

Signed-off-by: Colin Ian King 
---
  drivers/staging/comedi/drivers/adl_pci6208.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c 
b/drivers/staging/comedi/drivers/adl_pci6208.c
index d39b4eabce8d..e21840e9002d 100644
--- a/drivers/staging/comedi/drivers/adl_pci6208.c
+++ b/drivers/staging/comedi/drivers/adl_pci6208.c
@@ -58,12 +58,11 @@ static int pci6208_ao_insn_write(struct comedi_device *dev,
 unsigned int *data)
  {
unsigned int chan = CR_CHAN(insn->chanspec);
-   unsigned int val = s->readback[chan];
int ret;
int i;
  
  	for (i = 0; i < insn->n; i++) {

-   val = data[i];
+   unsigned int val = data[i];
  
  		/* D/A transfer rate is 2.2us */

ret = comedi_timeout(dev, s, insn, pci6208_ao_eoc, 0);



Looks good, thanks!

Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


LOAN OFFER APPLY NOW

2018-03-13 Thread KOH CHONG FINANCE LOAN COMPANY
Good Day,

Are you in any financial difficulty? Do you need loan to help you pay off bills 
and debts? Do you want to start a new business or enhance your business? 
Contact us today for a financial solutions
email:koh.chong...@yahoo.com

Qualifications:
1)The Borrower must be at least 18yrs old
2)Even with Bad credit, we still Guarantee the Borrower the Loan
3)The Loan Can Be Granted Even With low credit.
LOAN APPLICATION DETAILS
Full Names: _ __
Gender:___ 
Marital status:___
Contact Address:__
City/Zip code:
Country:__ 
Date of Birth:
Amount Needed as Loan:
Loan Duration:_ ___
Monthly Income:_
Date Of Loan Needed:__
Weekly Income:__
Occupation:___ 
Purpose for Loan:_
Phone: 
Fax:__ 
In acknowledgment to these details, I will send you a well calculated Terms and 
Condition which will include the  agreement.i will want you to fill the 
borrower's information above  and return back to me as soon as possible so that 
we can proceed further.
Contact Person:KOH CHONG FINANCE LOAN COMPANY.
Email Address:koh.chong...@yahoo.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: ks7010: replace DPRINTK traces in favour of preferred netdev_*

2018-03-13 Thread Dan Carpenter
It takes a long time to review this, not because it's hard but because
I have to look at each line and think "Is this really a worthwhile line
to keep?" and a lot of them are marginal but perhaps not necessarily
bad?

You've deleted some obviously rubbish printks but I feel you could have
gone much further.  That would be an easy patch to review if it just
deleted printks.  Maybe say [PATCH 1/2] delete stuff.  [PATCH 2/2] Use
netdev_*.

On Tue, Mar 13, 2018 at 07:42:22AM +0100, Sergio Paracuellos wrote:
> @@ -767,20 +753,20 @@ static int ks7010_upload_firmware(struct ks_sdio_card 
> *card)
>  
>  static void ks7010_card_init(struct ks_wlan_private *priv)
>  {
> - DPRINTK(5, "\ncard_init_task()\n");
> + netdev_dbg(priv->net_dev, "\ncard_init_task()\n");
>  

This one is obviously useless.  We already have ftrace to tell use when
functions are called.  And also the \n at the start is wrong because
it messes up the dmesg log levels.

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


[PATCH] staging: wilc1000: replace switch statement by simple if condition

2018-03-13 Thread hariprasath . elango
From: HariPrasath Elango 

In this case,there is only a single switch case statement.So replacing
by a simple if condition.

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c901108..17bd762 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -772,14 +772,8 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
}
 
if (sme->crypto.n_akm_suites) {
-   switch (sme->crypto.akm_suites[0]) {
-   case WLAN_AKM_SUITE_8021X:
+   if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X)
auth_type = IEEE8021;
-   break;
-
-   default:
-   break;
-   }
}
 
curr_channel = pstrNetworkInfo->ch;
-- 
2.10.0.GIT

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


Re: [PATCHv2] staging: wilc1000: use pre-defined macro is_broadcast_ether_addr

2018-03-13 Thread Greg Kroah-Hartman
On Tue, Mar 13, 2018 at 01:00:51PM +0530, Ajay Singh wrote:
> 
> Reviewed-by: Ajay Singh 
> 
> On Mon, 12 Mar 2018 15:09:03 +0530
>  wrote:
> 
> > From: HariPrasath Elango 
> >
> 
> Please avoid use of 'From' tag specially when there is only one
> 'Signed-off-by' tag and its same.

But the email client isn't putting the correct info in the email header,
so this line is needed.

And if it's redundant, not a problem, git handles it just fine, better
to be safe.

thanks,

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


[PATCH] staging: wilc1000: destroy initialized mutex object

2018-03-13 Thread hariprasath . elango
From: HariPrasath Elango 

A mutex object that is initialized but not destroyed.This patch destroys
the mutex object

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 205304c..c901108 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2303,6 +2303,7 @@ int wilc_deinit_host_int(struct net_device *net)
 
op_ifcs--;
 
+   mutex_destroy(>scan_req_lock);
ret = wilc_deinit(vif);
 
clear_shadow_scan();
-- 
2.10.0.GIT

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


Re: [PATCH 3/3] staging:iio:ad2s1210: Add write_raw to handle frequency

2018-03-13 Thread Dan Carpenter
On Mon, Mar 12, 2018 at 03:21:52PM -0300, Rodrigo Siqueira wrote:
> The write interface of AD2S1210 utilizes IIO_DEVICE_ATTR, which violate
> the official IIO ABI. This patch, add the write_raw function responsible
> for handling the fclkin and fexcit channel; also it removes the use of
> IIO_DEVICE_ATTR for fclkin and fexcit.
> 
> Signed-off-by: Rodrigo Siqueira 
> ---
>  drivers/staging/iio/resolver/ad2s1210.c | 117 
> +++-
>  1 file changed, 55 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/staging/iio/resolver/ad2s1210.c 
> b/drivers/staging/iio/resolver/ad2s1210.c
> index 27a42ed10fcd..ea6ade4e563c 100644
> --- a/drivers/staging/iio/resolver/ad2s1210.c
> +++ b/drivers/staging/iio/resolver/ad2s1210.c
> @@ -60,6 +60,8 @@
>  
>  #define AD2S1210_DEF_EXCIT   1
>  
> +#define ERROR_MESSAGE "ad2s1210: %s out of range\n"
> +

Don't make this a define.  That's horrible.  It's a pointless layer of
abstraction.


>  enum ad2s1210_mode {
>   MOD_POS = 0,
>   MOD_VEL,
> @@ -210,64 +212,6 @@ static inline int ad2s1210_soft_reset(struct 
> ad2s1210_state *st)
>   return ad2s1210_config_write(st, 0x0);
>  }
>  
> -static ssize_t ad2s1210_store_fclkin(struct device *dev,
> -  struct device_attribute *attr,
> -  const char *buf,
> -  size_t len)
> -{
> - struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
> - unsigned int fclkin;
> - int ret;
> -
> - ret = kstrtouint(buf, 10, );
> - if (ret)
> - return ret;
> - if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
> - dev_err(dev, "ad2s1210: fclkin out of range\n");
> - return -EINVAL;
> - }
> -
> - mutex_lock(>lock);
> - st->fclkin = fclkin;
> -
> - ret = ad2s1210_update_frequency_control_word(st);
> - if (ret < 0)
> - goto error_ret;
> - ret = ad2s1210_soft_reset(st);
> -error_ret:
> - mutex_unlock(>lock);
> -
> - return ret < 0 ? ret : len;
> -}
> -
> -static ssize_t ad2s1210_store_fexcit(struct device *dev,
> -  struct device_attribute *attr,
> -  const char *buf, size_t len)
> -{
> - struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
> - unsigned int fexcit;
> - int ret;
> -
> - ret = kstrtouint(buf, 10, );
> - if (ret < 0)
> - return ret;
> - if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
> - dev_err(dev,
> - "ad2s1210: excitation frequency out of range\n");
> - return -EINVAL;
> - }
> - mutex_lock(>lock);
> - st->fexcit = fexcit;
> - ret = ad2s1210_update_frequency_control_word(st);
> - if (ret < 0)
> - goto error_ret;
> - ret = ad2s1210_soft_reset(st);
> -error_ret:
> - mutex_unlock(>lock);
> -
> - return ret < 0 ? ret : len;
> -}
> -
>  static ssize_t ad2s1210_show_control(struct device *dev,
>struct device_attribute *attr,
>char *buf)
> @@ -545,8 +489,58 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
>   return ret;
>  }
>  
> -static IIO_DEVICE_ATTR(fclkin, 0644, NULL, ad2s1210_store_fclkin, 0);
> -static IIO_DEVICE_ATTR(fexcit, 0644, NULL, ad2s1210_store_fexcit, 0);
> +static int ad2s1210_write_raw(struct iio_dev *indio_dev,
> +   struct iio_chan_spec const *chan, int val,
> +   int val2, long mask)
> +{
> + struct ad2s1210_state *st = iio_priv(indio_dev);
> + unsigned int clk = val;
> + int ret;
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_FREQUENCY:
> + switch (chan->channel) {

This is a switch statement with only one case.  Make it an if statement
and chop out some indenting.

if (mask != IIO_CHAN_INFO_FREQUENCY)
return -EINVAL;

> + case FCLKIN:
> + if (clk < AD2S1210_MIN_CLKIN ||
> + clk > AD2S1210_MAX_CLKIN) {
> + dev_err(_dev->dev, ERROR_MESSAGE,

Ah...  I see why you did the ERROR_MESSAGE define, to get around the 80
character limit.  Don't do that.  Just go over 80 characters if you need
to.


> + "fclkin");
> + ret = -EINVAL;
> + goto error_ret;

Direct returns are better.  Less chance of bugs statistically.

regards,
dan carpenter

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


Re: [PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy

2018-03-13 Thread Ajay Singh
On Tue, 13 Mar 2018 11:50:48 +0530
 wrote:

> From: HariPrasath Elango 
> 
> Kmalloc followed by memcpy can be replaced by kmemdup.
> 
> Signed-off-by: HariPrasath Elango 

Reviewed-by: Ajay Singh 


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


Re: [PATCH] staging: wilc1000: Destroy mutex object in deinitialization

2018-03-13 Thread Ajay Singh
On Mon, 12 Mar 2018 18:49:49 +0530
 wrote:

> From: HariPrasath Elango 
> 
> Destroy the mutex object that is initialized in wlan_init_locks()
> 
> Signed-off-by: HariPrasath Elango 

Reviewed-by: Ajay Singh 


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


Re: [PATCH] staging: wilc1000: Fix code block alignment

2018-03-13 Thread Ajay Singh
On Mon, 12 Mar 2018 18:30:44 +0530
 wrote:

> From: HariPrasath Elango 
> 
> Fix the code alignment for a block of code to adhere to coding
> guidelines
> 
> Signed-off-by: HariPrasath Elango 

Reviewed-by: Ajay Singh 

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


Re: [PATCHv2] staging: wilc1000: use pre-defined macro is_broadcast_ether_addr

2018-03-13 Thread Ajay Singh

Reviewed-by: Ajay Singh 

On Mon, 12 Mar 2018 15:09:03 +0530
 wrote:

> From: HariPrasath Elango 
>

Please avoid use of 'From' tag specially when there is only one
'Signed-off-by' tag and its same.

> Use the kernel pre-defined macro is_broadcast_ether_addr() instead of
> doing a memcmp here.
> 
> Signed-off-by: HariPrasath Elango 
> ---

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


[PATCH] staging: ks7010: replace DPRINTK traces in favour of preferred netdev_*

2018-03-13 Thread Sergio Paracuellos
This patch removes custom defined DPRINTK macro and replaces all the
associated debug and other traces for preferred ones netdev_*.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/Makefile  |   1 -
 drivers/staging/ks7010/ks7010_sdio.c | 146 +++
 drivers/staging/ks7010/ks_hostif.c   | 222 ++-
 drivers/staging/ks7010/ks_wlan.h |  10 --
 drivers/staging/ks7010/ks_wlan_net.c |  81 +
 5 files changed, 180 insertions(+), 280 deletions(-)

diff --git a/drivers/staging/ks7010/Makefile b/drivers/staging/ks7010/Makefile
index 69fcf8d..07dc16c 100644
--- a/drivers/staging/ks7010/Makefile
+++ b/drivers/staging/ks7010/Makefile
@@ -1,4 +1,3 @@
 obj-$(CONFIG_KS7010) += ks7010.o
 
-ccflags-y   += -DKS_WLAN_DEBUG=0
 ks7010-y:= michael_mic.o ks_hostif.o ks_wlan_net.o ks7010_sdio.o
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 7de78d1..5451c04 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -112,22 +112,20 @@ static void ks_wlan_hw_sleep_doze_request(struct 
ks_wlan_private *priv)
 {
int ret;
 
-   DPRINTK(4, "\n");
-
/* clear request */
atomic_set(>sleepstatus.doze_request, 0);
 
if (atomic_read(>sleepstatus.status) == 0) {
ret = ks7010_sdio_writeb(priv, GCR_B, GCR_B_DOZE);
if (ret) {
-   DPRINTK(1, " error : GCR_B\n");
+   netdev_err(priv->net_dev, " error : GCR_B\n");
goto set_sleep_mode;
}
-   DPRINTK(3, "sleep_mode=SLP_SLEEP\n");
+   netdev_dbg(priv->net_dev, "sleep_mode=SLP_SLEEP\n");
atomic_set(>sleepstatus.status, 1);
priv->last_doze = jiffies;
} else {
-   DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode);
+   netdev_dbg(priv->net_dev, "sleep_mode=%d\n", priv->sleep_mode);
}
 
 set_sleep_mode:
@@ -138,23 +136,21 @@ static void ks_wlan_hw_sleep_wakeup_request(struct 
ks_wlan_private *priv)
 {
int ret;
 
-   DPRINTK(4, "\n");
-
/* clear request */
atomic_set(>sleepstatus.wakeup_request, 0);
 
if (atomic_read(>sleepstatus.status) == 1) {
ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ);
if (ret) {
-   DPRINTK(1, " error : WAKEUP\n");
+   netdev_err(priv->net_dev, " error : WAKEUP\n");
goto set_sleep_mode;
}
-   DPRINTK(4, "wake up : WAKEUP\n");
+   netdev_dbg(priv->net_dev, "wake up : WAKEUP\n");
atomic_set(>sleepstatus.status, 0);
priv->last_wakeup = jiffies;
++priv->wakeup_count;
} else {
-   DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode);
+   netdev_dbg(priv->net_dev, "sleep_mode=%d\n", priv->sleep_mode);
}
 
 set_sleep_mode:
@@ -165,18 +161,17 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private 
*priv)
 {
int ret;
 
-   DPRINTK(4, "\n");
if (atomic_read(>psstatus.status) == PS_SNOOZE) {
ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ);
if (ret)
-   DPRINTK(1, " error : WAKEUP\n");
+   netdev_err(priv->net_dev, " error : WAKEUP\n");
else
-   DPRINTK(4, "wake up : WAKEUP\n");
+   netdev_dbg(priv->net_dev, "wake up : WAKEUP\n");
 
priv->last_wakeup = jiffies;
++priv->wakeup_count;
} else {
-   DPRINTK(1, "psstatus=%d\n",
+   netdev_dbg(priv->net_dev, "psstatus=%d\n",
atomic_read(>psstatus.status));
}
 }
@@ -201,7 +196,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
if (atomic_read(>psstatus.status) == PS_SNOOZE)
return;
 
-   DPRINTK(5, 
"\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n",
+   netdev_dbg(priv->net_dev, 
"\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n",
atomic_read(>psstatus.status),
atomic_read(>psstatus.confirm_wait),
atomic_read(>psstatus.snooze_guard),
@@ -216,7 +211,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
 
ret = ks7010_sdio_readb(priv, INT_PENDING, );
if (ret) {
-   DPRINTK(1, " error : INT_PENDING\n");
+   netdev_err(priv->net_dev, " error : INT_PENDING\n");
goto queue_delayed_work;
}
if (byte)
@@ -224,11 +219,11 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
 
ret = ks7010_sdio_writeb(priv, GCR_B, 

[PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy

2018-03-13 Thread hariprasath . elango
From: HariPrasath Elango 

Kmalloc followed by memcpy can be replaced by kmemdup.

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/linux_mon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index f93f411..c6fd6b3 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -146,7 +146,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
if (!mgmt_tx)
return -ENOMEM;
 
-   mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
+   mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC);
if (!mgmt_tx->buff) {
kfree(mgmt_tx);
return -ENOMEM;
@@ -154,7 +154,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
 
mgmt_tx->size = len;
 
-   memcpy(mgmt_tx->buff, buf, len);
wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
   mgmt_tx_complete);
 
-- 
2.10.0.GIT

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


[PATCH] staging: rtl8723bs: core: rtw_cmd: remove unnecessary initialization

2018-03-13 Thread Ji-Hun Kim
Clean up checkpatch error:
ERROR: do not initialise globals to 0

Signed-off-by: Ji-Hun Kim 
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index af0a9e0..9e132f9 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1742,7 +1742,7 @@ u8 rtw_ps_cmd(struct adapter *padapter)
return res;
 }
 
-u32 g_wait_hiq_empty = 0;
+u32 g_wait_hiq_empty;
 
 static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
 {
-- 
1.9.1

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