[PATCH] vcodec: mediatek: Add V4L2_CAP_TIMEPERFRAME capability setting

2016-09-05 Thread Tiffany Lin
This patch setting V4L2_CAP_TIMEPERFRAME capability in
vidioc_venc_s/g_parm functions

Signed-off-by: Tiffany Lin 
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 34fd89c..d0c2b9a 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -243,6 +243,8 @@ static int vidioc_venc_s_parm(struct file *file, void *priv,
a->parm.output.timeperframe.numerator;
ctx->param_change |= MTK_ENCODE_PARAM_FRAMERATE;
 
+   a->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
+
return 0;
 }
 
@@ -254,6 +256,7 @@ static int vidioc_venc_g_parm(struct file *file, void *priv,
if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
return -EINVAL;
 
+   a->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
a->parm.output.timeperframe.denominator =
ctx->enc_params.framerate_num;
a->parm.output.timeperframe.numerator =
-- 
1.7.9.5



[PATCH] vcodec: mediatek: Add V4L2_CAP_TIMEPERFRAME capability setting

2016-09-05 Thread Tiffany Lin
This patch setting V4L2_CAP_TIMEPERFRAME capability in
vidioc_venc_s/g_parm functions

Signed-off-by: Tiffany Lin 
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 34fd89c..d0c2b9a 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -243,6 +243,8 @@ static int vidioc_venc_s_parm(struct file *file, void *priv,
a->parm.output.timeperframe.numerator;
ctx->param_change |= MTK_ENCODE_PARAM_FRAMERATE;
 
+   a->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
+
return 0;
 }
 
@@ -254,6 +256,7 @@ static int vidioc_venc_g_parm(struct file *file, void *priv,
if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
return -EINVAL;
 
+   a->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
a->parm.output.timeperframe.denominator =
ctx->enc_params.framerate_num;
a->parm.output.timeperframe.numerator =
-- 
1.7.9.5



[PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h

2016-09-05 Thread Wang Nan
tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
tools/perf/util/map.c depend on several macros in mman.h, which
are lost on old systems like ubuntu 12.04. They are architecture
dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
into tools/ is not easy because mman.h for some unusual archs
(like tile) have extra dependencies.

This patch introduces only required macros into mman-fix.h.
Macros list is gotten from tools/perf/trace/beauty/mmap.c.

This patch is gnerated using following bash script:

 #!/bin/bash

 function begin_mman_fix_header()
 {
   echo "#ifndef $1" >  $2
   echo "#define $1" >> $2
   echo "#include " >> $2
 }

 function finish_mman_fix_header()
 {
   echo "#endif // $1" >> $2
   echo "Finish writing $2"
 }

 function build_mman_fix_header()
 {
   guard=$1
   shift
   target=$1
   shift
   begin_mman_fix_header $guard $target
   for src in $@
   do
 if [ -f $src ]
 then
   for macro in $macros
   do
 if grep '#define[ \t]*'$macro $src > /dev/null 2>&1
 then
   echo "#ifndef $macro" >> $target
   grep '#define[ \t]*'$macro $src | sed 's/[ \t]*\/\*.*$//g' >> $target
   echo "#endif" >> $target
 fi
   done
 fi
   done
 }

 macros=`grep ifndef tools/perf/trace/beauty/mmap.c | awk '{print $2}'`

 baseheader=tools/include/uapi/asm-generic/mman-fix.h
 build_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader 
include/uapi/asm-generic/mman*
 echo "#ifndef MAP_UNINITIALIZED" >> $baseheader
 echo "#define MAP_UNINITIALIZED 0x400" >> $baseheader
 echo "#endif" >> $baseheader
 finish_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader

 archs=`ls tools/arch`
 for arch in $archs
 do
   archheader=tools/arch/$arch/include/uapi/asm/mman-fix.h
   if [ ! -d tools/arch/$arch/include/uapi/asm ]
   then
 mkdir -p tools/arch/$arch/include/uapi/asm
   fi
   uppercase=`echo $arch | awk '{print toupper($0)}'`
   build_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H 
$archheader arch/$arch/include/uapi/asm/mman.h
   echo "#include " >> $archheader
   finish_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H 
$archheader
 done

Signed-off-by: Wang Nan 
Cc: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/arch/alpha/include/uapi/asm/mman-fix.h  | 38 +++
 tools/arch/arm/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/arm64/include/uapi/asm/mman-fix.h  |  5 +++
 tools/arch/frv/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/h8300/include/uapi/asm/mman-fix.h  |  5 +++
 tools/arch/hexagon/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/ia64/include/uapi/asm/mman-fix.h   |  5 +++
 tools/arch/m32r/include/uapi/asm/mman-fix.h   |  5 +++
 tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 +++
 tools/arch/mips/include/uapi/asm/mman-fix.h   | 41 
 tools/arch/mn10300/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/parisc/include/uapi/asm/mman-fix.h | 38 +++
 tools/arch/powerpc/include/uapi/asm/mman-fix.h| 11 ++
 tools/arch/s390/include/uapi/asm/mman-fix.h   |  5 +++
 tools/arch/score/include/uapi/asm/mman-fix.h  |  5 +++
 tools/arch/sh/include/uapi/asm/mman-fix.h |  5 +++
 tools/arch/sparc/include/uapi/asm/mman-fix.h  | 11 ++
 tools/arch/tile/include/uapi/asm/mman-fix.h   | 11 ++
 tools/arch/x86/include/uapi/asm/mman-fix.h|  8 
 tools/arch/xtensa/include/uapi/asm/mman-fix.h | 38 +++
 tools/include/uapi/asm-generic/mman-fix.h | 46 +++
 tools/perf/MANIFEST   |  2 +
 22 files changed, 304 insertions(+)
 create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
 create mode 100644 

[PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h

2016-09-05 Thread Wang Nan
tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
tools/perf/util/map.c depend on several macros in mman.h, which
are lost on old systems like ubuntu 12.04. They are architecture
dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
into tools/ is not easy because mman.h for some unusual archs
(like tile) have extra dependencies.

This patch introduces only required macros into mman-fix.h.
Macros list is gotten from tools/perf/trace/beauty/mmap.c.

This patch is gnerated using following bash script:

 #!/bin/bash

 function begin_mman_fix_header()
 {
   echo "#ifndef $1" >  $2
   echo "#define $1" >> $2
   echo "#include " >> $2
 }

 function finish_mman_fix_header()
 {
   echo "#endif // $1" >> $2
   echo "Finish writing $2"
 }

 function build_mman_fix_header()
 {
   guard=$1
   shift
   target=$1
   shift
   begin_mman_fix_header $guard $target
   for src in $@
   do
 if [ -f $src ]
 then
   for macro in $macros
   do
 if grep '#define[ \t]*'$macro $src > /dev/null 2>&1
 then
   echo "#ifndef $macro" >> $target
   grep '#define[ \t]*'$macro $src | sed 's/[ \t]*\/\*.*$//g' >> $target
   echo "#endif" >> $target
 fi
   done
 fi
   done
 }

 macros=`grep ifndef tools/perf/trace/beauty/mmap.c | awk '{print $2}'`

 baseheader=tools/include/uapi/asm-generic/mman-fix.h
 build_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader 
include/uapi/asm-generic/mman*
 echo "#ifndef MAP_UNINITIALIZED" >> $baseheader
 echo "#define MAP_UNINITIALIZED 0x400" >> $baseheader
 echo "#endif" >> $baseheader
 finish_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader

 archs=`ls tools/arch`
 for arch in $archs
 do
   archheader=tools/arch/$arch/include/uapi/asm/mman-fix.h
   if [ ! -d tools/arch/$arch/include/uapi/asm ]
   then
 mkdir -p tools/arch/$arch/include/uapi/asm
   fi
   uppercase=`echo $arch | awk '{print toupper($0)}'`
   build_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H 
$archheader arch/$arch/include/uapi/asm/mman.h
   echo "#include " >> $archheader
   finish_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H 
$archheader
 done

Signed-off-by: Wang Nan 
Cc: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/arch/alpha/include/uapi/asm/mman-fix.h  | 38 +++
 tools/arch/arm/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/arm64/include/uapi/asm/mman-fix.h  |  5 +++
 tools/arch/frv/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/h8300/include/uapi/asm/mman-fix.h  |  5 +++
 tools/arch/hexagon/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/ia64/include/uapi/asm/mman-fix.h   |  5 +++
 tools/arch/m32r/include/uapi/asm/mman-fix.h   |  5 +++
 tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 +++
 tools/arch/mips/include/uapi/asm/mman-fix.h   | 41 
 tools/arch/mn10300/include/uapi/asm/mman-fix.h|  5 +++
 tools/arch/parisc/include/uapi/asm/mman-fix.h | 38 +++
 tools/arch/powerpc/include/uapi/asm/mman-fix.h| 11 ++
 tools/arch/s390/include/uapi/asm/mman-fix.h   |  5 +++
 tools/arch/score/include/uapi/asm/mman-fix.h  |  5 +++
 tools/arch/sh/include/uapi/asm/mman-fix.h |  5 +++
 tools/arch/sparc/include/uapi/asm/mman-fix.h  | 11 ++
 tools/arch/tile/include/uapi/asm/mman-fix.h   | 11 ++
 tools/arch/x86/include/uapi/asm/mman-fix.h|  8 
 tools/arch/xtensa/include/uapi/asm/mman-fix.h | 38 +++
 tools/include/uapi/asm-generic/mman-fix.h | 46 +++
 tools/perf/MANIFEST   |  2 +
 22 files changed, 304 insertions(+)
 create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
 create mode 100644 

[PATCH 0/2] Fix mman macros using mman-fix.h

2016-09-05 Thread Wang Nan
Macros in mman like MAP_HUGETLB are missed in some old systems, causes
building error like this:

  CC   /tmp/build/perf/arch/x86/util/perf_regs.o
  util/event.c: In function 'perf_event__synthesize_mmap_events':
  util/event.c:350: error: 'MAP_HUGETLB' undeclared (first use in this function)
  util/event.c:350: error: (Each undeclared identifier is reported only once
  util/event.c:350: error: for each function it appears in.)

The first patch generates mman-fix.h for each arch, the second patch
fixes these macros use mman-fix.h.

Wang Nan (2):
  perf tools: Introduce memory mapping macros in mman-fix.h
  perf tools: Fix mman macros using mman-fix.h

 tools/arch/alpha/include/uapi/asm/mman-fix.h  | 38 ++
 tools/arch/arm/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/arm64/include/uapi/asm/mman-fix.h  |  5 ++
 tools/arch/frv/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/h8300/include/uapi/asm/mman-fix.h  |  5 ++
 tools/arch/hexagon/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/ia64/include/uapi/asm/mman-fix.h   |  5 ++
 tools/arch/m32r/include/uapi/asm/mman-fix.h   |  5 ++
 tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 ++
 tools/arch/mips/include/uapi/asm/mman-fix.h   | 41 +++
 tools/arch/mn10300/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/parisc/include/uapi/asm/mman-fix.h | 38 ++
 tools/arch/powerpc/include/uapi/asm/mman-fix.h| 11 
 tools/arch/s390/include/uapi/asm/mman-fix.h   |  5 ++
 tools/arch/score/include/uapi/asm/mman-fix.h  |  5 ++
 tools/arch/sh/include/uapi/asm/mman-fix.h |  5 ++
 tools/arch/sparc/include/uapi/asm/mman-fix.h  | 11 
 tools/arch/tile/include/uapi/asm/mman-fix.h   | 11 
 tools/arch/x86/include/uapi/asm/mman-fix.h|  8 +++
 tools/arch/xtensa/include/uapi/asm/mman-fix.h | 38 ++
 tools/include/uapi/asm-generic/mman-fix.h | 46 +
 tools/perf/MANIFEST   |  2 +
 tools/perf/trace/beauty/mmap.c| 63 +--
 tools/perf/util/event.c   |  5 +-
 tools/perf/util/map.c |  3 +-
 25 files changed, 307 insertions(+), 68 deletions(-)
 create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/xtensa/include/uapi/asm/mman-fix.h
 create mode 100644 tools/include/uapi/asm-generic/mman-fix.h

-- 
1.8.3.4



[PATCH 2/2] perf tools: Fix mman macros using mman-fix.h

2016-09-05 Thread Wang Nan
Use mman-fix.h to fix potential undefined macros in mman.h for
building perf in old systems.

Signed-off-by: Wang Nan 
Cc: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/perf/trace/beauty/mmap.c | 63 +-
 tools/perf/util/event.c|  5 +---
 tools/perf/util/map.c  |  3 +-
 3 files changed, 3 insertions(+), 68 deletions(-)

diff --git a/tools/perf/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c
index d0a3a8e..c96b3e2 100644
--- a/tools/perf/trace/beauty/mmap.c
+++ b/tools/perf/trace/beauty/mmap.c
@@ -1,8 +1,5 @@
 #include 
-
-#ifndef PROT_SEM
-#define PROT_SEM 0x8
-#endif
+#include 
 
 static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
   struct syscall_arg *arg)
@@ -33,31 +30,6 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, 
size_t size,
 
 #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot
 
-#ifndef MAP_FIXED
-#define MAP_FIXED   0x10
-#endif
-
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS   0x20
-#endif
-
-#ifndef MAP_32BIT
-#define MAP_32BIT   0x40
-#endif
-
-#ifndef MAP_STACK
-#define MAP_STACK0x2
-#endif
-
-#ifndef MAP_HUGETLB
-#define MAP_HUGETLB  0x4
-#endif
-
-#ifndef MAP_UNINITIALIZED
-#define MAP_UNINITIALIZED  0x400
-#endif
-
-
 static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
struct syscall_arg *arg)
 {
@@ -125,39 +97,6 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, 
size_t size,
 
 #define SCA_MREMAP_FLAGS syscall_arg__scnprintf_mremap_flags
 
-#ifndef MADV_HWPOISON
-#define MADV_HWPOISON  100
-#endif
-
-#ifndef MADV_SOFT_OFFLINE
-#define MADV_SOFT_OFFLINE  101
-#endif
-
-#ifndef MADV_MERGEABLE
-#define MADV_MERGEABLE  12
-#endif
-
-#ifndef MADV_UNMERGEABLE
-#define MADV_UNMERGEABLE13
-#endif
-
-#ifndef MADV_HUGEPAGE
-#define MADV_HUGEPAGE   14
-#endif
-
-#ifndef MADV_NOHUGEPAGE
-#define MADV_NOHUGEPAGE 15
-#endif
-
-#ifndef MADV_DONTDUMP
-#define MADV_DONTDUMP   16
-#endif
-
-#ifndef MADV_DODUMP
-#define MADV_DODUMP 17
-#endif
-
-
 static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
  struct syscall_arg *arg)
 {
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 23c3ebd..df85931 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 #include 
 #include "event.h"
 #include "debug.h"
@@ -249,10 +250,8 @@ int perf_event__synthesize_mmap_events(struct perf_tool 
*tool,
bool truncation = false;
unsigned long long timeout = proc_map_timeout * 100ULL;
int rc = 0;
-#ifdef MAP_HUGETLB
const char *hugetlbfs_mnt = hugetlbfs__mountpoint();
int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0;
-#endif
 
if (machine__is_default_guest(machine))
return 0;
@@ -347,12 +346,10 @@ out:
 
if (!strcmp(execname, ""))
strcpy(execname, anonstr);
-#ifdef MAP_HUGETLB
if (!strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) {
strcpy(execname, anonstr);
event->mmap2.flags |= MAP_HUGETLB;
}
-#endif
 
size = strlen(execname) + 1;
memcpy(event->mmap2.filename, execname, size);
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index f52d460..76c68853 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "map.h"
 #include "thread.h"
 #include "strlist.h"
@@ -29,9 +30,7 @@ static inline int is_anon_memory(const char *filename, u32 
flags)
 {
u32 anon_flags = 0;
 
-#ifdef MAP_HUGETLB
anon_flags |= MAP_HUGETLB;
-#endif
return flags & anon_flags ||
   !strcmp(filename, "//anon") ||
   !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) ||
-- 
1.8.3.4



[PATCH 0/2] Fix mman macros using mman-fix.h

2016-09-05 Thread Wang Nan
Macros in mman like MAP_HUGETLB are missed in some old systems, causes
building error like this:

  CC   /tmp/build/perf/arch/x86/util/perf_regs.o
  util/event.c: In function 'perf_event__synthesize_mmap_events':
  util/event.c:350: error: 'MAP_HUGETLB' undeclared (first use in this function)
  util/event.c:350: error: (Each undeclared identifier is reported only once
  util/event.c:350: error: for each function it appears in.)

The first patch generates mman-fix.h for each arch, the second patch
fixes these macros use mman-fix.h.

Wang Nan (2):
  perf tools: Introduce memory mapping macros in mman-fix.h
  perf tools: Fix mman macros using mman-fix.h

 tools/arch/alpha/include/uapi/asm/mman-fix.h  | 38 ++
 tools/arch/arm/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/arm64/include/uapi/asm/mman-fix.h  |  5 ++
 tools/arch/frv/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/h8300/include/uapi/asm/mman-fix.h  |  5 ++
 tools/arch/hexagon/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/ia64/include/uapi/asm/mman-fix.h   |  5 ++
 tools/arch/m32r/include/uapi/asm/mman-fix.h   |  5 ++
 tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 ++
 tools/arch/mips/include/uapi/asm/mman-fix.h   | 41 +++
 tools/arch/mn10300/include/uapi/asm/mman-fix.h|  5 ++
 tools/arch/parisc/include/uapi/asm/mman-fix.h | 38 ++
 tools/arch/powerpc/include/uapi/asm/mman-fix.h| 11 
 tools/arch/s390/include/uapi/asm/mman-fix.h   |  5 ++
 tools/arch/score/include/uapi/asm/mman-fix.h  |  5 ++
 tools/arch/sh/include/uapi/asm/mman-fix.h |  5 ++
 tools/arch/sparc/include/uapi/asm/mman-fix.h  | 11 
 tools/arch/tile/include/uapi/asm/mman-fix.h   | 11 
 tools/arch/x86/include/uapi/asm/mman-fix.h|  8 +++
 tools/arch/xtensa/include/uapi/asm/mman-fix.h | 38 ++
 tools/include/uapi/asm-generic/mman-fix.h | 46 +
 tools/perf/MANIFEST   |  2 +
 tools/perf/trace/beauty/mmap.c| 63 +--
 tools/perf/util/event.c   |  5 +-
 tools/perf/util/map.c |  3 +-
 25 files changed, 307 insertions(+), 68 deletions(-)
 create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/xtensa/include/uapi/asm/mman-fix.h
 create mode 100644 tools/include/uapi/asm-generic/mman-fix.h

-- 
1.8.3.4



[PATCH 2/2] perf tools: Fix mman macros using mman-fix.h

2016-09-05 Thread Wang Nan
Use mman-fix.h to fix potential undefined macros in mman.h for
building perf in old systems.

Signed-off-by: Wang Nan 
Cc: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/perf/trace/beauty/mmap.c | 63 +-
 tools/perf/util/event.c|  5 +---
 tools/perf/util/map.c  |  3 +-
 3 files changed, 3 insertions(+), 68 deletions(-)

diff --git a/tools/perf/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c
index d0a3a8e..c96b3e2 100644
--- a/tools/perf/trace/beauty/mmap.c
+++ b/tools/perf/trace/beauty/mmap.c
@@ -1,8 +1,5 @@
 #include 
-
-#ifndef PROT_SEM
-#define PROT_SEM 0x8
-#endif
+#include 
 
 static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
   struct syscall_arg *arg)
@@ -33,31 +30,6 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, 
size_t size,
 
 #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot
 
-#ifndef MAP_FIXED
-#define MAP_FIXED   0x10
-#endif
-
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS   0x20
-#endif
-
-#ifndef MAP_32BIT
-#define MAP_32BIT   0x40
-#endif
-
-#ifndef MAP_STACK
-#define MAP_STACK0x2
-#endif
-
-#ifndef MAP_HUGETLB
-#define MAP_HUGETLB  0x4
-#endif
-
-#ifndef MAP_UNINITIALIZED
-#define MAP_UNINITIALIZED  0x400
-#endif
-
-
 static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
struct syscall_arg *arg)
 {
@@ -125,39 +97,6 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, 
size_t size,
 
 #define SCA_MREMAP_FLAGS syscall_arg__scnprintf_mremap_flags
 
-#ifndef MADV_HWPOISON
-#define MADV_HWPOISON  100
-#endif
-
-#ifndef MADV_SOFT_OFFLINE
-#define MADV_SOFT_OFFLINE  101
-#endif
-
-#ifndef MADV_MERGEABLE
-#define MADV_MERGEABLE  12
-#endif
-
-#ifndef MADV_UNMERGEABLE
-#define MADV_UNMERGEABLE13
-#endif
-
-#ifndef MADV_HUGEPAGE
-#define MADV_HUGEPAGE   14
-#endif
-
-#ifndef MADV_NOHUGEPAGE
-#define MADV_NOHUGEPAGE 15
-#endif
-
-#ifndef MADV_DONTDUMP
-#define MADV_DONTDUMP   16
-#endif
-
-#ifndef MADV_DODUMP
-#define MADV_DODUMP 17
-#endif
-
-
 static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
  struct syscall_arg *arg)
 {
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 23c3ebd..df85931 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 #include 
 #include "event.h"
 #include "debug.h"
@@ -249,10 +250,8 @@ int perf_event__synthesize_mmap_events(struct perf_tool 
*tool,
bool truncation = false;
unsigned long long timeout = proc_map_timeout * 100ULL;
int rc = 0;
-#ifdef MAP_HUGETLB
const char *hugetlbfs_mnt = hugetlbfs__mountpoint();
int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0;
-#endif
 
if (machine__is_default_guest(machine))
return 0;
@@ -347,12 +346,10 @@ out:
 
if (!strcmp(execname, ""))
strcpy(execname, anonstr);
-#ifdef MAP_HUGETLB
if (!strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) {
strcpy(execname, anonstr);
event->mmap2.flags |= MAP_HUGETLB;
}
-#endif
 
size = strlen(execname) + 1;
memcpy(event->mmap2.filename, execname, size);
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index f52d460..76c68853 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "map.h"
 #include "thread.h"
 #include "strlist.h"
@@ -29,9 +30,7 @@ static inline int is_anon_memory(const char *filename, u32 
flags)
 {
u32 anon_flags = 0;
 
-#ifdef MAP_HUGETLB
anon_flags |= MAP_HUGETLB;
-#endif
return flags & anon_flags ||
   !strcmp(filename, "//anon") ||
   !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) ||
-- 
1.8.3.4



linux-next: Tree for Sep 6

2016-09-05 Thread Stephen Rothwell
Hi all,

Changes since 20160905:

The kbuild tree still had its build warnings for PowerPC, for which I
reverted a commit.

The tip tree gained a conflict against the kbuild tree.

The akpm-current tree lost its build failure after I applied a supplied
patch.

Non-merge commits (relative to Linus' tree): 5316
 5229 files changed, 241014 insertions(+), 95578 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 240 trees (counting Linus' and 34 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (bc4dee5aa727 Merge branch 'linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6)
Merging fixes/master (d3396e1e4ec4 Merge tag 'fixes-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc)
Merging kbuild-current/rc-fixes (d3e2773c4ede builddeb: Skip gcc-plugins when 
not configured)
Merging arc-current/for-curr (3eab887a5542 Linux 4.8-rc4)
Merging arm-current/fixes (da60626e7d02 ARM: sa1100: clear reset status prior 
to reboot)
Merging m68k-current/for-linus (6bd80f372371 m68k/defconfig: Update defconfigs 
for v4.7-rc2)
Merging metag-fixes/fixes (97b1d23f7bcb metag: Drop show_mem() from mem_init())
Merging powerpc-fixes/fixes (78a3e8889b4b powerpc: signals: Discard transaction 
state from signal frames)
Merging sparc/master (4620a06e4b3c shmem: Fix link error if huge pages support 
is disabled)
Merging net/master (6e1ce3c34512 af_unix: split 'u->readlock' into two: 
'iolock' and 'bindlock')
Merging ipsec/master (11d7a0bb95ea xfrm: Only add l3mdev oif to dst lookups)
Merging netfilter/master (5210d393ef84 netfilter: nf_tables_trace: fix endiness 
when dump chain policy)
Merging ipvs/master (ea43f860d984 Merge branch 'ethoc-fixes')
Merging wireless-drivers/master (bb87f02b7e4c Merge ath-current from ath.git)
Merging mac80211/master (61aaa0e8c1c1 cfg80211: Add stub for 
cfg80211_get_station())
Merging sound-current/for-linus (6b1ca4bcadf9 ALSA: fireworks: accessing to 
user space outside spinlock)
Merging pci-current/for-linus (6af7e4f77259 PCI: Mark Haswell Power Control 
Unit as having non-compliant BARs)
Merging driver-core.current/driver-core-linus (c6935931c189 Linux 4.8-rc5)
Merging tty.current/tty-linus (c6935931c189 Linux 4.8-rc5)
Merging usb.current/usb-linus (c6935931c189 Linux 4.8-rc5)
Merging usb-gadget-fixes/fixes (519d8bd4b5d3 usb: renesas_usbhs: fix clearing 
the {BRDY,BEMP}STS condition)
Merging usb-serial-fixes/usb-linus (40d9c32525cb USB: serial: option: add 
WeTelecom 0x6802 and 0x6803 products)
Merging usb-chipidea-fixes/ci-for-usb-stable (c4e94174983a usb: chipidea: udc: 
don't touch DP when controller is in host mode)
Merging staging.current/staging-linus (c6935931c189 Linux 4.8-rc5)
Merging char-misc.current/char-misc-linus (c6935931c189 Linux 4.8-rc5)
Merging input-current/for-linus (e3a888a4bff0 Input: ads7846 - remove redundant 
regulator_disable call)
Merging crypto-current/master (8b18e2359aff crypto: caam - fix IV loading for 
authenc (giv)decryption)
Merging ide/master (797cee982eef Merge branch 'stable-4.8' of 
git://git.infradead.org/users/pcmoore/audit)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (c8952a707556 vfio/pci: Fix NULL pointer oops in 
error interrupt setup handling)
Merging kselftest-fixes/fixes (29b4817d4018

linux-next: Tree for Sep 6

2016-09-05 Thread Stephen Rothwell
Hi all,

Changes since 20160905:

The kbuild tree still had its build warnings for PowerPC, for which I
reverted a commit.

The tip tree gained a conflict against the kbuild tree.

The akpm-current tree lost its build failure after I applied a supplied
patch.

Non-merge commits (relative to Linus' tree): 5316
 5229 files changed, 241014 insertions(+), 95578 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 240 trees (counting Linus' and 34 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (bc4dee5aa727 Merge branch 'linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6)
Merging fixes/master (d3396e1e4ec4 Merge tag 'fixes-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc)
Merging kbuild-current/rc-fixes (d3e2773c4ede builddeb: Skip gcc-plugins when 
not configured)
Merging arc-current/for-curr (3eab887a5542 Linux 4.8-rc4)
Merging arm-current/fixes (da60626e7d02 ARM: sa1100: clear reset status prior 
to reboot)
Merging m68k-current/for-linus (6bd80f372371 m68k/defconfig: Update defconfigs 
for v4.7-rc2)
Merging metag-fixes/fixes (97b1d23f7bcb metag: Drop show_mem() from mem_init())
Merging powerpc-fixes/fixes (78a3e8889b4b powerpc: signals: Discard transaction 
state from signal frames)
Merging sparc/master (4620a06e4b3c shmem: Fix link error if huge pages support 
is disabled)
Merging net/master (6e1ce3c34512 af_unix: split 'u->readlock' into two: 
'iolock' and 'bindlock')
Merging ipsec/master (11d7a0bb95ea xfrm: Only add l3mdev oif to dst lookups)
Merging netfilter/master (5210d393ef84 netfilter: nf_tables_trace: fix endiness 
when dump chain policy)
Merging ipvs/master (ea43f860d984 Merge branch 'ethoc-fixes')
Merging wireless-drivers/master (bb87f02b7e4c Merge ath-current from ath.git)
Merging mac80211/master (61aaa0e8c1c1 cfg80211: Add stub for 
cfg80211_get_station())
Merging sound-current/for-linus (6b1ca4bcadf9 ALSA: fireworks: accessing to 
user space outside spinlock)
Merging pci-current/for-linus (6af7e4f77259 PCI: Mark Haswell Power Control 
Unit as having non-compliant BARs)
Merging driver-core.current/driver-core-linus (c6935931c189 Linux 4.8-rc5)
Merging tty.current/tty-linus (c6935931c189 Linux 4.8-rc5)
Merging usb.current/usb-linus (c6935931c189 Linux 4.8-rc5)
Merging usb-gadget-fixes/fixes (519d8bd4b5d3 usb: renesas_usbhs: fix clearing 
the {BRDY,BEMP}STS condition)
Merging usb-serial-fixes/usb-linus (40d9c32525cb USB: serial: option: add 
WeTelecom 0x6802 and 0x6803 products)
Merging usb-chipidea-fixes/ci-for-usb-stable (c4e94174983a usb: chipidea: udc: 
don't touch DP when controller is in host mode)
Merging staging.current/staging-linus (c6935931c189 Linux 4.8-rc5)
Merging char-misc.current/char-misc-linus (c6935931c189 Linux 4.8-rc5)
Merging input-current/for-linus (e3a888a4bff0 Input: ads7846 - remove redundant 
regulator_disable call)
Merging crypto-current/master (8b18e2359aff crypto: caam - fix IV loading for 
authenc (giv)decryption)
Merging ide/master (797cee982eef Merge branch 'stable-4.8' of 
git://git.infradead.org/users/pcmoore/audit)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (c8952a707556 vfio/pci: Fix NULL pointer oops in 
error interrupt setup handling)
Merging kselftest-fixes/fixes (29b4817d4018

Re: [PATCH v16 0/4] Introduce usb charger framework to deal with the usb gadget power negotation

2016-09-05 Thread NeilBrown
On Mon, Aug 29 2016, Baolin Wang wrote:

> Hi Felipe,
>
> On 11 August 2016 at 11:14, Baolin Wang  wrote:
>> Hi Felipe,
>>
>> On 1 August 2016 at 15:09, Baolin Wang  wrote:
>>> Currently the Linux kernel does not provide any standard integration of this
>>> feature that integrates the USB subsystem with the system power regulation
>>> provided by PMICs meaning that either vendors must add this in their kernels
>>> or USB gadget devices based on Linux (such as mobile phones) may not behave
>>> as they should. Thus provide a standard framework for doing this in kernel.
>>>
>>> Now introduce one user with wm831x_power to support and test the usb 
>>> charger,
>>> which is pending testing. Moreover there may be other potential users will 
>>> use
>>> it in future.
>>
>> Could you please apply this patchset into your 'next' branch if you
>> have no comments about it? Thank you.
>
> Since there are no other comments about this patchset for a long time,
> could you please apply this patchset? Thanks.

Sorry, I should have replied earlier.  Tim Bird mentioned on the
ksummit-discuss list that there was a frustration with this not making
progress so I decided to contribute what I could now.

I think this patch set is attempting to address an important problem
that needs solving.  However I think it gets some key aspects wrong.
Maybe they can get fixed up after the patchset is upstream, maybe they
should be fixed first - I have no strong opinion on that.

My main complaints involve the detection and handling of the different
charger types - DCP, CDP, ACA etc.
The big-picture requirement here that the PHY will detect the physical
properties of the cable (e.g. resistance to ground on ID) and determine
the type of charger expected.  This information must be communicated to
the PMIC "power_supply" device so it can regulate the power being drawn
through the cable.

The first problem is that there are two different ways that the
distinction between DCP, CDP, ACA etc can be represented in Linux.  They
are cable types in the 'extcon' subsystem, and they are power_supply
types in the 'power_supply' subsystem.  This duplication is confusing.
It is not caused by your patch set, but I believe your patchset needs to
work with the duplication and I think it does so poorly.

In my mind, the power_supply should *not* know about this distinction at
all (except possibly as an advisor attribute simiarly to the current
battery technology attribute).  The other types it knows of are "AC",
"USB", and "BATTERY".  The contrast between these is quite different
From the contrast between DCP, CDP, ACA, which, from the perspective of
the power supply, are almost irrelevant.  Your patchset effectively
examines the power_supply_type of one power_supply, and communicates it
to another.  It isn't clear to me how the first power_supply gets the
information, or what the relationship between the two power_supplies is
meant to be.

It makes much more sense, to me, to utilized the knowledge of this
distinction that extcon provides.  A usb PHY can register an extcon,
declare the sorts of cables that it can detect, and tell the extcon as
cables appear or disappear.  The PMIC power_supply can then register with
that extcon for events and can find out when a cable is attached, and
what sort of cable.
Your usb-charging framework would be well placed to help the
power_supply to find the correct extcon, and possibly even to handle the
registration for events.

Your framework does currently register with extcon, but only listens for
EXTCON_USB cables.  I don't think that cable type is (reliably) reported
when a DCP (for example) is plugged in.

Here there is another problem that is not of your making, but still
needs fixing.  Extcon declares a number of cable types like:

/* USB external connector */
#define EXTCON_USB  1
#define EXTCON_USB_HOST 2

/* Charging external connector */
#define EXTCON_CHG_USB_SDP  5   /* Standard Downstream Port */
#define EXTCON_CHG_USB_DCP  6   /* Dedicated Charging Port */
#define EXTCON_CHG_USB_CDP  7   /* Charging Downstream Port */
#define EXTCON_CHG_USB_ACA  8   /* Accessory Charger Adapter */
#define EXTCON_CHG_USB_FAST 9
#define EXTCON_CHG_USB_SLOW 10

However it doesn't define what those mean, so we are left to guess.
They each correspond to bits in a bitmap, so a cable can have multiple types.
I think the best interpretation is that:

 EXTCON_USB means that the cable carries USB data from a host.
 EXTCON_USB_HOST means that that cable carries USB data to a host.
 EXTCON_CHG_* means that power is available as described in the
 standards.
 (what EXTCON_CHG_USB_FAST and EXTCON_CHG_USB_SLOW mean is not at all
 clear).

There is some support for this in the code, but it is not universally
acknowledged.  For a USB charging framework to be genuinely useful, it
must (I think) make sure this issue gets clarified, and the 

Re: [PATCH v16 0/4] Introduce usb charger framework to deal with the usb gadget power negotation

2016-09-05 Thread NeilBrown
On Mon, Aug 29 2016, Baolin Wang wrote:

> Hi Felipe,
>
> On 11 August 2016 at 11:14, Baolin Wang  wrote:
>> Hi Felipe,
>>
>> On 1 August 2016 at 15:09, Baolin Wang  wrote:
>>> Currently the Linux kernel does not provide any standard integration of this
>>> feature that integrates the USB subsystem with the system power regulation
>>> provided by PMICs meaning that either vendors must add this in their kernels
>>> or USB gadget devices based on Linux (such as mobile phones) may not behave
>>> as they should. Thus provide a standard framework for doing this in kernel.
>>>
>>> Now introduce one user with wm831x_power to support and test the usb 
>>> charger,
>>> which is pending testing. Moreover there may be other potential users will 
>>> use
>>> it in future.
>>
>> Could you please apply this patchset into your 'next' branch if you
>> have no comments about it? Thank you.
>
> Since there are no other comments about this patchset for a long time,
> could you please apply this patchset? Thanks.

Sorry, I should have replied earlier.  Tim Bird mentioned on the
ksummit-discuss list that there was a frustration with this not making
progress so I decided to contribute what I could now.

I think this patch set is attempting to address an important problem
that needs solving.  However I think it gets some key aspects wrong.
Maybe they can get fixed up after the patchset is upstream, maybe they
should be fixed first - I have no strong opinion on that.

My main complaints involve the detection and handling of the different
charger types - DCP, CDP, ACA etc.
The big-picture requirement here that the PHY will detect the physical
properties of the cable (e.g. resistance to ground on ID) and determine
the type of charger expected.  This information must be communicated to
the PMIC "power_supply" device so it can regulate the power being drawn
through the cable.

The first problem is that there are two different ways that the
distinction between DCP, CDP, ACA etc can be represented in Linux.  They
are cable types in the 'extcon' subsystem, and they are power_supply
types in the 'power_supply' subsystem.  This duplication is confusing.
It is not caused by your patch set, but I believe your patchset needs to
work with the duplication and I think it does so poorly.

In my mind, the power_supply should *not* know about this distinction at
all (except possibly as an advisor attribute simiarly to the current
battery technology attribute).  The other types it knows of are "AC",
"USB", and "BATTERY".  The contrast between these is quite different
From the contrast between DCP, CDP, ACA, which, from the perspective of
the power supply, are almost irrelevant.  Your patchset effectively
examines the power_supply_type of one power_supply, and communicates it
to another.  It isn't clear to me how the first power_supply gets the
information, or what the relationship between the two power_supplies is
meant to be.

It makes much more sense, to me, to utilized the knowledge of this
distinction that extcon provides.  A usb PHY can register an extcon,
declare the sorts of cables that it can detect, and tell the extcon as
cables appear or disappear.  The PMIC power_supply can then register with
that extcon for events and can find out when a cable is attached, and
what sort of cable.
Your usb-charging framework would be well placed to help the
power_supply to find the correct extcon, and possibly even to handle the
registration for events.

Your framework does currently register with extcon, but only listens for
EXTCON_USB cables.  I don't think that cable type is (reliably) reported
when a DCP (for example) is plugged in.

Here there is another problem that is not of your making, but still
needs fixing.  Extcon declares a number of cable types like:

/* USB external connector */
#define EXTCON_USB  1
#define EXTCON_USB_HOST 2

/* Charging external connector */
#define EXTCON_CHG_USB_SDP  5   /* Standard Downstream Port */
#define EXTCON_CHG_USB_DCP  6   /* Dedicated Charging Port */
#define EXTCON_CHG_USB_CDP  7   /* Charging Downstream Port */
#define EXTCON_CHG_USB_ACA  8   /* Accessory Charger Adapter */
#define EXTCON_CHG_USB_FAST 9
#define EXTCON_CHG_USB_SLOW 10

However it doesn't define what those mean, so we are left to guess.
They each correspond to bits in a bitmap, so a cable can have multiple types.
I think the best interpretation is that:

 EXTCON_USB means that the cable carries USB data from a host.
 EXTCON_USB_HOST means that that cable carries USB data to a host.
 EXTCON_CHG_* means that power is available as described in the
 standards.
 (what EXTCON_CHG_USB_FAST and EXTCON_CHG_USB_SLOW mean is not at all
 clear).

There is some support for this in the code, but it is not universally
acknowledged.  For a USB charging framework to be genuinely useful, it
must (I think) make sure this issue gets clarified, and the various
cable types used properly.

Once the 

RE: linux-next: manual merge of the char-misc tree with the net-next tree

2016-09-05 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:g...@kroah.com]
> Sent: Monday, September 5, 2016 5:04 PM
> To: Stephen Rothwell 
> Cc: Arnd Bergmann ; David Miller ;
> Networking ; linux-n...@vger.kernel.org; linux-
> ker...@vger.kernel.org; Stephen Hemminger ;
> Vitaly Kuznetsov ; KY Srinivasan 
> Subject: Re: linux-next: manual merge of the char-misc tree with the net-next
> tree
> 
> On Mon, Sep 05, 2016 at 04:56:50PM +1000, Stephen Rothwell wrote:
> > Hi all,
> >
> > Today's linux-next merge of the char-misc tree got a conflict in:
> >
> >   include/linux/hyperv.h
> >
> > between commit:
> >
> >   30d1de08c87d ("hv_netvsc: make inline functions static")
> >
> > from the net-next tree and commit:
> >
> >   bb08d431a914 ("Drivers: hv: ring_buffer: count on wrap around mappings in
> get_next_pkt_raw()")
> >
> > from the char-misc tree.
> >
> > I fixed it up (the former moved the code modified by the latter, so the
> > below patch applies to the new location of the code) and can carry the
> > fix as necessary. This is now fixed as far as linux-next is concerned,
> > but any non trivial conflicts should be mentioned to your upstream
> > maintainer when your tree is submitted for merging.  You may also want
> > to consider cooperating with the maintainer of the conflicting tree to
> > minimise any particularly complex conflicts.
> >
> > From: Stephen Rothwell 
> > Date: Mon, 5 Sep 2016 16:53:06 +1000
> > Subject: [PATCH] Drivers: hv: ring_buffer: merge fix up for "hv_netvsc: make
> >  inline functions static"
> >
> > Signed-off-by: Stephen Rothwell 
> > ---
> >  drivers/net/hyperv/netvsc.c | 32 +++-
> >  1 file changed, 11 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> > index 2a9ccc4d9e3c..026df6556068 100644
> > --- a/drivers/net/hyperv/netvsc.c
> > +++ b/drivers/net/hyperv/netvsc.c
> > @@ -42,31 +42,23 @@ static struct vmpacket_descriptor *
> >  get_next_pkt_raw(struct vmbus_channel *channel)
> >  {
> > struct hv_ring_buffer_info *ring_info = >inbound;
> > -   u32 read_loc = ring_info->priv_read_index;
> > +   u32 priv_read_loc = ring_info->priv_read_index;
> > void *ring_buffer = hv_get_ring_buffer(ring_info);
> > -   struct vmpacket_descriptor *cur_desc;
> > -   u32 packetlen;
> > u32 dsize = ring_info->ring_datasize;
> > -   u32 delta = read_loc - ring_info->ring_buffer->read_index;
> > +   /*
> > +* delta is the difference between what is available to read and
> > +* what was already consumed in place. We commit read index after
> > +* the whole batch is processed.
> > +*/
> > +   u32 delta = priv_read_loc >= ring_info->ring_buffer->read_index ?
> > +   priv_read_loc - ring_info->ring_buffer->read_index :
> > +   (dsize - ring_info->ring_buffer->read_index) + priv_read_loc;
> > u32 bytes_avail_toread = (hv_get_bytes_to_read(ring_info) - delta);
> >
> > if (bytes_avail_toread < sizeof(struct vmpacket_descriptor))
> > return NULL;
> >
> > -   if ((read_loc + sizeof(*cur_desc)) > dsize)
> > -   return NULL;
> > -
> > -   cur_desc = ring_buffer + read_loc;
> > -   packetlen = cur_desc->len8 << 3;
> > -
> > -   /*
> > -* If the packet under consideration is wrapping around,
> > -* return failure.
> > -*/
> > -   if ((read_loc + packetlen + VMBUS_PKT_TRAILER) > (dsize - 1))
> > -   return NULL;
> > -
> > -   return cur_desc;
> > +   return ring_buffer + priv_read_loc;
> >  }
> >
> >  /*
> > @@ -78,16 +70,14 @@ static void put_pkt_raw(struct vmbus_channel
> *channel,
> > struct vmpacket_descriptor *desc)
> >  {
> > struct hv_ring_buffer_info *ring_info = >inbound;
> > -   u32 read_loc = ring_info->priv_read_index;
> > u32 packetlen = desc->len8 << 3;
> > u32 dsize = ring_info->ring_datasize;
> >
> > -   BUG_ON((read_loc + packetlen + VMBUS_PKT_TRAILER) > dsize);
> > -
> > /*
> >  * Include the packet trailer.
> >  */
> > ring_info->priv_read_index += packetlen + VMBUS_PKT_TRAILER;
> > +   ring_info->priv_read_index %= dsize;
> >  }
> >
> >  /*
> 
> Ugh, messy.  Thanks for this.
> 
> KY, how did this happen?
Thanks Stephen. Greg, sorry about this. We should have split Vitaly's patch to 
avoid this inter-tree issue. Vitaly and I will work to fix this.

Regards,

K. Y 

> 
> greg k-h


RE: linux-next: manual merge of the char-misc tree with the net-next tree

2016-09-05 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:g...@kroah.com]
> Sent: Monday, September 5, 2016 5:04 PM
> To: Stephen Rothwell 
> Cc: Arnd Bergmann ; David Miller ;
> Networking ; linux-n...@vger.kernel.org; linux-
> ker...@vger.kernel.org; Stephen Hemminger ;
> Vitaly Kuznetsov ; KY Srinivasan 
> Subject: Re: linux-next: manual merge of the char-misc tree with the net-next
> tree
> 
> On Mon, Sep 05, 2016 at 04:56:50PM +1000, Stephen Rothwell wrote:
> > Hi all,
> >
> > Today's linux-next merge of the char-misc tree got a conflict in:
> >
> >   include/linux/hyperv.h
> >
> > between commit:
> >
> >   30d1de08c87d ("hv_netvsc: make inline functions static")
> >
> > from the net-next tree and commit:
> >
> >   bb08d431a914 ("Drivers: hv: ring_buffer: count on wrap around mappings in
> get_next_pkt_raw()")
> >
> > from the char-misc tree.
> >
> > I fixed it up (the former moved the code modified by the latter, so the
> > below patch applies to the new location of the code) and can carry the
> > fix as necessary. This is now fixed as far as linux-next is concerned,
> > but any non trivial conflicts should be mentioned to your upstream
> > maintainer when your tree is submitted for merging.  You may also want
> > to consider cooperating with the maintainer of the conflicting tree to
> > minimise any particularly complex conflicts.
> >
> > From: Stephen Rothwell 
> > Date: Mon, 5 Sep 2016 16:53:06 +1000
> > Subject: [PATCH] Drivers: hv: ring_buffer: merge fix up for "hv_netvsc: make
> >  inline functions static"
> >
> > Signed-off-by: Stephen Rothwell 
> > ---
> >  drivers/net/hyperv/netvsc.c | 32 +++-
> >  1 file changed, 11 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> > index 2a9ccc4d9e3c..026df6556068 100644
> > --- a/drivers/net/hyperv/netvsc.c
> > +++ b/drivers/net/hyperv/netvsc.c
> > @@ -42,31 +42,23 @@ static struct vmpacket_descriptor *
> >  get_next_pkt_raw(struct vmbus_channel *channel)
> >  {
> > struct hv_ring_buffer_info *ring_info = >inbound;
> > -   u32 read_loc = ring_info->priv_read_index;
> > +   u32 priv_read_loc = ring_info->priv_read_index;
> > void *ring_buffer = hv_get_ring_buffer(ring_info);
> > -   struct vmpacket_descriptor *cur_desc;
> > -   u32 packetlen;
> > u32 dsize = ring_info->ring_datasize;
> > -   u32 delta = read_loc - ring_info->ring_buffer->read_index;
> > +   /*
> > +* delta is the difference between what is available to read and
> > +* what was already consumed in place. We commit read index after
> > +* the whole batch is processed.
> > +*/
> > +   u32 delta = priv_read_loc >= ring_info->ring_buffer->read_index ?
> > +   priv_read_loc - ring_info->ring_buffer->read_index :
> > +   (dsize - ring_info->ring_buffer->read_index) + priv_read_loc;
> > u32 bytes_avail_toread = (hv_get_bytes_to_read(ring_info) - delta);
> >
> > if (bytes_avail_toread < sizeof(struct vmpacket_descriptor))
> > return NULL;
> >
> > -   if ((read_loc + sizeof(*cur_desc)) > dsize)
> > -   return NULL;
> > -
> > -   cur_desc = ring_buffer + read_loc;
> > -   packetlen = cur_desc->len8 << 3;
> > -
> > -   /*
> > -* If the packet under consideration is wrapping around,
> > -* return failure.
> > -*/
> > -   if ((read_loc + packetlen + VMBUS_PKT_TRAILER) > (dsize - 1))
> > -   return NULL;
> > -
> > -   return cur_desc;
> > +   return ring_buffer + priv_read_loc;
> >  }
> >
> >  /*
> > @@ -78,16 +70,14 @@ static void put_pkt_raw(struct vmbus_channel
> *channel,
> > struct vmpacket_descriptor *desc)
> >  {
> > struct hv_ring_buffer_info *ring_info = >inbound;
> > -   u32 read_loc = ring_info->priv_read_index;
> > u32 packetlen = desc->len8 << 3;
> > u32 dsize = ring_info->ring_datasize;
> >
> > -   BUG_ON((read_loc + packetlen + VMBUS_PKT_TRAILER) > dsize);
> > -
> > /*
> >  * Include the packet trailer.
> >  */
> > ring_info->priv_read_index += packetlen + VMBUS_PKT_TRAILER;
> > +   ring_info->priv_read_index %= dsize;
> >  }
> >
> >  /*
> 
> Ugh, messy.  Thanks for this.
> 
> KY, how did this happen?
Thanks Stephen. Greg, sorry about this. We should have split Vitaly's patch to 
avoid this inter-tree issue. Vitaly and I will work to fix this.

Regards,

K. Y 

> 
> greg k-h


[PATCH V2 2/2] mm: Add sysfs interface to dump each node's zonelist information

2016-09-05 Thread Anshuman Khandual
Each individual node in the system has a ZONELIST_FALLBACK zonelist
and a ZONELIST_NOFALLBACK zonelist. These zonelists decide fallback
order of zones during memory allocations. Sometimes it helps to dump
these zonelists to see the priority order of various zones in them.

Particularly platforms which support memory hotplug into previously
non existing zones (at boot), this interface helps in visualizing
which all zonelists of the system at what priority level, the new
hot added memory ends up in. POWER is such a platform where all the
memory detected during boot time remains with ZONE_DMA for good but
then hot plug process can actually get new memory into ZONE_MOVABLE.
So having a way to get the snapshot of the zonelists on the system
after memory or node hot[un]plug is desirable. This change adds one
new sysfs interface (/sys/devices/system/memory/system_zone_details)
which will fetch and dump this information.

Example zonelist information from a KVM guest.

[NODE (0)]
ZONELIST_FALLBACK
(0) (node 0) (zone DMA c140c000)
(1) (node 1) (zone DMA c001)
(2) (node 2) (zone DMA c002)
(3) (node 3) (zone DMA c003)
ZONELIST_NOFALLBACK
(0) (node 0) (zone DMA c140c000)
[NODE (1)]
ZONELIST_FALLBACK
(0) (node 1) (zone DMA c001)
(1) (node 2) (zone DMA c002)
(2) (node 3) (zone DMA c003)
(3) (node 0) (zone DMA c140c000)
ZONELIST_NOFALLBACK
(0) (node 1) (zone DMA c001)
[NODE (2)]
ZONELIST_FALLBACK
(0) (node 2) (zone DMA c002)
(1) (node 3) (zone DMA c003)
(2) (node 0) (zone DMA c140c000)
(3) (node 1) (zone DMA c001)
ZONELIST_NOFALLBACK
(0) (node 2) (zone DMA c002)
[NODE (3)]
ZONELIST_FALLBACK
(0) (node 3) (zone DMA c003)
(1) (node 0) (zone DMA c140c000)
(2) (node 1) (zone DMA c001)
(3) (node 2) (zone DMA c002)
ZONELIST_NOFALLBACK
(0) (node 3) (zone DMA c003)

Signed-off-by: Anshuman Khandual 
---
Changes in V2:
- Added more details into the commit message
- Added sysfs interface file details into the commit message
- Added ../ABI/testing/sysfs-system-zone-details file

 .../ABI/testing/sysfs-system-zone-details  |  9 +
 drivers/base/memory.c  | 46 ++
 2 files changed, 55 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-system-zone-details

diff --git a/Documentation/ABI/testing/sysfs-system-zone-details 
b/Documentation/ABI/testing/sysfs-system-zone-details
new file mode 100644
index 000..9c13b2e
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-system-zone-details
@@ -0,0 +1,9 @@
+What:  /sys/devices/system/memory/system_zone_details
+Date:  Sep 2016
+KernelVersion: 4.8
+Contact:   khand...@linux.vnet.ibm.com
+Description:
+   This read only file dumps the zonelist and it's constituent
+   zones information for both ZONELIST_FALLBACK and ZONELIST_
+   NOFALLBACK zonelists for each online node of the system at
+   any given point of time.
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index dc75de9..8c9330a 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -442,7 +442,52 @@ print_block_size(struct device *dev, struct 
device_attribute *attr,
return sprintf(buf, "%lx\n", get_memory_block_size());
 }
 
+static ssize_t dump_zonelist(char *buf, struct zonelist *zonelist)
+{
+   unsigned int i;
+   ssize_t count = 0;
+
+   for (i = 0; zonelist->_zonerefs[i].zone; i++) {
+   count += sprintf(buf + count,
+   "\t\t(%d) (node %d) (%-10s %lx)\n", i,
+   zonelist->_zonerefs[i].zone->zone_pgdat->node_id,
+   zone_names[zonelist->_zonerefs[i].zone_idx],
+   (unsigned long) zonelist->_zonerefs[i].zone);
+   }
+   return count;
+}
+
+static ssize_t dump_zonelists(char *buf)
+{
+   struct zonelist *zonelist;
+   unsigned int node;
+   ssize_t count = 0;
+
+   for_each_online_node(node) {
+   zonelist = &(NODE_DATA(node)->
+   node_zonelists[ZONELIST_FALLBACK]);
+   count += sprintf(buf + count, "[NODE (%d)]\n", node);
+   count += sprintf(buf + count, "\tZONELIST_FALLBACK\n");
+   count += dump_zonelist(buf + count, zonelist);
+
+   zonelist = &(NODE_DATA(node)->
+   node_zonelists[ZONELIST_NOFALLBACK]);
+   count += sprintf(buf + count, "\tZONELIST_NOFALLBACK\n");
+   count += dump_zonelist(buf + count, zonelist);
+   }
+ 

[PATCH V2 1/2] mm: Export definition of 'zone_names' array through mmzone.h

2016-09-05 Thread Anshuman Khandual
zone_names[] is used to identify any zone given it's index which
can be used in many other places. So exporting the definition
through include/linux/mmzone.h header for it's broader access.

Signed-off-by: Anshuman Khandual 
---
Changes in V2:
- Removed the static and declared in mmzone.h per Andrew

 include/linux/mmzone.h | 1 +
 mm/page_alloc.c| 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 7f2ae99..9943204 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -341,6 +341,7 @@ enum zone_type {
 
 };
 
+extern char * const zone_names[];
 #ifndef __GENERATING_BOUNDS_H
 
 struct zone {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a2214c6..cb46bf8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -207,7 +207,7 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
 
 EXPORT_SYMBOL(totalram_pages);
 
-static char * const zone_names[MAX_NR_ZONES] = {
+char * const zone_names[MAX_NR_ZONES] = {
 #ifdef CONFIG_ZONE_DMA
 "DMA",
 #endif
-- 
2.1.0



[PATCH V2 2/2] mm: Add sysfs interface to dump each node's zonelist information

2016-09-05 Thread Anshuman Khandual
Each individual node in the system has a ZONELIST_FALLBACK zonelist
and a ZONELIST_NOFALLBACK zonelist. These zonelists decide fallback
order of zones during memory allocations. Sometimes it helps to dump
these zonelists to see the priority order of various zones in them.

Particularly platforms which support memory hotplug into previously
non existing zones (at boot), this interface helps in visualizing
which all zonelists of the system at what priority level, the new
hot added memory ends up in. POWER is such a platform where all the
memory detected during boot time remains with ZONE_DMA for good but
then hot plug process can actually get new memory into ZONE_MOVABLE.
So having a way to get the snapshot of the zonelists on the system
after memory or node hot[un]plug is desirable. This change adds one
new sysfs interface (/sys/devices/system/memory/system_zone_details)
which will fetch and dump this information.

Example zonelist information from a KVM guest.

[NODE (0)]
ZONELIST_FALLBACK
(0) (node 0) (zone DMA c140c000)
(1) (node 1) (zone DMA c001)
(2) (node 2) (zone DMA c002)
(3) (node 3) (zone DMA c003)
ZONELIST_NOFALLBACK
(0) (node 0) (zone DMA c140c000)
[NODE (1)]
ZONELIST_FALLBACK
(0) (node 1) (zone DMA c001)
(1) (node 2) (zone DMA c002)
(2) (node 3) (zone DMA c003)
(3) (node 0) (zone DMA c140c000)
ZONELIST_NOFALLBACK
(0) (node 1) (zone DMA c001)
[NODE (2)]
ZONELIST_FALLBACK
(0) (node 2) (zone DMA c002)
(1) (node 3) (zone DMA c003)
(2) (node 0) (zone DMA c140c000)
(3) (node 1) (zone DMA c001)
ZONELIST_NOFALLBACK
(0) (node 2) (zone DMA c002)
[NODE (3)]
ZONELIST_FALLBACK
(0) (node 3) (zone DMA c003)
(1) (node 0) (zone DMA c140c000)
(2) (node 1) (zone DMA c001)
(3) (node 2) (zone DMA c002)
ZONELIST_NOFALLBACK
(0) (node 3) (zone DMA c003)

Signed-off-by: Anshuman Khandual 
---
Changes in V2:
- Added more details into the commit message
- Added sysfs interface file details into the commit message
- Added ../ABI/testing/sysfs-system-zone-details file

 .../ABI/testing/sysfs-system-zone-details  |  9 +
 drivers/base/memory.c  | 46 ++
 2 files changed, 55 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-system-zone-details

diff --git a/Documentation/ABI/testing/sysfs-system-zone-details 
b/Documentation/ABI/testing/sysfs-system-zone-details
new file mode 100644
index 000..9c13b2e
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-system-zone-details
@@ -0,0 +1,9 @@
+What:  /sys/devices/system/memory/system_zone_details
+Date:  Sep 2016
+KernelVersion: 4.8
+Contact:   khand...@linux.vnet.ibm.com
+Description:
+   This read only file dumps the zonelist and it's constituent
+   zones information for both ZONELIST_FALLBACK and ZONELIST_
+   NOFALLBACK zonelists for each online node of the system at
+   any given point of time.
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index dc75de9..8c9330a 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -442,7 +442,52 @@ print_block_size(struct device *dev, struct 
device_attribute *attr,
return sprintf(buf, "%lx\n", get_memory_block_size());
 }
 
+static ssize_t dump_zonelist(char *buf, struct zonelist *zonelist)
+{
+   unsigned int i;
+   ssize_t count = 0;
+
+   for (i = 0; zonelist->_zonerefs[i].zone; i++) {
+   count += sprintf(buf + count,
+   "\t\t(%d) (node %d) (%-10s %lx)\n", i,
+   zonelist->_zonerefs[i].zone->zone_pgdat->node_id,
+   zone_names[zonelist->_zonerefs[i].zone_idx],
+   (unsigned long) zonelist->_zonerefs[i].zone);
+   }
+   return count;
+}
+
+static ssize_t dump_zonelists(char *buf)
+{
+   struct zonelist *zonelist;
+   unsigned int node;
+   ssize_t count = 0;
+
+   for_each_online_node(node) {
+   zonelist = &(NODE_DATA(node)->
+   node_zonelists[ZONELIST_FALLBACK]);
+   count += sprintf(buf + count, "[NODE (%d)]\n", node);
+   count += sprintf(buf + count, "\tZONELIST_FALLBACK\n");
+   count += dump_zonelist(buf + count, zonelist);
+
+   zonelist = &(NODE_DATA(node)->
+   node_zonelists[ZONELIST_NOFALLBACK]);
+   count += sprintf(buf + count, "\tZONELIST_NOFALLBACK\n");
+   count += dump_zonelist(buf + count, zonelist);
+   }
+   return count;
+}
+

[PATCH V2 1/2] mm: Export definition of 'zone_names' array through mmzone.h

2016-09-05 Thread Anshuman Khandual
zone_names[] is used to identify any zone given it's index which
can be used in many other places. So exporting the definition
through include/linux/mmzone.h header for it's broader access.

Signed-off-by: Anshuman Khandual 
---
Changes in V2:
- Removed the static and declared in mmzone.h per Andrew

 include/linux/mmzone.h | 1 +
 mm/page_alloc.c| 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 7f2ae99..9943204 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -341,6 +341,7 @@ enum zone_type {
 
 };
 
+extern char * const zone_names[];
 #ifndef __GENERATING_BOUNDS_H
 
 struct zone {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a2214c6..cb46bf8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -207,7 +207,7 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
 
 EXPORT_SYMBOL(totalram_pages);
 
-static char * const zone_names[MAX_NR_ZONES] = {
+char * const zone_names[MAX_NR_ZONES] = {
 #ifdef CONFIG_ZONE_DMA
 "DMA",
 #endif
-- 
2.1.0



[PATCH] x86: Put the num_processors++ code in a more suitable position

2016-09-05 Thread Dou Liyang
This is a code optimization.

If checking the topology package map of apicid and cpu is failure,
it will stop generating the processor info for that apicid and the
disabled_cpus will plus one. However, the num-processors has already
been added one above. That may cause the number of processors incorrect.

Just put the num_processors++ code in the more suitable position.
it makes sure that the num-processors will not conflict with the
disabled_cpus.

Signed-off-by: Dou Liyang 
---
 arch/x86/kernel/apic/apic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 50c95af..f3e9b2d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version)
return -EINVAL;
}
 
-   num_processors++;
if (apicid == boot_cpu_physical_apicid) {
/*
 * x86_bios_cpu_apicid is required to have processors listed
@@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version)
 
pr_warning("APIC: Package limit reached. Processor %d/0x%x 
ignored.\n",
   thiscpu, apicid);
+
disabled_cpus++;
return -ENOSPC;
}
 
+   num_processors++;
+
/*
 * Validate version
 */
-- 
2.5.5





[PATCH] x86: Put the num_processors++ code in a more suitable position

2016-09-05 Thread Dou Liyang
This is a code optimization.

If checking the topology package map of apicid and cpu is failure,
it will stop generating the processor info for that apicid and the
disabled_cpus will plus one. However, the num-processors has already
been added one above. That may cause the number of processors incorrect.

Just put the num_processors++ code in the more suitable position.
it makes sure that the num-processors will not conflict with the
disabled_cpus.

Signed-off-by: Dou Liyang 
---
 arch/x86/kernel/apic/apic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 50c95af..f3e9b2d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version)
return -EINVAL;
}
 
-   num_processors++;
if (apicid == boot_cpu_physical_apicid) {
/*
 * x86_bios_cpu_apicid is required to have processors listed
@@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version)
 
pr_warning("APIC: Package limit reached. Processor %d/0x%x 
ignored.\n",
   thiscpu, apicid);
+
disabled_cpus++;
return -ENOSPC;
}
 
+   num_processors++;
+
/*
 * Validate version
 */
-- 
2.5.5





RE: [PATCH v2] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-05 Thread Zhao Lei
Hi, Sean Fu

> -Original Message-
> From: Sean Fu [mailto:fxinr...@gmail.com]
> Sent: Tuesday, September 06, 2016 11:51 AM
> To: dste...@suse.com
> Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com;
> zhao...@cn.fujitsu.com; linux-kernel@vger.kernel.org;
> linux-bt...@vger.kernel.org; Sean Fu 
> Subject: [PATCH v2] Btrfs: remove unnecessary code of chunk_root assignment
> in btrfs_read_chunk_tree.
> 
> The input argument root is already set with "fs_info->chunk_root".
> "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller
> "open_ctree".
> "root->fs_info = fs_info” in "btrfs_alloc_root".
> 
> Signed-off-by: Sean Fu 
> ---
> Changes in v2:
>   - Renaming root to chunk_root to make it clear.
> 
>  fs/btrfs/volumes.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 366b335..eb3d04a 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -6591,7 +6591,7 @@ out_short_read:
>   return -EIO;
>  }
> 
> -int btrfs_read_chunk_tree(struct btrfs_root *root)
> +int btrfs_read_chunk_tree(struct btrfs_root *chunk_root)

Maybe you also need to modify function body to make it
pass compile, and the header file also need to be modified.

BTW, Qu Wenruo give us a better way in reply, we
can use fs_info directly.

Thanks
Zhaolei

>  {
>   struct btrfs_path *path;
>   struct extent_buffer *leaf;
> @@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
>   int ret;
>   int slot;
> 
> - root = root->fs_info->chunk_root;
> -
>   path = btrfs_alloc_path();
>   if (!path)
>   return -ENOMEM;
> --
> 2.6.2
> 






RE: [PATCH v2] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-05 Thread Zhao Lei
Hi, Sean Fu

> -Original Message-
> From: Sean Fu [mailto:fxinr...@gmail.com]
> Sent: Tuesday, September 06, 2016 11:51 AM
> To: dste...@suse.com
> Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com;
> zhao...@cn.fujitsu.com; linux-kernel@vger.kernel.org;
> linux-bt...@vger.kernel.org; Sean Fu 
> Subject: [PATCH v2] Btrfs: remove unnecessary code of chunk_root assignment
> in btrfs_read_chunk_tree.
> 
> The input argument root is already set with "fs_info->chunk_root".
> "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller
> "open_ctree".
> "root->fs_info = fs_info” in "btrfs_alloc_root".
> 
> Signed-off-by: Sean Fu 
> ---
> Changes in v2:
>   - Renaming root to chunk_root to make it clear.
> 
>  fs/btrfs/volumes.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 366b335..eb3d04a 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -6591,7 +6591,7 @@ out_short_read:
>   return -EIO;
>  }
> 
> -int btrfs_read_chunk_tree(struct btrfs_root *root)
> +int btrfs_read_chunk_tree(struct btrfs_root *chunk_root)

Maybe you also need to modify function body to make it
pass compile, and the header file also need to be modified.

BTW, Qu Wenruo give us a better way in reply, we
can use fs_info directly.

Thanks
Zhaolei

>  {
>   struct btrfs_path *path;
>   struct extent_buffer *leaf;
> @@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
>   int ret;
>   int slot;
> 
> - root = root->fs_info->chunk_root;
> -
>   path = btrfs_alloc_path();
>   if (!path)
>   return -ENOMEM;
> --
> 2.6.2
> 






Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform

2016-09-05 Thread Kishon Vijay Abraham I
Hi,

On Sunday 04 September 2016 03:25 AM, Randy Li wrote:
> On the rk3288 USB host-only port (the one that's not the OTG-enabled
> port) the PHY can get into a bad state when a wakeup is asserted (not
> just a wakeup from full system suspend but also a wakeup from
> autosuspend).
> 
> We can get the PHY out of its bad state by asserting its "port reset",
> but unfortunately that seems to assert a reset onto the USB bus so it
> could confuse things if we don't actually deenumerate / reenumerate the
> device.
> 
> We can also get the PHY out of its bad state by fully resetting it using
> the reset from the CRU (clock reset unit) in chip, which does a more full
> reset.  The CRU-based reset appears to actually cause devices on the bus
> to be removed and reinserted, which fixes the problem (albeit in a hacky
> way).
> 
> It's unfortunate that we need to do a full re-enumeration of devices at
> wakeup time, but this is better than alternative of letting the bus get
> wedged.
> 
> Signed-off-by: Randy Li 
> ---
>  drivers/usb/dwc2/core_intr.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
> index d85c5c9..08485b7 100644
> --- a/drivers/usb/dwc2/core_intr.c
> +++ b/drivers/usb/dwc2/core_intr.c
> @@ -345,6 +345,7 @@ static void dwc2_handle_session_req_intr(struct 
> dwc2_hsotg *hsotg)
>  static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
>  {
>   int ret;
> + struct device_node *np = hsotg->dev->of_node;
>  
>   /* Clear interrupt */
>   dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
> @@ -379,6 +380,17 @@ static void dwc2_handle_wakeup_detected_intr(struct 
> dwc2_hsotg *hsotg)
>   /* Restart the Phy Clock */
>   pcgcctl &= ~PCGCTL_STOPPCLK;
>   dwc2_writel(pcgcctl, hsotg->regs + PCGCTL);
> +
> + /*
> +  * It is a quirk in Rockchip RK3288, causing by
> +  * a hardware bug. This will propagate out and
> +  * eventually we'll re-enumerate the device. 
> +  * Not great but the best we can do 
> +  */
> + if (of_device_is_compatible(np, "rockchip,rk3288-usb")
> + && (NULL != hsotg->phy->ops->reset))
> + hsotg->phy->ops->reset(hsotg->phy);

never call the phy ops directly from the controller driver. It has to be
protected as well.

Thanks
Kishon


Re: [PATCH v7 3/4] usb: dwc2: assert phy reset when waking up in rk3288 platform

2016-09-05 Thread Kishon Vijay Abraham I
Hi,

On Sunday 04 September 2016 03:25 AM, Randy Li wrote:
> On the rk3288 USB host-only port (the one that's not the OTG-enabled
> port) the PHY can get into a bad state when a wakeup is asserted (not
> just a wakeup from full system suspend but also a wakeup from
> autosuspend).
> 
> We can get the PHY out of its bad state by asserting its "port reset",
> but unfortunately that seems to assert a reset onto the USB bus so it
> could confuse things if we don't actually deenumerate / reenumerate the
> device.
> 
> We can also get the PHY out of its bad state by fully resetting it using
> the reset from the CRU (clock reset unit) in chip, which does a more full
> reset.  The CRU-based reset appears to actually cause devices on the bus
> to be removed and reinserted, which fixes the problem (albeit in a hacky
> way).
> 
> It's unfortunate that we need to do a full re-enumeration of devices at
> wakeup time, but this is better than alternative of letting the bus get
> wedged.
> 
> Signed-off-by: Randy Li 
> ---
>  drivers/usb/dwc2/core_intr.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
> index d85c5c9..08485b7 100644
> --- a/drivers/usb/dwc2/core_intr.c
> +++ b/drivers/usb/dwc2/core_intr.c
> @@ -345,6 +345,7 @@ static void dwc2_handle_session_req_intr(struct 
> dwc2_hsotg *hsotg)
>  static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
>  {
>   int ret;
> + struct device_node *np = hsotg->dev->of_node;
>  
>   /* Clear interrupt */
>   dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
> @@ -379,6 +380,17 @@ static void dwc2_handle_wakeup_detected_intr(struct 
> dwc2_hsotg *hsotg)
>   /* Restart the Phy Clock */
>   pcgcctl &= ~PCGCTL_STOPPCLK;
>   dwc2_writel(pcgcctl, hsotg->regs + PCGCTL);
> +
> + /*
> +  * It is a quirk in Rockchip RK3288, causing by
> +  * a hardware bug. This will propagate out and
> +  * eventually we'll re-enumerate the device. 
> +  * Not great but the best we can do 
> +  */
> + if (of_device_is_compatible(np, "rockchip,rk3288-usb")
> + && (NULL != hsotg->phy->ops->reset))
> + hsotg->phy->ops->reset(hsotg->phy);

never call the phy ops directly from the controller driver. It has to be
protected as well.

Thanks
Kishon


Re: [PATCH] leds: Introduce userspace leds driver

2016-09-05 Thread Peter Meerwald-Stadler
Hi,

> This driver creates a userspace leds driver similar to uinput.

is the module really called leds-user as claimed by Kconfig?
or rather uleds

p.

> New leds are created by opening /dev/uleds and writing a uleds_user_dev
> struct. A new leds class device is registered with the name given in the
> struct. Reading will return a single byte that is the current brightness.
> The poll() syscall is also supported. It will be triggered whenever the
> brightness changes.
> 
> Signed-off-by: David Lechner 
> ---
> 
> Here is a sample python program that I used to test that it works as expected.
> 
> #!/usr/bin/env python3
> 
> import select
> from threading import Timer
> 
> ULEDS_MAX_NAME_SIZE = 80
> 
> name = 'test'
> 
> 
> def change_brightness(b):
> with open('/sys/class/leds/{}/brightness'.format(name) , 'w') as f:
>f.write(str(b))
> 
> 
> with open('/dev/uleds', 'rb+', 0) as uleds:
> bname = name.encode("ascii")
> # create the leds class device
> uleds.write(bname + b'\0' * (ULEDS_MAX_NAME_SIZE - len(bname)))
> 
> # test that it works
> print(uleds.read(1))
> 
> # schedule some brighness changes at 1 second intervals
> Timer(1, change_brightness, (1,)).start()
> # this won't trigger poll since brighness does not change
> Timer(2, change_brightness, (1,)).start()
> Timer(3, change_brightness, (2,)).start()
> 
> # wait for the scheduled changes
> p = select.poll()
> p.register(uleds.fileno(), select.POLLIN)
> p.poll()
> print(uleds.read(1))
> p.poll()
> print(uleds.read(1))
> 
> 
> 
>  drivers/leds/Kconfig   |   8 ++
>  drivers/leds/Makefile  |   3 +
>  drivers/leds/uleds.c   | 224 
> +
>  include/uapi/linux/Kbuild  |   1 +
>  include/uapi/linux/uleds.h |  23 +
>  5 files changed, 259 insertions(+)
>  create mode 100644 drivers/leds/uleds.c
>  create mode 100644 include/uapi/linux/uleds.h
> 
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index 9dcc9b1..25c6168 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -631,6 +631,14 @@ config LEDS_VERSATILE
> This option enabled support for the LEDs on the ARM Versatile
> and RealView boards. Say Y to enabled these.
>  
> +config LEDS_USER
> + tristate "Userspace LED support"
> + depends on LEDS_CLASS
> + help
> +   This option enables support for userspace LEDs. Say 'y' to enable this
> +   support in kernel. To compile this driver as a module, choose 'm' 
> here:
> +   the module will be called leds-user.
> +
>  comment "LED Triggers"
>  source "drivers/leds/trigger/Kconfig"
>  
> diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
> index 0684c86..d723eeb 100644
> --- a/drivers/leds/Makefile
> +++ b/drivers/leds/Makefile
> @@ -72,5 +72,8 @@ obj-$(CONFIG_LEDS_IS31FL32XX)   += 
> leds-is31fl32xx.o
>  # LED SPI Drivers
>  obj-$(CONFIG_LEDS_DAC124S085)+= leds-dac124s085.o
>  
> +# LED Userspace Drivers
> +obj-$(CONFIG_LEDS_USER)  += uleds.o
> +
>  # LED Triggers
>  obj-$(CONFIG_LEDS_TRIGGERS)  += trigger/
> diff --git a/drivers/leds/uleds.c b/drivers/leds/uleds.c
> new file mode 100644
> index 000..992bca4
> --- /dev/null
> +++ b/drivers/leds/uleds.c
> @@ -0,0 +1,224 @@
> +/*
> + * Userspace driver for leds subsystem
> + *
> + * Copyright (C) 2016 David Lechner 
> + *
> + * Based on uinput.c: Aristeu Sergio Rozanski Filho 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#define ULEDS_NAME   "uleds"
> +
> +enum uleds_state {
> + ULEDS_STATE_UNKNOWN,
> + ULEDS_STATE_REGISTERED,
> +};
> +
> +struct uleds_device {
> + struct uleds_user_dev   user_dev;
> + struct led_classdev led_cdev;
> + struct mutexmutex;
> + enum uleds_statestate;
> + wait_queue_head_t   waitq;
> + unsigned char   brightness;
> + unsigned char   new_data;
> +};
> +
> +static void uleds_brightness_set(struct led_classdev *led_cdev,
> +  enum led_brightness brightness)
> +{
> + struct uleds_device *udev = container_of(led_cdev, struct uleds_device,
> +  led_cdev);
> +
> + if 

Re: [PATCH] leds: Introduce userspace leds driver

2016-09-05 Thread Peter Meerwald-Stadler
Hi,

> This driver creates a userspace leds driver similar to uinput.

is the module really called leds-user as claimed by Kconfig?
or rather uleds

p.

> New leds are created by opening /dev/uleds and writing a uleds_user_dev
> struct. A new leds class device is registered with the name given in the
> struct. Reading will return a single byte that is the current brightness.
> The poll() syscall is also supported. It will be triggered whenever the
> brightness changes.
> 
> Signed-off-by: David Lechner 
> ---
> 
> Here is a sample python program that I used to test that it works as expected.
> 
> #!/usr/bin/env python3
> 
> import select
> from threading import Timer
> 
> ULEDS_MAX_NAME_SIZE = 80
> 
> name = 'test'
> 
> 
> def change_brightness(b):
> with open('/sys/class/leds/{}/brightness'.format(name) , 'w') as f:
>f.write(str(b))
> 
> 
> with open('/dev/uleds', 'rb+', 0) as uleds:
> bname = name.encode("ascii")
> # create the leds class device
> uleds.write(bname + b'\0' * (ULEDS_MAX_NAME_SIZE - len(bname)))
> 
> # test that it works
> print(uleds.read(1))
> 
> # schedule some brighness changes at 1 second intervals
> Timer(1, change_brightness, (1,)).start()
> # this won't trigger poll since brighness does not change
> Timer(2, change_brightness, (1,)).start()
> Timer(3, change_brightness, (2,)).start()
> 
> # wait for the scheduled changes
> p = select.poll()
> p.register(uleds.fileno(), select.POLLIN)
> p.poll()
> print(uleds.read(1))
> p.poll()
> print(uleds.read(1))
> 
> 
> 
>  drivers/leds/Kconfig   |   8 ++
>  drivers/leds/Makefile  |   3 +
>  drivers/leds/uleds.c   | 224 
> +
>  include/uapi/linux/Kbuild  |   1 +
>  include/uapi/linux/uleds.h |  23 +
>  5 files changed, 259 insertions(+)
>  create mode 100644 drivers/leds/uleds.c
>  create mode 100644 include/uapi/linux/uleds.h
> 
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index 9dcc9b1..25c6168 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -631,6 +631,14 @@ config LEDS_VERSATILE
> This option enabled support for the LEDs on the ARM Versatile
> and RealView boards. Say Y to enabled these.
>  
> +config LEDS_USER
> + tristate "Userspace LED support"
> + depends on LEDS_CLASS
> + help
> +   This option enables support for userspace LEDs. Say 'y' to enable this
> +   support in kernel. To compile this driver as a module, choose 'm' 
> here:
> +   the module will be called leds-user.
> +
>  comment "LED Triggers"
>  source "drivers/leds/trigger/Kconfig"
>  
> diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
> index 0684c86..d723eeb 100644
> --- a/drivers/leds/Makefile
> +++ b/drivers/leds/Makefile
> @@ -72,5 +72,8 @@ obj-$(CONFIG_LEDS_IS31FL32XX)   += 
> leds-is31fl32xx.o
>  # LED SPI Drivers
>  obj-$(CONFIG_LEDS_DAC124S085)+= leds-dac124s085.o
>  
> +# LED Userspace Drivers
> +obj-$(CONFIG_LEDS_USER)  += uleds.o
> +
>  # LED Triggers
>  obj-$(CONFIG_LEDS_TRIGGERS)  += trigger/
> diff --git a/drivers/leds/uleds.c b/drivers/leds/uleds.c
> new file mode 100644
> index 000..992bca4
> --- /dev/null
> +++ b/drivers/leds/uleds.c
> @@ -0,0 +1,224 @@
> +/*
> + * Userspace driver for leds subsystem
> + *
> + * Copyright (C) 2016 David Lechner 
> + *
> + * Based on uinput.c: Aristeu Sergio Rozanski Filho 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#define ULEDS_NAME   "uleds"
> +
> +enum uleds_state {
> + ULEDS_STATE_UNKNOWN,
> + ULEDS_STATE_REGISTERED,
> +};
> +
> +struct uleds_device {
> + struct uleds_user_dev   user_dev;
> + struct led_classdev led_cdev;
> + struct mutexmutex;
> + enum uleds_statestate;
> + wait_queue_head_t   waitq;
> + unsigned char   brightness;
> + unsigned char   new_data;
> +};
> +
> +static void uleds_brightness_set(struct led_classdev *led_cdev,
> +  enum led_brightness brightness)
> +{
> + struct uleds_device *udev = container_of(led_cdev, struct uleds_device,
> +  led_cdev);
> +
> + if (udev->brightness != brightness) {
> + udev->brightness = 

[PATCH] sched/fair: Fix update_min_vruntime() to get proper min_vruntime

2016-09-05 Thread Byungchul Park
I am sorry for making you confused. The patch I posted one year ago,
Commit 97a7142 'sched/fair: Make update_min_vruntime() more readable',
has a bug, which you picked up.

Please add this patch to fix it, or combine these two patches into
one, or revert commit 97a7142. Whatever you want. Sorry.

Thank you,
Byungchul

-8<-
>From 295895be8befbab040d6054bb8186c03daabcedd Mon Sep 17 00:00:00 2001
From: Byungchul Park 
Date: Tue, 6 Sep 2016 12:22:26 +0900
Subject: [PATCH] sched/fair: Fix update_min_vruntime() to get proper
 min_vruntime

Commit 97a7142 'sched/fair: Make update_min_vruntime() more readable'
introduces a bug that cfs_rq gets a wrong min_vruntime if
!cfs_rq->rb_leftmost && cfs_rq->curr. This fixes it and makes it more
readable and simple.

Signed-off-by: Byungchul Park 
---
 kernel/sched/fair.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a6820b3..0a5f666b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -462,21 +462,20 @@ static inline int entity_before(struct sched_entity *a,
 
 static void update_min_vruntime(struct cfs_rq *cfs_rq)
 {
-   u64 vruntime = cfs_rq->min_vruntime;
-
-   if (cfs_rq->rb_leftmost) {
-   struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
-  struct sched_entity,
-  run_node);
+   u64 vruntime = U64_MAX;
 
-   vruntime = se->vruntime;
-   }
+   if (cfs_rq->rb_leftmost)
+   vruntime = rb_entry(cfs_rq->rb_leftmost,
+   struct sched_entity,
+   run_node)->vruntime;
 
if (cfs_rq->curr)
vruntime = min_vruntime(vruntime, cfs_rq->curr->vruntime);
 
/* ensure we never gain time by being placed backwards. */
-   cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
+   if (vruntime != U64_MAX)
+   cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, 
vruntime);
+
 #ifndef CONFIG_64BIT
smp_wmb();
cfs_rq->min_vruntime_copy = cfs_rq->min_vruntime;
-- 
1.9.1



[PATCH] sched/fair: Fix update_min_vruntime() to get proper min_vruntime

2016-09-05 Thread Byungchul Park
I am sorry for making you confused. The patch I posted one year ago,
Commit 97a7142 'sched/fair: Make update_min_vruntime() more readable',
has a bug, which you picked up.

Please add this patch to fix it, or combine these two patches into
one, or revert commit 97a7142. Whatever you want. Sorry.

Thank you,
Byungchul

-8<-
>From 295895be8befbab040d6054bb8186c03daabcedd Mon Sep 17 00:00:00 2001
From: Byungchul Park 
Date: Tue, 6 Sep 2016 12:22:26 +0900
Subject: [PATCH] sched/fair: Fix update_min_vruntime() to get proper
 min_vruntime

Commit 97a7142 'sched/fair: Make update_min_vruntime() more readable'
introduces a bug that cfs_rq gets a wrong min_vruntime if
!cfs_rq->rb_leftmost && cfs_rq->curr. This fixes it and makes it more
readable and simple.

Signed-off-by: Byungchul Park 
---
 kernel/sched/fair.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a6820b3..0a5f666b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -462,21 +462,20 @@ static inline int entity_before(struct sched_entity *a,
 
 static void update_min_vruntime(struct cfs_rq *cfs_rq)
 {
-   u64 vruntime = cfs_rq->min_vruntime;
-
-   if (cfs_rq->rb_leftmost) {
-   struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
-  struct sched_entity,
-  run_node);
+   u64 vruntime = U64_MAX;
 
-   vruntime = se->vruntime;
-   }
+   if (cfs_rq->rb_leftmost)
+   vruntime = rb_entry(cfs_rq->rb_leftmost,
+   struct sched_entity,
+   run_node)->vruntime;
 
if (cfs_rq->curr)
vruntime = min_vruntime(vruntime, cfs_rq->curr->vruntime);
 
/* ensure we never gain time by being placed backwards. */
-   cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
+   if (vruntime != U64_MAX)
+   cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, 
vruntime);
+
 #ifndef CONFIG_64BIT
smp_wmb();
cfs_rq->min_vruntime_copy = cfs_rq->min_vruntime;
-- 
1.9.1



[PATCH v2 0/3] perf report: Recognize hugetlb mapping as anon mapping

2016-09-05 Thread Wang Nan
The requirement of this function is first proposed at 2015.
Please refer to

http://lkml.iu.edu/hypermail/linux/kernel/1506.2/02372.html
http://lkml.iu.edu/hypermail/linux/kernel/1506.3/02290.html
http://lkml.iu.edu/hypermail/linux/kernel/1506.3/03512.html

For systems which use hugetlbfs, if a sample is captured inside
hugetlbfs, perf should not resolve symbols from the file shown in
/prof//mmap, because 'files' in hugetlbfs are constructed
during execution and not ELF files. If user knows positions of
symbols, he/she should provide /tmp/perf-.map file.

This 3 patches makes perf recognize hugetlbfs mapping as anon mapping.
Before this 3 patches user has no chance to use his/her own .map file
to resolve symbols because perf tries to use hugetlbfs file.

v1 -> v2: Fix building when MAP_HUGETLB is missing.
  Note that simply define a MAP_HUGETLB not work because
  its value depend on arch. This patch v2 disable this
  'hugetlbfs as as anon mapping' feature if it is built
  in very old system.

Wang Nan (3):
  perf tools: Recognize hugetlb mapping as anon mapping
  tools lib api fs: Add hugetlbfs filesystem detector
  perf record: Mark MAP_HUGETLB during synthesizing mmap events

 tools/lib/api/fs/fs.c   | 15 +++
 tools/lib/api/fs/fs.h   |  1 +
 tools/perf/util/event.c | 11 +++
 tools/perf/util/map.c   | 13 ++---
 4 files changed, 37 insertions(+), 3 deletions(-)

Signed-off-by: Wang Nan 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
Cc: Nilay Vaish 

-- 
1.8.3.4



[PATCH v2 1/3] perf tools: Recognize hugetlb mapping as anon mapping

2016-09-05 Thread Wang Nan
Hugetlbfs mapping should be recognized as anon mapping so user has
a chance to create /tmp/perf-.map file for symbol resolving. This
patch utilizes MAP_HUGETLB to identify hugetlb mapping.

After this patch, if perf is started before the program starts using
huge pages (so perf gets MMAP2 events from kernel), perf is able to
recognize hugetlb mapping as anon mapping.

Signed-off-by: Wang Nan 
Signed-off-by: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
Cc: Nilay Vaish 
---
 tools/perf/util/map.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 728129a..f52d460 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "map.h"
 #include "thread.h"
 #include "strlist.h"
@@ -24,9 +25,15 @@ const char *map_type__name[MAP__NR_TYPES] = {
[MAP__VARIABLE] = "Variables",
 };
 
-static inline int is_anon_memory(const char *filename)
+static inline int is_anon_memory(const char *filename, u32 flags)
 {
-   return !strcmp(filename, "//anon") ||
+   u32 anon_flags = 0;
+
+#ifdef MAP_HUGETLB
+   anon_flags |= MAP_HUGETLB;
+#endif
+   return flags & anon_flags ||
+  !strcmp(filename, "//anon") ||
   !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) ||
   !strncmp(filename, "/anon_hugepage", sizeof("/anon_hugepage") - 
1);
 }
@@ -155,7 +162,7 @@ struct map *map__new(struct machine *machine, u64 start, 
u64 len,
int anon, no_dso, vdso, android;
 
android = is_android_lib(filename);
-   anon = is_anon_memory(filename);
+   anon = is_anon_memory(filename, flags);
vdso = is_vdso_map(filename);
no_dso = is_no_dso_memory(filename);
 
-- 
1.8.3.4



[PATCH v2 1/3] perf tools: Recognize hugetlb mapping as anon mapping

2016-09-05 Thread Wang Nan
Hugetlbfs mapping should be recognized as anon mapping so user has
a chance to create /tmp/perf-.map file for symbol resolving. This
patch utilizes MAP_HUGETLB to identify hugetlb mapping.

After this patch, if perf is started before the program starts using
huge pages (so perf gets MMAP2 events from kernel), perf is able to
recognize hugetlb mapping as anon mapping.

Signed-off-by: Wang Nan 
Signed-off-by: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
Cc: Nilay Vaish 
---
 tools/perf/util/map.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 728129a..f52d460 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "map.h"
 #include "thread.h"
 #include "strlist.h"
@@ -24,9 +25,15 @@ const char *map_type__name[MAP__NR_TYPES] = {
[MAP__VARIABLE] = "Variables",
 };
 
-static inline int is_anon_memory(const char *filename)
+static inline int is_anon_memory(const char *filename, u32 flags)
 {
-   return !strcmp(filename, "//anon") ||
+   u32 anon_flags = 0;
+
+#ifdef MAP_HUGETLB
+   anon_flags |= MAP_HUGETLB;
+#endif
+   return flags & anon_flags ||
+  !strcmp(filename, "//anon") ||
   !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) ||
   !strncmp(filename, "/anon_hugepage", sizeof("/anon_hugepage") - 
1);
 }
@@ -155,7 +162,7 @@ struct map *map__new(struct machine *machine, u64 start, 
u64 len,
int anon, no_dso, vdso, android;
 
android = is_android_lib(filename);
-   anon = is_anon_memory(filename);
+   anon = is_anon_memory(filename, flags);
vdso = is_vdso_map(filename);
no_dso = is_no_dso_memory(filename);
 
-- 
1.8.3.4



[PATCH v2 0/3] perf report: Recognize hugetlb mapping as anon mapping

2016-09-05 Thread Wang Nan
The requirement of this function is first proposed at 2015.
Please refer to

http://lkml.iu.edu/hypermail/linux/kernel/1506.2/02372.html
http://lkml.iu.edu/hypermail/linux/kernel/1506.3/02290.html
http://lkml.iu.edu/hypermail/linux/kernel/1506.3/03512.html

For systems which use hugetlbfs, if a sample is captured inside
hugetlbfs, perf should not resolve symbols from the file shown in
/prof//mmap, because 'files' in hugetlbfs are constructed
during execution and not ELF files. If user knows positions of
symbols, he/she should provide /tmp/perf-.map file.

This 3 patches makes perf recognize hugetlbfs mapping as anon mapping.
Before this 3 patches user has no chance to use his/her own .map file
to resolve symbols because perf tries to use hugetlbfs file.

v1 -> v2: Fix building when MAP_HUGETLB is missing.
  Note that simply define a MAP_HUGETLB not work because
  its value depend on arch. This patch v2 disable this
  'hugetlbfs as as anon mapping' feature if it is built
  in very old system.

Wang Nan (3):
  perf tools: Recognize hugetlb mapping as anon mapping
  tools lib api fs: Add hugetlbfs filesystem detector
  perf record: Mark MAP_HUGETLB during synthesizing mmap events

 tools/lib/api/fs/fs.c   | 15 +++
 tools/lib/api/fs/fs.h   |  1 +
 tools/perf/util/event.c | 11 +++
 tools/perf/util/map.c   | 13 ++---
 4 files changed, 37 insertions(+), 3 deletions(-)

Signed-off-by: Wang Nan 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
Cc: Nilay Vaish 

-- 
1.8.3.4



[PATCH v2 2/3] tools lib api fs: Add hugetlbfs filesystem detector

2016-09-05 Thread Wang Nan
Detect hugetlbfs. hugetlbfs__mountpoint() will be used during recording
to help recorder identifying hugetlb mmaps: which should be recognized
as anon mapping.

Signed-off-by: Wang Nan 
Reviewed-by: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/lib/api/fs/fs.c | 15 +++
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ba7094b..f99f49e4 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -34,6 +34,10 @@
 #define TRACEFS_MAGIC  0x74726163
 #endif
 
+#ifndef HUGETLBFS_MAGIC
+#define HUGETLBFS_MAGIC0x958458f6
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
@@ -67,6 +71,10 @@ static const char * const tracefs__known_mountpoints[] = {
0,
 };
 
+static const char * const hugetlbfs__known_mountpoints[] = {
+   0,
+};
+
 struct fs {
const char  *name;
const char * const  *mounts;
@@ -80,6 +88,7 @@ enum {
FS__PROCFS  = 1,
FS__DEBUGFS = 2,
FS__TRACEFS = 3,
+   FS__HUGETLBFS = 4,
 };
 
 #ifndef TRACEFS_MAGIC
@@ -107,6 +116,11 @@ static struct fs fs__entries[] = {
.mounts = tracefs__known_mountpoints,
.magic  = TRACEFS_MAGIC,
},
+   [FS__HUGETLBFS] = {
+   .name   = "hugetlbfs",
+   .mounts = hugetlbfs__known_mountpoints,
+   .magic  = HUGETLBFS_MAGIC,
+   },
 };
 
 static bool fs__read_mounts(struct fs *fs)
@@ -265,6 +279,7 @@ FS(sysfs,   FS__SYSFS);
 FS(procfs,  FS__PROCFS);
 FS(debugfs, FS__DEBUGFS);
 FS(tracefs, FS__TRACEFS);
+FS(hugetlbfs, FS__HUGETLBFS);
 
 int filename__read_int(const char *filename, int *value)
 {
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 16c9c2e..a63269f 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -21,6 +21,7 @@ FS(sysfs)
 FS(procfs)
 FS(debugfs)
 FS(tracefs)
+FS(hugetlbfs)
 
 #undef FS
 
-- 
1.8.3.4



[PATCH v2 3/3] perf record: Mark MAP_HUGETLB during synthesizing mmap events

2016-09-05 Thread Wang Nan
During synthesizing mmap events, add MAP_HUGETLB map flag if the
source of mapping is file in hugetlbfs.

After this patch, perf can identify hugetlb mapping even if perf
is started after the mapping of huge pages (like perf top).

Signed-off-by: Wang Nan 
Reviewed-by: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/perf/util/event.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index e20438b..23c3ebd 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 #include "event.h"
 #include "debug.h"
 #include "hist.h"
@@ -248,6 +249,10 @@ int perf_event__synthesize_mmap_events(struct perf_tool 
*tool,
bool truncation = false;
unsigned long long timeout = proc_map_timeout * 100ULL;
int rc = 0;
+#ifdef MAP_HUGETLB
+   const char *hugetlbfs_mnt = hugetlbfs__mountpoint();
+   int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0;
+#endif
 
if (machine__is_default_guest(machine))
return 0;
@@ -342,6 +347,12 @@ out:
 
if (!strcmp(execname, ""))
strcpy(execname, anonstr);
+#ifdef MAP_HUGETLB
+   if (!strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) {
+   strcpy(execname, anonstr);
+   event->mmap2.flags |= MAP_HUGETLB;
+   }
+#endif
 
size = strlen(execname) + 1;
memcpy(event->mmap2.filename, execname, size);
-- 
1.8.3.4



[PATCH v2 2/3] tools lib api fs: Add hugetlbfs filesystem detector

2016-09-05 Thread Wang Nan
Detect hugetlbfs. hugetlbfs__mountpoint() will be used during recording
to help recorder identifying hugetlb mmaps: which should be recognized
as anon mapping.

Signed-off-by: Wang Nan 
Reviewed-by: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/lib/api/fs/fs.c | 15 +++
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ba7094b..f99f49e4 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -34,6 +34,10 @@
 #define TRACEFS_MAGIC  0x74726163
 #endif
 
+#ifndef HUGETLBFS_MAGIC
+#define HUGETLBFS_MAGIC0x958458f6
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
@@ -67,6 +71,10 @@ static const char * const tracefs__known_mountpoints[] = {
0,
 };
 
+static const char * const hugetlbfs__known_mountpoints[] = {
+   0,
+};
+
 struct fs {
const char  *name;
const char * const  *mounts;
@@ -80,6 +88,7 @@ enum {
FS__PROCFS  = 1,
FS__DEBUGFS = 2,
FS__TRACEFS = 3,
+   FS__HUGETLBFS = 4,
 };
 
 #ifndef TRACEFS_MAGIC
@@ -107,6 +116,11 @@ static struct fs fs__entries[] = {
.mounts = tracefs__known_mountpoints,
.magic  = TRACEFS_MAGIC,
},
+   [FS__HUGETLBFS] = {
+   .name   = "hugetlbfs",
+   .mounts = hugetlbfs__known_mountpoints,
+   .magic  = HUGETLBFS_MAGIC,
+   },
 };
 
 static bool fs__read_mounts(struct fs *fs)
@@ -265,6 +279,7 @@ FS(sysfs,   FS__SYSFS);
 FS(procfs,  FS__PROCFS);
 FS(debugfs, FS__DEBUGFS);
 FS(tracefs, FS__TRACEFS);
+FS(hugetlbfs, FS__HUGETLBFS);
 
 int filename__read_int(const char *filename, int *value)
 {
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 16c9c2e..a63269f 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -21,6 +21,7 @@ FS(sysfs)
 FS(procfs)
 FS(debugfs)
 FS(tracefs)
+FS(hugetlbfs)
 
 #undef FS
 
-- 
1.8.3.4



[PATCH v2 3/3] perf record: Mark MAP_HUGETLB during synthesizing mmap events

2016-09-05 Thread Wang Nan
During synthesizing mmap events, add MAP_HUGETLB map flag if the
source of mapping is file in hugetlbfs.

After this patch, perf can identify hugetlb mapping even if perf
is started after the mapping of huge pages (like perf top).

Signed-off-by: Wang Nan 
Reviewed-by: Nilay Vaish 
Cc: Hou Pengyang 
Cc: He Kuang 
Cc: Arnaldo Carvalho de Melo 
---
 tools/perf/util/event.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index e20438b..23c3ebd 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 #include "event.h"
 #include "debug.h"
 #include "hist.h"
@@ -248,6 +249,10 @@ int perf_event__synthesize_mmap_events(struct perf_tool 
*tool,
bool truncation = false;
unsigned long long timeout = proc_map_timeout * 100ULL;
int rc = 0;
+#ifdef MAP_HUGETLB
+   const char *hugetlbfs_mnt = hugetlbfs__mountpoint();
+   int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0;
+#endif
 
if (machine__is_default_guest(machine))
return 0;
@@ -342,6 +347,12 @@ out:
 
if (!strcmp(execname, ""))
strcpy(execname, anonstr);
+#ifdef MAP_HUGETLB
+   if (!strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) {
+   strcpy(execname, anonstr);
+   event->mmap2.flags |= MAP_HUGETLB;
+   }
+#endif
 
size = strlen(execname) + 1;
memcpy(event->mmap2.filename, execname, size);
-- 
1.8.3.4



[PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver

2016-09-05 Thread Chris Zhong
This patch adds DP audio output support to the rk3300-gru machine
driver.

Signed-off-by: Chris Zhong 
hyc...@chromium.org, broo...@kernel.org
---

 .../bindings/sound/rockchip,rk3399-gru-sound.txt   | 13 +++---
 sound/soc/rockchip/rk3399_gru_sound.c  | 48 ++
 2 files changed, 55 insertions(+), 6 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt 
b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
index f19b6c8..222124b 100644
--- a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
@@ -1,15 +1,16 @@
-ROCKCHIP with MAX98357A/RT5514/DA7219 codecs on GRU boards
+ROCKCHIP with MAX98357A/RT5514/DA7219 codecs and DP via spdif on GRU boards
 
 Required properties:
 - compatible: "rockchip,rk3399-gru-sound"
-- rockchip,cpu: The phandle of the Rockchip I2S controller that's
-  connected to the codecs
-- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs
+- rockchip,cpu: The phandle of the Rockchip I2S controller controller that's
+  connected to the codecs, and the SPDIF controller that's connected to DP
+- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs and of the
+  DP encoder node
 
 Example:
 
 sound {
compatible = "rockchip,rk3399-gru-sound";
-   rockchip,cpu = <>;
-   rockchip,codec = <  >;
+   rockchip,cpu = < >;
+   rockchip,codec = <   _dp 1>;
 };
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c 
b/sound/soc/rockchip/rk3399_gru_sound.c
index 164b6da..50e5d9a 100644
--- a/sound/soc/rockchip/rk3399_gru_sound.c
+++ b/sound/soc/rockchip/rk3399_gru_sound.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -226,10 +227,30 @@ static struct snd_soc_ops rockchip_sound_da7219_ops = {
.hw_params = rockchip_sound_da7219_hw_params,
 };
 
+static struct snd_soc_jack cdn_dp_card_jack;
+
+static int cdn_dp_init(struct snd_soc_pcm_runtime *runtime)
+{
+   struct snd_soc_card *card = runtime->card;
+   struct snd_soc_codec *codec = runtime->codec;
+   int ret;
+
+   /* enable jack detection */
+   ret = snd_soc_card_jack_new(card, "DP Jack", SND_JACK_LINEOUT,
+   _dp_card_jack, NULL, 0);
+   if (ret) {
+   dev_err(card->dev, "Can't new DP Jack %d\n", ret);
+   return ret;
+   }
+
+   return hdmi_codec_set_jack_detect(codec, _dp_card_jack);
+}
+
 enum {
DAILINK_MAX98357A,
DAILINK_RT5514,
DAILINK_DA7219,
+   DAILINK_CDNDP,
DAILINK_RT5514_DSP,
 };
 
@@ -264,6 +285,14 @@ static struct snd_soc_dai_link rockchip_dailinks[] = {
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
},
+   [DAILINK_CDNDP] = {
+   .name = "DP",
+   .stream_name = "DP PCM",
+   .codec_dai_name = "spdif-hifi",
+   .init = cdn_dp_init,
+   .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+   SND_SOC_DAIFMT_CBS_CFS,
+   },
/* RT5514 DSP for voice wakeup via spi bus */
[DAILINK_RT5514_DSP] = {
.name = "RT5514 DSP",
@@ -334,6 +363,25 @@ static int rockchip_sound_probe(struct platform_device 
*pdev)
return -ENODEV;
}
 
+   cpu_node = of_parse_phandle(pdev->dev.of_node, "rockchip,cpu", 1);
+   if (!cpu_node) {
+   dev_err(>dev, "Property 'rockchip,cpu 1' missing or 
invalid\n");
+   return -EINVAL;
+   }
+
+   rockchip_dailinks[DAILINK_CDNDP].platform_of_node = cpu_node;
+   rockchip_dailinks[DAILINK_CDNDP].cpu_of_node = cpu_node;
+
+   rockchip_dailinks[DAILINK_CDNDP].codec_of_node =
+   of_parse_phandle(pdev->dev.of_node, "rockchip,codec",
+DAILINK_CDNDP);
+   if (!rockchip_dailinks[DAILINK_CDNDP].codec_of_node) {
+   dev_err(>dev,
+   "Property[%d] 'rockchip,codec' missing or invalid\n",
+   DAILINK_CDNDP);
+   return -EINVAL;
+   }
+
rockchip_dailinks[DAILINK_RT5514_DSP].cpu_name = 
kstrdup_const(dev_name(dev), GFP_KERNEL);
rockchip_dailinks[DAILINK_RT5514_DSP].cpu_dai_name = 
kstrdup_const(dev_name(dev), GFP_KERNEL);
rockchip_dailinks[DAILINK_RT5514_DSP].platform_name = 
kstrdup_const(dev_name(dev), GFP_KERNEL);
-- 
1.9.1



[PATCH 1/2] drm/rockchip: cdn-dp: support audio hot-plug

2016-09-05 Thread Chris Zhong
Issue hot-plug detection, EDID update, and ELD update notifications
from DP drivers.

Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c 
b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index 530b7ba..e0055a9 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -185,6 +186,7 @@ static int cdn_dp_connector_get_modes(struct drm_connector 
*connector)
drm_mode_connector_update_edid_property(connector,
edid);
drm_edid_to_eld(connector, edid);
+   hdmi_event_new_eld(dp->dev, connector->eld);
}
kfree(edid);
}
@@ -345,6 +347,7 @@ static void cdn_dp_encoder_enable(struct drm_encoder 
*encoder)
 
if (dp->dpms_mode != DRM_MODE_DPMS_ON)
cdn_dp_commit(encoder);
+   hdmi_event_connect(dp->dev);
 }
 
 static void cdn_dp_encoder_disable(struct drm_encoder *encoder)
@@ -352,6 +355,7 @@ static void cdn_dp_encoder_disable(struct drm_encoder 
*encoder)
struct cdn_dp_device *dp = encoder_to_dp(encoder);
 
dp->dpms_mode = DRM_MODE_DPMS_OFF;
+   hdmi_event_disconnect(dp->dev);
 }
 
 static int cdn_dp_encoder_atomic_check(struct drm_encoder *encoder,
-- 
1.9.1



[PATCH 0/2] Add DP dai-links to the rk3399-gru machine driver

2016-09-05 Thread Chris Zhong

Hi

This series patch is for the machine driver supporting for DP.

It base on the DP drvier patches[0] and hdmi-notify patches[1], they are both
in reviewing.

[0]
https://patchwork.kernel.org/patch/9315557/
https://patchwork.kernel.org/patch/9278077/

[1]
https://patchwork.kernel.org/patch/8887261/
https://patchwork.kernel.org/patch/8887251/


Chris Zhong (2):
  drm/rockchip: cdn-dp: support audio hot-plug
  ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver

 .../bindings/sound/rockchip,rk3399-gru-sound.txt   | 13 +++---
 drivers/gpu/drm/rockchip/cdn-dp-core.c |  4 ++
 sound/soc/rockchip/rk3399_gru_sound.c  | 48 ++
 3 files changed, 59 insertions(+), 6 deletions(-)

-- 
1.9.1



[PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver

2016-09-05 Thread Chris Zhong
This patch adds DP audio output support to the rk3300-gru machine
driver.

Signed-off-by: Chris Zhong 
hyc...@chromium.org, broo...@kernel.org
---

 .../bindings/sound/rockchip,rk3399-gru-sound.txt   | 13 +++---
 sound/soc/rockchip/rk3399_gru_sound.c  | 48 ++
 2 files changed, 55 insertions(+), 6 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt 
b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
index f19b6c8..222124b 100644
--- a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
@@ -1,15 +1,16 @@
-ROCKCHIP with MAX98357A/RT5514/DA7219 codecs on GRU boards
+ROCKCHIP with MAX98357A/RT5514/DA7219 codecs and DP via spdif on GRU boards
 
 Required properties:
 - compatible: "rockchip,rk3399-gru-sound"
-- rockchip,cpu: The phandle of the Rockchip I2S controller that's
-  connected to the codecs
-- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs
+- rockchip,cpu: The phandle of the Rockchip I2S controller controller that's
+  connected to the codecs, and the SPDIF controller that's connected to DP
+- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs and of the
+  DP encoder node
 
 Example:
 
 sound {
compatible = "rockchip,rk3399-gru-sound";
-   rockchip,cpu = <>;
-   rockchip,codec = <  >;
+   rockchip,cpu = < >;
+   rockchip,codec = <   _dp 1>;
 };
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c 
b/sound/soc/rockchip/rk3399_gru_sound.c
index 164b6da..50e5d9a 100644
--- a/sound/soc/rockchip/rk3399_gru_sound.c
+++ b/sound/soc/rockchip/rk3399_gru_sound.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -226,10 +227,30 @@ static struct snd_soc_ops rockchip_sound_da7219_ops = {
.hw_params = rockchip_sound_da7219_hw_params,
 };
 
+static struct snd_soc_jack cdn_dp_card_jack;
+
+static int cdn_dp_init(struct snd_soc_pcm_runtime *runtime)
+{
+   struct snd_soc_card *card = runtime->card;
+   struct snd_soc_codec *codec = runtime->codec;
+   int ret;
+
+   /* enable jack detection */
+   ret = snd_soc_card_jack_new(card, "DP Jack", SND_JACK_LINEOUT,
+   _dp_card_jack, NULL, 0);
+   if (ret) {
+   dev_err(card->dev, "Can't new DP Jack %d\n", ret);
+   return ret;
+   }
+
+   return hdmi_codec_set_jack_detect(codec, _dp_card_jack);
+}
+
 enum {
DAILINK_MAX98357A,
DAILINK_RT5514,
DAILINK_DA7219,
+   DAILINK_CDNDP,
DAILINK_RT5514_DSP,
 };
 
@@ -264,6 +285,14 @@ static struct snd_soc_dai_link rockchip_dailinks[] = {
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
},
+   [DAILINK_CDNDP] = {
+   .name = "DP",
+   .stream_name = "DP PCM",
+   .codec_dai_name = "spdif-hifi",
+   .init = cdn_dp_init,
+   .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+   SND_SOC_DAIFMT_CBS_CFS,
+   },
/* RT5514 DSP for voice wakeup via spi bus */
[DAILINK_RT5514_DSP] = {
.name = "RT5514 DSP",
@@ -334,6 +363,25 @@ static int rockchip_sound_probe(struct platform_device 
*pdev)
return -ENODEV;
}
 
+   cpu_node = of_parse_phandle(pdev->dev.of_node, "rockchip,cpu", 1);
+   if (!cpu_node) {
+   dev_err(>dev, "Property 'rockchip,cpu 1' missing or 
invalid\n");
+   return -EINVAL;
+   }
+
+   rockchip_dailinks[DAILINK_CDNDP].platform_of_node = cpu_node;
+   rockchip_dailinks[DAILINK_CDNDP].cpu_of_node = cpu_node;
+
+   rockchip_dailinks[DAILINK_CDNDP].codec_of_node =
+   of_parse_phandle(pdev->dev.of_node, "rockchip,codec",
+DAILINK_CDNDP);
+   if (!rockchip_dailinks[DAILINK_CDNDP].codec_of_node) {
+   dev_err(>dev,
+   "Property[%d] 'rockchip,codec' missing or invalid\n",
+   DAILINK_CDNDP);
+   return -EINVAL;
+   }
+
rockchip_dailinks[DAILINK_RT5514_DSP].cpu_name = 
kstrdup_const(dev_name(dev), GFP_KERNEL);
rockchip_dailinks[DAILINK_RT5514_DSP].cpu_dai_name = 
kstrdup_const(dev_name(dev), GFP_KERNEL);
rockchip_dailinks[DAILINK_RT5514_DSP].platform_name = 
kstrdup_const(dev_name(dev), GFP_KERNEL);
-- 
1.9.1



[PATCH 1/2] drm/rockchip: cdn-dp: support audio hot-plug

2016-09-05 Thread Chris Zhong
Issue hot-plug detection, EDID update, and ELD update notifications
from DP drivers.

Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c 
b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index 530b7ba..e0055a9 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -185,6 +186,7 @@ static int cdn_dp_connector_get_modes(struct drm_connector 
*connector)
drm_mode_connector_update_edid_property(connector,
edid);
drm_edid_to_eld(connector, edid);
+   hdmi_event_new_eld(dp->dev, connector->eld);
}
kfree(edid);
}
@@ -345,6 +347,7 @@ static void cdn_dp_encoder_enable(struct drm_encoder 
*encoder)
 
if (dp->dpms_mode != DRM_MODE_DPMS_ON)
cdn_dp_commit(encoder);
+   hdmi_event_connect(dp->dev);
 }
 
 static void cdn_dp_encoder_disable(struct drm_encoder *encoder)
@@ -352,6 +355,7 @@ static void cdn_dp_encoder_disable(struct drm_encoder 
*encoder)
struct cdn_dp_device *dp = encoder_to_dp(encoder);
 
dp->dpms_mode = DRM_MODE_DPMS_OFF;
+   hdmi_event_disconnect(dp->dev);
 }
 
 static int cdn_dp_encoder_atomic_check(struct drm_encoder *encoder,
-- 
1.9.1



[PATCH 0/2] Add DP dai-links to the rk3399-gru machine driver

2016-09-05 Thread Chris Zhong

Hi

This series patch is for the machine driver supporting for DP.

It base on the DP drvier patches[0] and hdmi-notify patches[1], they are both
in reviewing.

[0]
https://patchwork.kernel.org/patch/9315557/
https://patchwork.kernel.org/patch/9278077/

[1]
https://patchwork.kernel.org/patch/8887261/
https://patchwork.kernel.org/patch/8887251/


Chris Zhong (2):
  drm/rockchip: cdn-dp: support audio hot-plug
  ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver

 .../bindings/sound/rockchip,rk3399-gru-sound.txt   | 13 +++---
 drivers/gpu/drm/rockchip/cdn-dp-core.c |  4 ++
 sound/soc/rockchip/rk3399_gru_sound.c  | 48 ++
 3 files changed, 59 insertions(+), 6 deletions(-)

-- 
1.9.1



Re: [PATCH 0/7] perpcu rwsem, fs/locks and killing lglocks

2016-09-05 Thread Mike Galbraith
On Mon, 2016-09-05 at 21:40 +0200, Peter Zijlstra wrote:
> Hi all,
> 
> Here are some patches that I've been sitting on for far too long now.

Woohoo, goodbye to bad rubbish.

FWIW, I plugged these into 4.8-rt (motto: if it's gonna go boom
anywhere, it'll likely do so in rt), and am beating the living crap out
of hotplug in parallel with routine tree merges, builds, serving nfs
etc etc, and all seems just peachy.  (If anything bad happens, I'll
move to a generic tree before reporting 'course)

-Mike


Re: [PATCH 0/7] perpcu rwsem, fs/locks and killing lglocks

2016-09-05 Thread Mike Galbraith
On Mon, 2016-09-05 at 21:40 +0200, Peter Zijlstra wrote:
> Hi all,
> 
> Here are some patches that I've been sitting on for far too long now.

Woohoo, goodbye to bad rubbish.

FWIW, I plugged these into 4.8-rt (motto: if it's gonna go boom
anywhere, it'll likely do so in rt), and am beating the living crap out
of hotplug in parallel with routine tree merges, builds, serving nfs
etc etc, and all seems just peachy.  (If anything bad happens, I'll
move to a generic tree before reporting 'course)

-Mike


RE: [PATCH v10 5/5] drm/rockchip: Add dmc notifier in vop driver

2016-09-05 Thread MyungJoo Ham
> when in ddr frequency scaling process, vop can not do enable or
> disable operation, since in dcf we check vop clock to see whether
> vop work. If vop work, dcf do ddr frequency scaling when vop
> in vblank status, and we need to read vop register to check whether
> vop go into vblank status. If vop not work, dcf can do ddr frequency
> any time. So when do ddr frequency scaling, you disabled or enable
> vop, there may two bad thing happen: 1, the panel flicker(when vop from
> disable status change to enable). 2, kernel hang (when vop from enable
> status change to disable, dcf need to read vblank status, but if you disable
> vop clock, it can not get the status, it will lead soc dead) So we need
> register to devfreq notifier, and we can get the dmc status. Also, when
> there have two vop enabled, we need to disable dmc, since dcf only base
> on one vop vblank time, so the other panel will flicker when do ddr
> frequency scaling.
> 
> Signed-off-by: Lin Huang 
> Reviewed-by: Chanwoo Choi 


Acked-by: MyungJoo Ham 


The code looks fine, but I've just found that I cannot merge this
code as I am not handling drivers/gpu/drm.

Please try to merge this piece into drivers/gpu/drm tree.

For the other 4 piecies (1/5 to 4/5) I'm ok with them. I'm merging them now.


> ---
> Changes in v10:
> - None
> 
> Changes in v9:
> - None
> 
> Changes in v8:
> - None
> 
> Changes in v7:
> - None
> 
> Changes in v6:
> - fix a build error
> 
> Changes in v5:
> - improve some nits
> 
> Changes in v4:
> - register notifier to devfreq_register_notifier
> - use DEVFREQ_PRECHANGE and DEVFREQ_POSTCHANGE to get dmc status
> - when two vop enable, disable dmc
> - when two vop back to one vop, enable dmc
> 
> Changes in v3:
> - when do vop eanble/disable, dmc will wait until it finish
> 
> Changes in v2:
> - None
> 
> Changes in v1:
> - use wait_event instead usleep
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 116 
> 
>  1 file changed, 116 insertions(+)
> 


RE: [PATCH v10 5/5] drm/rockchip: Add dmc notifier in vop driver

2016-09-05 Thread MyungJoo Ham
> when in ddr frequency scaling process, vop can not do enable or
> disable operation, since in dcf we check vop clock to see whether
> vop work. If vop work, dcf do ddr frequency scaling when vop
> in vblank status, and we need to read vop register to check whether
> vop go into vblank status. If vop not work, dcf can do ddr frequency
> any time. So when do ddr frequency scaling, you disabled or enable
> vop, there may two bad thing happen: 1, the panel flicker(when vop from
> disable status change to enable). 2, kernel hang (when vop from enable
> status change to disable, dcf need to read vblank status, but if you disable
> vop clock, it can not get the status, it will lead soc dead) So we need
> register to devfreq notifier, and we can get the dmc status. Also, when
> there have two vop enabled, we need to disable dmc, since dcf only base
> on one vop vblank time, so the other panel will flicker when do ddr
> frequency scaling.
> 
> Signed-off-by: Lin Huang 
> Reviewed-by: Chanwoo Choi 


Acked-by: MyungJoo Ham 


The code looks fine, but I've just found that I cannot merge this
code as I am not handling drivers/gpu/drm.

Please try to merge this piece into drivers/gpu/drm tree.

For the other 4 piecies (1/5 to 4/5) I'm ok with them. I'm merging them now.


> ---
> Changes in v10:
> - None
> 
> Changes in v9:
> - None
> 
> Changes in v8:
> - None
> 
> Changes in v7:
> - None
> 
> Changes in v6:
> - fix a build error
> 
> Changes in v5:
> - improve some nits
> 
> Changes in v4:
> - register notifier to devfreq_register_notifier
> - use DEVFREQ_PRECHANGE and DEVFREQ_POSTCHANGE to get dmc status
> - when two vop enable, disable dmc
> - when two vop back to one vop, enable dmc
> 
> Changes in v3:
> - when do vop eanble/disable, dmc will wait until it finish
> 
> Changes in v2:
> - None
> 
> Changes in v1:
> - use wait_event instead usleep
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 116 
> 
>  1 file changed, 116 insertions(+)
> 


Re: [PATCH v2] ubifs: compress lines for immediate return

2016-09-05 Thread Heiko Schocher

Hello Richard,

Am 05.09.2016 um 15:32 schrieb Richard Weinberger:

On 05.09.2016 15:05, Heiko Schocher wrote:

@Richard: Should we just forget this patch?


Let's drop it for now.
It caused already a way more churn than a trivial style cleanup
patch should...


Yes! It was a too fast shoot ... sorry for the noise!

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


Re: [PATCH v2] ubifs: compress lines for immediate return

2016-09-05 Thread Heiko Schocher

Hello Richard,

Am 05.09.2016 um 15:32 schrieb Richard Weinberger:

On 05.09.2016 15:05, Heiko Schocher wrote:

@Richard: Should we just forget this patch?


Let's drop it for now.
It caused already a way more churn than a trivial style cleanup
patch should...


Yes! It was a too fast shoot ... sorry for the noise!

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


[v14.2 PATCH 5/5] drm/rockchip: cdn-dp: add cdn DP support for rk3399

2016-09-05 Thread Chris Zhong
Add support for cdn DP controller which is embedded in the rk3399
SoCs. The DP is compliant with DisplayPort Specification,
Version 1.3, This IP is compatible with the rockchip type-c PHY IP.
There is a uCPU in DP controller, it need a firmware to work,
please put the firmware file to /lib/firmware/rockchip/dptx.bin. The
uCPU in charge of aux communication and link training, the host use
mailbox to communicate with the ucpu.
The dclk pin_pol of vop must not be invert for DP.

Signed-off-by: Chris Zhong 
Reviewed-by: Sean Paul 
Acked-by: Mark Yao 

---

Changes in v14.2:
- Modify some grammatical errors
- remove the mutex around cdn_dp_audio_get_eld

Changes in v14.1:
- power on the power domain after clk_enable
- retry to read edid

Changes in v14:
- change super speed property name to EXTCON_PROP_USB_SS
- do a correct mode_valid check when bpc is 0

Changes in v13:
- support suspend/resume
- switch power domain dynamically
- re-training when hpd signal is triggered

Changes in v12:
- use EXTCON_PROP_USB_SUPERSPEED to replace EXTCON_USB_HOST

Changes in v11:
- add best_encoder back, since it required by drm_atomic_helper_check

Changes in v10:
- remove best_encoder ops
- support read sink count from DPCD
- control the grf_clk in DP

Changes in v9:
- do not need reset the phy before power_on
- add a orientation information for set_capability
- retry to read dpcd in 10 seconds

Changes in v8:
- optimization the err log

Changes in v7:
- support firmware standby when no dptx connection
- optimization the calculation of tu size and valid symbol

Changes in v6:
- add a port struct
- select SND_SOC_HDMI_CODEC
- force reset the phy when hpd detected

Changes in v5:
- alphabetical order
- do not use long, use u32 or u64
- return MODE_CLOCK_HIGH when requested > actual
- Optimized Coding Style
- add a formula to get better tu size and symbol value.
- modify according to Sean Paul's comments
- fixed the fw_wait always 0

Changes in v4:
- use phy framework to control DP phy
- support 2 phys

Changes in v3:
- use EXTCON_DISP_DP and EXTCON_DISP_DP_ALT cable to get dp port state.
- reset spdif before config it
- modify the firmware clk to 100Mhz
- retry load firmware if fw file is requested too early

Changes in v2:
- Alphabetic order
- remove excess error message
- use define clk_rate
- check all return value
- remove dev_set_name(dp->dev, "cdn-dp");
- use schedule_delayed_work
- remove never-called functions
- remove some unnecessary ()

Changes in v1:
- use extcon API
- use hdmi-codec for the DP Asoc
- do not initialize the "ret"
- printk a err log when drm_of_encoder_active_endpoint_id
- modify the dclk pin_pol to a single line

 drivers/gpu/drm/rockchip/Kconfig|   10 +
 drivers/gpu/drm/rockchip/Makefile   |1 +
 drivers/gpu/drm/rockchip/cdn-dp-core.c  | 1053 +++
 drivers/gpu/drm/rockchip/cdn-dp-core.h  |  106 +++
 drivers/gpu/drm/rockchip/cdn-dp-reg.c   |  961 
 drivers/gpu/drm/rockchip/cdn-dp-reg.h   |  482 
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   13 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h |9 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c |2 +
 9 files changed, 2634 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.h
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.h

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index d30bdc3..20aaafe 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -25,6 +25,16 @@ config ROCKCHIP_ANALOGIX_DP
  for the Analogix Core DP driver. If you want to enable DP
  on RK3288 based SoC, you should selet this option.
 
+config ROCKCHIP_CDN_DP
+tristate "Rockchip cdn DP"
+depends on DRM_ROCKCHIP
+   select SND_SOC_HDMI_CODEC if SND_SOC
+help
+ This selects support for Rockchip SoC specific extensions
+ for the cdn DP driver. If you want to enable Dp on
+ RK3399 based SoC, you should select this
+ option.
+
 config ROCKCHIP_DW_HDMI
 tristate "Rockchip specific extensions for Synopsys DW HDMI"
 depends on DRM_ROCKCHIP
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index 9746365..6a07809 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -7,6 +7,7 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
 
 obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
+obj-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
 obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
 obj-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
 

[v14.2 PATCH 5/5] drm/rockchip: cdn-dp: add cdn DP support for rk3399

2016-09-05 Thread Chris Zhong
Add support for cdn DP controller which is embedded in the rk3399
SoCs. The DP is compliant with DisplayPort Specification,
Version 1.3, This IP is compatible with the rockchip type-c PHY IP.
There is a uCPU in DP controller, it need a firmware to work,
please put the firmware file to /lib/firmware/rockchip/dptx.bin. The
uCPU in charge of aux communication and link training, the host use
mailbox to communicate with the ucpu.
The dclk pin_pol of vop must not be invert for DP.

Signed-off-by: Chris Zhong 
Reviewed-by: Sean Paul 
Acked-by: Mark Yao 

---

Changes in v14.2:
- Modify some grammatical errors
- remove the mutex around cdn_dp_audio_get_eld

Changes in v14.1:
- power on the power domain after clk_enable
- retry to read edid

Changes in v14:
- change super speed property name to EXTCON_PROP_USB_SS
- do a correct mode_valid check when bpc is 0

Changes in v13:
- support suspend/resume
- switch power domain dynamically
- re-training when hpd signal is triggered

Changes in v12:
- use EXTCON_PROP_USB_SUPERSPEED to replace EXTCON_USB_HOST

Changes in v11:
- add best_encoder back, since it required by drm_atomic_helper_check

Changes in v10:
- remove best_encoder ops
- support read sink count from DPCD
- control the grf_clk in DP

Changes in v9:
- do not need reset the phy before power_on
- add a orientation information for set_capability
- retry to read dpcd in 10 seconds

Changes in v8:
- optimization the err log

Changes in v7:
- support firmware standby when no dptx connection
- optimization the calculation of tu size and valid symbol

Changes in v6:
- add a port struct
- select SND_SOC_HDMI_CODEC
- force reset the phy when hpd detected

Changes in v5:
- alphabetical order
- do not use long, use u32 or u64
- return MODE_CLOCK_HIGH when requested > actual
- Optimized Coding Style
- add a formula to get better tu size and symbol value.
- modify according to Sean Paul's comments
- fixed the fw_wait always 0

Changes in v4:
- use phy framework to control DP phy
- support 2 phys

Changes in v3:
- use EXTCON_DISP_DP and EXTCON_DISP_DP_ALT cable to get dp port state.
- reset spdif before config it
- modify the firmware clk to 100Mhz
- retry load firmware if fw file is requested too early

Changes in v2:
- Alphabetic order
- remove excess error message
- use define clk_rate
- check all return value
- remove dev_set_name(dp->dev, "cdn-dp");
- use schedule_delayed_work
- remove never-called functions
- remove some unnecessary ()

Changes in v1:
- use extcon API
- use hdmi-codec for the DP Asoc
- do not initialize the "ret"
- printk a err log when drm_of_encoder_active_endpoint_id
- modify the dclk pin_pol to a single line

 drivers/gpu/drm/rockchip/Kconfig|   10 +
 drivers/gpu/drm/rockchip/Makefile   |1 +
 drivers/gpu/drm/rockchip/cdn-dp-core.c  | 1053 +++
 drivers/gpu/drm/rockchip/cdn-dp-core.h  |  106 +++
 drivers/gpu/drm/rockchip/cdn-dp-reg.c   |  961 
 drivers/gpu/drm/rockchip/cdn-dp-reg.h   |  482 
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   13 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h |9 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c |2 +
 9 files changed, 2634 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.h
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.h

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index d30bdc3..20aaafe 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -25,6 +25,16 @@ config ROCKCHIP_ANALOGIX_DP
  for the Analogix Core DP driver. If you want to enable DP
  on RK3288 based SoC, you should selet this option.
 
+config ROCKCHIP_CDN_DP
+tristate "Rockchip cdn DP"
+depends on DRM_ROCKCHIP
+   select SND_SOC_HDMI_CODEC if SND_SOC
+help
+ This selects support for Rockchip SoC specific extensions
+ for the cdn DP driver. If you want to enable Dp on
+ RK3399 based SoC, you should select this
+ option.
+
 config ROCKCHIP_DW_HDMI
 tristate "Rockchip specific extensions for Synopsys DW HDMI"
 depends on DRM_ROCKCHIP
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index 9746365..6a07809 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -7,6 +7,7 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
 
 obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
+obj-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
 obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
 obj-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
 obj-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
diff --git 

Re: [PATCH v4 2/3] mmc: core: Factor out the alignment of erase size

2016-09-05 Thread Andreas Mohr
On Tue, Sep 06, 2016 at 10:55:11AM +0800, Baolin Wang wrote:
> In order to clean up the mmc_erase() function and do some optimization
> for erase size alignment, factor out the guts of erase size alignment
> into mmc_align_erase_size() function.
> 
> Signed-off-by: Baolin Wang 
> Tested-by: Shawn Lin 
> ---
>  drivers/mmc/core/core.c |   60 
> +--
>  1 file changed, 37 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 7d7209d..5f93eef 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2202,6 +2202,37 @@ out:
>   return err;
>  }
>  
> +static unsigned int mmc_align_erase_size(struct mmc_card *card,
> +  unsigned int *from,
> +  unsigned int *to,
> +  unsigned int nr)
> +{
> + unsigned int from_new = *from, nr_new = nr, rem;
> +
> + rem = from_new % card->erase_size;
> + if (rem) {
> + rem = card->erase_size - rem;
> + from_new += rem;
> + if (nr_new > rem)
> + nr_new -= rem;
> + else
> + return 0;
> + }
> +
> + rem = nr_new % card->erase_size;
> + if (rem)
> + nr_new -= rem;
> +
> + if (nr_new == 0)
> + return 0;
> +
> + /* 'from' and 'to' are inclusive */
> + *to = from_new + nr_new - 1;
> + *from = from_new;
> +
> + return nr_new;
> +}
> +
>  /**
>   * mmc_erase - erase sectors.
>   * @card: card to erase
> @@ -2234,31 +2265,14 @@ int mmc_erase(struct mmc_card *card, unsigned int 
> from, unsigned int nr,
>   }
>  
>   if (arg == MMC_ERASE_ARG) {
> - rem = from % card->erase_size;
> - if (rem) {
> - rem = card->erase_size - rem;
> - from += rem;
> - if (nr > rem)
> - nr -= rem;
> - else
> - return 0;
> - }
> - rem = nr % card->erase_size;
> - if (rem)
> - nr -= rem;
> + nr = mmc_align_erase_size(card, , , nr);
> + if (nr == 0)
> + return 0;
> + } else {
> + /* 'from' and 'to' are inclusive */
> + to -= 1;
>   }
>  
> - if (nr == 0)
> - return 0;
> -
> - to = from + nr;
> -
> - if (to <= from)
> - return -EINVAL;

Hmm, this is swallowing -EINVAL behaviour
i.e., now possibly violating protocol?

(this may easily be ok - haven't done an extensive review -
but since the commit has that characteristic change,
the commit message should contain that detail)

Thanks for the cleanup work & HTH,

Andreas Mohr


Re: [PATCH v4 2/3] mmc: core: Factor out the alignment of erase size

2016-09-05 Thread Andreas Mohr
On Tue, Sep 06, 2016 at 10:55:11AM +0800, Baolin Wang wrote:
> In order to clean up the mmc_erase() function and do some optimization
> for erase size alignment, factor out the guts of erase size alignment
> into mmc_align_erase_size() function.
> 
> Signed-off-by: Baolin Wang 
> Tested-by: Shawn Lin 
> ---
>  drivers/mmc/core/core.c |   60 
> +--
>  1 file changed, 37 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 7d7209d..5f93eef 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2202,6 +2202,37 @@ out:
>   return err;
>  }
>  
> +static unsigned int mmc_align_erase_size(struct mmc_card *card,
> +  unsigned int *from,
> +  unsigned int *to,
> +  unsigned int nr)
> +{
> + unsigned int from_new = *from, nr_new = nr, rem;
> +
> + rem = from_new % card->erase_size;
> + if (rem) {
> + rem = card->erase_size - rem;
> + from_new += rem;
> + if (nr_new > rem)
> + nr_new -= rem;
> + else
> + return 0;
> + }
> +
> + rem = nr_new % card->erase_size;
> + if (rem)
> + nr_new -= rem;
> +
> + if (nr_new == 0)
> + return 0;
> +
> + /* 'from' and 'to' are inclusive */
> + *to = from_new + nr_new - 1;
> + *from = from_new;
> +
> + return nr_new;
> +}
> +
>  /**
>   * mmc_erase - erase sectors.
>   * @card: card to erase
> @@ -2234,31 +2265,14 @@ int mmc_erase(struct mmc_card *card, unsigned int 
> from, unsigned int nr,
>   }
>  
>   if (arg == MMC_ERASE_ARG) {
> - rem = from % card->erase_size;
> - if (rem) {
> - rem = card->erase_size - rem;
> - from += rem;
> - if (nr > rem)
> - nr -= rem;
> - else
> - return 0;
> - }
> - rem = nr % card->erase_size;
> - if (rem)
> - nr -= rem;
> + nr = mmc_align_erase_size(card, , , nr);
> + if (nr == 0)
> + return 0;
> + } else {
> + /* 'from' and 'to' are inclusive */
> + to -= 1;
>   }
>  
> - if (nr == 0)
> - return 0;
> -
> - to = from + nr;
> -
> - if (to <= from)
> - return -EINVAL;

Hmm, this is swallowing -EINVAL behaviour
i.e., now possibly violating protocol?

(this may easily be ok - haven't done an extensive review -
but since the commit has that characteristic change,
the commit message should contain that detail)

Thanks for the cleanup work & HTH,

Andreas Mohr


Re: [PATCH 01/13] perf/core: Add perf_arch_regs and mask to perf_regs structure

2016-09-05 Thread Madhavan Srinivasan



On Thursday 01 September 2016 12:56 PM, Peter Zijlstra wrote:

On Mon, Aug 29, 2016 at 02:30:46AM +0530, Madhavan Srinivasan wrote:

It's a perennial request from hardware folks to be able to
see the raw values of the pmu registers. Partly it's so that
they can verify perf is doing what they want, and some
of it is that they're interested in some of the more obscure
info that isn't plumbed out through other perf interfaces.

How much and what is that? Can't we try and get interfaces sorted?


We have bunch of registers which exports information regarding the
sampled instruction like SIER/SIAR/SDAR/MMCRA. Lot of bits in these
registers are not yet architected and incase of SIER register, some of
the bits are not plumbed out and we are working on getting some these
exposed via perf.




Over the years internally have used various hack to get
the requested data out but this is an attempt to use a
somewhat standard mechanism (using PERF_SAMPLE_REGS_INTR).

Not really liking that. It assumes too much and doesn't seem to cover
about half the perf use-cases.

It assumes the machine state can be captured by registers (this is false
for things like Intel DS/PT, which have state in memory), it might
assume <= 64 registers but I didn't look that closely, this too might
become somewhat restrictive.

Worse, it doesn't work for !sampling workloads, of which you also very
much want to verify programming etc.


Yes, I agree, my bad. I did assume and implemented considering
pmu registers primarily, but we can extend with additional flags
on the content being copied. Good point that patchset not handling
!sampling case. Let me explore on this and also the tracing options.

Thanks for the comments.
Maddy




This would also be helpful for those of us working on the perf
hardware backends, to be able to verify that we're programming
things correctly, without resorting to debug printks etc.

On x86 we can trace the MSR writes. No need to add debug printk()s.
We could (and I have on occasion) added tracepoints (well trace_printk)
to the Intel DS memory stores to see what was written there.

Tracing is much more flexible for debugging this stuff.

Can't you do something along those lines?





Re: [PATCH 01/13] perf/core: Add perf_arch_regs and mask to perf_regs structure

2016-09-05 Thread Madhavan Srinivasan



On Thursday 01 September 2016 12:56 PM, Peter Zijlstra wrote:

On Mon, Aug 29, 2016 at 02:30:46AM +0530, Madhavan Srinivasan wrote:

It's a perennial request from hardware folks to be able to
see the raw values of the pmu registers. Partly it's so that
they can verify perf is doing what they want, and some
of it is that they're interested in some of the more obscure
info that isn't plumbed out through other perf interfaces.

How much and what is that? Can't we try and get interfaces sorted?


We have bunch of registers which exports information regarding the
sampled instruction like SIER/SIAR/SDAR/MMCRA. Lot of bits in these
registers are not yet architected and incase of SIER register, some of
the bits are not plumbed out and we are working on getting some these
exposed via perf.




Over the years internally have used various hack to get
the requested data out but this is an attempt to use a
somewhat standard mechanism (using PERF_SAMPLE_REGS_INTR).

Not really liking that. It assumes too much and doesn't seem to cover
about half the perf use-cases.

It assumes the machine state can be captured by registers (this is false
for things like Intel DS/PT, which have state in memory), it might
assume <= 64 registers but I didn't look that closely, this too might
become somewhat restrictive.

Worse, it doesn't work for !sampling workloads, of which you also very
much want to verify programming etc.


Yes, I agree, my bad. I did assume and implemented considering
pmu registers primarily, but we can extend with additional flags
on the content being copied. Good point that patchset not handling
!sampling case. Let me explore on this and also the tracing options.

Thanks for the comments.
Maddy




This would also be helpful for those of us working on the perf
hardware backends, to be able to verify that we're programming
things correctly, without resorting to debug printks etc.

On x86 we can trace the MSR writes. No need to add debug printk()s.
We could (and I have on occasion) added tracepoints (well trace_printk)
to the Intel DS memory stores to see what was written there.

Tracing is much more flexible for debugging this stuff.

Can't you do something along those lines?





Partnership Cooperation

2016-09-05 Thread Hasher Al Maktoum
Dear Friend,

Your contact details came to me by recommendation, I am interested in investing 
in your country and I believe you have the capabilities of providing the needed 
assistance, solutions and advise in actualizing this, Let me know if you are 
willing to understake this task for me so we can discuss more. I hope to hear 
from you soon.

Regards,
Hasher Al Maktoum
Chairman/Chief Executive Officer
Dubai International Holding Company.


Partnership Cooperation

2016-09-05 Thread Hasher Al Maktoum
Dear Friend,

Your contact details came to me by recommendation, I am interested in investing 
in your country and I believe you have the capabilities of providing the needed 
assistance, solutions and advise in actualizing this, Let me know if you are 
willing to understake this task for me so we can discuss more. I hope to hear 
from you soon.

Regards,
Hasher Al Maktoum
Chairman/Chief Executive Officer
Dubai International Holding Company.


Re: [PATCH] phy: da8xx-usb: Fix syscon device name

2016-09-05 Thread Kishon Vijay Abraham I


On Tuesday 06 September 2016 01:15 AM, David Lechner wrote:
> The syscon device in board config/device tree has been renamed.
> 
> Signed-off-by: David Lechner 

merged, thanks.

-Kishon
> ---
> 
> This is a follow-up of the "da8xx USB PHY platform devices and clocks" patch
> series. Just a small but important detail that slipped through the cracks.
> 
>  drivers/phy/phy-da8xx-usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-da8xx-usb.c b/drivers/phy/phy-da8xx-usb.c
> index b2e59b6..32ae78c 100644
> --- a/drivers/phy/phy-da8xx-usb.c
> +++ b/drivers/phy/phy-da8xx-usb.c
> @@ -154,7 +154,7 @@ static int da8xx_usb_phy_probe(struct platform_device 
> *pdev)
>   d_phy->regmap = syscon_regmap_lookup_by_compatible(
>   "ti,da830-cfgchip");
>   else
> - d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon.0");
> + d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon");
>   if (IS_ERR(d_phy->regmap)) {
>   dev_err(dev, "Failed to get syscon\n");
>   return PTR_ERR(d_phy->regmap);
> 


Re: [PATCH] phy: da8xx-usb: Fix syscon device name

2016-09-05 Thread Kishon Vijay Abraham I


On Tuesday 06 September 2016 01:15 AM, David Lechner wrote:
> The syscon device in board config/device tree has been renamed.
> 
> Signed-off-by: David Lechner 

merged, thanks.

-Kishon
> ---
> 
> This is a follow-up of the "da8xx USB PHY platform devices and clocks" patch
> series. Just a small but important detail that slipped through the cracks.
> 
>  drivers/phy/phy-da8xx-usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-da8xx-usb.c b/drivers/phy/phy-da8xx-usb.c
> index b2e59b6..32ae78c 100644
> --- a/drivers/phy/phy-da8xx-usb.c
> +++ b/drivers/phy/phy-da8xx-usb.c
> @@ -154,7 +154,7 @@ static int da8xx_usb_phy_probe(struct platform_device 
> *pdev)
>   d_phy->regmap = syscon_regmap_lookup_by_compatible(
>   "ti,da830-cfgchip");
>   else
> - d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon.0");
> + d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon");
>   if (IS_ERR(d_phy->regmap)) {
>   dev_err(dev, "Failed to get syscon\n");
>   return PTR_ERR(d_phy->regmap);
> 


Re: [v14 PATCH 2/5] phy: Add USB Type-C PHY driver for rk3399

2016-09-05 Thread Kishon Vijay Abraham I


On Wednesday 24 August 2016 10:47 AM, Chris Zhong wrote:
> Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
> Type-C PHY is designed to support the USB3 and DP applications.
> The USB3 operates in SuperSpeed mode and the DP can operate at RBR,
> HBR and HBR2 data rates. This driver create 2 PHY devices separately
> for USB3 and DisplyPort, and registers them under the child node.
> 
> Signed-off-by: Chris Zhong 
> Signed-off-by: Kever Yang 
> Reviewed-by: Guenter Roeck 
> Tested-by: Guenter Roeck 

merged, thanks.

-Kishon
> 
> ---
> 
> Changes in v14:
> - change the name of property from super speed to EXTCON_PROP_USB_SS
> 
> Changes in v13:
> - add some description in front of driver
> - change name of usb to usb3
> - add a USB3 RX register configuration
> - do not return err if nothing connected with Type-C, when usb phy power on,
>   since the USB core driver will call phy power without USB3 device connected.
> 
> Changes in v12:
> - enable DP+USB3 mode, only when EXTCON_PROP_USB_SUPERSPEED equal 1
>   and DP is attached
> 
> Changes in v11:
> - make a clearer demarcation between usb phy and dp phy.
> 
> Changes in v10:
> - do not control dp select and hpd config in phy driver
> 
> Changes in v9:
> - the new_mode should be int not u8
> - move mutex_lock(>lock); to earlier place. in
>   rockchip_usb3_phy_power_off
> - better mutex lock for phy mode and flip
> - split the Type-C PHY into two PHYs: USB3 and DP
> 
> Changes in v8:
> - set the default cable id to EXTCON_USB_HOST
> - optimization Error log
> 
> Changes in v7:
> - support new API of extcon
> 
> Changes in v6:
> - delete the support of PIN_ASSIGN_A/B
> - set the default mode to MODE_DFP_USB
> - disable DP PLL at USB3 only mode
> 
> Changes in v5:
> - support get property from extcon
> - remove PIN ASSIGN A/B support
> 
> Changes in v4:
> - select EXTCON
> - use phy framework to control the USB3 and DP function
> - rename PIN_MAP_ to PIN_ASSIGN_
> 
> Changes in v3:
> - remove the phy framework(Kishon Vijay Abraham I)
> - add parentheses around the macro
> - use a single space between type and name
> - add spaces after opening and before closing braces.
> - use u16 for register value
> - remove type-c phy header file
> - CodingStyle optimization
> - use some cable extcon to get type-c port information
> - add a extcon to notify Display Port
> 
> Changes in v2:
> - select RESET_CONTROLLER
> - alphabetic order
> - modify some spelling mistakes
> - make mode cleaner
> - use bool for enable/disable
> - check all of the return value
> - return a better err number
> - use more readx_poll_timeout()
> - clk_disable_unprepare(tcphy->clk_ref);
> - remove unuse functions, rockchip_typec_phy_power_on/off
> - remove unnecessary typecast from void *
> - use dts node to distinguish between phys.
> 
> Changes in v1:
> - update the licence note
> - init core clock to 50MHz
> - use extcon API
> - remove unused global
> - add some comments for magic num
> - change usleep_range(1000, 2000) tousleep_range(1000, 1050)
> - remove __func__ from dev_err
> - return err number when get clk failed
> - remove ADDR_ADJ define
> - use devm_clk_get(>dev, "tcpdcore")
> 
>  drivers/phy/Kconfig  |9 +
>  drivers/phy/Makefile |1 +
>  drivers/phy/phy-rockchip-typec.c | 1013 
> ++
>  3 files changed, 1023 insertions(+)
>  create mode 100644 drivers/phy/phy-rockchip-typec.c
> 
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 42f3e30..c775fd7 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -348,6 +348,15 @@ config PHY_ROCKCHIP_PCIE
>   help
> Enable this to support the Rockchip PCIe PHY.
>  
> +config PHY_ROCKCHIP_TYPEC
> + tristate "Rockchip TYPEC PHY Driver"
> + depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
> + select EXTCON
> + select GENERIC_PHY
> + select RESET_CONTROLLER
> + help
> +   Enable this to support the Rockchip USB TYPEC PHY.
> +
>  config PHY_ST_SPEAR1310_MIPHY
>   tristate "ST SPEAR1310-MIPHY driver"
>   select GENERIC_PHY
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index fbb91e7..5d58b63 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -39,6 +39,7 @@ obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)+= 
> phy-rockchip-inno-usb2.o
>  obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o
>  obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o
>  obj-$(CONFIG_PHY_ROCKCHIP_DP)+= phy-rockchip-dp.o
> +obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o
>  obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)  += phy-qcom-ipq806x-sata.o
>  obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o
>  obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o
> diff --git a/drivers/phy/phy-rockchip-typec.c 
> b/drivers/phy/phy-rockchip-typec.c
> new file mode 100644
> 

Re: [v14 PATCH 2/5] phy: Add USB Type-C PHY driver for rk3399

2016-09-05 Thread Kishon Vijay Abraham I


On Wednesday 24 August 2016 10:47 AM, Chris Zhong wrote:
> Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
> Type-C PHY is designed to support the USB3 and DP applications.
> The USB3 operates in SuperSpeed mode and the DP can operate at RBR,
> HBR and HBR2 data rates. This driver create 2 PHY devices separately
> for USB3 and DisplyPort, and registers them under the child node.
> 
> Signed-off-by: Chris Zhong 
> Signed-off-by: Kever Yang 
> Reviewed-by: Guenter Roeck 
> Tested-by: Guenter Roeck 

merged, thanks.

-Kishon
> 
> ---
> 
> Changes in v14:
> - change the name of property from super speed to EXTCON_PROP_USB_SS
> 
> Changes in v13:
> - add some description in front of driver
> - change name of usb to usb3
> - add a USB3 RX register configuration
> - do not return err if nothing connected with Type-C, when usb phy power on,
>   since the USB core driver will call phy power without USB3 device connected.
> 
> Changes in v12:
> - enable DP+USB3 mode, only when EXTCON_PROP_USB_SUPERSPEED equal 1
>   and DP is attached
> 
> Changes in v11:
> - make a clearer demarcation between usb phy and dp phy.
> 
> Changes in v10:
> - do not control dp select and hpd config in phy driver
> 
> Changes in v9:
> - the new_mode should be int not u8
> - move mutex_lock(>lock); to earlier place. in
>   rockchip_usb3_phy_power_off
> - better mutex lock for phy mode and flip
> - split the Type-C PHY into two PHYs: USB3 and DP
> 
> Changes in v8:
> - set the default cable id to EXTCON_USB_HOST
> - optimization Error log
> 
> Changes in v7:
> - support new API of extcon
> 
> Changes in v6:
> - delete the support of PIN_ASSIGN_A/B
> - set the default mode to MODE_DFP_USB
> - disable DP PLL at USB3 only mode
> 
> Changes in v5:
> - support get property from extcon
> - remove PIN ASSIGN A/B support
> 
> Changes in v4:
> - select EXTCON
> - use phy framework to control the USB3 and DP function
> - rename PIN_MAP_ to PIN_ASSIGN_
> 
> Changes in v3:
> - remove the phy framework(Kishon Vijay Abraham I)
> - add parentheses around the macro
> - use a single space between type and name
> - add spaces after opening and before closing braces.
> - use u16 for register value
> - remove type-c phy header file
> - CodingStyle optimization
> - use some cable extcon to get type-c port information
> - add a extcon to notify Display Port
> 
> Changes in v2:
> - select RESET_CONTROLLER
> - alphabetic order
> - modify some spelling mistakes
> - make mode cleaner
> - use bool for enable/disable
> - check all of the return value
> - return a better err number
> - use more readx_poll_timeout()
> - clk_disable_unprepare(tcphy->clk_ref);
> - remove unuse functions, rockchip_typec_phy_power_on/off
> - remove unnecessary typecast from void *
> - use dts node to distinguish between phys.
> 
> Changes in v1:
> - update the licence note
> - init core clock to 50MHz
> - use extcon API
> - remove unused global
> - add some comments for magic num
> - change usleep_range(1000, 2000) tousleep_range(1000, 1050)
> - remove __func__ from dev_err
> - return err number when get clk failed
> - remove ADDR_ADJ define
> - use devm_clk_get(>dev, "tcpdcore")
> 
>  drivers/phy/Kconfig  |9 +
>  drivers/phy/Makefile |1 +
>  drivers/phy/phy-rockchip-typec.c | 1013 
> ++
>  3 files changed, 1023 insertions(+)
>  create mode 100644 drivers/phy/phy-rockchip-typec.c
> 
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 42f3e30..c775fd7 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -348,6 +348,15 @@ config PHY_ROCKCHIP_PCIE
>   help
> Enable this to support the Rockchip PCIe PHY.
>  
> +config PHY_ROCKCHIP_TYPEC
> + tristate "Rockchip TYPEC PHY Driver"
> + depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
> + select EXTCON
> + select GENERIC_PHY
> + select RESET_CONTROLLER
> + help
> +   Enable this to support the Rockchip USB TYPEC PHY.
> +
>  config PHY_ST_SPEAR1310_MIPHY
>   tristate "ST SPEAR1310-MIPHY driver"
>   select GENERIC_PHY
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index fbb91e7..5d58b63 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -39,6 +39,7 @@ obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)+= 
> phy-rockchip-inno-usb2.o
>  obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o
>  obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o
>  obj-$(CONFIG_PHY_ROCKCHIP_DP)+= phy-rockchip-dp.o
> +obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o
>  obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)  += phy-qcom-ipq806x-sata.o
>  obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o
>  obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o
> diff --git a/drivers/phy/phy-rockchip-typec.c 
> b/drivers/phy/phy-rockchip-typec.c
> new file mode 100644
> index 000..fb58a27
> --- /dev/null
> +++ b/drivers/phy/phy-rockchip-typec.c
> @@ -0,0 

Re: [v14 PATCH 2/5] phy: Add USB Type-C PHY driver for rk3399

2016-09-05 Thread Kishon Vijay Abraham I
Hi chanwoo,

On Monday 05 September 2016 06:58 AM, Chanwoo Choi wrote:
> Dear all,
> 
> On 2016년 08월 24일 14:17, Chris Zhong wrote:
>> Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
>> Type-C PHY is designed to support the USB3 and DP applications.
>> The USB3 operates in SuperSpeed mode and the DP can operate at RBR,
>> HBR and HBR2 data rates. This driver create 2 PHY devices separately
>> for USB3 and DisplyPort, and registers them under the child node.
>>
>> Signed-off-by: Chris Zhong 
>> Signed-off-by: Kever Yang 
>> Reviewed-by: Guenter Roeck 
>> Tested-by: Guenter Roeck 
>>
>> ---
>>
>> Changes in v14:
>> - change the name of property from super speed to EXTCON_PROP_USB_SS
>>
>> Changes in v13:
>> - add some description in front of driver
>> - change name of usb to usb3
>> - add a USB3 RX register configuration
>> - do not return err if nothing connected with Type-C, when usb phy power on,
>>   since the USB core driver will call phy power without USB3 device 
>> connected.
>>
>> Changes in v12:
>> - enable DP+USB3 mode, only when EXTCON_PROP_USB_SUPERSPEED equal 1
>>   and DP is attached
>>
>> Changes in v11:
>> - make a clearer demarcation between usb phy and dp phy.
>>
>> Changes in v10:
>> - do not control dp select and hpd config in phy driver
>>
>> Changes in v9:
>> - the new_mode should be int not u8
>> - move mutex_lock(>lock); to earlier place. in
>>   rockchip_usb3_phy_power_off
>> - better mutex lock for phy mode and flip
>> - split the Type-C PHY into two PHYs: USB3 and DP
>>
>> Changes in v8:
>> - set the default cable id to EXTCON_USB_HOST
>> - optimization Error log
>>
>> Changes in v7:
>> - support new API of extcon
>>
>> Changes in v6:
>> - delete the support of PIN_ASSIGN_A/B
>> - set the default mode to MODE_DFP_USB
>> - disable DP PLL at USB3 only mode
>>
>> Changes in v5:
>> - support get property from extcon
>> - remove PIN ASSIGN A/B support
>>
>> Changes in v4:
>> - select EXTCON
>> - use phy framework to control the USB3 and DP function
>> - rename PIN_MAP_ to PIN_ASSIGN_
>>
>> Changes in v3:
>> - remove the phy framework(Kishon Vijay Abraham I)
>> - add parentheses around the macro
>> - use a single space between type and name
>> - add spaces after opening and before closing braces.
>> - use u16 for register value
>> - remove type-c phy header file
>> - CodingStyle optimization
>> - use some cable extcon to get type-c port information
>> - add a extcon to notify Display Port
>>
>> Changes in v2:
>> - select RESET_CONTROLLER
>> - alphabetic order
>> - modify some spelling mistakes
>> - make mode cleaner
>> - use bool for enable/disable
>> - check all of the return value
>> - return a better err number
>> - use more readx_poll_timeout()
>> - clk_disable_unprepare(tcphy->clk_ref);
>> - remove unuse functions, rockchip_typec_phy_power_on/off
>> - remove unnecessary typecast from void *
>> - use dts node to distinguish between phys.
>>
>> Changes in v1:
>> - update the licence note
>> - init core clock to 50MHz
>> - use extcon API
>> - remove unused global
>> - add some comments for magic num
>> - change usleep_range(1000, 2000) tousleep_range(1000, 1050)
>> - remove __func__ from dev_err
>> - return err number when get clk failed
>> - remove ADDR_ADJ define
>> - use devm_clk_get(>dev, "tcpdcore")
>>
>>  drivers/phy/Kconfig  |9 +
>>  drivers/phy/Makefile |1 +
>>  drivers/phy/phy-rockchip-typec.c | 1013 
>> ++
>>  3 files changed, 1023 insertions(+)
>>  create mode 100644 drivers/phy/phy-rockchip-typec.c
>>
> 
> [snip]
> 
> This patch rely on the extcon git repository to support the extcon property
> and USB 3.0 property. I created the immutable branch(ib-extcon-phy-4.9).
> I send this pull request to prevent the build error.
> 
> (The patches of extcon property for USB 3.0 depend on the other extcon patches
> which are already merged. So, it is diffcult to separate the only patches
> of extcon property.)
> 
> Best Regards,
> Chanwoo Choi
> 
> The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:
> 
>   Linux 4.8-rc1 (2016-08-07 18:18:00 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
> ib-extcon-phy-4.9

I've included this branch in linux-phy next for merging phy-rockchip-typec.c.

Thanks
Kishon
> 
> for you to fetch changes up to 8457a1b49a2af0a0e71f80afed9f7c80de361610:
> 
>   extcon: Introduce EXTCON_PROP_USB_SS property for SuperSpeed mode 
> (2016-08-18 10:23:36 +0900)
> 
> 
> Chanwoo Choi (12):
>   extcon: arizona: Remove the usage of extcon_update_state()
>   extcon: adc-jack: Remove the usage of extcon_set_state()
>   extcon: gpio: Remove the usage of extcon_set_state()
>   extcon: Remove the state_store() to prevent the 

Re: [v14 PATCH 2/5] phy: Add USB Type-C PHY driver for rk3399

2016-09-05 Thread Kishon Vijay Abraham I
Hi chanwoo,

On Monday 05 September 2016 06:58 AM, Chanwoo Choi wrote:
> Dear all,
> 
> On 2016년 08월 24일 14:17, Chris Zhong wrote:
>> Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
>> Type-C PHY is designed to support the USB3 and DP applications.
>> The USB3 operates in SuperSpeed mode and the DP can operate at RBR,
>> HBR and HBR2 data rates. This driver create 2 PHY devices separately
>> for USB3 and DisplyPort, and registers them under the child node.
>>
>> Signed-off-by: Chris Zhong 
>> Signed-off-by: Kever Yang 
>> Reviewed-by: Guenter Roeck 
>> Tested-by: Guenter Roeck 
>>
>> ---
>>
>> Changes in v14:
>> - change the name of property from super speed to EXTCON_PROP_USB_SS
>>
>> Changes in v13:
>> - add some description in front of driver
>> - change name of usb to usb3
>> - add a USB3 RX register configuration
>> - do not return err if nothing connected with Type-C, when usb phy power on,
>>   since the USB core driver will call phy power without USB3 device 
>> connected.
>>
>> Changes in v12:
>> - enable DP+USB3 mode, only when EXTCON_PROP_USB_SUPERSPEED equal 1
>>   and DP is attached
>>
>> Changes in v11:
>> - make a clearer demarcation between usb phy and dp phy.
>>
>> Changes in v10:
>> - do not control dp select and hpd config in phy driver
>>
>> Changes in v9:
>> - the new_mode should be int not u8
>> - move mutex_lock(>lock); to earlier place. in
>>   rockchip_usb3_phy_power_off
>> - better mutex lock for phy mode and flip
>> - split the Type-C PHY into two PHYs: USB3 and DP
>>
>> Changes in v8:
>> - set the default cable id to EXTCON_USB_HOST
>> - optimization Error log
>>
>> Changes in v7:
>> - support new API of extcon
>>
>> Changes in v6:
>> - delete the support of PIN_ASSIGN_A/B
>> - set the default mode to MODE_DFP_USB
>> - disable DP PLL at USB3 only mode
>>
>> Changes in v5:
>> - support get property from extcon
>> - remove PIN ASSIGN A/B support
>>
>> Changes in v4:
>> - select EXTCON
>> - use phy framework to control the USB3 and DP function
>> - rename PIN_MAP_ to PIN_ASSIGN_
>>
>> Changes in v3:
>> - remove the phy framework(Kishon Vijay Abraham I)
>> - add parentheses around the macro
>> - use a single space between type and name
>> - add spaces after opening and before closing braces.
>> - use u16 for register value
>> - remove type-c phy header file
>> - CodingStyle optimization
>> - use some cable extcon to get type-c port information
>> - add a extcon to notify Display Port
>>
>> Changes in v2:
>> - select RESET_CONTROLLER
>> - alphabetic order
>> - modify some spelling mistakes
>> - make mode cleaner
>> - use bool for enable/disable
>> - check all of the return value
>> - return a better err number
>> - use more readx_poll_timeout()
>> - clk_disable_unprepare(tcphy->clk_ref);
>> - remove unuse functions, rockchip_typec_phy_power_on/off
>> - remove unnecessary typecast from void *
>> - use dts node to distinguish between phys.
>>
>> Changes in v1:
>> - update the licence note
>> - init core clock to 50MHz
>> - use extcon API
>> - remove unused global
>> - add some comments for magic num
>> - change usleep_range(1000, 2000) tousleep_range(1000, 1050)
>> - remove __func__ from dev_err
>> - return err number when get clk failed
>> - remove ADDR_ADJ define
>> - use devm_clk_get(>dev, "tcpdcore")
>>
>>  drivers/phy/Kconfig  |9 +
>>  drivers/phy/Makefile |1 +
>>  drivers/phy/phy-rockchip-typec.c | 1013 
>> ++
>>  3 files changed, 1023 insertions(+)
>>  create mode 100644 drivers/phy/phy-rockchip-typec.c
>>
> 
> [snip]
> 
> This patch rely on the extcon git repository to support the extcon property
> and USB 3.0 property. I created the immutable branch(ib-extcon-phy-4.9).
> I send this pull request to prevent the build error.
> 
> (The patches of extcon property for USB 3.0 depend on the other extcon patches
> which are already merged. So, it is diffcult to separate the only patches
> of extcon property.)
> 
> Best Regards,
> Chanwoo Choi
> 
> The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:
> 
>   Linux 4.8-rc1 (2016-08-07 18:18:00 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
> ib-extcon-phy-4.9

I've included this branch in linux-phy next for merging phy-rockchip-typec.c.

Thanks
Kishon
> 
> for you to fetch changes up to 8457a1b49a2af0a0e71f80afed9f7c80de361610:
> 
>   extcon: Introduce EXTCON_PROP_USB_SS property for SuperSpeed mode 
> (2016-08-18 10:23:36 +0900)
> 
> 
> Chanwoo Choi (12):
>   extcon: arizona: Remove the usage of extcon_update_state()
>   extcon: adc-jack: Remove the usage of extcon_set_state()
>   extcon: gpio: Remove the usage of extcon_set_state()
>   extcon: Remove the state_store() to prevent the wrong access
>   extcon: Block the bit masking operation for cable state except for 
> 

[PATCH 3/4] drm/fsl-dcu: update all registers on flush

2016-09-05 Thread Stefan Agner
Use the UPDATE_MODE READREG bit to initiate a register transfer
on flush. This makes sure that we flush all registers only once
for all planes.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  | 3 +++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 5 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
index d30b61e..62eb284 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
@@ -27,6 +27,9 @@ static void fsl_dcu_drm_crtc_atomic_flush(struct drm_crtc 
*crtc,
 {
struct drm_pending_vblank_event *event = crtc->state->event;
 
+   regmap_write(fsl_dev->regmap,
+DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG);
+
if (event) {
crtc->state->event = NULL;
 
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index a6af3d9..d7412ff 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -160,11 +160,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct 
drm_plane *plane,
 DCU_LAYER_POST_SKIP(0) |
 DCU_LAYER_PRE_SKIP(0));
}
-   regmap_update_bits(fsl_dev->regmap, DCU_DCU_MODE,
-  DCU_MODE_DCU_MODE_MASK,
-  DCU_MODE_DCU_MODE(DCU_MODE_NORMAL));
-   regmap_write(fsl_dev->regmap,
-DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG);
 
return;
 }
-- 
2.9.3



[PATCH 3/4] drm/fsl-dcu: update all registers on flush

2016-09-05 Thread Stefan Agner
Use the UPDATE_MODE READREG bit to initiate a register transfer
on flush. This makes sure that we flush all registers only once
for all planes.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  | 3 +++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 5 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
index d30b61e..62eb284 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
@@ -27,6 +27,9 @@ static void fsl_dcu_drm_crtc_atomic_flush(struct drm_crtc 
*crtc,
 {
struct drm_pending_vblank_event *event = crtc->state->event;
 
+   regmap_write(fsl_dev->regmap,
+DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG);
+
if (event) {
crtc->state->event = NULL;
 
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index a6af3d9..d7412ff 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -160,11 +160,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct 
drm_plane *plane,
 DCU_LAYER_POST_SKIP(0) |
 DCU_LAYER_PRE_SKIP(0));
}
-   regmap_update_bits(fsl_dev->regmap, DCU_DCU_MODE,
-  DCU_MODE_DCU_MODE_MASK,
-  DCU_MODE_DCU_MODE(DCU_MODE_NORMAL));
-   regmap_write(fsl_dev->regmap,
-DCU_UPDATE_MODE, DCU_UPDATE_MODE_READREG);
 
return;
 }
-- 
2.9.3



[PATCH 0/4] drm/fsl-dcu: add overlay and cursor plane support

2016-09-05 Thread Stefan Agner
This patchset adds overlay and cursor plane support. It also
fixes some issues uncovered during implementation of this.

However, the plane updates currently causes the display to flicker for
unknown reasons. As far as I can tell, the CRTC atomic_flush should
trigger the update correctly via READREG, which according to
documentation:
The READREG bit causes a single transfer to begin at the next frame
blanking period. This bit is cleared when the transfer is complete.

I made a video how that looks:
https://cloud.agner.ch/index.php/s/Yfqa2u7UBEWUT8N

Any ideas?

Stefan Agner (4):
  drm/fsl-dcu: support overlay and cursor planes
  drm/fsl-dcu: respect pos/size register sizes
  drm/fsl-dcu: update all registers on flush
  drm/fsl-dcu: do not update when modifying irq registers

 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  | 50 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   |  4 ---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h   |  8 ++---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 42 +++-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.h |  3 +-
 5 files changed, 67 insertions(+), 40 deletions(-)

-- 
2.9.3



Re: [PATCH v2 3/8] regulator: axp20x: support AXP806 variant

2016-09-05 Thread Chen-Yu Tsai
Hi Lee,

On Fri, Sep 2, 2016 at 4:23 AM, Mark Brown  wrote:
> On Sat, Aug 27, 2016 at 03:55:39PM +0800, Chen-Yu Tsai wrote:
>> The X-Powers AXP806 PMIC has a new set of buck and LDO regulators, and
>> also a switch. The buck regulators support teaming into multi-phase
>> groups, with A+B, A+B+C, D+E groupings.
>
> Acked-by: Mark Brown 

Could you merge this through the mfd tree, along with the AXP806
mfd patches?

Thanks
ChenYu


[PATCH 1/4] drm/fsl-dcu: support overlay and cursor planes

2016-09-05 Thread Stefan Agner
Add support for overlay plane and a cursor plane. The driver uses
the topmost plane as cursor plane. The DCU IP would have dedicated
cursor support, but that lacks proper color support and hence is
not practical to use for Linux systems.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  | 47 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 37 ---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.h |  3 +-
 3 files changed, 60 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
index 3371635..d30b61e 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
@@ -139,20 +139,51 @@ static const struct drm_crtc_funcs fsl_dcu_drm_crtc_funcs 
= {
 
 int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev)
 {
-   struct drm_plane *primary;
+   struct drm_device *drm = fsl_dev->drm;
+   struct drm_plane *primary, *cursor;
struct drm_crtc *crtc = _dev->crtc;
-   int ret;
+   int total_layer = fsl_dev->soc->total_layer;
+   int ret, i;
 
-   fsl_dcu_drm_init_planes(fsl_dev->drm);
+   fsl_dcu_drm_init_planes(drm);
 
-   primary = fsl_dcu_drm_primary_create_plane(fsl_dev->drm);
-   if (!primary)
-   return -ENOMEM;
+   primary = fsl_dcu_drm_create_plane(drm, DRM_PLANE_TYPE_PRIMARY);
+   if (IS_ERR(primary)) {
+   dev_err(fsl_dev->dev, "failed to construct primary plane\n");
+   ret = PTR_ERR(primary);
+   return ret;
+   }
+
+   /*
+* Initialize overlay layers. The hardware does not have specific
+* layer types, we just happen to use one layer as primary layer
+* and one layer as cursor layer, hence total_layer - 2 = overlays.
+*/
+   for (i = 0; i < total_layer - 2; i++) {
+   struct drm_plane *plane =
+   fsl_dcu_drm_create_plane(drm, DRM_PLANE_TYPE_OVERLAY);
+
+   if (IS_ERR(plane))
+   continue;
+   }
 
-   ret = drm_crtc_init_with_planes(fsl_dev->drm, crtc, primary, NULL,
+   cursor = fsl_dcu_drm_create_plane(drm, DRM_PLANE_TYPE_CURSOR);
+   if (IS_ERR(cursor)) {
+   dev_warn(fsl_dev->dev, "failed to construct cursor plane\n");
+   cursor = NULL;
+   }
+
+   /*
+* Initialize cursor plane after overlay planes since the initialization
+* order is crucial to the layer id (and hence layer stacking order).
+*/
+   ret = drm_crtc_init_with_planes(drm, crtc, primary, cursor,
_dcu_drm_crtc_funcs, NULL);
if (ret) {
-   primary->funcs->destroy(primary);
+   struct drm_plane *plane;
+
+   list_for_each_entry(plane, >mode_config.plane_list, head)
+   drm_plane_cleanup(plane);
return ret;
}
 
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index a7e5486..a6af3d9 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -178,7 +178,6 @@ static const struct drm_plane_helper_funcs 
fsl_dcu_drm_plane_helper_funcs = {
 static void fsl_dcu_drm_plane_destroy(struct drm_plane *plane)
 {
drm_plane_cleanup(plane);
-   kfree(plane);
 }
 
 static const struct drm_plane_funcs fsl_dcu_drm_plane_funcs = {
@@ -218,28 +217,30 @@ void fsl_dcu_drm_init_planes(struct drm_device *dev)
 DCU_UPDATE_MODE_READREG);
 }
 
-struct drm_plane *fsl_dcu_drm_primary_create_plane(struct drm_device *dev)
+struct drm_plane *fsl_dcu_drm_create_plane(struct drm_device *dev,
+  enum drm_plane_type type)
 {
-   struct drm_plane *primary;
+   struct drm_plane *plane;
int ret;
 
-   primary = kzalloc(sizeof(*primary), GFP_KERNEL);
-   if (!primary) {
-   DRM_DEBUG_KMS("Failed to allocate primary plane\n");
-   return NULL;
-   }
+   plane = devm_kzalloc(dev->dev, sizeof(struct drm_plane),
+ GFP_KERNEL);
+   if (!plane)
+   return ERR_PTR(-ENOMEM);
 
-   /* possible_crtc's will be filled in later by crtc_init */
-   ret = drm_universal_plane_init(dev, primary, 0,
-  _dcu_drm_plane_funcs,
+   ret = drm_universal_plane_init(dev, plane, 1, _dcu_drm_plane_funcs,
   fsl_dcu_drm_plane_formats,
   ARRAY_SIZE(fsl_dcu_drm_plane_formats),
-  DRM_PLANE_TYPE_PRIMARY, NULL);
-   if (ret) {
-   kfree(primary);
-   primary = NULL;
-   }
-   drm_plane_helper_add(primary, 

[PATCH 1/4] drm/fsl-dcu: support overlay and cursor planes

2016-09-05 Thread Stefan Agner
Add support for overlay plane and a cursor plane. The driver uses
the topmost plane as cursor plane. The DCU IP would have dedicated
cursor support, but that lacks proper color support and hence is
not practical to use for Linux systems.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  | 47 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 37 ---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.h |  3 +-
 3 files changed, 60 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
index 3371635..d30b61e 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
@@ -139,20 +139,51 @@ static const struct drm_crtc_funcs fsl_dcu_drm_crtc_funcs 
= {
 
 int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev)
 {
-   struct drm_plane *primary;
+   struct drm_device *drm = fsl_dev->drm;
+   struct drm_plane *primary, *cursor;
struct drm_crtc *crtc = _dev->crtc;
-   int ret;
+   int total_layer = fsl_dev->soc->total_layer;
+   int ret, i;
 
-   fsl_dcu_drm_init_planes(fsl_dev->drm);
+   fsl_dcu_drm_init_planes(drm);
 
-   primary = fsl_dcu_drm_primary_create_plane(fsl_dev->drm);
-   if (!primary)
-   return -ENOMEM;
+   primary = fsl_dcu_drm_create_plane(drm, DRM_PLANE_TYPE_PRIMARY);
+   if (IS_ERR(primary)) {
+   dev_err(fsl_dev->dev, "failed to construct primary plane\n");
+   ret = PTR_ERR(primary);
+   return ret;
+   }
+
+   /*
+* Initialize overlay layers. The hardware does not have specific
+* layer types, we just happen to use one layer as primary layer
+* and one layer as cursor layer, hence total_layer - 2 = overlays.
+*/
+   for (i = 0; i < total_layer - 2; i++) {
+   struct drm_plane *plane =
+   fsl_dcu_drm_create_plane(drm, DRM_PLANE_TYPE_OVERLAY);
+
+   if (IS_ERR(plane))
+   continue;
+   }
 
-   ret = drm_crtc_init_with_planes(fsl_dev->drm, crtc, primary, NULL,
+   cursor = fsl_dcu_drm_create_plane(drm, DRM_PLANE_TYPE_CURSOR);
+   if (IS_ERR(cursor)) {
+   dev_warn(fsl_dev->dev, "failed to construct cursor plane\n");
+   cursor = NULL;
+   }
+
+   /*
+* Initialize cursor plane after overlay planes since the initialization
+* order is crucial to the layer id (and hence layer stacking order).
+*/
+   ret = drm_crtc_init_with_planes(drm, crtc, primary, cursor,
_dcu_drm_crtc_funcs, NULL);
if (ret) {
-   primary->funcs->destroy(primary);
+   struct drm_plane *plane;
+
+   list_for_each_entry(plane, >mode_config.plane_list, head)
+   drm_plane_cleanup(plane);
return ret;
}
 
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index a7e5486..a6af3d9 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -178,7 +178,6 @@ static const struct drm_plane_helper_funcs 
fsl_dcu_drm_plane_helper_funcs = {
 static void fsl_dcu_drm_plane_destroy(struct drm_plane *plane)
 {
drm_plane_cleanup(plane);
-   kfree(plane);
 }
 
 static const struct drm_plane_funcs fsl_dcu_drm_plane_funcs = {
@@ -218,28 +217,30 @@ void fsl_dcu_drm_init_planes(struct drm_device *dev)
 DCU_UPDATE_MODE_READREG);
 }
 
-struct drm_plane *fsl_dcu_drm_primary_create_plane(struct drm_device *dev)
+struct drm_plane *fsl_dcu_drm_create_plane(struct drm_device *dev,
+  enum drm_plane_type type)
 {
-   struct drm_plane *primary;
+   struct drm_plane *plane;
int ret;
 
-   primary = kzalloc(sizeof(*primary), GFP_KERNEL);
-   if (!primary) {
-   DRM_DEBUG_KMS("Failed to allocate primary plane\n");
-   return NULL;
-   }
+   plane = devm_kzalloc(dev->dev, sizeof(struct drm_plane),
+ GFP_KERNEL);
+   if (!plane)
+   return ERR_PTR(-ENOMEM);
 
-   /* possible_crtc's will be filled in later by crtc_init */
-   ret = drm_universal_plane_init(dev, primary, 0,
-  _dcu_drm_plane_funcs,
+   ret = drm_universal_plane_init(dev, plane, 1, _dcu_drm_plane_funcs,
   fsl_dcu_drm_plane_formats,
   ARRAY_SIZE(fsl_dcu_drm_plane_formats),
-  DRM_PLANE_TYPE_PRIMARY, NULL);
-   if (ret) {
-   kfree(primary);
-   primary = NULL;
-   }
-   drm_plane_helper_add(primary, _dcu_drm_plane_helper_funcs);
+  

[PATCH 0/4] drm/fsl-dcu: add overlay and cursor plane support

2016-09-05 Thread Stefan Agner
This patchset adds overlay and cursor plane support. It also
fixes some issues uncovered during implementation of this.

However, the plane updates currently causes the display to flicker for
unknown reasons. As far as I can tell, the CRTC atomic_flush should
trigger the update correctly via READREG, which according to
documentation:
The READREG bit causes a single transfer to begin at the next frame
blanking period. This bit is cleared when the transfer is complete.

I made a video how that looks:
https://cloud.agner.ch/index.php/s/Yfqa2u7UBEWUT8N

Any ideas?

Stefan Agner (4):
  drm/fsl-dcu: support overlay and cursor planes
  drm/fsl-dcu: respect pos/size register sizes
  drm/fsl-dcu: update all registers on flush
  drm/fsl-dcu: do not update when modifying irq registers

 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  | 50 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   |  4 ---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h   |  8 ++---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 42 +++-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.h |  3 +-
 5 files changed, 67 insertions(+), 40 deletions(-)

-- 
2.9.3



Re: [PATCH v2 3/8] regulator: axp20x: support AXP806 variant

2016-09-05 Thread Chen-Yu Tsai
Hi Lee,

On Fri, Sep 2, 2016 at 4:23 AM, Mark Brown  wrote:
> On Sat, Aug 27, 2016 at 03:55:39PM +0800, Chen-Yu Tsai wrote:
>> The X-Powers AXP806 PMIC has a new set of buck and LDO regulators, and
>> also a switch. The buck regulators support teaming into multi-phase
>> groups, with A+B, A+B+C, D+E groupings.
>
> Acked-by: Mark Brown 

Could you merge this through the mfd tree, along with the AXP806
mfd patches?

Thanks
ChenYu


[PATCH 4/4] drm/fsl-dcu: do not update when modifying irq registers

2016-09-05 Thread Stefan Agner
The IRQ status and mask registers are not "double buffered" according
to the reference manual. Hence, there is no extra transfer/update
write needed when modifying these registers.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 092aaec..4e700bc4 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -59,8 +59,6 @@ static int fsl_dcu_drm_irq_init(struct drm_device *dev)
 
regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0);
regmap_write(fsl_dev->regmap, DCU_INT_MASK, ~0);
-   regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE,
-DCU_UPDATE_MODE_READREG);
 
return ret;
 }
@@ -139,8 +137,6 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
drm_handle_vblank(dev, 0);
 
regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
-   regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE,
-DCU_UPDATE_MODE_READREG);
 
return IRQ_HANDLED;
 }
-- 
2.9.3



[PATCH 2/4] drm/fsl-dcu: respect pos/size register sizes

2016-09-05 Thread Stefan Agner
Mask the size and position values to avoid mutual overwriting.
Especially, a negative X position caused the Y position to be
overwritten with 0xfff too. This has been observed when using
a layer as cursor layer.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index 3b371fe7..060f881 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -118,11 +118,11 @@
 
 #define DCU_CTRLDESCLN(layer, reg) (0x200 + (reg - 1) * 4 + (layer) * 0x40)
 
-#define DCU_LAYER_HEIGHT(x)((x) << 16)
-#define DCU_LAYER_WIDTH(x) (x)
+#define DCU_LAYER_HEIGHT(x)(((x) & 0x7ff) << 16)
+#define DCU_LAYER_WIDTH(x) ((x) & 0x7ff)
 
-#define DCU_LAYER_POSY(x)  ((x) << 16)
-#define DCU_LAYER_POSX(x)  (x)
+#define DCU_LAYER_POSY(x)  (((x) & 0xfff) << 16)
+#define DCU_LAYER_POSX(x)  ((x) & 0xfff)
 
 #define DCU_LAYER_EN   BIT(31)
 #define DCU_LAYER_TILE_EN  BIT(30)
-- 
2.9.3



[PATCH 4/4] drm/fsl-dcu: do not update when modifying irq registers

2016-09-05 Thread Stefan Agner
The IRQ status and mask registers are not "double buffered" according
to the reference manual. Hence, there is no extra transfer/update
write needed when modifying these registers.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 092aaec..4e700bc4 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -59,8 +59,6 @@ static int fsl_dcu_drm_irq_init(struct drm_device *dev)
 
regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0);
regmap_write(fsl_dev->regmap, DCU_INT_MASK, ~0);
-   regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE,
-DCU_UPDATE_MODE_READREG);
 
return ret;
 }
@@ -139,8 +137,6 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
drm_handle_vblank(dev, 0);
 
regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
-   regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE,
-DCU_UPDATE_MODE_READREG);
 
return IRQ_HANDLED;
 }
-- 
2.9.3



[PATCH 2/4] drm/fsl-dcu: respect pos/size register sizes

2016-09-05 Thread Stefan Agner
Mask the size and position values to avoid mutual overwriting.
Especially, a negative X position caused the Y position to be
overwritten with 0xfff too. This has been observed when using
a layer as cursor layer.

Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index 3b371fe7..060f881 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -118,11 +118,11 @@
 
 #define DCU_CTRLDESCLN(layer, reg) (0x200 + (reg - 1) * 4 + (layer) * 0x40)
 
-#define DCU_LAYER_HEIGHT(x)((x) << 16)
-#define DCU_LAYER_WIDTH(x) (x)
+#define DCU_LAYER_HEIGHT(x)(((x) & 0x7ff) << 16)
+#define DCU_LAYER_WIDTH(x) ((x) & 0x7ff)
 
-#define DCU_LAYER_POSY(x)  ((x) << 16)
-#define DCU_LAYER_POSX(x)  (x)
+#define DCU_LAYER_POSY(x)  (((x) & 0xfff) << 16)
+#define DCU_LAYER_POSX(x)  ((x) & 0xfff)
 
 #define DCU_LAYER_EN   BIT(31)
 #define DCU_LAYER_TILE_EN  BIT(30)
-- 
2.9.3



RE: [PATCH v3 0/3] Make core_pattern support namespace

2016-09-05 Thread Zhao Lei
Ping

> -Original Message-
> From: Zhao Lei [mailto:zhao...@cn.fujitsu.com]
> Sent: Monday, August 29, 2016 8:07 PM
> To: linux-kernel@vger.kernel.org
> Cc: contain...@lists.linux-foundation.org; Eric W. Biederman
> ; Mateusz Guzik ;
> Kamezawa Hiroyuki ; Stéphane Graber
> ; Andrei Vagin ; Zhao Lei
> 
> Subject: [PATCH v3 0/3] Make core_pattern support namespace
> 
> This patchset includes following function points:
> 1: Let usermodehelper function possible to set pid namespace
>done by: [PATCH v3 1/3] Make call_usermodehelper_exec possible
>to set pid namespace.
> 2: Let pipe_type core_pattern write dump into container's rootfs
>done by: [PATCH v3 2/3] Limit dump_pipe program's permission to
>init for container.
> 2: Make separate core_pattern setting for each container
>done by: [PATCH v3 3/3] Make core_pattern support namespace
> 3: Compatibility with current system
>also included in: [PATCH v3 3/3] Make core_pattern support namespace
>If container hadn't change core_pattern setting, it will keep
>same setting with host.
> 
> Test:
> 1: Pass a test script for each function of this patchset
>## TEST IN HOST ##
>[root@kerneldev dumptest]# ./test_host
>Set file core_pattern: OK
>./test_host: line 41:  2366 Segmentation fault  (core dumped)
> "$SCRIPT_BASE_DIR"/make_dump
>Checking dumpfile: OK
>Set file core_pattern: OK
>./test_host: line 41:  2369 Segmentation fault  (core dumped)
> "$SCRIPT_BASE_DIR"/make_dump
>Checking dump_pipe triggered: OK
>Checking rootfs: OK
>Checking dumpfile: OK
>Checking namespace: OK
>Checking process list: OK
>Checking capabilities: OK
> 
>## TEST IN GUEST ##
># ./test
>Segmentation fault (core dumped)
>Checking dump_pipe triggered: OK
>Checking rootfs: OK
>Checking dumpfile: OK
>Checking namespace: OK
>Checking process list: OK
>Checking cg pids: OK
>Checking capabilities: OK
>[   64.940734] make_dump[2432]: segfault at 0 ip 0040049d sp
> 7ffc4af025f0 error 6 in make_dump[40+a6000]
>#
> 2: Pass other test(which is not easy to do in script) by hand.
> 
> Changelog v2->v3:
> 1: Fix problem of setting pid namespace, pointed out by:
>Andrei Vagin 
> 
> Changelog v1(RFC)->v2:
> 1: Add [PATCH 2/2] which was todo in [RFC v1].
> 2: Pass a test script for each function.
> 3: Rebase on top of v4.7.
> 
> Suggested-by: Eric W. Biederman 
> Suggested-by: KOSAKI Motohiro 
> Signed-off-by: Zhao Lei 
> 
> Zhao Lei (3):
>   Make call_usermodehelper_exec possible to set pid namespace
>   Limit dump_pipe program's permission to init for container
>   Make core_pattern support namespace
> 
>  fs/coredump.c | 126
> ---
>  include/linux/binfmts.h   |   1 +
>  include/linux/kmod.h  |   2 +
>  include/linux/pid_namespace.h |   3 +
>  init/do_mounts_initrd.c   |   3 +-
>  kernel/kmod.c | 133
> +-
>  kernel/pid.c  |   2 +
>  kernel/pid_namespace.c|   2 +
>  kernel/sysctl.c   |  50 ++--
>  lib/kobject_uevent.c  |   3 +-
>  security/keys/request_key.c   |   4 +-
>  11 files changed, 296 insertions(+), 33 deletions(-)
> 
> --
> 1.8.5.1





RE: [PATCH v3 0/3] Make core_pattern support namespace

2016-09-05 Thread Zhao Lei
Ping

> -Original Message-
> From: Zhao Lei [mailto:zhao...@cn.fujitsu.com]
> Sent: Monday, August 29, 2016 8:07 PM
> To: linux-kernel@vger.kernel.org
> Cc: contain...@lists.linux-foundation.org; Eric W. Biederman
> ; Mateusz Guzik ;
> Kamezawa Hiroyuki ; Stéphane Graber
> ; Andrei Vagin ; Zhao Lei
> 
> Subject: [PATCH v3 0/3] Make core_pattern support namespace
> 
> This patchset includes following function points:
> 1: Let usermodehelper function possible to set pid namespace
>done by: [PATCH v3 1/3] Make call_usermodehelper_exec possible
>to set pid namespace.
> 2: Let pipe_type core_pattern write dump into container's rootfs
>done by: [PATCH v3 2/3] Limit dump_pipe program's permission to
>init for container.
> 2: Make separate core_pattern setting for each container
>done by: [PATCH v3 3/3] Make core_pattern support namespace
> 3: Compatibility with current system
>also included in: [PATCH v3 3/3] Make core_pattern support namespace
>If container hadn't change core_pattern setting, it will keep
>same setting with host.
> 
> Test:
> 1: Pass a test script for each function of this patchset
>## TEST IN HOST ##
>[root@kerneldev dumptest]# ./test_host
>Set file core_pattern: OK
>./test_host: line 41:  2366 Segmentation fault  (core dumped)
> "$SCRIPT_BASE_DIR"/make_dump
>Checking dumpfile: OK
>Set file core_pattern: OK
>./test_host: line 41:  2369 Segmentation fault  (core dumped)
> "$SCRIPT_BASE_DIR"/make_dump
>Checking dump_pipe triggered: OK
>Checking rootfs: OK
>Checking dumpfile: OK
>Checking namespace: OK
>Checking process list: OK
>Checking capabilities: OK
> 
>## TEST IN GUEST ##
># ./test
>Segmentation fault (core dumped)
>Checking dump_pipe triggered: OK
>Checking rootfs: OK
>Checking dumpfile: OK
>Checking namespace: OK
>Checking process list: OK
>Checking cg pids: OK
>Checking capabilities: OK
>[   64.940734] make_dump[2432]: segfault at 0 ip 0040049d sp
> 7ffc4af025f0 error 6 in make_dump[40+a6000]
>#
> 2: Pass other test(which is not easy to do in script) by hand.
> 
> Changelog v2->v3:
> 1: Fix problem of setting pid namespace, pointed out by:
>Andrei Vagin 
> 
> Changelog v1(RFC)->v2:
> 1: Add [PATCH 2/2] which was todo in [RFC v1].
> 2: Pass a test script for each function.
> 3: Rebase on top of v4.7.
> 
> Suggested-by: Eric W. Biederman 
> Suggested-by: KOSAKI Motohiro 
> Signed-off-by: Zhao Lei 
> 
> Zhao Lei (3):
>   Make call_usermodehelper_exec possible to set pid namespace
>   Limit dump_pipe program's permission to init for container
>   Make core_pattern support namespace
> 
>  fs/coredump.c | 126
> ---
>  include/linux/binfmts.h   |   1 +
>  include/linux/kmod.h  |   2 +
>  include/linux/pid_namespace.h |   3 +
>  init/do_mounts_initrd.c   |   3 +-
>  kernel/kmod.c | 133
> +-
>  kernel/pid.c  |   2 +
>  kernel/pid_namespace.c|   2 +
>  kernel/sysctl.c   |  50 ++--
>  lib/kobject_uevent.c  |   3 +-
>  security/keys/request_key.c   |   4 +-
>  11 files changed, 296 insertions(+), 33 deletions(-)
> 
> --
> 1.8.5.1





linux-next: manual merge of the tip tree with the kbuild tree

2016-09-05 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  arch/x86/lib/memcpy_64.S
  arch/x86/kernel/x8664_ksyms_64.c

between commit:

  784d5699eddc ("x86: move exports to actual definitions")

from the kbuild tree and commit:

  9a6fb28a355d ("x86/mce: Improve memcpy_mcsafe()")

from the tip tree.

I fixed it up (see below - I also removed
arch/x86/kernel/x8664_ksyms_64.c) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/lib/memcpy_64.S
index 94c917af9688,49e6ebac7e73..
--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@@ -276,8 -273,7 +276,8 @@@ ENTRY(memcpy_mcsafe_unrolled
  .L_done_memcpy_trap:
xorq %rax, %rax
ret
- ENDPROC(memcpy_mcsafe)
- EXPORT_SYMBOL_GPL(memcpy_mcsafe)
+ ENDPROC(memcpy_mcsafe_unrolled)
++EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled)
  
.section .fixup, "ax"
/* Return -EFAULT for any failure */


linux-next: manual merge of the tip tree with the kbuild tree

2016-09-05 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  arch/x86/lib/memcpy_64.S
  arch/x86/kernel/x8664_ksyms_64.c

between commit:

  784d5699eddc ("x86: move exports to actual definitions")

from the kbuild tree and commit:

  9a6fb28a355d ("x86/mce: Improve memcpy_mcsafe()")

from the tip tree.

I fixed it up (see below - I also removed
arch/x86/kernel/x8664_ksyms_64.c) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/lib/memcpy_64.S
index 94c917af9688,49e6ebac7e73..
--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@@ -276,8 -273,7 +276,8 @@@ ENTRY(memcpy_mcsafe_unrolled
  .L_done_memcpy_trap:
xorq %rax, %rax
ret
- ENDPROC(memcpy_mcsafe)
- EXPORT_SYMBOL_GPL(memcpy_mcsafe)
+ ENDPROC(memcpy_mcsafe_unrolled)
++EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled)
  
.section .fixup, "ax"
/* Return -EFAULT for any failure */


Re: [PATCH v10 5/5] drm/rockchip: Add dmc notifier in vop driver

2016-09-05 Thread kbuild test robot
Hi Lin,

[auto build test ERROR on next-20160825]
[cannot apply to rockchip/for-next devfreq/for-rafael linus/master v4.8-rc5 
v4.8-rc4 v4.8-rc3 v4.8-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Lin-Huang/rk3399-support-ddr-frequency-scaling/20160905-131110
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1124:16: note: (near 
initialization for 'vop_crtc_helper_funcs.mode_fixup')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1125:18: error: initializer 
element is not constant
 .atomic_flush = vop_crtc_atomic_flush,
 ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1125:18: note: (near 
initialization for 'vop_crtc_helper_funcs.atomic_flush')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1126:18: error: initializer 
element is not constant
 .atomic_begin = vop_crtc_atomic_begin,
 ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1126:18: note: (near 
initialization for 'vop_crtc_helper_funcs.atomic_begin')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1129:13: error: invalid storage 
class for function 'vop_crtc_destroy'
static void vop_crtc_destroy(struct drm_crtc *crtc)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1134:13: error: invalid storage 
class for function 'vop_crtc_reset'
static void vop_crtc_reset(struct drm_crtc *crtc)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1145:31: error: invalid storage 
class for function 'vop_crtc_duplicate_state'
static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc 
*crtc)
  ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1157:13: error: invalid storage 
class for function 'vop_crtc_destroy_state'
static void vop_crtc_destroy_state(struct drm_crtc *crtc,
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1169:13: error: initializer 
element is not constant
 .destroy = vop_crtc_destroy,
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1169:13: note: (near 
initialization for 'vop_crtc_funcs.destroy')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1170:11: error: initializer 
element is not constant
 .reset = vop_crtc_reset,
  ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1170:11: note: (near 
initialization for 'vop_crtc_funcs.reset')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1171:28: error: initializer 
element is not constant
 .atomic_duplicate_state = vop_crtc_duplicate_state,
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1171:28: note: (near 
initialization for 'vop_crtc_funcs.atomic_duplicate_state')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1172:26: error: initializer 
element is not constant
 .atomic_destroy_state = vop_crtc_destroy_state,
 ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1172:26: note: (near 
initialization for 'vop_crtc_funcs.atomic_destroy_state')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1175:13: error: invalid storage 
class for function 'vop_win_pending_is_complete'
static bool vop_win_pending_is_complete(struct vop_win *vop_win)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1187:13: error: invalid storage 
class for function 'vop_handle_vblank'
static void vop_handle_vblank(struct vop *vop)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1213:20: error: invalid storage 
class for function 'vop_isr'
static irqreturn_t vop_isr(int irq, void *data)
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1259:12: error: invalid storage 
class for function 'vop_create_crtc'
static int vop_create_crtc(struct vop *vop)
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1359:13: error: invalid storage 
class for function 'vop_destroy_crtc'
static void vop_destroy_crtc(struct vop *vop)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1387:12: error: invalid storage 
class for function 'vop_initial'
static int vop_initial(struct vop *vop)
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1487:13: error: invalid storage 
class for function 'vop_win_init'
static void vop_win_init(struct

Re: [PATCH v10 5/5] drm/rockchip: Add dmc notifier in vop driver

2016-09-05 Thread kbuild test robot
Hi Lin,

[auto build test ERROR on next-20160825]
[cannot apply to rockchip/for-next devfreq/for-rafael linus/master v4.8-rc5 
v4.8-rc4 v4.8-rc3 v4.8-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Lin-Huang/rk3399-support-ddr-frequency-scaling/20160905-131110
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1124:16: note: (near 
initialization for 'vop_crtc_helper_funcs.mode_fixup')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1125:18: error: initializer 
element is not constant
 .atomic_flush = vop_crtc_atomic_flush,
 ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1125:18: note: (near 
initialization for 'vop_crtc_helper_funcs.atomic_flush')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1126:18: error: initializer 
element is not constant
 .atomic_begin = vop_crtc_atomic_begin,
 ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1126:18: note: (near 
initialization for 'vop_crtc_helper_funcs.atomic_begin')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1129:13: error: invalid storage 
class for function 'vop_crtc_destroy'
static void vop_crtc_destroy(struct drm_crtc *crtc)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1134:13: error: invalid storage 
class for function 'vop_crtc_reset'
static void vop_crtc_reset(struct drm_crtc *crtc)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1145:31: error: invalid storage 
class for function 'vop_crtc_duplicate_state'
static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc 
*crtc)
  ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1157:13: error: invalid storage 
class for function 'vop_crtc_destroy_state'
static void vop_crtc_destroy_state(struct drm_crtc *crtc,
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1169:13: error: initializer 
element is not constant
 .destroy = vop_crtc_destroy,
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1169:13: note: (near 
initialization for 'vop_crtc_funcs.destroy')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1170:11: error: initializer 
element is not constant
 .reset = vop_crtc_reset,
  ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1170:11: note: (near 
initialization for 'vop_crtc_funcs.reset')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1171:28: error: initializer 
element is not constant
 .atomic_duplicate_state = vop_crtc_duplicate_state,
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1171:28: note: (near 
initialization for 'vop_crtc_funcs.atomic_duplicate_state')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1172:26: error: initializer 
element is not constant
 .atomic_destroy_state = vop_crtc_destroy_state,
 ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1172:26: note: (near 
initialization for 'vop_crtc_funcs.atomic_destroy_state')
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1175:13: error: invalid storage 
class for function 'vop_win_pending_is_complete'
static bool vop_win_pending_is_complete(struct vop_win *vop_win)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1187:13: error: invalid storage 
class for function 'vop_handle_vblank'
static void vop_handle_vblank(struct vop *vop)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1213:20: error: invalid storage 
class for function 'vop_isr'
static irqreturn_t vop_isr(int irq, void *data)
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1259:12: error: invalid storage 
class for function 'vop_create_crtc'
static int vop_create_crtc(struct vop *vop)
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1359:13: error: invalid storage 
class for function 'vop_destroy_crtc'
static void vop_destroy_crtc(struct vop *vop)
^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1387:12: error: invalid storage 
class for function 'vop_initial'
static int vop_initial(struct vop *vop)
   ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1487:13: error: invalid storage 
class for function 'vop_win_init'
static void vop_win_init(struct

Re: ACPI-APEI-HEST: Fine-tuning for three function implementations

2016-09-05 Thread SF Markus Elfring
> Like in the other patch series I've just commented,

Thanks for your quick response.


> please put all label renames into one patch.

Could you accept these update suggestions generally?


I would prefer to avoid squashing special changes together by default.

Regards,
Markus


Re: ACPI-APEI-HEST: Fine-tuning for three function implementations

2016-09-05 Thread SF Markus Elfring
> Like in the other patch series I've just commented,

Thanks for your quick response.


> please put all label renames into one patch.

Could you accept these update suggestions generally?


I would prefer to avoid squashing special changes together by default.

Regards,
Markus


Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-05 Thread Jeff Mahoney
On 9/5/16 11:05 PM, Jeff Mahoney wrote:
> On 9/5/16 3:56 AM, Qu Wenruo wrote:
>>
>>
>> At 09/05/2016 09:19 AM, Zhao Lei wrote:
>>> Hi, Sean Fu
>>>
 From: Sean Fu [mailto:fxinr...@gmail.com]
 Sent: Sunday, September 04, 2016 7:54 PM
 To: dste...@suse.com
 Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com;
 zhao...@cn.fujitsu.com; linux-bt...@vger.kernel.org;
 linux-kernel@vger.kernel.org; Sean Fu 
 Subject: [PATCH] Btrfs: remove unnecessary code of chunk_root
 assignment in
 btrfs_read_chunk_tree.

 The input argument root is already set with "fs_info->chunk_root".
 "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller
 "open_ctree".
 “root->fs_info = fs_info” in "btrfs_alloc_root".

>>> The root argument of this function means "any root".
>>> And the function is designed getting chunk root from
>>> "any root" in head.
>>>
>>> Since there is only one caller of this function,
>>> and the caller always send chunk_root as root argument in
>>> current code, we can remove above conversion,
>>> and I suggest renaming root to chunk_root to make it clear,
>>> something like:
>>>
>>> - btrfs_read_chunk_tree(struct btrfs_root *root)
>>> + btrfs_read_chunk_tree(struct btrfs_root *chunk_root)
>>
>> Since root is only used to get fs_info->chunk_root, why not use fs_info
>> directly?
> 
> Weird.  Exactly this was a part of my fs_info patchset.  I guess I need
> to go back and check what else is missing.

Actually, most of this didn't land.  Pretty much anything that's a root
->fs_info conversion is in there.

-Jeff

> -Jeff
> 
> 
>> Thanks,
>> Qu
>>
>>>
>>> Thanks
>>> Zhaolei
>>>
 Signed-off-by: Sean Fu 
 ---
  fs/btrfs/volumes.c | 2 --
  1 file changed, 2 deletions(-)

 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
 index 366b335..384a6d2 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
  int ret;
  int slot;

 -root = root->fs_info->chunk_root;
 -
  path = btrfs_alloc_path();
  if (!path)
  return -ENOMEM;
 -- 
 2.6.2

>>>
>>>
>>>
>>>
>>> -- 
>>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>>> the body of a message to majord...@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> 


-- 
Jeff Mahoney
SUSE Labs



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-05 Thread Jeff Mahoney
On 9/5/16 11:05 PM, Jeff Mahoney wrote:
> On 9/5/16 3:56 AM, Qu Wenruo wrote:
>>
>>
>> At 09/05/2016 09:19 AM, Zhao Lei wrote:
>>> Hi, Sean Fu
>>>
 From: Sean Fu [mailto:fxinr...@gmail.com]
 Sent: Sunday, September 04, 2016 7:54 PM
 To: dste...@suse.com
 Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com;
 zhao...@cn.fujitsu.com; linux-bt...@vger.kernel.org;
 linux-kernel@vger.kernel.org; Sean Fu 
 Subject: [PATCH] Btrfs: remove unnecessary code of chunk_root
 assignment in
 btrfs_read_chunk_tree.

 The input argument root is already set with "fs_info->chunk_root".
 "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller
 "open_ctree".
 “root->fs_info = fs_info” in "btrfs_alloc_root".

>>> The root argument of this function means "any root".
>>> And the function is designed getting chunk root from
>>> "any root" in head.
>>>
>>> Since there is only one caller of this function,
>>> and the caller always send chunk_root as root argument in
>>> current code, we can remove above conversion,
>>> and I suggest renaming root to chunk_root to make it clear,
>>> something like:
>>>
>>> - btrfs_read_chunk_tree(struct btrfs_root *root)
>>> + btrfs_read_chunk_tree(struct btrfs_root *chunk_root)
>>
>> Since root is only used to get fs_info->chunk_root, why not use fs_info
>> directly?
> 
> Weird.  Exactly this was a part of my fs_info patchset.  I guess I need
> to go back and check what else is missing.

Actually, most of this didn't land.  Pretty much anything that's a root
->fs_info conversion is in there.

-Jeff

> -Jeff
> 
> 
>> Thanks,
>> Qu
>>
>>>
>>> Thanks
>>> Zhaolei
>>>
 Signed-off-by: Sean Fu 
 ---
  fs/btrfs/volumes.c | 2 --
  1 file changed, 2 deletions(-)

 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
 index 366b335..384a6d2 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
  int ret;
  int slot;

 -root = root->fs_info->chunk_root;
 -
  path = btrfs_alloc_path();
  if (!path)
  return -ENOMEM;
 -- 
 2.6.2

>>>
>>>
>>>
>>>
>>> -- 
>>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>>> the body of a message to majord...@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> 


-- 
Jeff Mahoney
SUSE Labs



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] ASoC: sun4i-codec: Distinguish sun4i from sun7i

2016-09-05 Thread Chen-Yu Tsai
On Tue, Sep 6, 2016 at 3:24 AM, Danny Milosavljevic
 wrote:
> ASoC: sun4i-codec: Distinguish sun4i from sun7i
>
> Introduce mechanism to detect sun7i and provide a different regmap, codec
> and different controls for it - different compared to sun4i Allwinner A10.
>
> The controls will be extended in a forthcoming patch - it is necessary to
> distinguish between sun4i and sun7i controls because the mic gains are in
> different registers.
>
> Renamed SUN4I_CODEC_AC_SYS_VERI to SUN7I_CODEC_AC_DAC_CAL and renamed
> SUN4I_CODEC_AC_MIC_PHONE_CAL to SUN7I_CODEC_AC_MIC_PHONE_CAL because these
> are actually not present on Allwinner A10.
>
> Handle quirks by regmap config and codec and select the correct quirks
> automatically.
>
> Signed-off-by: Danny Milosavljevic 

Acked-by: Chen-Yu Tsai 


Re: [PATCH] speakup: Add spinlock in synth_direct_store

2016-09-05 Thread Vaishali Thakkar


On Monday 05 September 2016 06:47 PM, Pavel Andrianov wrote:
> All operations with synth buffer should be protected,
> as there are global pointers, which should be modified atomically.
> 
> Found by Linux Driver Verification project (linuxtesting.org)
> 
> Signed-off-by: Pavel Andrianov 

Acked-by: Vaishali Thakkar 

> ---
>  drivers/staging/speakup/kobjects.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index 528cbdc..7fedee3 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -411,11 +411,13 @@ static ssize_t synth_direct_store(struct kobject *kobj,
>   int len;
>   int bytes;
>   const char *ptr = buf;
> + unsigned long flags;
>  
>   if (!synth)
>   return -EPERM;
>  
>   len = strlen(buf);
> + spin_lock_irqsave(_info.spinlock, flags);
>   while (len > 0) {
>   bytes = min_t(size_t, len, 250);
>   strncpy(tmp, ptr, bytes);
> @@ -425,6 +427,7 @@ static ssize_t synth_direct_store(struct kobject *kobj,
>   ptr += bytes;
>   len -= bytes;
>   }
> + spin_unlock_irqrestore(_info.spinlock, flags);
>   return count;
>  }
>  
> 

-- 
Vaishali


Re: [PATCH] ASoC: sun4i-codec: Distinguish sun4i from sun7i

2016-09-05 Thread Chen-Yu Tsai
On Tue, Sep 6, 2016 at 3:24 AM, Danny Milosavljevic
 wrote:
> ASoC: sun4i-codec: Distinguish sun4i from sun7i
>
> Introduce mechanism to detect sun7i and provide a different regmap, codec
> and different controls for it - different compared to sun4i Allwinner A10.
>
> The controls will be extended in a forthcoming patch - it is necessary to
> distinguish between sun4i and sun7i controls because the mic gains are in
> different registers.
>
> Renamed SUN4I_CODEC_AC_SYS_VERI to SUN7I_CODEC_AC_DAC_CAL and renamed
> SUN4I_CODEC_AC_MIC_PHONE_CAL to SUN7I_CODEC_AC_MIC_PHONE_CAL because these
> are actually not present on Allwinner A10.
>
> Handle quirks by regmap config and codec and select the correct quirks
> automatically.
>
> Signed-off-by: Danny Milosavljevic 

Acked-by: Chen-Yu Tsai 


Re: [PATCH] speakup: Add spinlock in synth_direct_store

2016-09-05 Thread Vaishali Thakkar


On Monday 05 September 2016 06:47 PM, Pavel Andrianov wrote:
> All operations with synth buffer should be protected,
> as there are global pointers, which should be modified atomically.
> 
> Found by Linux Driver Verification project (linuxtesting.org)
> 
> Signed-off-by: Pavel Andrianov 

Acked-by: Vaishali Thakkar 

> ---
>  drivers/staging/speakup/kobjects.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index 528cbdc..7fedee3 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -411,11 +411,13 @@ static ssize_t synth_direct_store(struct kobject *kobj,
>   int len;
>   int bytes;
>   const char *ptr = buf;
> + unsigned long flags;
>  
>   if (!synth)
>   return -EPERM;
>  
>   len = strlen(buf);
> + spin_lock_irqsave(_info.spinlock, flags);
>   while (len > 0) {
>   bytes = min_t(size_t, len, 250);
>   strncpy(tmp, ptr, bytes);
> @@ -425,6 +427,7 @@ static ssize_t synth_direct_store(struct kobject *kobj,
>   ptr += bytes;
>   len -= bytes;
>   }
> + spin_unlock_irqrestore(_info.spinlock, flags);
>   return count;
>  }
>  
> 

-- 
Vaishali


Re: [PATCH v2 3/3] arm: dts: thermal: add thermal/auxadc node.

2016-09-05 Thread Dawei Chien
Dear Rui,

On Tue, 2016-09-06 at 08:30 +0800, Zhang Rui wrote:
> On 二, 2016-09-06 at 08:24 +0800, Zhang Rui wrote:
> > On 四, 2016-08-18 at 11:50 +0800, Dawei Chien wrote:
> > > 
> > > This adds the thermal controller and auxadc nodes
> > > to the Mediatek MT2701 dtsi file.
> > > 
> > > Signed-off-by: Dawei Chien 
> > > ---
> > > This patch depned on:
> > > https://patchwork.kernel.org/patch/9249589/
> > > https://patchwork.kernel.org/patch/9249589/
> > Hmm, does this mean that I should take all these three patches and
> > hold
> > the patches in next merge window until the above patch has been
> > merged?
> > 
Yes, this patch is base on auxadc patchset.

> Patch 3/3 can not be applied on top of upstream kernel, so I guess it
> still has some other dependencies.
> I think I can apply patch 1, 2 first. And patch 3/3 should be handled
> in the dt tree.

Sorry, this patch is also need Mediatek's clock patchset what I miss to
add in dependency list, I would resend this dt tree once clock patch
merge, or resend this for right dependency on next version, thank you.

> thanks,
> rui
> > thanks,
> > rui 
> > > 
> > > ---
> > >  arch/arm/boot/dts/mt2701.dtsi |   44
> > > +
> > >  1 file changed, 44 insertions(+)
> > > 
> > > diff --git a/arch/arm/boot/dts/mt2701.dtsi
> > > b/arch/arm/boot/dts/mt2701.dtsi
> > > index e9150a4..cee4724 100644
> > > --- a/arch/arm/boot/dts/mt2701.dtsi
> > > +++ b/arch/arm/boot/dts/mt2701.dtsi
> > > @@ -87,6 +87,36 @@
> > >   clock-output-names = "rtc32k";
> > >   };
> > >  
> > > + thermal-zones {
> > > + cpu_thermal: cpu_thermal {
> > > + polling-delay-passive = <1000>; /*
> > > milliseconds */
> > > + polling-delay = <1000>; /* milliseconds */
> > > +
> > > + thermal-sensors = < 0>;
> > > + sustainable-power = <1000>;
> > > +
> > > + trips {
> > > + threshold: trip-point@0 {
> > > + temperature = <68000>;
> > > + hysteresis = <2000>;
> > > + type = "passive";
> > > + };
> > > +
> > > + target: trip-point@1 {
> > > + temperature = <85000>;
> > > + hysteresis = <2000>;
> > > + type = "passive";
> > > + };
> > > +
> > > + cpu_crit: cpu_crit@0 {
> > > + temperature = <115000>;
> > > + hysteresis = <2000>;
> > > + type = "critical";
> > > + };
> > > + };
> > > + };
> > > + };
> > > +
> > >   timer {
> > >   compatible = "arm,armv7-timer";
> > >   interrupt-parent = <>;
> > > @@ -222,4 +252,18 @@
> > >   clock-names = "baud", "bus";
> > >   status = "disabled";
> > >   };
> > > +
> > > + thermal: thermal@1100b000 {
> > > + #thermal-sensor-cells = <0>;
> > > + compatible = "mediatek,mt2701-thermal";
> > > + reg = <0 0x1100b000 0 0x1000>;
> > > + interrupts = ;
> > > + clocks = < CLK_PERI_THERM>, <
> > > CLK_PERI_AUXADC>;
> > > + clock-names = "therm", "auxadc";
> > > + resets = < 0x10>;
> > > + reset-names = "therm";
> > > + mediatek,auxadc = <>;
> > > + mediatek,apmixedsys = <>;
> > > + };
> > > +
> > >  };
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-pm"
> > in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html




Re: ACPI-video: Fine-tuning for several function implementations

2016-09-05 Thread SF Markus Elfring
> I'd prefer this to be combined into fewer patches
> that each will address several issues of one type,

I understand your concern a bit in principle.


> ie. put all label renames into one patch,

Are any of my update suggestions controversial here?


> all size determination improvements into another one and so on.

I am unsure about the acceptance for the selected software change opportunities.
So I chose a very specific patch granularity intentionally.

I tend to provide some change ideas for each affected function
implementation individually. I imagine that this way should support
the recombination of update steps to some degree already, shouldn't it?

Regards,
Markus


Re: [PATCH v2 3/3] arm: dts: thermal: add thermal/auxadc node.

2016-09-05 Thread Dawei Chien
Dear Rui,

On Tue, 2016-09-06 at 08:30 +0800, Zhang Rui wrote:
> On 二, 2016-09-06 at 08:24 +0800, Zhang Rui wrote:
> > On 四, 2016-08-18 at 11:50 +0800, Dawei Chien wrote:
> > > 
> > > This adds the thermal controller and auxadc nodes
> > > to the Mediatek MT2701 dtsi file.
> > > 
> > > Signed-off-by: Dawei Chien 
> > > ---
> > > This patch depned on:
> > > https://patchwork.kernel.org/patch/9249589/
> > > https://patchwork.kernel.org/patch/9249589/
> > Hmm, does this mean that I should take all these three patches and
> > hold
> > the patches in next merge window until the above patch has been
> > merged?
> > 
Yes, this patch is base on auxadc patchset.

> Patch 3/3 can not be applied on top of upstream kernel, so I guess it
> still has some other dependencies.
> I think I can apply patch 1, 2 first. And patch 3/3 should be handled
> in the dt tree.

Sorry, this patch is also need Mediatek's clock patchset what I miss to
add in dependency list, I would resend this dt tree once clock patch
merge, or resend this for right dependency on next version, thank you.

> thanks,
> rui
> > thanks,
> > rui 
> > > 
> > > ---
> > >  arch/arm/boot/dts/mt2701.dtsi |   44
> > > +
> > >  1 file changed, 44 insertions(+)
> > > 
> > > diff --git a/arch/arm/boot/dts/mt2701.dtsi
> > > b/arch/arm/boot/dts/mt2701.dtsi
> > > index e9150a4..cee4724 100644
> > > --- a/arch/arm/boot/dts/mt2701.dtsi
> > > +++ b/arch/arm/boot/dts/mt2701.dtsi
> > > @@ -87,6 +87,36 @@
> > >   clock-output-names = "rtc32k";
> > >   };
> > >  
> > > + thermal-zones {
> > > + cpu_thermal: cpu_thermal {
> > > + polling-delay-passive = <1000>; /*
> > > milliseconds */
> > > + polling-delay = <1000>; /* milliseconds */
> > > +
> > > + thermal-sensors = < 0>;
> > > + sustainable-power = <1000>;
> > > +
> > > + trips {
> > > + threshold: trip-point@0 {
> > > + temperature = <68000>;
> > > + hysteresis = <2000>;
> > > + type = "passive";
> > > + };
> > > +
> > > + target: trip-point@1 {
> > > + temperature = <85000>;
> > > + hysteresis = <2000>;
> > > + type = "passive";
> > > + };
> > > +
> > > + cpu_crit: cpu_crit@0 {
> > > + temperature = <115000>;
> > > + hysteresis = <2000>;
> > > + type = "critical";
> > > + };
> > > + };
> > > + };
> > > + };
> > > +
> > >   timer {
> > >   compatible = "arm,armv7-timer";
> > >   interrupt-parent = <>;
> > > @@ -222,4 +252,18 @@
> > >   clock-names = "baud", "bus";
> > >   status = "disabled";
> > >   };
> > > +
> > > + thermal: thermal@1100b000 {
> > > + #thermal-sensor-cells = <0>;
> > > + compatible = "mediatek,mt2701-thermal";
> > > + reg = <0 0x1100b000 0 0x1000>;
> > > + interrupts = ;
> > > + clocks = < CLK_PERI_THERM>, <
> > > CLK_PERI_AUXADC>;
> > > + clock-names = "therm", "auxadc";
> > > + resets = < 0x10>;
> > > + reset-names = "therm";
> > > + mediatek,auxadc = <>;
> > > + mediatek,apmixedsys = <>;
> > > + };
> > > +
> > >  };
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-pm"
> > in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html




Re: ACPI-video: Fine-tuning for several function implementations

2016-09-05 Thread SF Markus Elfring
> I'd prefer this to be combined into fewer patches
> that each will address several issues of one type,

I understand your concern a bit in principle.


> ie. put all label renames into one patch,

Are any of my update suggestions controversial here?


> all size determination improvements into another one and so on.

I am unsure about the acceptance for the selected software change opportunities.
So I chose a very specific patch granularity intentionally.

I tend to provide some change ideas for each affected function
implementation individually. I imagine that this way should support
the recombination of update steps to some degree already, shouldn't it?

Regards,
Markus


[PATCH] mfd: Add HiSilicon Flash Memory Controller(FMC) driver

2016-09-05 Thread linshunquan 00354166
From: Shunquan Lin 

This patch adds driver support for HiSilicon Flash Memory
Controller(FMC). HiSilicon FMC is a multi-functions device which
supports SPI Nor flash controller, SPI nand Flash controller and
parallel nand flash controller.

Signed-off-by: Shunquan Lin 
---
 .../devicetree/bindings/mfd/hisilicon,hisi-fmc.txt |  54 ++
 drivers/mfd/Kconfig|  10 ++
 drivers/mfd/Makefile   |   1 +
 drivers/mfd/hisi_fmc.c | 109 +
 include/linux/mfd/hisi_fmc.h   |  92 +
 5 files changed, 266 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt
 create mode 100644 drivers/mfd/hisi_fmc.c
 create mode 100644 include/linux/mfd/hisi_fmc.h

diff --git a/Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt 
b/Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt
new file mode 100644
index 000..cdaa0bf
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt
@@ -0,0 +1,54 @@
+HiSilicon Flash Memory Controller
+
+The HiSilicon Flash Memory Controller(FMC) is a feature-rich controller
+that supports SPI Nor, SPI Nand and Parallel Nand devices. This document
+describes the binding for HiSilicon FMC device and its sub-notes.
+
+Required properties:
+- compatible : Should be "hisilicon,hisi-fmc".
+- reg : Offset and length of the register set for the controller device.
+- reg-names : Must include the following two entries: "control", "memory".
+- address-cells : Should be 1.
+- size-cells : Should be 0.
+- clocks : A phandle to the HiSilicon FMC controller clock.
+
+Optional sub-nodes:
+   - spi-nor:
+   Required properties:
+   - compatible : "hisilicon,fmc-spi-nor"
+   see "Documentation/devicetree/bindings/mtd/hisilicon,fmc-spi-nor.txt
+
+   - spi-nand:
+   Required properties:
+   - compatible : "hisilicon,fmc-spi-nand"
+   - reg : The chipselect for spi-nand devices
+   - address-cells : Should be 1.
+   - size-cells : Should be 0.
+
+   - nand:
+   Required properties:
+   - compatible : "hisilicon,fmc-nand"
+   - reg : The chipselect for nand devices
+   - address-cells : Should be 1.
+   - size-cells : Should be 0.
+
+Example:
+fmc: spi-nor-controller@1000 {
+compatible = "hisilicon,hisi-fmc";
+reg = <0x1000 0x1000>, <0x1400 0x100>;
+reg-names = "control", "memory";
+clocks = < FMC_CLK>;
+#address-cells = <1>;
+#size-cells = <0>;
+
+hisfc:spi-nor@0 {
+  compatible = "hisilicon,fmc-spi-nor";
+  #address-cells = <1>;
+  #size-cells = <0>;
+  hi_sfc {
+  compatible = "jedec,spi-nor";
+  reg = <0>;
+  };
+   };
+
+};
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 2d1fb64..57473dc 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -340,6 +340,16 @@ config MFD_HI655X_PMIC
help
  Select this option to enable Hisilicon hi655x series pmic driver.
 
+config MFD_HISI_FMC
+   tristate "HiSilicon Flash Memory Controller"
+   depends on OF
+   select MFD_CORE
+   select REGMAP_MMIO
+   default y if (SPI_HISI_SFC)
+   help
+ Select this option to enable the HiSilicon Flash Memory
+ Controller(FMC) driver.
+
 config HTC_EGPIO
bool "HTC EGPIO support"
depends on GPIOLIB && ARM
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 2ba3ba3..a2476fb 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -176,6 +176,7 @@ obj-$(CONFIG_MFD_TPS65090)  += tps65090.o
 obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o
 obj-$(CONFIG_MFD_ATMEL_FLEXCOM)+= atmel-flexcom.o
 obj-$(CONFIG_MFD_ATMEL_HLCDC)  += atmel-hlcdc.o
+obj-$(CONFIG_MFD_HISI_FMC) += hisi_fmc.o
 obj-$(CONFIG_MFD_INTEL_LPSS)   += intel-lpss.o
 obj-$(CONFIG_MFD_INTEL_LPSS_PCI)   += intel-lpss-pci.o
 obj-$(CONFIG_MFD_INTEL_LPSS_ACPI)  += intel-lpss-acpi.o
diff --git a/drivers/mfd/hisi_fmc.c b/drivers/mfd/hisi_fmc.c
new file mode 100644
index 000..97ae3be
--- /dev/null
+++ b/drivers/mfd/hisi_fmc.c
@@ -0,0 +1,109 @@
+/* HiSilicon Flash Memory Controller Driver
+ *
+ * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) 

[PATCH] mfd: Add HiSilicon Flash Memory Controller(FMC) driver

2016-09-05 Thread linshunquan 00354166
From: Shunquan Lin 

This patch adds driver support for HiSilicon Flash Memory
Controller(FMC). HiSilicon FMC is a multi-functions device which
supports SPI Nor flash controller, SPI nand Flash controller and
parallel nand flash controller.

Signed-off-by: Shunquan Lin 
---
 .../devicetree/bindings/mfd/hisilicon,hisi-fmc.txt |  54 ++
 drivers/mfd/Kconfig|  10 ++
 drivers/mfd/Makefile   |   1 +
 drivers/mfd/hisi_fmc.c | 109 +
 include/linux/mfd/hisi_fmc.h   |  92 +
 5 files changed, 266 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt
 create mode 100644 drivers/mfd/hisi_fmc.c
 create mode 100644 include/linux/mfd/hisi_fmc.h

diff --git a/Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt 
b/Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt
new file mode 100644
index 000..cdaa0bf
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/hisilicon,hisi-fmc.txt
@@ -0,0 +1,54 @@
+HiSilicon Flash Memory Controller
+
+The HiSilicon Flash Memory Controller(FMC) is a feature-rich controller
+that supports SPI Nor, SPI Nand and Parallel Nand devices. This document
+describes the binding for HiSilicon FMC device and its sub-notes.
+
+Required properties:
+- compatible : Should be "hisilicon,hisi-fmc".
+- reg : Offset and length of the register set for the controller device.
+- reg-names : Must include the following two entries: "control", "memory".
+- address-cells : Should be 1.
+- size-cells : Should be 0.
+- clocks : A phandle to the HiSilicon FMC controller clock.
+
+Optional sub-nodes:
+   - spi-nor:
+   Required properties:
+   - compatible : "hisilicon,fmc-spi-nor"
+   see "Documentation/devicetree/bindings/mtd/hisilicon,fmc-spi-nor.txt
+
+   - spi-nand:
+   Required properties:
+   - compatible : "hisilicon,fmc-spi-nand"
+   - reg : The chipselect for spi-nand devices
+   - address-cells : Should be 1.
+   - size-cells : Should be 0.
+
+   - nand:
+   Required properties:
+   - compatible : "hisilicon,fmc-nand"
+   - reg : The chipselect for nand devices
+   - address-cells : Should be 1.
+   - size-cells : Should be 0.
+
+Example:
+fmc: spi-nor-controller@1000 {
+compatible = "hisilicon,hisi-fmc";
+reg = <0x1000 0x1000>, <0x1400 0x100>;
+reg-names = "control", "memory";
+clocks = < FMC_CLK>;
+#address-cells = <1>;
+#size-cells = <0>;
+
+hisfc:spi-nor@0 {
+  compatible = "hisilicon,fmc-spi-nor";
+  #address-cells = <1>;
+  #size-cells = <0>;
+  hi_sfc {
+  compatible = "jedec,spi-nor";
+  reg = <0>;
+  };
+   };
+
+};
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 2d1fb64..57473dc 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -340,6 +340,16 @@ config MFD_HI655X_PMIC
help
  Select this option to enable Hisilicon hi655x series pmic driver.
 
+config MFD_HISI_FMC
+   tristate "HiSilicon Flash Memory Controller"
+   depends on OF
+   select MFD_CORE
+   select REGMAP_MMIO
+   default y if (SPI_HISI_SFC)
+   help
+ Select this option to enable the HiSilicon Flash Memory
+ Controller(FMC) driver.
+
 config HTC_EGPIO
bool "HTC EGPIO support"
depends on GPIOLIB && ARM
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 2ba3ba3..a2476fb 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -176,6 +176,7 @@ obj-$(CONFIG_MFD_TPS65090)  += tps65090.o
 obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o
 obj-$(CONFIG_MFD_ATMEL_FLEXCOM)+= atmel-flexcom.o
 obj-$(CONFIG_MFD_ATMEL_HLCDC)  += atmel-hlcdc.o
+obj-$(CONFIG_MFD_HISI_FMC) += hisi_fmc.o
 obj-$(CONFIG_MFD_INTEL_LPSS)   += intel-lpss.o
 obj-$(CONFIG_MFD_INTEL_LPSS_PCI)   += intel-lpss-pci.o
 obj-$(CONFIG_MFD_INTEL_LPSS_ACPI)  += intel-lpss-acpi.o
diff --git a/drivers/mfd/hisi_fmc.c b/drivers/mfd/hisi_fmc.c
new file mode 100644
index 000..97ae3be
--- /dev/null
+++ b/drivers/mfd/hisi_fmc.c
@@ -0,0 +1,109 @@
+/* HiSilicon Flash Memory Controller Driver
+ *
+ * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed 

drivers/nvme/host/nvme.h:217:20: error: 'REQ_OP_DISCARD' undeclared

2016-09-05 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   c6935931c1894ff857616ff8549b61236a19148f
commit: aa71987472a974f4f6dc4be377720564079ef42e nvme: fabrics drivers don't 
need the nvme-pci driver
date:   2 weeks ago
config: i386-randconfig-h0-09052023 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
git checkout aa71987472a974f4f6dc4be377720564079ef42e
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/nvme/host/core.c:16:0:
   include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type
 struct kobject  kobj;
 ^~~~
   include/linux/blk-mq.h:128:2: error: unknown type name 'softirq_done_fn'
 softirq_done_fn  *complete;
 ^~~
   include/linux/blk-mq.h:181:33: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
int blk_mq_register_disk(struct gendisk *);
^~~
   include/linux/blk-mq.h:182:36: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
void blk_mq_unregister_disk(struct gendisk *);
   ^~~
   include/linux/blk-mq.h: In function 'blk_mq_rq_from_pdu':
   include/linux/blk-mq.h:260:22: error: invalid application of 'sizeof' to 
incomplete type 'struct request'
 return pdu - sizeof(struct request);
 ^~
   include/linux/blk-mq.h: In function 'blk_mq_rq_to_pdu':
   include/linux/blk-mq.h:264:2: error: invalid use of undefined type 'struct 
request'
 return rq + 1;
 ^~
   In file included from drivers/nvme/host/core.c:32:0:
   drivers/nvme/host/nvme.h: In function 'nvme_map_len':
   drivers/nvme/host/nvme.h:217:6: error: implicit declaration of function 
'req_op' [-Werror=implicit-function-declaration]
 if (req_op(rq) == REQ_OP_DISCARD)
 ^~
>> drivers/nvme/host/nvme.h:217:20: error: 'REQ_OP_DISCARD' undeclared (first 
>> use in this function)
 if (req_op(rq) == REQ_OP_DISCARD)
   ^~
   drivers/nvme/host/nvme.h:217:20: note: each undeclared identifier is 
reported only once for each function it appears in
   drivers/nvme/host/nvme.h:220:10: error: implicit declaration of function 
'blk_rq_bytes' [-Werror=implicit-function-declaration]
  return blk_rq_bytes(rq);
 ^~~~
   drivers/nvme/host/nvme.h: In function 'nvme_cleanup_cmd':
   drivers/nvme/host/nvme.h:225:21: error: 'REQ_OP_DISCARD' undeclared (first 
use in this function)
 if (req_op(req) == REQ_OP_DISCARD)
^~
   drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete 
type 'struct request'
  kfree(req->completion_data);
   ^~
   drivers/nvme/host/nvme.h: In function 'nvme_req_needs_retry':
   drivers/nvme/host/nvme.h:243:35: error: implicit declaration of function 
'blk_noretry_request' [-Werror=implicit-function-declaration]
 return !(status & NVME_SC_DNR || blk_noretry_request(req)) &&
  ^~~
   drivers/nvme/host/core.c: In function 'nvme_cancel_request':
   drivers/nvme/host/core.c:75:6: error: implicit declaration of function 
'blk_queue_dying' [-Werror=implicit-function-declaration]
 if (blk_queue_dying(req->q))
 ^~~
   drivers/nvme/host/core.c: In function 'nvme_free_ns':
   drivers/nvme/host/core.c:157:42: error: dereferencing pointer to incomplete 
type 'struct gendisk'
  nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
 ^~
   drivers/nvme/host/core.c:163:2: error: implicit declaration of function 
'put_disk' [-Werror=implicit-function-declaration]
 put_disk(ns->disk);
 ^~~~
   drivers/nvme/host/core.c: In function 'nvme_requeue_req':
   drivers/nvme/host/core.c:203:7: error: implicit declaration of function 
'blk_queue_stopped' [-Werror=implicit-function-declaration]
 if (!blk_queue_stopped(req->q))
  ^
   drivers/nvme/host/core.c: In function 'nvme_alloc_request':
   drivers/nvme/host/core.c:223:18: error: 'REQ_TYPE_DRV_PRIV' undeclared 
(first use in this function)
 req->cmd_type = REQ_TYPE_DRV_PRIV;
 ^
>> drivers/nvme/host/core.c:224:20: error: 'REQ_FAILFAST_DRIVER' undeclared 
>> (first use in this function)
 req->cmd_flags |= REQ_FAILFAST_DRIVER;
   ^~~
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from 

drivers/nvme/host/nvme.h:217:20: error: 'REQ_OP_DISCARD' undeclared

2016-09-05 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   c6935931c1894ff857616ff8549b61236a19148f
commit: aa71987472a974f4f6dc4be377720564079ef42e nvme: fabrics drivers don't 
need the nvme-pci driver
date:   2 weeks ago
config: i386-randconfig-h0-09052023 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
git checkout aa71987472a974f4f6dc4be377720564079ef42e
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/nvme/host/core.c:16:0:
   include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type
 struct kobject  kobj;
 ^~~~
   include/linux/blk-mq.h:128:2: error: unknown type name 'softirq_done_fn'
 softirq_done_fn  *complete;
 ^~~
   include/linux/blk-mq.h:181:33: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
int blk_mq_register_disk(struct gendisk *);
^~~
   include/linux/blk-mq.h:182:36: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
void blk_mq_unregister_disk(struct gendisk *);
   ^~~
   include/linux/blk-mq.h: In function 'blk_mq_rq_from_pdu':
   include/linux/blk-mq.h:260:22: error: invalid application of 'sizeof' to 
incomplete type 'struct request'
 return pdu - sizeof(struct request);
 ^~
   include/linux/blk-mq.h: In function 'blk_mq_rq_to_pdu':
   include/linux/blk-mq.h:264:2: error: invalid use of undefined type 'struct 
request'
 return rq + 1;
 ^~
   In file included from drivers/nvme/host/core.c:32:0:
   drivers/nvme/host/nvme.h: In function 'nvme_map_len':
   drivers/nvme/host/nvme.h:217:6: error: implicit declaration of function 
'req_op' [-Werror=implicit-function-declaration]
 if (req_op(rq) == REQ_OP_DISCARD)
 ^~
>> drivers/nvme/host/nvme.h:217:20: error: 'REQ_OP_DISCARD' undeclared (first 
>> use in this function)
 if (req_op(rq) == REQ_OP_DISCARD)
   ^~
   drivers/nvme/host/nvme.h:217:20: note: each undeclared identifier is 
reported only once for each function it appears in
   drivers/nvme/host/nvme.h:220:10: error: implicit declaration of function 
'blk_rq_bytes' [-Werror=implicit-function-declaration]
  return blk_rq_bytes(rq);
 ^~~~
   drivers/nvme/host/nvme.h: In function 'nvme_cleanup_cmd':
   drivers/nvme/host/nvme.h:225:21: error: 'REQ_OP_DISCARD' undeclared (first 
use in this function)
 if (req_op(req) == REQ_OP_DISCARD)
^~
   drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete 
type 'struct request'
  kfree(req->completion_data);
   ^~
   drivers/nvme/host/nvme.h: In function 'nvme_req_needs_retry':
   drivers/nvme/host/nvme.h:243:35: error: implicit declaration of function 
'blk_noretry_request' [-Werror=implicit-function-declaration]
 return !(status & NVME_SC_DNR || blk_noretry_request(req)) &&
  ^~~
   drivers/nvme/host/core.c: In function 'nvme_cancel_request':
   drivers/nvme/host/core.c:75:6: error: implicit declaration of function 
'blk_queue_dying' [-Werror=implicit-function-declaration]
 if (blk_queue_dying(req->q))
 ^~~
   drivers/nvme/host/core.c: In function 'nvme_free_ns':
   drivers/nvme/host/core.c:157:42: error: dereferencing pointer to incomplete 
type 'struct gendisk'
  nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
 ^~
   drivers/nvme/host/core.c:163:2: error: implicit declaration of function 
'put_disk' [-Werror=implicit-function-declaration]
 put_disk(ns->disk);
 ^~~~
   drivers/nvme/host/core.c: In function 'nvme_requeue_req':
   drivers/nvme/host/core.c:203:7: error: implicit declaration of function 
'blk_queue_stopped' [-Werror=implicit-function-declaration]
 if (!blk_queue_stopped(req->q))
  ^
   drivers/nvme/host/core.c: In function 'nvme_alloc_request':
   drivers/nvme/host/core.c:223:18: error: 'REQ_TYPE_DRV_PRIV' undeclared 
(first use in this function)
 req->cmd_type = REQ_TYPE_DRV_PRIV;
 ^
>> drivers/nvme/host/core.c:224:20: error: 'REQ_FAILFAST_DRIVER' undeclared 
>> (first use in this function)
 req->cmd_flags |= REQ_FAILFAST_DRIVER;
   ^~~
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from 

Re: [PATCH] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

2016-09-05 Thread Jeff Mahoney
On 9/5/16 3:56 AM, Qu Wenruo wrote:
> 
> 
> At 09/05/2016 09:19 AM, Zhao Lei wrote:
>> Hi, Sean Fu
>>
>>> From: Sean Fu [mailto:fxinr...@gmail.com]
>>> Sent: Sunday, September 04, 2016 7:54 PM
>>> To: dste...@suse.com
>>> Cc: c...@fb.com; anand.j...@oracle.com; fdman...@suse.com;
>>> zhao...@cn.fujitsu.com; linux-bt...@vger.kernel.org;
>>> linux-kernel@vger.kernel.org; Sean Fu 
>>> Subject: [PATCH] Btrfs: remove unnecessary code of chunk_root
>>> assignment in
>>> btrfs_read_chunk_tree.
>>>
>>> The input argument root is already set with "fs_info->chunk_root".
>>> "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller
>>> "open_ctree".
>>> “root->fs_info = fs_info” in "btrfs_alloc_root".
>>>
>> The root argument of this function means "any root".
>> And the function is designed getting chunk root from
>> "any root" in head.
>>
>> Since there is only one caller of this function,
>> and the caller always send chunk_root as root argument in
>> current code, we can remove above conversion,
>> and I suggest renaming root to chunk_root to make it clear,
>> something like:
>>
>> - btrfs_read_chunk_tree(struct btrfs_root *root)
>> + btrfs_read_chunk_tree(struct btrfs_root *chunk_root)
> 
> Since root is only used to get fs_info->chunk_root, why not use fs_info
> directly?

Weird.  Exactly this was a part of my fs_info patchset.  I guess I need
to go back and check what else is missing.

-Jeff


> Thanks,
> Qu
> 
>>
>> Thanks
>> Zhaolei
>>
>>> Signed-off-by: Sean Fu 
>>> ---
>>>  fs/btrfs/volumes.c | 2 --
>>>  1 file changed, 2 deletions(-)
>>>
>>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>>> index 366b335..384a6d2 100644
>>> --- a/fs/btrfs/volumes.c
>>> +++ b/fs/btrfs/volumes.c
>>> @@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
>>>  int ret;
>>>  int slot;
>>>
>>> -root = root->fs_info->chunk_root;
>>> -
>>>  path = btrfs_alloc_path();
>>>  if (!path)
>>>  return -ENOMEM;
>>> -- 
>>> 2.6.2
>>>
>>
>>
>>
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
Jeff Mahoney
SUSE Labs



signature.asc
Description: OpenPGP digital signature


drivers/nvme/host/core.c:202:2: note: in expansion of macro 'spin_lock_irqsave'

2016-09-05 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   c6935931c1894ff857616ff8549b61236a19148f
commit: aa71987472a974f4f6dc4be377720564079ef42e nvme: fabrics drivers don't 
need the nvme-pci driver
date:   2 weeks ago
config: x86_64-randconfig-n0-09052021 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
git checkout aa71987472a974f4f6dc4be377720564079ef42e
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from drivers/nvme/host/core.c:16:0:
   include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type
 struct kobject  kobj;
 ^
   include/linux/blk-mq.h:128:2: error: unknown type name 'softirq_done_fn'
 softirq_done_fn  *complete;
 ^
   include/linux/blk-mq.h:181:33: warning: 'struct gendisk' declared inside 
parameter list [enabled by default]
int blk_mq_register_disk(struct gendisk *);
^
   include/linux/blk-mq.h:181:33: warning: its scope is only this definition or 
declaration, which is probably not what you want [enabled by default]
   include/linux/blk-mq.h:182:36: warning: 'struct gendisk' declared inside 
parameter list [enabled by default]
void blk_mq_unregister_disk(struct gendisk *);
   ^
   include/linux/blk-mq.h: In function 'blk_mq_rq_from_pdu':
   include/linux/blk-mq.h:260:22: error: invalid application of 'sizeof' to 
incomplete type 'struct request'
 return pdu - sizeof(struct request);
 ^
   include/linux/blk-mq.h: In function 'blk_mq_rq_to_pdu':
   include/linux/blk-mq.h:264:2: error: invalid use of undefined type 'struct 
request'
 return rq + 1;
 ^
   In file included from drivers/nvme/host/core.c:32:0:
   drivers/nvme/host/nvme.h: In function 'nvme_map_len':
   drivers/nvme/host/nvme.h:217:2: error: implicit declaration of function 
'req_op' [-Werror=implicit-function-declaration]
 if (req_op(rq) == REQ_OP_DISCARD)
 ^
   drivers/nvme/host/nvme.h:220:3: error: implicit declaration of function 
'blk_rq_bytes' [-Werror=implicit-function-declaration]
  return blk_rq_bytes(rq);
  ^
   drivers/nvme/host/nvme.h: In function 'nvme_cleanup_cmd':
   drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete 
type
  kfree(req->completion_data);
   ^
   drivers/nvme/host/nvme.h: In function 'nvme_req_needs_retry':
   drivers/nvme/host/nvme.h:243:2: error: implicit declaration of function 
'blk_noretry_request' [-Werror=implicit-function-declaration]
 return !(status & NVME_SC_DNR || blk_noretry_request(req)) &&
 ^
   drivers/nvme/host/nvme.h:244:17: error: dereferencing pointer to incomplete 
type
  (jiffies - req->start_time) < req->timeout &&
^
   drivers/nvme/host/nvme.h:244:36: error: dereferencing pointer to incomplete 
type
  (jiffies - req->start_time) < req->timeout &&
   ^
   drivers/nvme/host/nvme.h:245:6: error: dereferencing pointer to incomplete 
type
  req->retries < nvme_max_retries;
 ^
   In file included from include/linux/pci.h:30:0,
from drivers/nvme/host/nvme.h:18,
from drivers/nvme/host/core.c:32:
   drivers/nvme/host/core.c: In function 'nvme_cancel_request':
   drivers/nvme/host/core.c:72:29: error: dereferencing pointer to incomplete 
type
"Cancelling I/O %d", req->tag);
^
   include/linux/device.h:1294:38: note: in definition of macro 
'dev_dbg_ratelimited'
  dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
 ^
   drivers/nvme/host/core.c:75:2: error: implicit declaration of function 
'blk_queue_dying' [-Werror=implicit-function-declaration]
 if (blk_queue_dying(req->q))
 ^
   drivers/nvme/host/core.c:75:25: error: dereferencing pointer to incomplete 
type
 if (blk_queue_dying(req->q))
^
   drivers/nvme/host/core.c: In function 'nvme_free_ns':
   drivers/nvme/host/core.c:157:42: error: dereferencing pointer to incomplete 
type
  nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
 ^
   drivers/nvme/host/core.c:160:10: error: dereferencing pointer to incomplete 
type
 ns->disk->private_data = NULL;
 ^
   drivers/nvme/host/core.c:163:2: error: implicit declaration of function 
'put_disk' [-Werror=implicit-function-declaration]
 put_disk(ns->disk);
 ^
   drivers/nvme/host/core.c: In function 'nvme_get_ns_from_disk':
   drivers/nvme/host/core.c:179:11: error: dereferencing pointer to incomplete 
type
 ns = disk->private_data;
  ^
   In file included from include/linux/seqlock.h:35:0,
from include/linux/time.h:5,
from 

Re: [PATCH v2 4/7] dts: sun8i-h3: add UART1-3 to Orange Pi Plus

2016-09-05 Thread Chen-Yu Tsai
On Tue, Sep 6, 2016 at 3:31 AM, Maxime Ripard
 wrote:
> Hi Jorik,
>
> On Sat, Sep 03, 2016 at 02:09:32PM +0200, Jorik Jonker wrote:
>> On Fri, Sep 02, 2016 at 09:04:25AM +0200, Maxime Ripard wrote:
>> >Unfortunately, these pins can be used for other purposes as well, so
>> >we cannot make force that decision down to our users.
>>
>> Yes, but since the associated peripheral is disabled, the users are free to
>> configure other functions/peripherals, right? I mean something like this in
>> pseudo-DT:
>>
>> /soc/pio: pinctrl@01c20800/uart1_pins:
>>   allwinner,pins = "PG6, PG7";
>> /soc/pio: pinctrl@01c20800/foo0_pins:
>>   allwinner,pins = "PG6, PG7";
>>   ..
>> /soc/uart1: serial@serial@01c28400:
>>   pinctrl-0 = <_pins>;
>>   status = "disabled";
>> /soc/bar:
>>   pinctrl-0 = <_pins>;
>>   status = "disabled";
>>
>> Assuming Linux/DT allows this, this would force nothing, only offer choice
>> and ease of use.
>
> Hmm, sorry, I went over your patches too quickly...
>
> That's a great compromise I think. Chen-Yu, any opinion on this?

In short, I'm ok with it. But please put an explicit

status = "disabled";

and probably a comment about how/where the peripheral can be
used in the board dts.

I intended to do this for the Banana Pis. Though my original plan
was to enable Raspberry Pi compatible peripherals by default, and
list the other peripherals that are defined by the vendor as
"disabled".

"Defined by the vendor" means that the vendor has some sort of
document associating the gpio header pins with the peripherals,
as shown in:

http://www.orangepi.org/Docs/Pindefinition.html#CON3_Definition

This should make it easier for the average user to enable the
peripherals. I'm not sure we should list _all_ possible ones
though. That would make the list very large, and some might
end up never being used.


Regards
ChenYu


drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete type 'struct request'

2016-09-05 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   c6935931c1894ff857616ff8549b61236a19148f
commit: aa71987472a974f4f6dc4be377720564079ef42e nvme: fabrics drivers don't 
need the nvme-pci driver
date:   2 weeks ago
config: x86_64-randconfig-n0-09052021 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
git checkout aa71987472a974f4f6dc4be377720564079ef42e
# save the attached .config to linux build tree
make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/nvme/host/core.c:16:0:
   include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type
 struct kobject  kobj;
 ^~~~
   include/linux/blk-mq.h:128:2: error: unknown type name 'softirq_done_fn'
 softirq_done_fn  *complete;
 ^~~
>> include/linux/blk-mq.h:181:33: warning: 'struct gendisk' declared inside 
>> parameter list will not be visible outside of this definition or declaration
int blk_mq_register_disk(struct gendisk *);
^~~
   include/linux/blk-mq.h:182:36: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
void blk_mq_unregister_disk(struct gendisk *);
   ^~~
   include/linux/blk-mq.h: In function 'blk_mq_rq_from_pdu':
   include/linux/blk-mq.h:260:22: error: invalid application of 'sizeof' to 
incomplete type 'struct request'
 return pdu - sizeof(struct request);
 ^~
   include/linux/blk-mq.h: In function 'blk_mq_rq_to_pdu':
   include/linux/blk-mq.h:264:2: error: invalid use of undefined type 'struct 
request'
 return rq + 1;
 ^~
   In file included from drivers/nvme/host/core.c:32:0:
   drivers/nvme/host/nvme.h: In function 'nvme_map_len':
   drivers/nvme/host/nvme.h:217:6: error: implicit declaration of function 
'req_op' [-Werror=implicit-function-declaration]
 if (req_op(rq) == REQ_OP_DISCARD)
 ^~
   drivers/nvme/host/nvme.h:220:10: error: implicit declaration of function 
'blk_rq_bytes' [-Werror=implicit-function-declaration]
  return blk_rq_bytes(rq);
 ^~~~
   drivers/nvme/host/nvme.h: In function 'nvme_cleanup_cmd':
>> drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete 
>> type 'struct request'
  kfree(req->completion_data);
   ^~
   drivers/nvme/host/nvme.h: In function 'nvme_req_needs_retry':
   drivers/nvme/host/nvme.h:243:35: error: implicit declaration of function 
'blk_noretry_request' [-Werror=implicit-function-declaration]
 return !(status & NVME_SC_DNR || blk_noretry_request(req)) &&
  ^~~
   drivers/nvme/host/core.c: In function 'nvme_cancel_request':
   drivers/nvme/host/core.c:75:6: error: implicit declaration of function 
'blk_queue_dying' [-Werror=implicit-function-declaration]
 if (blk_queue_dying(req->q))
 ^~~
   drivers/nvme/host/core.c: In function 'nvme_free_ns':
>> drivers/nvme/host/core.c:157:42: error: dereferencing pointer to incomplete 
>> type 'struct gendisk'
  nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
 ^~
   drivers/nvme/host/core.c:163:2: error: implicit declaration of function 
'put_disk' [-Werror=implicit-function-declaration]
 put_disk(ns->disk);
 ^~~~
   drivers/nvme/host/core.c: In function 'nvme_requeue_req':
   drivers/nvme/host/core.c:203:7: error: implicit declaration of function 
'blk_queue_stopped' [-Werror=implicit-function-declaration]
 if (!blk_queue_stopped(req->q))
  ^
   drivers/nvme/host/core.c: In function 'nvme_alloc_request':
   drivers/nvme/host/core.c:223:18: error: 'REQ_TYPE_DRV_PRIV' undeclared 
(first use in this function)
 req->cmd_type = REQ_TYPE_DRV_PRIV;
 ^
   drivers/nvme/host/core.c:223:18: note: each undeclared identifier is 
reported only once for each function it appears in
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/sched.h:17,
from include/linux/blkdev.h:4,
from drivers/nvme/host/core.c:15:
   drivers/nvme/host/core.c: In function 'nvme_setup_discard':
   drivers/nvme/host/core.c:254:46: error: implicit declaration of function 
'blk_rq_pos' [-Werror=implicit-function-declaration]
 range->slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
 ^
   

  1   2   3   4   5   6   7   8   9   10   >