Re: [PATCH v1 1/1] srcu-cbmc: Use /usr/bin/awk instead of /bin/awk

2017-04-23 Thread Lance Roy
Acked-by: Lance Roy 

On Sat, 22 Apr 2017 10:17:11 -0700
priyalee.kushw...@intel.com wrote:

> From: Priyalee Kushwaha 
>
> Most OS distribution have awk in /usr/bin not in /bin
> Without this patch, kernel-devsrc fails to build as
> runtime dependency for srcu-cbmc script /bin/awk is
> not found.
>
> Signed-off-by: Kushwaha, Priyalee 
> ---
>  tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git 
> a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk 
> b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk
> index 8ff8904..c9e8bc5 100755
> --- a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk
> +++ b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk
> @@ -1,4 +1,4 @@
> -#!/bin/awk -f
> +#!/usr/bin/awk -f
>
>  # Modify SRCU for formal verification. The first argument should be srcu.h 
> and
>  # the second should be srcu.c. Outputs modified srcu.h and srcu.c into the


Re: [PATCH v1 1/1] srcu-cbmc: Use /usr/bin/awk instead of /bin/awk

2017-04-23 Thread Lance Roy
Acked-by: Lance Roy 

On Sat, 22 Apr 2017 10:17:11 -0700
priyalee.kushw...@intel.com wrote:

> From: Priyalee Kushwaha 
>
> Most OS distribution have awk in /usr/bin not in /bin
> Without this patch, kernel-devsrc fails to build as
> runtime dependency for srcu-cbmc script /bin/awk is
> not found.
>
> Signed-off-by: Kushwaha, Priyalee 
> ---
>  tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git 
> a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk 
> b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk
> index 8ff8904..c9e8bc5 100755
> --- a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk
> +++ b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk
> @@ -1,4 +1,4 @@
> -#!/bin/awk -f
> +#!/usr/bin/awk -f
>
>  # Modify SRCU for formal verification. The first argument should be srcu.h 
> and
>  # the second should be srcu.c. Outputs modified srcu.h and srcu.c into the


Re: [PATCH v2 0/9] drm/sun4i: Support multiple display pipelines

2017-04-23 Thread Maxime Ripard
On Fri, Apr 21, 2017 at 04:38:48PM +0800, Chen-Yu Tsai wrote:
> Hi,
> 
> This is v2 of the series previously named "drm/sun4i: Support two
> display pipelines". As the name change suggests, the driver now
> supports any number of pipelines, though the hardware only has
> 2 or 3.
> 
> Changes since v1:
> 
>   - Add component endpoint ID numbering scheme to device tree binding.
> 
>   - Use lists to keep references to registered backends and tcons.
> 
>   - Save pointer to device node for backends.
> 
>   - Traverse the device tree of_graph starting from the tcons, going
> up towards the inputs, and matching the device nodes with the
> device nodes of registered backends, to find the one linked with
> the tcon the search started from.
> 
>   - Copy the ID for the tcon from its upstream backend, instead of
> trying, and possibly failing, to figure it out from the device
> tree.
> 
>   - Split out hunk dropping trailing 0 from a backend error message.
> 
> Patch 1 adds the component endpoint ID numbering scheme to the
> device tree binding. New in v2.
> 
> Patch 2 adds lists to track registered display backends and TCONs,
> instead of just one pointer per component type. Previously added
> arrays of pointers in v1.
> 
> Patch 3 drops the trailing 0 from one of the backend's bind error
> messages. This was previously part of the patch "drm/sun4i: Support
> two display pipelines".
> 
> Patch 4 adds a function to fetch a backend's ID from the device tree.
> Unchanged.
> 
> Patch 5 adds a device node field to the backend data structure and
> saves a reference to the underlying device node of the backend.
> New in v2.
> 
> Patch 6 makes the tcon driver find its upstream backend by traversing
> the of_graph and matching device nodes against the device nodes of
> registered backends.
> New in v2.
> 
> Patch 7 makes the tcon driver use the ID from its associated backend.
> New in v2. This is not immediately used in this series, but will be
> used in similar fashion for downstream encoders to figure out IDs and
> muxing
> 
> Patch 8 adds device nodes for sun6i's second display pipeline.
> Unchanged.
> 
> Patch 9 enables sun6i's tcon0 by default.
> Unchanged.

Applied everything, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH v2 0/9] drm/sun4i: Support multiple display pipelines

2017-04-23 Thread Maxime Ripard
On Fri, Apr 21, 2017 at 04:38:48PM +0800, Chen-Yu Tsai wrote:
> Hi,
> 
> This is v2 of the series previously named "drm/sun4i: Support two
> display pipelines". As the name change suggests, the driver now
> supports any number of pipelines, though the hardware only has
> 2 or 3.
> 
> Changes since v1:
> 
>   - Add component endpoint ID numbering scheme to device tree binding.
> 
>   - Use lists to keep references to registered backends and tcons.
> 
>   - Save pointer to device node for backends.
> 
>   - Traverse the device tree of_graph starting from the tcons, going
> up towards the inputs, and matching the device nodes with the
> device nodes of registered backends, to find the one linked with
> the tcon the search started from.
> 
>   - Copy the ID for the tcon from its upstream backend, instead of
> trying, and possibly failing, to figure it out from the device
> tree.
> 
>   - Split out hunk dropping trailing 0 from a backend error message.
> 
> Patch 1 adds the component endpoint ID numbering scheme to the
> device tree binding. New in v2.
> 
> Patch 2 adds lists to track registered display backends and TCONs,
> instead of just one pointer per component type. Previously added
> arrays of pointers in v1.
> 
> Patch 3 drops the trailing 0 from one of the backend's bind error
> messages. This was previously part of the patch "drm/sun4i: Support
> two display pipelines".
> 
> Patch 4 adds a function to fetch a backend's ID from the device tree.
> Unchanged.
> 
> Patch 5 adds a device node field to the backend data structure and
> saves a reference to the underlying device node of the backend.
> New in v2.
> 
> Patch 6 makes the tcon driver find its upstream backend by traversing
> the of_graph and matching device nodes against the device nodes of
> registered backends.
> New in v2.
> 
> Patch 7 makes the tcon driver use the ID from its associated backend.
> New in v2. This is not immediately used in this series, but will be
> used in similar fashion for downstream encoders to figure out IDs and
> muxing
> 
> Patch 8 adds device nodes for sun6i's second display pipeline.
> Unchanged.
> 
> Patch 9 enables sun6i's tcon0 by default.
> Unchanged.

Applied everything, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


linux-next: manual merge of the nvdimm tree with the block tree

2017-04-23 Thread Stephen Rothwell
Hi Dan,

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

  fs/dax.c

between commit:

  ee472d835c26 ("block: add a flags argument to (__)blkdev_issue_zeroout")

from the block tree and commit:

  52d52d6f1178 ("filesystem-dax: convert to dax_direct_access()")

from the nvdimm tree.

I fixed it up (see below) 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 fs/dax.c
index 6433650be833,5b7ee1bc74d0..
--- a/fs/dax.c
+++ b/fs/dax.c
@@@ -979,24 -956,36 +965,36 @@@ static bool dax_range_is_aligned(struc
return true;
  }
  
- int __dax_zero_page_range(struct block_device *bdev, sector_t sector,
-   unsigned int offset, unsigned int length)
+ int __dax_zero_page_range(struct block_device *bdev,
+   struct dax_device *dax_dev, sector_t sector,
+   unsigned int offset, unsigned int size)
  {
-   struct blk_dax_ctl dax = {
-   .sector = sector,
-   .size   = PAGE_SIZE,
-   };
- 
-   if (dax_range_is_aligned(bdev, offset, length)) {
-   sector_t start_sector = dax.sector + (offset >> 9);
+   if (dax_range_is_aligned(bdev, offset, size)) {
+   sector_t start_sector = sector + (offset >> 9);
  
return blkdev_issue_zeroout(bdev, start_sector,
-   length >> 9, GFP_NOFS, 0);
 -  size >> 9, GFP_NOFS, true);
++  size >> 9, GFP_NOFS, 0);
} else {
-   if (dax_map_atomic(bdev, ) < 0)
-   return PTR_ERR(dax.addr);
-   clear_pmem(dax.addr + offset, length);
-   dax_unmap_atomic(bdev, );
+   pgoff_t pgoff;
+   long rc, id;
+   void *kaddr;
+   pfn_t pfn;
+ 
+   rc = bdev_dax_pgoff(bdev, sector, size, );
+   if (rc)
+   return rc;
+ 
+   id = dax_read_lock();
+   rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), ,
+   );
+   if (rc < 0) {
+   dax_read_unlock(id);
+   return rc;
+   }
+   memset(kaddr + offset, 0, size);
+   if (test_bit(QUEUE_FLAG_WC, >bd_queue->queue_flags))
+   dax_flush(dax_dev, pgoff, kaddr + offset, size);
+   dax_read_unlock(id);
}
return 0;
  }


linux-next: manual merge of the nvdimm tree with the block tree

2017-04-23 Thread Stephen Rothwell
Hi Dan,

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

  fs/dax.c

between commit:

  ee472d835c26 ("block: add a flags argument to (__)blkdev_issue_zeroout")

from the block tree and commit:

  52d52d6f1178 ("filesystem-dax: convert to dax_direct_access()")

from the nvdimm tree.

I fixed it up (see below) 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 fs/dax.c
index 6433650be833,5b7ee1bc74d0..
--- a/fs/dax.c
+++ b/fs/dax.c
@@@ -979,24 -956,36 +965,36 @@@ static bool dax_range_is_aligned(struc
return true;
  }
  
- int __dax_zero_page_range(struct block_device *bdev, sector_t sector,
-   unsigned int offset, unsigned int length)
+ int __dax_zero_page_range(struct block_device *bdev,
+   struct dax_device *dax_dev, sector_t sector,
+   unsigned int offset, unsigned int size)
  {
-   struct blk_dax_ctl dax = {
-   .sector = sector,
-   .size   = PAGE_SIZE,
-   };
- 
-   if (dax_range_is_aligned(bdev, offset, length)) {
-   sector_t start_sector = dax.sector + (offset >> 9);
+   if (dax_range_is_aligned(bdev, offset, size)) {
+   sector_t start_sector = sector + (offset >> 9);
  
return blkdev_issue_zeroout(bdev, start_sector,
-   length >> 9, GFP_NOFS, 0);
 -  size >> 9, GFP_NOFS, true);
++  size >> 9, GFP_NOFS, 0);
} else {
-   if (dax_map_atomic(bdev, ) < 0)
-   return PTR_ERR(dax.addr);
-   clear_pmem(dax.addr + offset, length);
-   dax_unmap_atomic(bdev, );
+   pgoff_t pgoff;
+   long rc, id;
+   void *kaddr;
+   pfn_t pfn;
+ 
+   rc = bdev_dax_pgoff(bdev, sector, size, );
+   if (rc)
+   return rc;
+ 
+   id = dax_read_lock();
+   rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), ,
+   );
+   if (rc < 0) {
+   dax_read_unlock(id);
+   return rc;
+   }
+   memset(kaddr + offset, 0, size);
+   if (test_bit(QUEUE_FLAG_WC, >bd_queue->queue_flags))
+   dax_flush(dax_dev, pgoff, kaddr + offset, size);
+   dax_read_unlock(id);
}
return 0;
  }


linux-next: manual merge of the nvdimm tree with the block tree

2017-04-23 Thread Stephen Rothwell
Hi Dan,

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

  drivers/block/brd.c

between commit:

  f09a06a193d9 ("brd: remove discard support")

from the block tree and commit:

  1647b9b959c7 ("brd: add dax_operations support")

from the nvdimm tree.

Dan, thanks for the example merge, but I am not sure you did it quite
right. I removed the first three '-' lines below, you did not.

I fixed it up (see below) 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 drivers/block/brd.c
index 4ec84d504780,bfa4ed2c75ef..
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@@ -415,9 -478,11 +429,6 @@@ static struct brd_device *brd_alloc(in
 *  is harmless)
 */
blk_queue_physical_block_size(brd->brd_queue, PAGE_SIZE);
- #ifdef CONFIG_BLK_DEV_RAM_DAX
-   queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue);
- #endif
 -
 -  brd->brd_queue->limits.discard_granularity = PAGE_SIZE;
 -  blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX);
 -  brd->brd_queue->limits.discard_zeroes_data = 1;
 -  queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, brd->brd_queue);
disk = brd->brd_disk = alloc_disk(max_part);
if (!disk)
goto out_free_queue;


linux-next: manual merge of the nvdimm tree with the block tree

2017-04-23 Thread Stephen Rothwell
Hi Dan,

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

  drivers/block/brd.c

between commit:

  f09a06a193d9 ("brd: remove discard support")

from the block tree and commit:

  1647b9b959c7 ("brd: add dax_operations support")

from the nvdimm tree.

Dan, thanks for the example merge, but I am not sure you did it quite
right. I removed the first three '-' lines below, you did not.

I fixed it up (see below) 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 drivers/block/brd.c
index 4ec84d504780,bfa4ed2c75ef..
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@@ -415,9 -478,11 +429,6 @@@ static struct brd_device *brd_alloc(in
 *  is harmless)
 */
blk_queue_physical_block_size(brd->brd_queue, PAGE_SIZE);
- #ifdef CONFIG_BLK_DEV_RAM_DAX
-   queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue);
- #endif
 -
 -  brd->brd_queue->limits.discard_granularity = PAGE_SIZE;
 -  blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX);
 -  brd->brd_queue->limits.discard_zeroes_data = 1;
 -  queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, brd->brd_queue);
disk = brd->brd_disk = alloc_disk(max_part);
if (!disk)
goto out_free_queue;


[PATCH 1/2] of: add support of dtc compiler flags for device tree overlays

2017-04-23 Thread frowand . list
From: Frank Rowand 

The dtc compiler version that adds initial support was available
in 4.11-rc1.  Add the ability to set the dtc compiler flags needed
by overlays.

Signed-off-by: Frank Rowand 
---
 scripts/Makefile.lib | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0a07f9014944..0bbec480d323 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -283,6 +283,8 @@ ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
 DTC_FLAGS += -Wno-unit_address_vs_reg
 endif
 
+DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
+
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB $@
 cmd_dt_S_dtb=  \
-- 
Frank Rowand 



[PATCH 0/2] of: Add unit tests for applying overlays

2017-04-23 Thread frowand . list
From: Frank Rowand 

Existing overlay unit tests examine individual pieces of the overlay
code.  The new tests target the entire process of applying an overlay.

Frank Rowand (2):
  of: add support of dtc compiler flags for device tree overlays
  of: Add unit tests for applying overlays.

 drivers/of/fdt.c|  45 +
 drivers/of/of_private.h |   2 +
 drivers/of/unittest-data/Makefile   |  17 +-
 drivers/of/unittest-data/ot.dts |  53 ++
 drivers/of/unittest-data/ot_bad_phandle.dts |  20 +++
 drivers/of/unittest-data/ot_base.dts|  71 
 drivers/of/unittest.c   | 264 
 scripts/Makefile.lib|   2 +
 8 files changed, 471 insertions(+), 3 deletions(-)
 create mode 100644 drivers/of/unittest-data/ot.dts
 create mode 100644 drivers/of/unittest-data/ot_bad_phandle.dts
 create mode 100644 drivers/of/unittest-data/ot_base.dts

-- 
Frank Rowand 



[PATCH 1/2] of: add support of dtc compiler flags for device tree overlays

2017-04-23 Thread frowand . list
From: Frank Rowand 

The dtc compiler version that adds initial support was available
in 4.11-rc1.  Add the ability to set the dtc compiler flags needed
by overlays.

Signed-off-by: Frank Rowand 
---
 scripts/Makefile.lib | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0a07f9014944..0bbec480d323 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -283,6 +283,8 @@ ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
 DTC_FLAGS += -Wno-unit_address_vs_reg
 endif
 
+DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
+
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB $@
 cmd_dt_S_dtb=  \
-- 
Frank Rowand 



[PATCH 0/2] of: Add unit tests for applying overlays

2017-04-23 Thread frowand . list
From: Frank Rowand 

Existing overlay unit tests examine individual pieces of the overlay
code.  The new tests target the entire process of applying an overlay.

Frank Rowand (2):
  of: add support of dtc compiler flags for device tree overlays
  of: Add unit tests for applying overlays.

 drivers/of/fdt.c|  45 +
 drivers/of/of_private.h |   2 +
 drivers/of/unittest-data/Makefile   |  17 +-
 drivers/of/unittest-data/ot.dts |  53 ++
 drivers/of/unittest-data/ot_bad_phandle.dts |  20 +++
 drivers/of/unittest-data/ot_base.dts|  71 
 drivers/of/unittest.c   | 264 
 scripts/Makefile.lib|   2 +
 8 files changed, 471 insertions(+), 3 deletions(-)
 create mode 100644 drivers/of/unittest-data/ot.dts
 create mode 100644 drivers/of/unittest-data/ot_bad_phandle.dts
 create mode 100644 drivers/of/unittest-data/ot_base.dts

-- 
Frank Rowand 



[PATCH 2/2] of: Add unit tests for applying overlays.

2017-04-23 Thread frowand . list
From: Frank Rowand 

Existing overlay unit tests examine individual pieces of the overlay
code.  The new tests target the entire process of applying an overlay.

Signed-off-by: Frank Rowand 
---

There are checkpatch warnings.  I have reviewed them and feel they
can be ignored.

 drivers/of/fdt.c|  45 +
 drivers/of/of_private.h |   2 +
 drivers/of/unittest-data/Makefile   |  17 +-
 drivers/of/unittest-data/ot.dts |  53 ++
 drivers/of/unittest-data/ot_bad_phandle.dts |  20 +++
 drivers/of/unittest-data/ot_base.dts|  71 
 drivers/of/unittest.c   | 264 
 7 files changed, 469 insertions(+), 3 deletions(-)
 create mode 100644 drivers/of/unittest-data/ot.dts
 create mode 100644 drivers/of/unittest-data/ot_bad_phandle.dts
 create mode 100644 drivers/of/unittest-data/ot_base.dts

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index e5ce4b59e162..54120ab8f322 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -31,6 +31,8 @@
 #include   /* for COMMAND_LINE_SIZE */
 #include 
 
+#include "of_private.h"
+
 /*
  * of_fdt_limit_memory - limit the number of regions in the /memory node
  * @limit: maximum entries
@@ -1256,11 +1258,54 @@ bool __init early_init_dt_scan(void *params)
  */
 void __init unflatten_device_tree(void)
 {
+#ifdef CONFIG_OF_UNITTEST
+   extern uint8_t __dtb_ot_base_begin[];
+   extern uint8_t __dtb_ot_base_end[];
+   struct device_node *ot_base_root;
+   void *ot_base;
+   u32 data_size;
+   u32 size;
+#endif
+
__unflatten_device_tree(initial_boot_params, NULL, _root,
early_init_dt_alloc_memory_arch, false);
 
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch);
+
+#ifdef CONFIG_OF_UNITTEST
+   /*
+* Base device tree for the overlay unittest.
+* Do as much as possible the same way as done for the normal FDT.
+* Have to stop before resolving phandles, because that uses kmalloc.
+*/
+
+   data_size = __dtb_ot_base_end - __dtb_ot_base_begin;
+   if (!data_size) {
+   pr_err("No __dtb_ot_base_begin to attach\n");
+   return;
+   }
+
+   size = fdt_totalsize(__dtb_ot_base_begin);
+   if (size != data_size) {
+   pr_err("__dtb_ot_base_begin header totalsize != actual size");
+   return;
+   }
+
+   ot_base = early_init_dt_alloc_memory_arch(size,
+roundup_pow_of_two(FDT_V17_SIZE));
+   if (!ot_base) {
+   pr_err("alloc of ot_base failed");
+   return;
+   }
+
+   memcpy(ot_base, __dtb_ot_base_begin, size);
+
+   __unflatten_device_tree(ot_base, NULL, _base_root,
+   early_init_dt_alloc_memory_arch, true);
+
+   unittest_set_ot_base_root(ot_base_root);
+#endif
 }
 
 /**
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index f4f6793d2f04..02d54da078ac 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -55,6 +55,8 @@ static inline int of_property_notify(int action, struct 
device_node *np,
 }
 #endif /* CONFIG_OF_DYNAMIC */
 
+extern void unittest_set_ot_base_root(struct device_node *dn);
+
 /**
  * General utilities for working with live trees.
  *
diff --git a/drivers/of/unittest-data/Makefile 
b/drivers/of/unittest-data/Makefile
index 1ac5cc01d627..6879befe29d2 100644
--- a/drivers/of/unittest-data/Makefile
+++ b/drivers/of/unittest-data/Makefile
@@ -1,7 +1,18 @@
 obj-y += testcases.dtb.o
+obj-y += ot.dtb.o
+obj-y += ot_bad_phandle.dtb.o
+obj-y += ot_base.dtb.o
 
 targets += testcases.dtb testcases.dtb.S
+targets += ot.dtb ot.dtb.S
+targets += ot_bad_phandle.dtb ot_bad_phandle.dtb.S
+targets += ot_base.dtb ot_base.dtb.S
 
-.SECONDARY: \
-   $(obj)/testcases.dtb.S \
-   $(obj)/testcases.dtb
+.PRECIOUS: \
+   $(obj)/%.dtb.S \
+   $(obj)/%.dtb
+
+# enable creation of __symbols__ node
+DTC_FLAGS_ot := -@
+DTC_FLAGS_ot_base := -@
+DTC_FLAGS_ot_bad_phandle := -@
diff --git a/drivers/of/unittest-data/ot.dts b/drivers/of/unittest-data/ot.dts
new file mode 100644
index ..37e105622b7a
--- /dev/null
+++ b/drivers/of/unittest-data/ot.dts
@@ -0,0 +1,53 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+
+   fragment@0 {
+   target = <_1>;
+
+   __overlay__ {
+   status = "ok";
+
+   hvac_2: hvac_large_1 {
+   compatible = "ot,hvac-large";
+   heat-range = < 40 75 >;
+   cool-range = < 65 80 >;
+   };
+   };
+   };
+
+   fragment@1 {
+   target = <_1>;
+
+   __overlay__ {
+   

[PATCH 2/2] of: Add unit tests for applying overlays.

2017-04-23 Thread frowand . list
From: Frank Rowand 

Existing overlay unit tests examine individual pieces of the overlay
code.  The new tests target the entire process of applying an overlay.

Signed-off-by: Frank Rowand 
---

There are checkpatch warnings.  I have reviewed them and feel they
can be ignored.

 drivers/of/fdt.c|  45 +
 drivers/of/of_private.h |   2 +
 drivers/of/unittest-data/Makefile   |  17 +-
 drivers/of/unittest-data/ot.dts |  53 ++
 drivers/of/unittest-data/ot_bad_phandle.dts |  20 +++
 drivers/of/unittest-data/ot_base.dts|  71 
 drivers/of/unittest.c   | 264 
 7 files changed, 469 insertions(+), 3 deletions(-)
 create mode 100644 drivers/of/unittest-data/ot.dts
 create mode 100644 drivers/of/unittest-data/ot_bad_phandle.dts
 create mode 100644 drivers/of/unittest-data/ot_base.dts

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index e5ce4b59e162..54120ab8f322 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -31,6 +31,8 @@
 #include   /* for COMMAND_LINE_SIZE */
 #include 
 
+#include "of_private.h"
+
 /*
  * of_fdt_limit_memory - limit the number of regions in the /memory node
  * @limit: maximum entries
@@ -1256,11 +1258,54 @@ bool __init early_init_dt_scan(void *params)
  */
 void __init unflatten_device_tree(void)
 {
+#ifdef CONFIG_OF_UNITTEST
+   extern uint8_t __dtb_ot_base_begin[];
+   extern uint8_t __dtb_ot_base_end[];
+   struct device_node *ot_base_root;
+   void *ot_base;
+   u32 data_size;
+   u32 size;
+#endif
+
__unflatten_device_tree(initial_boot_params, NULL, _root,
early_init_dt_alloc_memory_arch, false);
 
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch);
+
+#ifdef CONFIG_OF_UNITTEST
+   /*
+* Base device tree for the overlay unittest.
+* Do as much as possible the same way as done for the normal FDT.
+* Have to stop before resolving phandles, because that uses kmalloc.
+*/
+
+   data_size = __dtb_ot_base_end - __dtb_ot_base_begin;
+   if (!data_size) {
+   pr_err("No __dtb_ot_base_begin to attach\n");
+   return;
+   }
+
+   size = fdt_totalsize(__dtb_ot_base_begin);
+   if (size != data_size) {
+   pr_err("__dtb_ot_base_begin header totalsize != actual size");
+   return;
+   }
+
+   ot_base = early_init_dt_alloc_memory_arch(size,
+roundup_pow_of_two(FDT_V17_SIZE));
+   if (!ot_base) {
+   pr_err("alloc of ot_base failed");
+   return;
+   }
+
+   memcpy(ot_base, __dtb_ot_base_begin, size);
+
+   __unflatten_device_tree(ot_base, NULL, _base_root,
+   early_init_dt_alloc_memory_arch, true);
+
+   unittest_set_ot_base_root(ot_base_root);
+#endif
 }
 
 /**
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index f4f6793d2f04..02d54da078ac 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -55,6 +55,8 @@ static inline int of_property_notify(int action, struct 
device_node *np,
 }
 #endif /* CONFIG_OF_DYNAMIC */
 
+extern void unittest_set_ot_base_root(struct device_node *dn);
+
 /**
  * General utilities for working with live trees.
  *
diff --git a/drivers/of/unittest-data/Makefile 
b/drivers/of/unittest-data/Makefile
index 1ac5cc01d627..6879befe29d2 100644
--- a/drivers/of/unittest-data/Makefile
+++ b/drivers/of/unittest-data/Makefile
@@ -1,7 +1,18 @@
 obj-y += testcases.dtb.o
+obj-y += ot.dtb.o
+obj-y += ot_bad_phandle.dtb.o
+obj-y += ot_base.dtb.o
 
 targets += testcases.dtb testcases.dtb.S
+targets += ot.dtb ot.dtb.S
+targets += ot_bad_phandle.dtb ot_bad_phandle.dtb.S
+targets += ot_base.dtb ot_base.dtb.S
 
-.SECONDARY: \
-   $(obj)/testcases.dtb.S \
-   $(obj)/testcases.dtb
+.PRECIOUS: \
+   $(obj)/%.dtb.S \
+   $(obj)/%.dtb
+
+# enable creation of __symbols__ node
+DTC_FLAGS_ot := -@
+DTC_FLAGS_ot_base := -@
+DTC_FLAGS_ot_bad_phandle := -@
diff --git a/drivers/of/unittest-data/ot.dts b/drivers/of/unittest-data/ot.dts
new file mode 100644
index ..37e105622b7a
--- /dev/null
+++ b/drivers/of/unittest-data/ot.dts
@@ -0,0 +1,53 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+
+   fragment@0 {
+   target = <_1>;
+
+   __overlay__ {
+   status = "ok";
+
+   hvac_2: hvac_large_1 {
+   compatible = "ot,hvac-large";
+   heat-range = < 40 75 >;
+   cool-range = < 65 80 >;
+   };
+   };
+   };
+
+   fragment@1 {
+   target = <_1>;
+
+   __overlay__ {
+   #address-cells = <1>;
+   #size-cells = 

Re: [PATCH] libnvdimm, region: sysfs trigger for nvdimm_flush()

2017-04-23 Thread Masayoshi Mizuma
On Fri, 21 Apr 2017 16:48:57 -0700 Dan Williams wrote:
> The nvdimm_flush() mechanism helps to reduce the impact of an ADR
> (asynchronous-dimm-refresh) failure. The ADR mechanism handles flushing
> platform WPQ (write-pending-queue) buffers when power is removed. The
> nvdimm_flush() mechanism performs that same function on-demand.
> 
> When a pmem namespace is associated with a block device, an
> nvdimm_flush() is triggered with every block-layer REQ_FUA, or REQ_FLUSH
> request. However, when a namespace is in device-dax mode, or namespaces
> are disabled, userspace needs another path.
> 
> The new 'flush' attribute is visible when it can be determined that the
> interleave-set either does, or does not have DIMMs that expose WPQ-flush
> addresses, "flush-hints" in ACPI NFIT terminology. It returns "1" and
> flushes DIMMs, or returns "0" the flush operation is a platform nop.
> 
> Signed-off-by: Dan Williams 
> ---
>  drivers/nvdimm/region_devs.c |   17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
> index 8de5a04644a1..3495b4c23941 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -255,6 +255,19 @@ static ssize_t size_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(size);
>  
> +static ssize_t flush_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct nd_region *nd_region = to_nd_region(dev);
> +
> + if (nvdimm_has_flush(nd_region)) {

nvdimm_has_flush() also returns as -ENXIO, so

if (nvdimm_has_flush(nd_region) == 1)  

> + nvdimm_flush(nd_region);
> + return sprintf(buf, "1\n");
> + }
> + return sprintf(buf, "0\n");
> +}
> +static DEVICE_ATTR_RO(flush);
> +

I think separating show and store is better because
users may only check wheter the device has the flush capability or not.

The separate code is like as follows (not tested).

static ssize_t flush_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct nd_region *nd_region = to_nd_region(dev);

if (nvdimm_has_flush(nd_region) == 1) {
return sprintf(buf, "1\n");
} else {
return sprintf(buf, "0\n");
}
}

static ssize_t flush_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
bool flush;
int rc = strtobool(buf, );
struct nd_region *nd_region = to_nd_region(dev);

if (rc)
return rc;

if (flush && (nvdimm_has_flush(nd_region) == 1)) {
nvdimm_flush(nd_region);
return 0;
} else {
return -1;
}
}
static DEVICE_ATTR_RW(flush);

Regards,
Masayoshi Mizuma

>  static ssize_t mappings_show(struct device *dev,
>   struct device_attribute *attr, char *buf)
>  {
> @@ -474,6 +487,7 @@ static DEVICE_ATTR_RO(resource);
>  
>  static struct attribute *nd_region_attributes[] = {
>   _attr_size.attr,
> + _attr_flush.attr,
>   _attr_nstype.attr,
>   _attr_mappings.attr,
>   _attr_btt_seed.attr,
> @@ -508,6 +522,9 @@ static umode_t region_visible(struct kobject *kobj, 
> struct attribute *a, int n)
>   if (!is_nd_pmem(dev) && a == _attr_resource.attr)
>   return 0;
>  
> + if (a == _attr_flush.attr && nvdimm_has_flush(nd_region) < 0)
> + return 0;
> +
>   if (a != _attr_set_cookie.attr
>   && a != _attr_available_size.attr)
>   return a->mode;
> 
> ___
> Linux-nvdimm mailing list
> linux-nvd...@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm



Re: [PATCH] libnvdimm, region: sysfs trigger for nvdimm_flush()

2017-04-23 Thread Masayoshi Mizuma
On Fri, 21 Apr 2017 16:48:57 -0700 Dan Williams wrote:
> The nvdimm_flush() mechanism helps to reduce the impact of an ADR
> (asynchronous-dimm-refresh) failure. The ADR mechanism handles flushing
> platform WPQ (write-pending-queue) buffers when power is removed. The
> nvdimm_flush() mechanism performs that same function on-demand.
> 
> When a pmem namespace is associated with a block device, an
> nvdimm_flush() is triggered with every block-layer REQ_FUA, or REQ_FLUSH
> request. However, when a namespace is in device-dax mode, or namespaces
> are disabled, userspace needs another path.
> 
> The new 'flush' attribute is visible when it can be determined that the
> interleave-set either does, or does not have DIMMs that expose WPQ-flush
> addresses, "flush-hints" in ACPI NFIT terminology. It returns "1" and
> flushes DIMMs, or returns "0" the flush operation is a platform nop.
> 
> Signed-off-by: Dan Williams 
> ---
>  drivers/nvdimm/region_devs.c |   17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
> index 8de5a04644a1..3495b4c23941 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -255,6 +255,19 @@ static ssize_t size_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(size);
>  
> +static ssize_t flush_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct nd_region *nd_region = to_nd_region(dev);
> +
> + if (nvdimm_has_flush(nd_region)) {

nvdimm_has_flush() also returns as -ENXIO, so

if (nvdimm_has_flush(nd_region) == 1)  

> + nvdimm_flush(nd_region);
> + return sprintf(buf, "1\n");
> + }
> + return sprintf(buf, "0\n");
> +}
> +static DEVICE_ATTR_RO(flush);
> +

I think separating show and store is better because
users may only check wheter the device has the flush capability or not.

The separate code is like as follows (not tested).

static ssize_t flush_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct nd_region *nd_region = to_nd_region(dev);

if (nvdimm_has_flush(nd_region) == 1) {
return sprintf(buf, "1\n");
} else {
return sprintf(buf, "0\n");
}
}

static ssize_t flush_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
bool flush;
int rc = strtobool(buf, );
struct nd_region *nd_region = to_nd_region(dev);

if (rc)
return rc;

if (flush && (nvdimm_has_flush(nd_region) == 1)) {
nvdimm_flush(nd_region);
return 0;
} else {
return -1;
}
}
static DEVICE_ATTR_RW(flush);

Regards,
Masayoshi Mizuma

>  static ssize_t mappings_show(struct device *dev,
>   struct device_attribute *attr, char *buf)
>  {
> @@ -474,6 +487,7 @@ static DEVICE_ATTR_RO(resource);
>  
>  static struct attribute *nd_region_attributes[] = {
>   _attr_size.attr,
> + _attr_flush.attr,
>   _attr_nstype.attr,
>   _attr_mappings.attr,
>   _attr_btt_seed.attr,
> @@ -508,6 +522,9 @@ static umode_t region_visible(struct kobject *kobj, 
> struct attribute *a, int n)
>   if (!is_nd_pmem(dev) && a == _attr_resource.attr)
>   return 0;
>  
> + if (a == _attr_flush.attr && nvdimm_has_flush(nd_region) < 0)
> + return 0;
> +
>   if (a != _attr_set_cookie.attr
>   && a != _attr_available_size.attr)
>   return a->mode;
> 
> ___
> Linux-nvdimm mailing list
> linux-nvd...@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm



[PATCH] driver-core: remove lock for platform devices during probe

2017-04-23 Thread Wei Li
During driver probe procedure, lock on the parent of
platform devices could be removed to make probe in
parallel.

Signed-off-by: Wei Li 
---
 drivers/base/dd.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index a1fbf55..e238fbc 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "base.h"
 #include "power/power.h"
@@ -749,13 +750,14 @@ static int __driver_attach(struct device *dev, void *data)
return ret;
} /* ret > 0 means positive match */
 
-   if (dev->parent)/* Needed for USB */
+   if (dev->parent &&
+   (dev->bus != _bus_type))   /* Needed for USB */
device_lock(dev->parent);
device_lock(dev);
if (!dev->driver)
driver_probe_device(drv, dev);
device_unlock(dev);
-   if (dev->parent)
+   if (dev->parent && (dev->bus != _bus_type))
device_unlock(dev->parent);
 
return 0;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na 
Linux Foundation Collaborative Project



[PATCH] driver-core: remove lock for platform devices during probe

2017-04-23 Thread Wei Li
During driver probe procedure, lock on the parent of
platform devices could be removed to make probe in
parallel.

Signed-off-by: Wei Li 
---
 drivers/base/dd.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index a1fbf55..e238fbc 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "base.h"
 #include "power/power.h"
@@ -749,13 +750,14 @@ static int __driver_attach(struct device *dev, void *data)
return ret;
} /* ret > 0 means positive match */
 
-   if (dev->parent)/* Needed for USB */
+   if (dev->parent &&
+   (dev->bus != _bus_type))   /* Needed for USB */
device_lock(dev->parent);
device_lock(dev);
if (!dev->driver)
driver_probe_device(drv, dev);
device_unlock(dev);
-   if (dev->parent)
+   if (dev->parent && (dev->bus != _bus_type))
device_unlock(dev->parent);
 
return 0;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na 
Linux Foundation Collaborative Project



Re: [PATCH 1/2] team: fix memory leak

2017-04-23 Thread Jiri Pirko
Sun, Apr 23, 2017 at 09:29:24AM CEST, bianpan2...@163.com wrote:
>In function team_nl_send_port_list_get(), pointer skb keeps the return
>value of nlmsg_new(). When the call to genlmsg_put() fails, the memory
>is not freed. This will result in a memory leak bug. This patch fixes
>it.
>


Looks good. Please adjust subject so the both patches have a specific
one. Also, please add "Fixes" tag (see git log for details).
Also, is is good to say which tree this patches are generated against
("-net")


>Signed-off-by: Pan Bian 
>---
> drivers/net/team/team.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index f8c81f1..dd3a2e9 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -2634,8 +2634,10 @@ static int team_nl_send_port_list_get(struct team 
>*team, u32 portid, u32 seq,
> 
>   hdr = genlmsg_put(skb, portid, seq, _nl_family, flags | 
> NLM_F_MULTI,
> TEAM_CMD_PORT_LIST_GET);
>-  if (!hdr)
>+  if (!hdr) {
>+  nlmsg_free(skb);
>   return -EMSGSIZE;
>+  }
> 
>   if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
>   goto nla_put_failure;
>-- 
>1.9.1
>
>


Re: [PATCH 1/2] team: fix memory leak

2017-04-23 Thread Jiri Pirko
Sun, Apr 23, 2017 at 09:29:24AM CEST, bianpan2...@163.com wrote:
>In function team_nl_send_port_list_get(), pointer skb keeps the return
>value of nlmsg_new(). When the call to genlmsg_put() fails, the memory
>is not freed. This will result in a memory leak bug. This patch fixes
>it.
>


Looks good. Please adjust subject so the both patches have a specific
one. Also, please add "Fixes" tag (see git log for details).
Also, is is good to say which tree this patches are generated against
("-net")


>Signed-off-by: Pan Bian 
>---
> drivers/net/team/team.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index f8c81f1..dd3a2e9 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -2634,8 +2634,10 @@ static int team_nl_send_port_list_get(struct team 
>*team, u32 portid, u32 seq,
> 
>   hdr = genlmsg_put(skb, portid, seq, _nl_family, flags | 
> NLM_F_MULTI,
> TEAM_CMD_PORT_LIST_GET);
>-  if (!hdr)
>+  if (!hdr) {
>+  nlmsg_free(skb);
>   return -EMSGSIZE;
>+  }
> 
>   if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
>   goto nla_put_failure;
>-- 
>1.9.1
>
>


Re: linux-next: build failure after merge of the tip tree

2017-04-23 Thread Ingo Molnar

* Stephen Rothwell  wrote:

> Hi all,
> 
> After merging the tip tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> kernel/tracepoint.c: In function 'tracepoint_remove_func':
> kernel/tracepoint.c:253:4: error: implicit declaration of function 
> 'static_key_slow_dec_cpuslocked' [-Werror=implicit-function-declaration]
> static_key_slow_dec_cpuslocked(>key);
> ^
> 
> Caused by commit
> 
>   24db7a671bd5 ("trace/perf: Cure hotplug lock ordering issues")
> 
> static_key_slow_dec_cpuslocked() is only defined if HAVE_JUMP_LABEL is
> set - which is only defined if defined(CC_HAVE_ASM_GOTO) &&
> defined(CONFIG_JUMP_LABEL).  CONFIG_JUMP_LABEL is not set for this build.
> 
> I wasn't sure if just adding
> 
>   #define static_key_slow_dec_cpuslocked static_key_slow_dec
> 
> in the !HAVE_JUMP_LABEL case in include/linux/jump_label.h would be
> sufficient, so I have reverted that commit for today.

Both are fine, thanks Stephen! It's all fixed up in tip:auto-latest as well.

Thanks,

Ingo


Re: linux-next: build failure after merge of the tip tree

2017-04-23 Thread Ingo Molnar

* Stephen Rothwell  wrote:

> Hi all,
> 
> After merging the tip tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> kernel/tracepoint.c: In function 'tracepoint_remove_func':
> kernel/tracepoint.c:253:4: error: implicit declaration of function 
> 'static_key_slow_dec_cpuslocked' [-Werror=implicit-function-declaration]
> static_key_slow_dec_cpuslocked(>key);
> ^
> 
> Caused by commit
> 
>   24db7a671bd5 ("trace/perf: Cure hotplug lock ordering issues")
> 
> static_key_slow_dec_cpuslocked() is only defined if HAVE_JUMP_LABEL is
> set - which is only defined if defined(CC_HAVE_ASM_GOTO) &&
> defined(CONFIG_JUMP_LABEL).  CONFIG_JUMP_LABEL is not set for this build.
> 
> I wasn't sure if just adding
> 
>   #define static_key_slow_dec_cpuslocked static_key_slow_dec
> 
> in the !HAVE_JUMP_LABEL case in include/linux/jump_label.h would be
> sufficient, so I have reverted that commit for today.

Both are fine, thanks Stephen! It's all fixed up in tip:auto-latest as well.

Thanks,

Ingo


Re: TREE_SRCU slows hotplug by factor ~16

2017-04-23 Thread Mike Galbraith
On Sun, 2017-04-23 at 20:32 -0700, Paul E. McKenney wrote:
> On Mon, Apr 24, 2017 at 04:48:09AM +0200, Mike Galbraith wrote:
> > Greetings,
> > 
> > Running Steven's hotplug stress script in tip w. CLASSIC_SRCU takes 55s
> > in my i4790 box, whereas TREE_SRCU takes over 16m.  (Master with the
> > same config does it in 39s.. but then lockdep isn't enabled in master)
> 
> That doesn't sound good...
> 
> But exactly which version are you using?  There were some 8x slowdowns
> earlier this week that have since been fixed.  Also, how many CPUs are
> on your system?

4 cores+SMT, tip.yesterday_afternoon (precise!) was initial test point,
tip.this_morning (v4.11-rc7-955-g76f8909e1cd8) is still slow.

-Mike


Re: TREE_SRCU slows hotplug by factor ~16

2017-04-23 Thread Mike Galbraith
On Sun, 2017-04-23 at 20:32 -0700, Paul E. McKenney wrote:
> On Mon, Apr 24, 2017 at 04:48:09AM +0200, Mike Galbraith wrote:
> > Greetings,
> > 
> > Running Steven's hotplug stress script in tip w. CLASSIC_SRCU takes 55s
> > in my i4790 box, whereas TREE_SRCU takes over 16m.  (Master with the
> > same config does it in 39s.. but then lockdep isn't enabled in master)
> 
> That doesn't sound good...
> 
> But exactly which version are you using?  There were some 8x slowdowns
> earlier this week that have since been fixed.  Also, how many CPUs are
> on your system?

4 cores+SMT, tip.yesterday_afternoon (precise!) was initial test point,
tip.this_morning (v4.11-rc7-955-g76f8909e1cd8) is still slow.

-Mike


[PATCH 1/3] of: overlay_adjust_phandles() - do not modify const field

2017-04-23 Thread frowand . list
From: Frank Rowand 

When adjusting overlay phandles to apply to the live device tree, can
not modify the property value because it is type const.

This is to resolve the issue found by Stephen Boyd [1] when he changed
the type of struct property.value from void * to const void *.  As
a result of the type change, the overlay code had compile errors
where the resolver updates phandle values.

  [1] http://lkml.iu.edu/hypermail/linux/kernel/1702.1/04160.html

Signed-off-by: Frank Rowand 
---
 drivers/of/base.c   |  4 ++--
 drivers/of/dynamic.c| 28 +--
 drivers/of/of_private.h |  3 +++
 drivers/of/resolver.c   | 51 ++---
 4 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index d7c4629a3a2d..b41650fd0fcf 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -220,8 +220,8 @@ void __init of_core_init(void)
proc_symlink("device-tree", NULL, 
"/sys/firmware/devicetree/base");
 }
 
-static struct property *__of_find_property(const struct device_node *np,
-  const char *name, int *lenp)
+struct property *__of_find_property(const struct device_node *np,
+   const char *name, int *lenp)
 {
struct property *pp;
 
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 888fdbc09992..44963b4e7235 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -354,17 +354,17 @@ void of_node_release(struct kobject *kobj)
 }
 
 /**
- * __of_prop_dup - Copy a property dynamically.
+ * __of_prop_alloc - Create a property dynamically.
  * @prop:  Property to copy
  * @allocflags:Allocation flags (typically pass GFP_KERNEL)
  *
- * Copy a property by dynamically allocating the memory of both the
+ * Create a property by dynamically allocating the memory of both the
  * property structure and the property name & contents. The property's
  * flags have the OF_DYNAMIC bit set so that we can differentiate between
  * dynamically allocated properties and not.
  * Returns the newly allocated property or NULL on out of memory error.
  */
-struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
+struct property *__of_prop_alloc(char *name, void *value, int len, gfp_t 
allocflags)
 {
struct property *new;
 
@@ -378,9 +378,9 @@ struct property *__of_prop_dup(const struct property *prop, 
gfp_t allocflags)
 * of zero bytes. We do this to work around the use
 * of of_get_property() calls on boolean values.
 */
-   new->name = kstrdup(prop->name, allocflags);
-   new->value = kmemdup(prop->value, prop->length, allocflags);
-   new->length = prop->length;
+   new->name = kstrdup(name, allocflags);
+   new->value = kmemdup(value, len, allocflags);
+   new->length = len;
if (!new->name || !new->value)
goto err_free;
 
@@ -397,6 +397,22 @@ struct property *__of_prop_dup(const struct property 
*prop, gfp_t allocflags)
 }
 
 /**
+ * __of_prop_dup - Copy a property dynamically.
+ * @prop:  Property to copy
+ * @allocflags:Allocation flags (typically pass GFP_KERNEL)
+ *
+ * Copy a property by dynamically allocating the memory of both the
+ * property structure and the property name & contents. The property's
+ * flags have the OF_DYNAMIC bit set so that we can differentiate between
+ * dynamically allocated properties and not.
+ * Returns the newly allocated property or NULL on out of memory error.
+ */
+struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
+{
+   return __of_prop_alloc(prop->name, prop->value, prop->length, 
allocflags);
+}
+
+/**
  * __of_node_dup() - Duplicate or create an empty device node dynamically.
  * @fmt: Format string (plus vargs) for new full name of the device node
  *
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 18bbb4517e25..554394c96569 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -62,6 +62,7 @@ static inline int of_property_notify(int action, struct 
device_node *np,
  * without taking node references, so you either have to
  * own the devtree lock or work on detached trees only.
  */
+struct property *__of_prop_alloc(char *name, void *value, int len, gfp_t 
allocflags);
 struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags);
 __printf(2, 3) struct device_node *__of_node_dup(const struct device_node *np, 
const char *fmt, ...);
 
@@ -70,6 +71,8 @@ extern const void *__of_get_property(const struct device_node 
*np,
 extern int __of_add_property(struct device_node *np, struct property *prop);
 extern int __of_add_property_sysfs(struct device_node *np,
struct property *prop);
+extern struct property *__of_find_property(const struct device_node *np,
+  const 

[PATCH 2/3] of: make __of_attach_node() static

2017-04-23 Thread frowand . list
From: Frank Rowand 

__of_attach_node() is not used outside of drivers/of/dynamic.c.  Make
it static and remove it from drivers/of/of_private.h.

Signed-off-by: Frank Rowand 
---
 drivers/of/dynamic.c| 2 +-
 drivers/of/of_private.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 44963b4e7235..9dcadd704aee 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -216,7 +216,7 @@ int of_property_notify(int action, struct device_node *np,
return of_reconfig_notify(action, );
 }
 
-void __of_attach_node(struct device_node *np)
+static void __of_attach_node(struct device_node *np)
 {
const __be32 *phandle;
int sz;
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 554394c96569..f4f6793d2f04 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -81,7 +81,6 @@ extern int __of_update_property(struct device_node *np,
 extern void __of_update_property_sysfs(struct device_node *np,
struct property *newprop, struct property *oldprop);
 
-extern void __of_attach_node(struct device_node *np);
 extern int __of_attach_node_sysfs(struct device_node *np);
 extern void __of_detach_node(struct device_node *np);
 extern void __of_detach_node_sysfs(struct device_node *np);
-- 
Frank Rowand 



[PATCH 3/3] of: detect invalid phandle in overlay

2017-04-23 Thread frowand . list
From: Frank Rowand 

Overlays are not allowed to modify phandle values of previously existing
nodes because there is no information available to allow fixup up of
properties that use the previously existing phandle.

Signed-off-by: Frank Rowand 
---
 drivers/of/overlay.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 7827786718d8..c0e4ee1cd1ba 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -132,6 +132,10 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
/* NOTE: Multiple mods of created nodes not supported */
tchild = of_get_child_by_name(target, cname);
if (tchild != NULL) {
+   /* new overlay phandle value conflicts with existing value */
+   if (child->phandle)
+   return -EINVAL;
+
/* apply overlay recursively */
ret = of_overlay_apply_one(ov, tchild, child);
of_node_put(tchild);
-- 
Frank Rowand 



[PATCH 1/3] of: overlay_adjust_phandles() - do not modify const field

2017-04-23 Thread frowand . list
From: Frank Rowand 

When adjusting overlay phandles to apply to the live device tree, can
not modify the property value because it is type const.

This is to resolve the issue found by Stephen Boyd [1] when he changed
the type of struct property.value from void * to const void *.  As
a result of the type change, the overlay code had compile errors
where the resolver updates phandle values.

  [1] http://lkml.iu.edu/hypermail/linux/kernel/1702.1/04160.html

Signed-off-by: Frank Rowand 
---
 drivers/of/base.c   |  4 ++--
 drivers/of/dynamic.c| 28 +--
 drivers/of/of_private.h |  3 +++
 drivers/of/resolver.c   | 51 ++---
 4 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index d7c4629a3a2d..b41650fd0fcf 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -220,8 +220,8 @@ void __init of_core_init(void)
proc_symlink("device-tree", NULL, 
"/sys/firmware/devicetree/base");
 }
 
-static struct property *__of_find_property(const struct device_node *np,
-  const char *name, int *lenp)
+struct property *__of_find_property(const struct device_node *np,
+   const char *name, int *lenp)
 {
struct property *pp;
 
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 888fdbc09992..44963b4e7235 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -354,17 +354,17 @@ void of_node_release(struct kobject *kobj)
 }
 
 /**
- * __of_prop_dup - Copy a property dynamically.
+ * __of_prop_alloc - Create a property dynamically.
  * @prop:  Property to copy
  * @allocflags:Allocation flags (typically pass GFP_KERNEL)
  *
- * Copy a property by dynamically allocating the memory of both the
+ * Create a property by dynamically allocating the memory of both the
  * property structure and the property name & contents. The property's
  * flags have the OF_DYNAMIC bit set so that we can differentiate between
  * dynamically allocated properties and not.
  * Returns the newly allocated property or NULL on out of memory error.
  */
-struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
+struct property *__of_prop_alloc(char *name, void *value, int len, gfp_t 
allocflags)
 {
struct property *new;
 
@@ -378,9 +378,9 @@ struct property *__of_prop_dup(const struct property *prop, 
gfp_t allocflags)
 * of zero bytes. We do this to work around the use
 * of of_get_property() calls on boolean values.
 */
-   new->name = kstrdup(prop->name, allocflags);
-   new->value = kmemdup(prop->value, prop->length, allocflags);
-   new->length = prop->length;
+   new->name = kstrdup(name, allocflags);
+   new->value = kmemdup(value, len, allocflags);
+   new->length = len;
if (!new->name || !new->value)
goto err_free;
 
@@ -397,6 +397,22 @@ struct property *__of_prop_dup(const struct property 
*prop, gfp_t allocflags)
 }
 
 /**
+ * __of_prop_dup - Copy a property dynamically.
+ * @prop:  Property to copy
+ * @allocflags:Allocation flags (typically pass GFP_KERNEL)
+ *
+ * Copy a property by dynamically allocating the memory of both the
+ * property structure and the property name & contents. The property's
+ * flags have the OF_DYNAMIC bit set so that we can differentiate between
+ * dynamically allocated properties and not.
+ * Returns the newly allocated property or NULL on out of memory error.
+ */
+struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
+{
+   return __of_prop_alloc(prop->name, prop->value, prop->length, 
allocflags);
+}
+
+/**
  * __of_node_dup() - Duplicate or create an empty device node dynamically.
  * @fmt: Format string (plus vargs) for new full name of the device node
  *
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 18bbb4517e25..554394c96569 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -62,6 +62,7 @@ static inline int of_property_notify(int action, struct 
device_node *np,
  * without taking node references, so you either have to
  * own the devtree lock or work on detached trees only.
  */
+struct property *__of_prop_alloc(char *name, void *value, int len, gfp_t 
allocflags);
 struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags);
 __printf(2, 3) struct device_node *__of_node_dup(const struct device_node *np, 
const char *fmt, ...);
 
@@ -70,6 +71,8 @@ extern const void *__of_get_property(const struct device_node 
*np,
 extern int __of_add_property(struct device_node *np, struct property *prop);
 extern int __of_add_property_sysfs(struct device_node *np,
struct property *prop);
+extern struct property *__of_find_property(const struct device_node *np,
+  const char *name, int *lenp);
 extern int 

[PATCH 2/3] of: make __of_attach_node() static

2017-04-23 Thread frowand . list
From: Frank Rowand 

__of_attach_node() is not used outside of drivers/of/dynamic.c.  Make
it static and remove it from drivers/of/of_private.h.

Signed-off-by: Frank Rowand 
---
 drivers/of/dynamic.c| 2 +-
 drivers/of/of_private.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 44963b4e7235..9dcadd704aee 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -216,7 +216,7 @@ int of_property_notify(int action, struct device_node *np,
return of_reconfig_notify(action, );
 }
 
-void __of_attach_node(struct device_node *np)
+static void __of_attach_node(struct device_node *np)
 {
const __be32 *phandle;
int sz;
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 554394c96569..f4f6793d2f04 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -81,7 +81,6 @@ extern int __of_update_property(struct device_node *np,
 extern void __of_update_property_sysfs(struct device_node *np,
struct property *newprop, struct property *oldprop);
 
-extern void __of_attach_node(struct device_node *np);
 extern int __of_attach_node_sysfs(struct device_node *np);
 extern void __of_detach_node(struct device_node *np);
 extern void __of_detach_node_sysfs(struct device_node *np);
-- 
Frank Rowand 



[PATCH 3/3] of: detect invalid phandle in overlay

2017-04-23 Thread frowand . list
From: Frank Rowand 

Overlays are not allowed to modify phandle values of previously existing
nodes because there is no information available to allow fixup up of
properties that use the previously existing phandle.

Signed-off-by: Frank Rowand 
---
 drivers/of/overlay.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 7827786718d8..c0e4ee1cd1ba 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -132,6 +132,10 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
/* NOTE: Multiple mods of created nodes not supported */
tchild = of_get_child_by_name(target, cname);
if (tchild != NULL) {
+   /* new overlay phandle value conflicts with existing value */
+   if (child->phandle)
+   return -EINVAL;
+
/* apply overlay recursively */
ret = of_overlay_apply_one(ov, tchild, child);
of_node_put(tchild);
-- 
Frank Rowand 



[PATCH 0/3] of: fix overlay modification of const variable

2017-04-23 Thread frowand . list
From: Frank Rowand 

When adjusting overlay phandles to apply to the live device tree, can
not modify the property value because it is type const.

This is to resolve the issue found by Stephen Boyd [1] when he changed
the type of struct property.value from void * to const void *.  As
a result of the type change, the overlay code had compile errors
where the resolver updates phandle values.

  [1] http://lkml.iu.edu/hypermail/linux/kernel/1702.1/04160.html

Patch 1 fixes the const variable problem.

Patches 2 and 3 are minor fixups for issues that became visible
while implementing patch 1.

Frank Rowand (3):
  of: overlay_adjust_phandles() - do not modify const field
  of: make __of_attach_node() static
  of: detect invalid phandle in overlay

 drivers/of/base.c   |  4 ++--
 drivers/of/dynamic.c| 30 ++---
 drivers/of/of_private.h |  4 +++-
 drivers/of/overlay.c|  4 
 drivers/of/resolver.c   | 51 ++---
 5 files changed, 63 insertions(+), 30 deletions(-)

-- 
Frank Rowand 



[PATCH 0/3] of: fix overlay modification of const variable

2017-04-23 Thread frowand . list
From: Frank Rowand 

When adjusting overlay phandles to apply to the live device tree, can
not modify the property value because it is type const.

This is to resolve the issue found by Stephen Boyd [1] when he changed
the type of struct property.value from void * to const void *.  As
a result of the type change, the overlay code had compile errors
where the resolver updates phandle values.

  [1] http://lkml.iu.edu/hypermail/linux/kernel/1702.1/04160.html

Patch 1 fixes the const variable problem.

Patches 2 and 3 are minor fixups for issues that became visible
while implementing patch 1.

Frank Rowand (3):
  of: overlay_adjust_phandles() - do not modify const field
  of: make __of_attach_node() static
  of: detect invalid phandle in overlay

 drivers/of/base.c   |  4 ++--
 drivers/of/dynamic.c| 30 ++---
 drivers/of/of_private.h |  4 +++-
 drivers/of/overlay.c|  4 
 drivers/of/resolver.c   | 51 ++---
 5 files changed, 63 insertions(+), 30 deletions(-)

-- 
Frank Rowand 



[PATCH v4 2/2] tiocsti-restrict : make TIOCSTI ioctl require CAP_SYS_ADMIN

2017-04-23 Thread Matt Brown
This introduces the tiocsti_restrict sysctl, whose default is controlled via
CONFIG_SECURITY_TIOCSTI_RESTRICT. When activated, this control restricts
all TIOCSTI ioctl calls from non CAP_SYS_ADMIN users.

This patch depends on patch 1/2

This patch was inspired from GRKERNSEC_HARDEN_TTY.

This patch would have prevented
https://bugzilla.redhat.com/show_bug.cgi?id=1411256 under the following
conditions:
* non-privileged container
* container run inside new user namespace

Possible effects on userland:

There could be a few user programs that would be effected by this
change.
See: 
notable programs are: agetty, csh, xemacs and tcsh

However, I still believe that this change is worth it given that the
Kconfig defaults to n. This will be a feature that is turned on for the
same reason that people activate it when using grsecurity. Users of this
opt-in feature will realize that they are choosing security over some OS
features like unprivileged TIOCSTI ioctls, as should be clear in the
Kconfig help message.

Threat Model/Patch Rational:

>From grsecurity's config for GRKERNSEC_HARDEN_TTY.

 | There are very few legitimate uses for this functionality and it
 | has made vulnerabilities in several 'su'-like programs possible in
 | the past.  Even without these vulnerabilities, it provides an
 | attacker with an easy mechanism to move laterally among other
 | processes within the same user's compromised session.

So if one process within a tty session becomes compromised it can follow
that additional processes, that are thought to be in different security
boundaries, can be compromised as a result. When using a program like su
or sudo, these additional processes could be in a tty session where TTY file
descriptors are indeed shared over privilege boundaries.

This is also an excellent writeup about the issue:


When user namespaces are in use, the check for the capability
CAP_SYS_ADMIN is done against the user namespace that originally opened
the tty.

Signed-off-by: Matt Brown 
---
 Documentation/sysctl/kernel.txt | 21 +
 drivers/tty/tty_io.c|  6 ++
 include/linux/tty.h |  2 ++
 kernel/sysctl.c | 12 
 security/Kconfig| 13 +
 5 files changed, 54 insertions(+)

diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index bac23c1..c15c660 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -89,6 +89,7 @@ show up in /proc/sys/kernel:
 - sysctl_writes_strict
 - tainted
 - threads-max
+- tiocsti_restrict
 - unknown_nmi_panic
 - watchdog
 - watchdog_thresh
@@ -987,6 +988,26 @@ available RAM pages threads-max is reduced accordingly.
 
 ==
 
+tiocsti_restrict:
+
+This toggle indicates whether unprivileged users are prevented
+from using the TIOCSTI ioctl to inject commands into otherprocesses
+which share a tty session.
+
+When tiocsti_restrict is set to (0) there are no restrictions(accept
+the default restriction of only being able to injection commands into
+one's own tty). When tiocsti_restrict is set to (1), users must
+have CAP_SYS_ADMIN to use the TIOCSTI ioctl.
+
+When user namespaces are in use, the check for the capability
+CAP_SYS_ADMIN is done against the user namespace that originally
+opened the tty.
+
+The kernel config option CONFIG_SECURITY_TIOCSTI_RESTRICT sets the
+default value of tiocsti_restrict.
+
+==
+
 unknown_nmi_panic:
 
 The value in this file affects behavior of handling NMI. When the
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c276814..fe68d14 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2297,11 +2297,17 @@ static int tty_fasync(int fd, struct file *filp, int on)
  * FIXME: may race normal receive processing
  */
 
+int tiocsti_restrict = IS_ENABLED(CONFIG_SECURITY_TIOCSTI_RESTRICT);
+
 static int tiocsti(struct tty_struct *tty, char __user *p)
 {
char ch, mbz = 0;
struct tty_ldisc *ld;
 
+   if (tiocsti_restrict && !ns_capable(tty->owner_user_ns,CAP_SYS_ADMIN)) {
+   pr_warn_ratelimited("TIOCSTI ioctl call blocked for 
non-privileged process\n");
+   return -EPERM;
+   }
if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
return -EPERM;
if (get_user(ch, p))
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d902d42..2fd7f49 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -344,6 +344,8 @@ struct tty_file_private {
struct list_head list;
 };
 
+extern int tiocsti_restrict;
+
 /* tty magic number */
 #define TTY_MAGIC  0x5401
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index acf0a5a..68d1363 

[PATCH v4 1/2] tiocsti-restrict : Add owner user namespace to tty_struct

2017-04-23 Thread Matt Brown
This patch adds struct user_namespace *owner_user_ns to the tty_struct.
Then it is set to current_user_ns() in the alloc_tty_struct function.

This is done to facilitate capability checks against the original user
namespace that allocated the tty.

E.g. ns_capable(tty->owner_user_ns,CAP_SYS_ADMIN)

This combined with the use of user namespace's will allow hardening
protections to be built to mitigate container escapes that utilize TTY
ioctls such as TIOCSTI.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1411256

Signed-off-by: Matt Brown 
---
 drivers/tty/tty_io.c | 2 ++
 include/linux/tty.h  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index e6d1a65..c276814 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -171,6 +171,7 @@ static void free_tty_struct(struct tty_struct *tty)
put_device(tty->dev);
kfree(tty->write_buf);
tty->magic = 0xDEADDEAD;
+   put_user_ns(tty->owner_user_ns);
kfree(tty);
 }
 
@@ -3191,6 +3192,7 @@ struct tty_struct *alloc_tty_struct(struct tty_driver 
*driver, int idx)
tty->index = idx;
tty_line_name(driver, idx, tty->name);
tty->dev = tty_get_device(tty);
+   tty->owner_user_ns = get_user_ns(current_user_ns());
 
return tty;
 }
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1017e904..d902d42 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 /*
@@ -333,6 +334,7 @@ struct tty_struct {
/* If the tty has a pending do_SAK, queue it here - akpm */
struct work_struct SAK_work;
struct tty_port *port;
+   struct user_namespace *owner_user_ns;
 };
 
 /* Each of a tty's open files has private_data pointing to tty_file_private */
-- 
2.10.2



[PATCH v4 2/2] tiocsti-restrict : make TIOCSTI ioctl require CAP_SYS_ADMIN

2017-04-23 Thread Matt Brown
This introduces the tiocsti_restrict sysctl, whose default is controlled via
CONFIG_SECURITY_TIOCSTI_RESTRICT. When activated, this control restricts
all TIOCSTI ioctl calls from non CAP_SYS_ADMIN users.

This patch depends on patch 1/2

This patch was inspired from GRKERNSEC_HARDEN_TTY.

This patch would have prevented
https://bugzilla.redhat.com/show_bug.cgi?id=1411256 under the following
conditions:
* non-privileged container
* container run inside new user namespace

Possible effects on userland:

There could be a few user programs that would be effected by this
change.
See: 
notable programs are: agetty, csh, xemacs and tcsh

However, I still believe that this change is worth it given that the
Kconfig defaults to n. This will be a feature that is turned on for the
same reason that people activate it when using grsecurity. Users of this
opt-in feature will realize that they are choosing security over some OS
features like unprivileged TIOCSTI ioctls, as should be clear in the
Kconfig help message.

Threat Model/Patch Rational:

>From grsecurity's config for GRKERNSEC_HARDEN_TTY.

 | There are very few legitimate uses for this functionality and it
 | has made vulnerabilities in several 'su'-like programs possible in
 | the past.  Even without these vulnerabilities, it provides an
 | attacker with an easy mechanism to move laterally among other
 | processes within the same user's compromised session.

So if one process within a tty session becomes compromised it can follow
that additional processes, that are thought to be in different security
boundaries, can be compromised as a result. When using a program like su
or sudo, these additional processes could be in a tty session where TTY file
descriptors are indeed shared over privilege boundaries.

This is also an excellent writeup about the issue:


When user namespaces are in use, the check for the capability
CAP_SYS_ADMIN is done against the user namespace that originally opened
the tty.

Signed-off-by: Matt Brown 
---
 Documentation/sysctl/kernel.txt | 21 +
 drivers/tty/tty_io.c|  6 ++
 include/linux/tty.h |  2 ++
 kernel/sysctl.c | 12 
 security/Kconfig| 13 +
 5 files changed, 54 insertions(+)

diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index bac23c1..c15c660 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -89,6 +89,7 @@ show up in /proc/sys/kernel:
 - sysctl_writes_strict
 - tainted
 - threads-max
+- tiocsti_restrict
 - unknown_nmi_panic
 - watchdog
 - watchdog_thresh
@@ -987,6 +988,26 @@ available RAM pages threads-max is reduced accordingly.
 
 ==
 
+tiocsti_restrict:
+
+This toggle indicates whether unprivileged users are prevented
+from using the TIOCSTI ioctl to inject commands into otherprocesses
+which share a tty session.
+
+When tiocsti_restrict is set to (0) there are no restrictions(accept
+the default restriction of only being able to injection commands into
+one's own tty). When tiocsti_restrict is set to (1), users must
+have CAP_SYS_ADMIN to use the TIOCSTI ioctl.
+
+When user namespaces are in use, the check for the capability
+CAP_SYS_ADMIN is done against the user namespace that originally
+opened the tty.
+
+The kernel config option CONFIG_SECURITY_TIOCSTI_RESTRICT sets the
+default value of tiocsti_restrict.
+
+==
+
 unknown_nmi_panic:
 
 The value in this file affects behavior of handling NMI. When the
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c276814..fe68d14 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2297,11 +2297,17 @@ static int tty_fasync(int fd, struct file *filp, int on)
  * FIXME: may race normal receive processing
  */
 
+int tiocsti_restrict = IS_ENABLED(CONFIG_SECURITY_TIOCSTI_RESTRICT);
+
 static int tiocsti(struct tty_struct *tty, char __user *p)
 {
char ch, mbz = 0;
struct tty_ldisc *ld;
 
+   if (tiocsti_restrict && !ns_capable(tty->owner_user_ns,CAP_SYS_ADMIN)) {
+   pr_warn_ratelimited("TIOCSTI ioctl call blocked for 
non-privileged process\n");
+   return -EPERM;
+   }
if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
return -EPERM;
if (get_user(ch, p))
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d902d42..2fd7f49 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -344,6 +344,8 @@ struct tty_file_private {
struct list_head list;
 };
 
+extern int tiocsti_restrict;
+
 /* tty magic number */
 #define TTY_MAGIC  0x5401
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index acf0a5a..68d1363 100644
--- 

[PATCH v4 1/2] tiocsti-restrict : Add owner user namespace to tty_struct

2017-04-23 Thread Matt Brown
This patch adds struct user_namespace *owner_user_ns to the tty_struct.
Then it is set to current_user_ns() in the alloc_tty_struct function.

This is done to facilitate capability checks against the original user
namespace that allocated the tty.

E.g. ns_capable(tty->owner_user_ns,CAP_SYS_ADMIN)

This combined with the use of user namespace's will allow hardening
protections to be built to mitigate container escapes that utilize TTY
ioctls such as TIOCSTI.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1411256

Signed-off-by: Matt Brown 
---
 drivers/tty/tty_io.c | 2 ++
 include/linux/tty.h  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index e6d1a65..c276814 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -171,6 +171,7 @@ static void free_tty_struct(struct tty_struct *tty)
put_device(tty->dev);
kfree(tty->write_buf);
tty->magic = 0xDEADDEAD;
+   put_user_ns(tty->owner_user_ns);
kfree(tty);
 }
 
@@ -3191,6 +3192,7 @@ struct tty_struct *alloc_tty_struct(struct tty_driver 
*driver, int idx)
tty->index = idx;
tty_line_name(driver, idx, tty->name);
tty->dev = tty_get_device(tty);
+   tty->owner_user_ns = get_user_ns(current_user_ns());
 
return tty;
 }
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1017e904..d902d42 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 /*
@@ -333,6 +334,7 @@ struct tty_struct {
/* If the tty has a pending do_SAK, queue it here - akpm */
struct work_struct SAK_work;
struct tty_port *port;
+   struct user_namespace *owner_user_ns;
 };
 
 /* Each of a tty's open files has private_data pointing to tty_file_private */
-- 
2.10.2



[PATCH v4 0/2] tiocsti-restrict : make TIOCSTI ioctl require CAP_SYS_ADMIN

2017-04-23 Thread Matt Brown
This patchset introduces the tiocsti_restrict sysctl, whose default is
controlled via CONFIG_SECURITY_TIOCSTI_RESTRICT. When activated, this
control restricts all TIOCSTI ioctl calls from non CAP_SYS_ADMIN users.

This patch was inspired from GRKERNSEC_HARDEN_TTY.

This patch would have prevented
https://bugzilla.redhat.com/show_bug.cgi?id=1411256 under the following
conditions:
* non-privileged container
* container run inside new user namespace

Possible effects on userland:

There could be a few user programs that would be effected by this
change.
See: 
notable programs are: agetty, csh, xemacs and tcsh

However, I still believe that this change is worth it given that the
Kconfig defaults to n. This will be a feature that is turned on for the
same reason that people activate it when using grsecurity. Users of this
opt-in feature will realize that they are choosing security over some OS
features like unprivileged TIOCSTI ioctls, as should be clear in the
Kconfig help message.

Threat Model/Patch Rational:

>From grsecurity's config for GRKERNSEC_HARDEN_TTY.

 | There are very few legitimate uses for this functionality and it
 | has made vulnerabilities in several 'su'-like programs possible in
 | the past.  Even without these vulnerabilities, it provides an
 | attacker with an easy mechanism to move laterally among other
 | processes within the same user's compromised session.

So if one process within a tty session becomes compromised it can follow
that additional processes, that are thought to be in different security
boundaries, can be compromised as a result. When using a program like su
or sudo, these additional processes could be in a tty session where TTY file
descriptors are indeed shared over privilege boundaries.

This is also an excellent writeup about the issue:


When user namespaces are in use, the check for the capability
CAP_SYS_ADMIN is done against the user namespace that originally opened
the tty.

# Changes since v3:
* use get_user_ns and put_user_ns to take and drop references to the owner
  user namespace because CONFIG_USER_NS is an option

# Changes since v2:
* take/drop reference to user namespace on tty struct alloc/free to prevent
  use-after-free.

# Changes since v1:
* added owner_user_ns to tty_struct to enable capability checks against
  the namespace that created the tty.
* rewording in different places to make patchset purpose clear
* Added Documentation



[PATCH v4 0/2] tiocsti-restrict : make TIOCSTI ioctl require CAP_SYS_ADMIN

2017-04-23 Thread Matt Brown
This patchset introduces the tiocsti_restrict sysctl, whose default is
controlled via CONFIG_SECURITY_TIOCSTI_RESTRICT. When activated, this
control restricts all TIOCSTI ioctl calls from non CAP_SYS_ADMIN users.

This patch was inspired from GRKERNSEC_HARDEN_TTY.

This patch would have prevented
https://bugzilla.redhat.com/show_bug.cgi?id=1411256 under the following
conditions:
* non-privileged container
* container run inside new user namespace

Possible effects on userland:

There could be a few user programs that would be effected by this
change.
See: 
notable programs are: agetty, csh, xemacs and tcsh

However, I still believe that this change is worth it given that the
Kconfig defaults to n. This will be a feature that is turned on for the
same reason that people activate it when using grsecurity. Users of this
opt-in feature will realize that they are choosing security over some OS
features like unprivileged TIOCSTI ioctls, as should be clear in the
Kconfig help message.

Threat Model/Patch Rational:

>From grsecurity's config for GRKERNSEC_HARDEN_TTY.

 | There are very few legitimate uses for this functionality and it
 | has made vulnerabilities in several 'su'-like programs possible in
 | the past.  Even without these vulnerabilities, it provides an
 | attacker with an easy mechanism to move laterally among other
 | processes within the same user's compromised session.

So if one process within a tty session becomes compromised it can follow
that additional processes, that are thought to be in different security
boundaries, can be compromised as a result. When using a program like su
or sudo, these additional processes could be in a tty session where TTY file
descriptors are indeed shared over privilege boundaries.

This is also an excellent writeup about the issue:


When user namespaces are in use, the check for the capability
CAP_SYS_ADMIN is done against the user namespace that originally opened
the tty.

# Changes since v3:
* use get_user_ns and put_user_ns to take and drop references to the owner
  user namespace because CONFIG_USER_NS is an option

# Changes since v2:
* take/drop reference to user namespace on tty struct alloc/free to prevent
  use-after-free.

# Changes since v1:
* added owner_user_ns to tty_struct to enable capability checks against
  the namespace that created the tty.
* rewording in different places to make patchset purpose clear
* Added Documentation



Re: [PATCH v6 05/15] lockdep: Implement crossrelease feature

2017-04-23 Thread Byungchul Park
On Wed, Apr 19, 2017 at 04:25:03PM +0200, Peter Zijlstra wrote:
> On Tue, Mar 14, 2017 at 05:18:52PM +0900, Byungchul Park wrote:
> > +struct hist_lock {
> > +   /*
> > +* Each work of workqueue might run in a different context,
> > +* thanks to concurrency support of workqueue. So we have to
> > +* distinguish each work to avoid false positive.
> > +*/
> > +   unsigned intwork_id;
> >  };
> 
> > @@ -1749,6 +1749,14 @@ struct task_struct {
> > struct held_lock held_locks[MAX_LOCK_DEPTH];
> > gfp_t lockdep_reclaim_gfp;
> >  #endif
> > +#ifdef CONFIG_LOCKDEP_CROSSRELEASE
> > +#define MAX_XHLOCKS_NR 64UL
> > +   struct hist_lock *xhlocks; /* Crossrelease history locks */
> > +   unsigned int xhlock_idx;
> > +   unsigned int xhlock_idx_soft; /* For backing up at softirq entry */
> > +   unsigned int xhlock_idx_hard; /* For backing up at hardirq entry */
> > +   unsigned int work_id;
> > +#endif
> >  #ifdef CONFIG_UBSAN
> > unsigned int in_ubsan;
> >  #endif
> 
> > +/*
> > + * Crossrelease needs to distinguish each work of workqueues.
> > + * Caller is supposed to be a worker.
> > + */
> > +void crossrelease_work_start(void)
> > +{
> > +   if (current->xhlocks)
> > +   current->work_id++;
> > +}
> 
> > +/*
> > + * Only access local task's data, so irq disable is only required.
> > + */
> > +static int same_context_xhlock(struct hist_lock *xhlock)
> > +{
> > +   struct task_struct *curr = current;
> > +
> > +   /* In the case of hardirq context */
> > +   if (curr->hardirq_context) {
> > +   if (xhlock->hlock.irq_context & 2) /* 2: bitmask for hardirq */
> > +   return 1;
> > +   /* In the case of softriq context */
> > +   } else if (curr->softirq_context) {
> > +   if (xhlock->hlock.irq_context & 1) /* 1: bitmask for softirq */
> > +   return 1;
> > +   /* In the case of process context */
> > +   } else {
> > +   if (xhlock->work_id == curr->work_id)
> > +   return 1;
> > +   }
> > +   return 0;
> > +}
> 
> I still don't like work_id; it doesn't have anything to do with
> workqueues per se, other than the fact that they end up using it.
> 
> It's a history generation id; touching it completely invalidates our
> history. Workqueues need this because they run independent work from the
> same context.
> 
> But the same is true for other sites. Last time I suggested
> lockdep_assert_empty() to denote all suck places (and note we already
> have lockdep_sys_exit() that hooks into the return to user path).

I'm sorry but I don't understand what you intend. It would be appriciated
if you explain more.

You might know why I introduced the 'work_id'.. Is there any alternative?

Thank you.


Re: [PATCH v6 05/15] lockdep: Implement crossrelease feature

2017-04-23 Thread Byungchul Park
On Wed, Apr 19, 2017 at 04:25:03PM +0200, Peter Zijlstra wrote:
> On Tue, Mar 14, 2017 at 05:18:52PM +0900, Byungchul Park wrote:
> > +struct hist_lock {
> > +   /*
> > +* Each work of workqueue might run in a different context,
> > +* thanks to concurrency support of workqueue. So we have to
> > +* distinguish each work to avoid false positive.
> > +*/
> > +   unsigned intwork_id;
> >  };
> 
> > @@ -1749,6 +1749,14 @@ struct task_struct {
> > struct held_lock held_locks[MAX_LOCK_DEPTH];
> > gfp_t lockdep_reclaim_gfp;
> >  #endif
> > +#ifdef CONFIG_LOCKDEP_CROSSRELEASE
> > +#define MAX_XHLOCKS_NR 64UL
> > +   struct hist_lock *xhlocks; /* Crossrelease history locks */
> > +   unsigned int xhlock_idx;
> > +   unsigned int xhlock_idx_soft; /* For backing up at softirq entry */
> > +   unsigned int xhlock_idx_hard; /* For backing up at hardirq entry */
> > +   unsigned int work_id;
> > +#endif
> >  #ifdef CONFIG_UBSAN
> > unsigned int in_ubsan;
> >  #endif
> 
> > +/*
> > + * Crossrelease needs to distinguish each work of workqueues.
> > + * Caller is supposed to be a worker.
> > + */
> > +void crossrelease_work_start(void)
> > +{
> > +   if (current->xhlocks)
> > +   current->work_id++;
> > +}
> 
> > +/*
> > + * Only access local task's data, so irq disable is only required.
> > + */
> > +static int same_context_xhlock(struct hist_lock *xhlock)
> > +{
> > +   struct task_struct *curr = current;
> > +
> > +   /* In the case of hardirq context */
> > +   if (curr->hardirq_context) {
> > +   if (xhlock->hlock.irq_context & 2) /* 2: bitmask for hardirq */
> > +   return 1;
> > +   /* In the case of softriq context */
> > +   } else if (curr->softirq_context) {
> > +   if (xhlock->hlock.irq_context & 1) /* 1: bitmask for softirq */
> > +   return 1;
> > +   /* In the case of process context */
> > +   } else {
> > +   if (xhlock->work_id == curr->work_id)
> > +   return 1;
> > +   }
> > +   return 0;
> > +}
> 
> I still don't like work_id; it doesn't have anything to do with
> workqueues per se, other than the fact that they end up using it.
> 
> It's a history generation id; touching it completely invalidates our
> history. Workqueues need this because they run independent work from the
> same context.
> 
> But the same is true for other sites. Last time I suggested
> lockdep_assert_empty() to denote all suck places (and note we already
> have lockdep_sys_exit() that hooks into the return to user path).

I'm sorry but I don't understand what you intend. It would be appriciated
if you explain more.

You might know why I introduced the 'work_id'.. Is there any alternative?

Thank you.


Re: Question on the five-level page table support patches

2017-04-23 Thread Andy Lutomirski
On Sun, Apr 23, 2017 at 3:53 AM, John Paul Adrian Glaubitz
 wrote:
> Hi Kirill!
>
> I recently read the LWN article on your and your colleagues work to
> add five-level page table support for x86 to the Linux kernel [1]
> and I got your email address from the last patch of the series.
>
> Since this extends the address space beyond 48-bits, as you may know,
> it will cause potential headaches with Javascript engines which use
> tagged pointers. On SPARC, the virtual address space already extends
> to 52 bits and we are running into these very issues with Javascript
> engines on SPARC.
>
> Now, a possible way to mitigate this problem would be to pass the
> "hint" parameter to mmap() in order to tell the kernel not to allocate
> memory beyond the 48 bits address space. Unfortunately, on Linux this
> will only work when the area pointed to by "hint" is unallocated which
> means one cannot simply use a hardcoded "hint" to mitigate this problem.
>
> However, since this trick still works on NetBSD and used to work on
> Linux [3], I was wondering whether there are plans to bring back
> this behavior to mmap() in Linux.
>
> Currently, people are using ugly work-arounds [4] to address this
> problem which involve a manual iteration over memory blocks and
> basically implementing another allocator in the user space
> application.
>
> Thanks,
> Adrian
>
>> [1] https://lwn.net/Articles/717293/
>> [2] https://lwn.net/Articles/717300/
>> [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824449#22
>> [4] https://hg.mozilla.org/mozilla-central/rev/dfaafbaaa291
>

Can you explain what the issue is?  What used to work on Linux and
doesn't any more?  The man page is quite clear:

   MAP_FIXED
  Don't  interpret  addr  as  a hint: place the mapping at exactly
  that address.  addr must be a multiple of the page size.  If the
  memory  region  specified  by addr and len overlaps pages of any
  existing mapping(s), then the overlapped part  of  the  existing
  mapping(s)  will  be discarded.  If the specified address cannot
  be used, mmap() will fail.  Because requiring  a  fixed  address
  for  a  mapping is less portable, the use of this option is dis‐
  couraged.

and AFAIK Linux works exactly as documented.

FWIW, a patch to add a new MAP_ mode to tell mmap(2) to use the hinted
address if available and to *fail* if the hinted address is not
available would very likely be accepted and would IMO be much nicer
than the current behavior.

--Andy


Re: Question on the five-level page table support patches

2017-04-23 Thread Andy Lutomirski
On Sun, Apr 23, 2017 at 3:53 AM, John Paul Adrian Glaubitz
 wrote:
> Hi Kirill!
>
> I recently read the LWN article on your and your colleagues work to
> add five-level page table support for x86 to the Linux kernel [1]
> and I got your email address from the last patch of the series.
>
> Since this extends the address space beyond 48-bits, as you may know,
> it will cause potential headaches with Javascript engines which use
> tagged pointers. On SPARC, the virtual address space already extends
> to 52 bits and we are running into these very issues with Javascript
> engines on SPARC.
>
> Now, a possible way to mitigate this problem would be to pass the
> "hint" parameter to mmap() in order to tell the kernel not to allocate
> memory beyond the 48 bits address space. Unfortunately, on Linux this
> will only work when the area pointed to by "hint" is unallocated which
> means one cannot simply use a hardcoded "hint" to mitigate this problem.
>
> However, since this trick still works on NetBSD and used to work on
> Linux [3], I was wondering whether there are plans to bring back
> this behavior to mmap() in Linux.
>
> Currently, people are using ugly work-arounds [4] to address this
> problem which involve a manual iteration over memory blocks and
> basically implementing another allocator in the user space
> application.
>
> Thanks,
> Adrian
>
>> [1] https://lwn.net/Articles/717293/
>> [2] https://lwn.net/Articles/717300/
>> [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824449#22
>> [4] https://hg.mozilla.org/mozilla-central/rev/dfaafbaaa291
>

Can you explain what the issue is?  What used to work on Linux and
doesn't any more?  The man page is quite clear:

   MAP_FIXED
  Don't  interpret  addr  as  a hint: place the mapping at exactly
  that address.  addr must be a multiple of the page size.  If the
  memory  region  specified  by addr and len overlaps pages of any
  existing mapping(s), then the overlapped part  of  the  existing
  mapping(s)  will  be discarded.  If the specified address cannot
  be used, mmap() will fail.  Because requiring  a  fixed  address
  for  a  mapping is less portable, the use of this option is dis‐
  couraged.

and AFAIK Linux works exactly as documented.

FWIW, a patch to add a new MAP_ mode to tell mmap(2) to use the hinted
address if available and to *fail* if the hinted address is not
available would very likely be accepted and would IMO be much nicer
than the current behavior.

--Andy


Re: [PATCH] xen/scsifront: use offset_in_page() macro

2017-04-23 Thread Juergen Gross
On 22/04/17 03:21, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
> 
> Signed-off-by: Geliang Tang 

Reviewed-by: Juergen Gross 


Thanks,

Juergen


Re: [PATCH] xen/scsifront: use offset_in_page() macro

2017-04-23 Thread Juergen Gross
On 22/04/17 03:21, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
> 
> Signed-off-by: Geliang Tang 

Reviewed-by: Juergen Gross 


Thanks,

Juergen


[PATCH v2 07/29] drm/cirrus: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort the touched part alphabetically

 drivers/gpu/drm/cirrus/Makefile | 1 -
 drivers/gpu/drm/cirrus/cirrus_ttm.c | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/Makefile b/drivers/gpu/drm/cirrus/Makefile
index 69ffe70..919c0a3 100644
--- a/drivers/gpu/drm/cirrus/Makefile
+++ b/drivers/gpu/drm/cirrus/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 cirrus-y  := cirrus_main.o cirrus_mode.o \
cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o
 
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c 
b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 93dbcd3..1ff1838 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -26,8 +26,9 @@
  * Authors: Dave Airlie 
  */
 #include 
+#include 
+
 #include "cirrus_drv.h"
-#include 
 
 static inline struct cirrus_device *
 cirrus_bdev(struct ttm_bo_device *bd)
-- 
2.7.4



[PATCH v2 08/29] drm/hisilicon: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/hisilicon/hibmc/Makefile| 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile 
b/drivers/gpu/drm/hisilicon/hibmc/Makefile
index f2e04c0..3df7266 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/Makefile
+++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_de.o hibmc_drm_vdac.o 
hibmc_drm_fbdev.o hibmc_ttm.o
 
 obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc-drm.o
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index 20732b6..ac457c7 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -17,7 +17,7 @@
  */
 
 #include 
-#include 
+#include 
 
 #include "hibmc_drm_drv.h"
 
-- 
2.7.4



[PATCH v2 04/29] drm/ast: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort the touched part alphabetically

 drivers/gpu/drm/ast/Makefile  | 2 --
 drivers/gpu/drm/ast/ast_ttm.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
index 171aa06..617fdd3 100644
--- a/drivers/gpu/drm/ast/Makefile
+++ b/drivers/gpu/drm/ast/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
-
 ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o 
ast_dp501.o
 
 obj-$(CONFIG_DRM_AST) := ast.o
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index e879496..5808498 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -26,8 +26,9 @@
  * Authors: Dave Airlie 
  */
 #include 
+#include 
+
 #include "ast_drv.h"
-#include 
 
 static inline struct ast_private *
 ast_bdev(struct ttm_bo_device *bd)
-- 
2.7.4



[PATCH v2 07/29] drm/cirrus: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort the touched part alphabetically

 drivers/gpu/drm/cirrus/Makefile | 1 -
 drivers/gpu/drm/cirrus/cirrus_ttm.c | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/Makefile b/drivers/gpu/drm/cirrus/Makefile
index 69ffe70..919c0a3 100644
--- a/drivers/gpu/drm/cirrus/Makefile
+++ b/drivers/gpu/drm/cirrus/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 cirrus-y  := cirrus_main.o cirrus_mode.o \
cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o
 
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c 
b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 93dbcd3..1ff1838 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -26,8 +26,9 @@
  * Authors: Dave Airlie 
  */
 #include 
+#include 
+
 #include "cirrus_drv.h"
-#include 
 
 static inline struct cirrus_device *
 cirrus_bdev(struct ttm_bo_device *bd)
-- 
2.7.4



[PATCH v2 08/29] drm/hisilicon: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/hisilicon/hibmc/Makefile| 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile 
b/drivers/gpu/drm/hisilicon/hibmc/Makefile
index f2e04c0..3df7266 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/Makefile
+++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_de.o hibmc_drm_vdac.o 
hibmc_drm_fbdev.o hibmc_ttm.o
 
 obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc-drm.o
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index 20732b6..ac457c7 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -17,7 +17,7 @@
  */
 
 #include 
-#include 
+#include 
 
 #include "hibmc_drm_drv.h"
 
-- 
2.7.4



[PATCH v2 04/29] drm/ast: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort the touched part alphabetically

 drivers/gpu/drm/ast/Makefile  | 2 --
 drivers/gpu/drm/ast/ast_ttm.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
index 171aa06..617fdd3 100644
--- a/drivers/gpu/drm/ast/Makefile
+++ b/drivers/gpu/drm/ast/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
-
 ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o 
ast_dp501.o
 
 obj-$(CONFIG_DRM_AST) := ast.o
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index e879496..5808498 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -26,8 +26,9 @@
  * Authors: Dave Airlie 
  */
 #include 
+#include 
+
 #include "ast_drv.h"
-#include 
 
 static inline struct ast_private *
 ast_bdev(struct ttm_bo_device *bd)
-- 
2.7.4



[PATCH v2 13/29] drm/radeon: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
Reviewed-by: Michel Dänzer 
---

Changes in v2: None

 drivers/gpu/drm/radeon/Makefile  |  2 +-
 drivers/gpu/drm/radeon/btc_dpm.c |  2 +-
 drivers/gpu/drm/radeon/ci_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/ci_smc.c  |  2 +-
 drivers/gpu/drm/radeon/cik.c |  2 +-
 drivers/gpu/drm/radeon/cypress_dpm.c |  2 +-
 drivers/gpu/drm/radeon/kv_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/kv_smc.c  |  2 +-
 drivers/gpu/drm/radeon/ni_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/r600_dpm.c|  2 +-
 drivers/gpu/drm/radeon/radeon.h  | 10 +-
 drivers/gpu/drm/radeon/radeon_drv.c  |  2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c  | 10 +-
 drivers/gpu/drm/radeon/rs780_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv6xx_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv730_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv740_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv770_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv770_smc.c   |  2 +-
 drivers/gpu/drm/radeon/si_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/si_smc.c  |  2 +-
 drivers/gpu/drm/radeon/sumo_dpm.c|  2 +-
 drivers/gpu/drm/radeon/sumo_smc.c|  2 +-
 drivers/gpu/drm/radeon/trinity_dpm.c |  2 +-
 drivers/gpu/drm/radeon/trinity_smc.c |  2 +-
 25 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 08bd17d..a5d3cd3 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include
+ccflags-y := -Idrivers/gpu/drm/amd/include
 
 hostprogs-y := mkregtable
 clean-files := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h 
rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h 
r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index 38e5123..95652e6 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "btcd.h"
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 7ba4508..f0cf997 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "radeon_ucode.h"
diff --git a/drivers/gpu/drm/radeon/ci_smc.c b/drivers/gpu/drm/radeon/ci_smc.c
index 24760ee..3356a21 100644
--- a/drivers/gpu/drm/radeon/ci_smc.c
+++ b/drivers/gpu/drm/radeon/ci_smc.c
@@ -23,7 +23,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "cikd.h"
 #include "ppsmc.h"
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 53710dd..e0db246 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "radeon_audio.h"
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c 
b/drivers/gpu/drm/radeon/cypress_dpm.c
index a4edd07..3eb7899 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "evergreend.h"
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index a7e9786..ae1529b 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -21,7 +21,7 @@
  *
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "cikd.h"
 #include "r600_dpm.h"
diff --git a/drivers/gpu/drm/radeon/kv_smc.c b/drivers/gpu/drm/radeon/kv_smc.c
index b59..af60bd3 100644
--- a/drivers/gpu/drm/radeon/kv_smc.c
+++ b/drivers/gpu/drm/radeon/kv_smc.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "cikd.h"
 #include "kv_dpm.h"
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 4a601f9..9416e72 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -21,7 +21,7 @@
  *
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "nid.h"
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c 
b/drivers/gpu/drm/radeon/r600_dpm.c
index c7fc1db..31d1b47 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"

[PATCH v2 02/29] drm/ttm: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
For the C file, include  instead of relative path from
include/drm.

For headers in include/drm/ttm, simplify the  with "*.h".

This allows us to remove the -Iinclude/drm compiler flag from
drivers/gpu/drm/ttm/Makefile (and from other drivers' Makefiles).

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Use #include "..." for headers  (Michel Danzer)

 drivers/gpu/drm/ttm/Makefile   | 1 -
 drivers/gpu/drm/ttm/ttm_bo_vm.c| 6 +++---
 include/drm/ttm/ttm_bo_driver.h| 9 +
 include/drm/ttm/ttm_execbuf_util.h | 3 ++-
 include/drm/ttm/ttm_lock.h | 3 ++-
 include/drm/ttm/ttm_object.h   | 3 ++-
 6 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index f923258..4d0c938 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -1,7 +1,6 @@
 #
 # Makefile for the drm device driver.  This driver provides support for the
 
-ccflags-y := -Iinclude/drm
 ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 9f53df9..b442d12 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -30,9 +30,9 @@
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 6bbd34d..990d529 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -30,10 +30,6 @@
 #ifndef _TTM_BO_DRIVER_H_
 #define _TTM_BO_DRIVER_H_
 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -42,6 +38,11 @@
 #include 
 #include 
 
+#include "ttm_bo_api.h"
+#include "ttm_memory.h"
+#include "ttm_module.h"
+#include "ttm_placement.h"
+
 #define TTM_MAX_BO_PRIORITY4U
 
 struct ttm_backend_func {
diff --git a/include/drm/ttm/ttm_execbuf_util.h 
b/include/drm/ttm/ttm_execbuf_util.h
index 47f35b8..b0fdd19 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -31,9 +31,10 @@
 #ifndef _TTM_EXECBUF_UTIL_H_
 #define _TTM_EXECBUF_UTIL_H_
 
-#include 
 #include 
 
+#include "ttm_bo_api.h"
+
 /**
  * struct ttm_validate_buffer
  *
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h
index 2902beb..0c3af98 100644
--- a/include/drm/ttm/ttm_lock.h
+++ b/include/drm/ttm/ttm_lock.h
@@ -49,10 +49,11 @@
 #ifndef _TTM_LOCK_H_
 #define _TTM_LOCK_H_
 
-#include 
 #include 
 #include 
 
+#include "ttm_object.h"
+
 /**
  * struct ttm_lock
  *
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index 1487011..a98bfeb 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -42,7 +42,8 @@
 #include 
 #include 
 #include 
-#include 
+
+#include "ttm_memory.h"
 
 /**
  * enum ttm_ref_type
-- 
2.7.4



[PATCH v2 12/29] drm/qxl: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort the touched parts

 drivers/gpu/drm/qxl/Makefile  |  2 --
 drivers/gpu/drm/qxl/qxl_debugfs.c |  2 +-
 drivers/gpu/drm/qxl/qxl_display.c |  9 -
 drivers/gpu/drm/qxl/qxl_drv.c |  6 +++---
 drivers/gpu/drm/qxl/qxl_drv.h | 18 --
 drivers/gpu/drm/qxl/qxl_fb.c  | 11 ++-
 drivers/gpu/drm/qxl/qxl_gem.c |  5 +++--
 drivers/gpu/drm/qxl/qxl_ttm.c | 10 +-
 8 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/qxl/Makefile b/drivers/gpu/drm/qxl/Makefile
index bacc4af..33a7d0c 100644
--- a/drivers/gpu/drm/qxl/Makefile
+++ b/drivers/gpu/drm/qxl/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
-
 qxl-y := qxl_drv.o qxl_kms.o qxl_display.o qxl_ttm.o qxl_fb.o qxl_object.o 
qxl_gem.o qxl_cmd.o qxl_image.o qxl_draw.o qxl_debugfs.o qxl_irq.o qxl_dumb.o 
qxl_ioctl.o qxl_release.o qxl_prime.o
 
 obj-$(CONFIG_DRM_QXL)+= qxl.o
diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c 
b/drivers/gpu/drm/qxl/qxl_debugfs.c
index ffe821b..15c8406 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -30,7 +30,7 @@
 
 #include 
 
-#include "drmP.h"
+#include 
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
diff --git a/drivers/gpu/drm/qxl/qxl_display.c 
b/drivers/gpu/drm/qxl/qxl_display.c
index 058340a..f5ef815 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -23,16 +23,15 @@
  *  Alon Levy
  */
 
-
 #include 
-
-#include "qxl_drv.h"
-#include "qxl_object.h"
-#include "drm_crtc_helper.h"
+#include 
 #include 
 #include 
 #include 
 
+#include "qxl_drv.h"
+#include "qxl_object.h"
+
 static bool qxl_head_enabled(struct qxl_head *head)
 {
return head->width && head->height;
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index abf7b83..c2fc201 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -31,9 +31,9 @@
 #include 
 #include 
 
-#include "drmP.h"
-#include "drm/drm.h"
-#include "drm_crtc_helper.h"
+#include 
+#include 
+#include 
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 5ea290a..3591d23 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -36,20 +36,18 @@
 #include 
 #include 
 
-#include "drmP.h"
-#include "drm_crtc.h"
-#include 
-#include 
-#include 
-#include 
-
+#include 
 #include 
 #include 
-
+#include 
+#include 
+#include 
 /* just for ttm_validate_buffer */
-#include 
-
+#include 
+#include 
+#include 
 #include 
+
 #include "qxl_dev.h"
 
 #define DRIVER_AUTHOR  "Dave Airlie"
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 14e2a49..573e7e9 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -25,14 +25,15 @@
  */
 #include 
 
-#include "drmP.h"
-#include "drm/drm.h"
-#include "drm/drm_crtc.h"
-#include "drm/drm_crtc_helper.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include "qxl_drv.h"
 
 #include "qxl_object.h"
-#include "drm_fb_helper.h"
 
 #define QXL_DIRTY_DELAY (HZ / 30)
 
diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c
index 3f185c4..85f5467 100644
--- a/drivers/gpu/drm/qxl/qxl_gem.c
+++ b/drivers/gpu/drm/qxl/qxl_gem.c
@@ -23,8 +23,9 @@
  *  Alon Levy
  */
 
-#include "drmP.h"
-#include "drm/drm.h"
+#include 
+#include 
+
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 0fdedee..87fc1db 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -23,11 +23,11 @@
  *  Alon Levy
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH v2 13/29] drm/radeon: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
Reviewed-by: Michel Dänzer 
---

Changes in v2: None

 drivers/gpu/drm/radeon/Makefile  |  2 +-
 drivers/gpu/drm/radeon/btc_dpm.c |  2 +-
 drivers/gpu/drm/radeon/ci_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/ci_smc.c  |  2 +-
 drivers/gpu/drm/radeon/cik.c |  2 +-
 drivers/gpu/drm/radeon/cypress_dpm.c |  2 +-
 drivers/gpu/drm/radeon/kv_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/kv_smc.c  |  2 +-
 drivers/gpu/drm/radeon/ni_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/r600_dpm.c|  2 +-
 drivers/gpu/drm/radeon/radeon.h  | 10 +-
 drivers/gpu/drm/radeon/radeon_drv.c  |  2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c  | 10 +-
 drivers/gpu/drm/radeon/rs780_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv6xx_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv730_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv740_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv770_dpm.c   |  2 +-
 drivers/gpu/drm/radeon/rv770_smc.c   |  2 +-
 drivers/gpu/drm/radeon/si_dpm.c  |  2 +-
 drivers/gpu/drm/radeon/si_smc.c  |  2 +-
 drivers/gpu/drm/radeon/sumo_dpm.c|  2 +-
 drivers/gpu/drm/radeon/sumo_smc.c|  2 +-
 drivers/gpu/drm/radeon/trinity_dpm.c |  2 +-
 drivers/gpu/drm/radeon/trinity_smc.c |  2 +-
 25 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 08bd17d..a5d3cd3 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include
+ccflags-y := -Idrivers/gpu/drm/amd/include
 
 hostprogs-y := mkregtable
 clean-files := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h 
rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h 
r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index 38e5123..95652e6 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "btcd.h"
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 7ba4508..f0cf997 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "radeon_ucode.h"
diff --git a/drivers/gpu/drm/radeon/ci_smc.c b/drivers/gpu/drm/radeon/ci_smc.c
index 24760ee..3356a21 100644
--- a/drivers/gpu/drm/radeon/ci_smc.c
+++ b/drivers/gpu/drm/radeon/ci_smc.c
@@ -23,7 +23,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "cikd.h"
 #include "ppsmc.h"
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 53710dd..e0db246 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "radeon_audio.h"
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c 
b/drivers/gpu/drm/radeon/cypress_dpm.c
index a4edd07..3eb7899 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "evergreend.h"
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index a7e9786..ae1529b 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -21,7 +21,7 @@
  *
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "cikd.h"
 #include "r600_dpm.h"
diff --git a/drivers/gpu/drm/radeon/kv_smc.c b/drivers/gpu/drm/radeon/kv_smc.c
index b59..af60bd3 100644
--- a/drivers/gpu/drm/radeon/kv_smc.c
+++ b/drivers/gpu/drm/radeon/kv_smc.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "cikd.h"
 #include "kv_dpm.h"
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 4a601f9..9416e72 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -21,7 +21,7 @@
  *
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 #include "nid.h"
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c 
b/drivers/gpu/drm/radeon/r600_dpm.c
index c7fc1db..31d1b47 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "radeon.h"
 #include "radeon_asic.h"
 

[PATCH v2 02/29] drm/ttm: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
For the C file, include  instead of relative path from
include/drm.

For headers in include/drm/ttm, simplify the  with "*.h".

This allows us to remove the -Iinclude/drm compiler flag from
drivers/gpu/drm/ttm/Makefile (and from other drivers' Makefiles).

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Use #include "..." for headers  (Michel Danzer)

 drivers/gpu/drm/ttm/Makefile   | 1 -
 drivers/gpu/drm/ttm/ttm_bo_vm.c| 6 +++---
 include/drm/ttm/ttm_bo_driver.h| 9 +
 include/drm/ttm/ttm_execbuf_util.h | 3 ++-
 include/drm/ttm/ttm_lock.h | 3 ++-
 include/drm/ttm/ttm_object.h   | 3 ++-
 6 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index f923258..4d0c938 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -1,7 +1,6 @@
 #
 # Makefile for the drm device driver.  This driver provides support for the
 
-ccflags-y := -Iinclude/drm
 ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 9f53df9..b442d12 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -30,9 +30,9 @@
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 6bbd34d..990d529 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -30,10 +30,6 @@
 #ifndef _TTM_BO_DRIVER_H_
 #define _TTM_BO_DRIVER_H_
 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -42,6 +38,11 @@
 #include 
 #include 
 
+#include "ttm_bo_api.h"
+#include "ttm_memory.h"
+#include "ttm_module.h"
+#include "ttm_placement.h"
+
 #define TTM_MAX_BO_PRIORITY4U
 
 struct ttm_backend_func {
diff --git a/include/drm/ttm/ttm_execbuf_util.h 
b/include/drm/ttm/ttm_execbuf_util.h
index 47f35b8..b0fdd19 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -31,9 +31,10 @@
 #ifndef _TTM_EXECBUF_UTIL_H_
 #define _TTM_EXECBUF_UTIL_H_
 
-#include 
 #include 
 
+#include "ttm_bo_api.h"
+
 /**
  * struct ttm_validate_buffer
  *
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h
index 2902beb..0c3af98 100644
--- a/include/drm/ttm/ttm_lock.h
+++ b/include/drm/ttm/ttm_lock.h
@@ -49,10 +49,11 @@
 #ifndef _TTM_LOCK_H_
 #define _TTM_LOCK_H_
 
-#include 
 #include 
 #include 
 
+#include "ttm_object.h"
+
 /**
  * struct ttm_lock
  *
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index 1487011..a98bfeb 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -42,7 +42,8 @@
 #include 
 #include 
 #include 
-#include 
+
+#include "ttm_memory.h"
 
 /**
  * enum ttm_ref_type
-- 
2.7.4



[PATCH v2 12/29] drm/qxl: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort the touched parts

 drivers/gpu/drm/qxl/Makefile  |  2 --
 drivers/gpu/drm/qxl/qxl_debugfs.c |  2 +-
 drivers/gpu/drm/qxl/qxl_display.c |  9 -
 drivers/gpu/drm/qxl/qxl_drv.c |  6 +++---
 drivers/gpu/drm/qxl/qxl_drv.h | 18 --
 drivers/gpu/drm/qxl/qxl_fb.c  | 11 ++-
 drivers/gpu/drm/qxl/qxl_gem.c |  5 +++--
 drivers/gpu/drm/qxl/qxl_ttm.c | 10 +-
 8 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/qxl/Makefile b/drivers/gpu/drm/qxl/Makefile
index bacc4af..33a7d0c 100644
--- a/drivers/gpu/drm/qxl/Makefile
+++ b/drivers/gpu/drm/qxl/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
-
 qxl-y := qxl_drv.o qxl_kms.o qxl_display.o qxl_ttm.o qxl_fb.o qxl_object.o 
qxl_gem.o qxl_cmd.o qxl_image.o qxl_draw.o qxl_debugfs.o qxl_irq.o qxl_dumb.o 
qxl_ioctl.o qxl_release.o qxl_prime.o
 
 obj-$(CONFIG_DRM_QXL)+= qxl.o
diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c 
b/drivers/gpu/drm/qxl/qxl_debugfs.c
index ffe821b..15c8406 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -30,7 +30,7 @@
 
 #include 
 
-#include "drmP.h"
+#include 
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
diff --git a/drivers/gpu/drm/qxl/qxl_display.c 
b/drivers/gpu/drm/qxl/qxl_display.c
index 058340a..f5ef815 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -23,16 +23,15 @@
  *  Alon Levy
  */
 
-
 #include 
-
-#include "qxl_drv.h"
-#include "qxl_object.h"
-#include "drm_crtc_helper.h"
+#include 
 #include 
 #include 
 #include 
 
+#include "qxl_drv.h"
+#include "qxl_object.h"
+
 static bool qxl_head_enabled(struct qxl_head *head)
 {
return head->width && head->height;
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index abf7b83..c2fc201 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -31,9 +31,9 @@
 #include 
 #include 
 
-#include "drmP.h"
-#include "drm/drm.h"
-#include "drm_crtc_helper.h"
+#include 
+#include 
+#include 
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 5ea290a..3591d23 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -36,20 +36,18 @@
 #include 
 #include 
 
-#include "drmP.h"
-#include "drm_crtc.h"
-#include 
-#include 
-#include 
-#include 
-
+#include 
 #include 
 #include 
-
+#include 
+#include 
+#include 
 /* just for ttm_validate_buffer */
-#include 
-
+#include 
+#include 
+#include 
 #include 
+
 #include "qxl_dev.h"
 
 #define DRIVER_AUTHOR  "Dave Airlie"
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 14e2a49..573e7e9 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -25,14 +25,15 @@
  */
 #include 
 
-#include "drmP.h"
-#include "drm/drm.h"
-#include "drm/drm_crtc.h"
-#include "drm/drm_crtc_helper.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include "qxl_drv.h"
 
 #include "qxl_object.h"
-#include "drm_fb_helper.h"
 
 #define QXL_DIRTY_DELAY (HZ / 30)
 
diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c
index 3f185c4..85f5467 100644
--- a/drivers/gpu/drm/qxl/qxl_gem.c
+++ b/drivers/gpu/drm/qxl/qxl_gem.c
@@ -23,8 +23,9 @@
  *  Alon Levy
  */
 
-#include "drmP.h"
-#include "drm/drm.h"
+#include 
+#include 
+
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 0fdedee..87fc1db 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -23,11 +23,11 @@
  *  Alon Levy
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH v2 11/29] drm/nouveau: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/nouveau/Kbuild| 1 -
 drivers/gpu/drm/nouveau/nouveau_drm.c | 4 ++--
 drivers/gpu/drm/nouveau/nouveau_drv.h | 2 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
index fde6e36..2e9ce53 100644
--- a/drivers/gpu/drm/nouveau/Kbuild
+++ b/drivers/gpu/drm/nouveau/Kbuild
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 ccflags-y += -I$(src)/include
 ccflags-y += -I$(src)/include/nvkm
 ccflags-y += -I$(src)/nvkm
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2b6ac24..301575c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -29,8 +29,8 @@
 #include 
 #include 
 
-#include "drmP.h"
-#include "drm_crtc_helper.h"
+#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h 
b/drivers/gpu/drm/nouveau/nouveau_drv.h
index eadec2f..aaa2564 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -43,7 +43,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c 
b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index 13e5cc5..999c35a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -28,7 +28,7 @@
 #include "nouveau_ttm.h"
 #include "nouveau_gem.h"
 
-#include "drm_legacy.h"
+#include 
 
 #include 
 
-- 
2.7.4



[PATCH v2 11/29] drm/nouveau: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/nouveau/Kbuild| 1 -
 drivers/gpu/drm/nouveau/nouveau_drm.c | 4 ++--
 drivers/gpu/drm/nouveau/nouveau_drv.h | 2 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
index fde6e36..2e9ce53 100644
--- a/drivers/gpu/drm/nouveau/Kbuild
+++ b/drivers/gpu/drm/nouveau/Kbuild
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 ccflags-y += -I$(src)/include
 ccflags-y += -I$(src)/include/nvkm
 ccflags-y += -I$(src)/nvkm
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2b6ac24..301575c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -29,8 +29,8 @@
 #include 
 #include 
 
-#include "drmP.h"
-#include "drm_crtc_helper.h"
+#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h 
b/drivers/gpu/drm/nouveau/nouveau_drv.h
index eadec2f..aaa2564 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -43,7 +43,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c 
b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index 13e5cc5..999c35a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -28,7 +28,7 @@
 #include "nouveau_ttm.h"
 #include "nouveau_gem.h"
 
-#include "drm_legacy.h"
+#include 
 
 #include 
 
-- 
2.7.4



[PATCH v2 01/29] drm: make drm_panel.h self-contained

2017-04-23 Thread Masahiro Yamada
-ENOSYS and -EINVAL are referenced in some static inline functions.
of_drm_find_pane() takes a pointer to struct device_node.

Make this header self-contained to not depend on specific include
order.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 include/drm/drm_panel.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 1b364b0..14ac240 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -24,8 +24,10 @@
 #ifndef __DRM_PANEL_H__
 #define __DRM_PANEL_H__
 
+#include 
 #include 
 
+struct device_node;
 struct drm_connector;
 struct drm_device;
 struct drm_panel;
-- 
2.7.4



[PATCH v2 00/29] gpu/drm: remove -Iinclude/drm compiler flags from Makefile

2017-04-23 Thread Masahiro Yamada
Many Makefiles needed to add -Iinclude/drm as an include path,
but the right thing to do is to include headers in the form
  #include 

This series fixes the source files, then rip off -Iinclude/drm flags.


Masahiro Yamada (29):
  drm: make drm_panel.h self-contained
  drm/ttm: fix include notation and remove -Iinclude/drm flag
  drm/amd: fix include notation and remove -Iinclude/drm flag
  drm/ast: fix include notation and remove -Iinclude/drm flag
  drm/bochs: fix include notation and remove -Iinclude/drm flag
  drm/bridge: fix include notation and remove -Iinclude/drm flag
  drm/cirrus: fix include notation and remove -Iinclude/drm flag
  drm/hisilicon: fix include notation and remove -Iinclude/drm flag
  drm/mgag200: fix include notation and remove -Iinclude/drm flag
  drm/msm: fix include notation and remove -Iinclude/drm flag
  drm/nouveau: fix include notation and remove -Iinclude/drm flag
  drm/qxl: fix include notation and remove -Iinclude/drm flag
  drm/radeon: fix include notation and remove -Iinclude/drm flag
  drm/tilcdc: fix include notation and remove -Iinclude/drm flag
  drm/vc4: fix include notation and remove -Iinclude/drm flag
  drm/virtio: fix include notation and remove -Iinclude/drm flag
  drm/vmwgfx: fix include notation and remove -Iinclude/drm flag
  drm/gma500: remove unneeded -Iinclude/drm compiler flag
  drm/i810: remove unneeded -Iinclude/drm compiler flag
  drm/i2c: remove unneeded -Iinclude/drm compiler flag
  drm/mga: remove unneeded -Iinclude/drm compiler flag
  drm/omap: remove unneeded -Iinclude/drm compiler flag
  drm/r128: remove unneeded -Iinclude/drm compiler flag
  drm/savage: remove unneeded -Iinclude/drm compiler flag
  drm/sis: remove unneeded -Iinclude/drm compiler flag
  drm/tdfx: remove unneeded -Iinclude/drm compiler flag
  drm/udl: remove unneeded -Iinclude/drm compiler flag
  drm/vgem: remove unneeded -Iinclude/drm compiler flag
  drm/via: remove unneeded -Iinclude/drm compiler flag

 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h  | 10 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 10 -
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/ci_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cz_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/si.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/vi.c  |  2 +-
 drivers/gpu/drm/amd/amdkfd/Makefile  |  2 +-
 drivers/gpu/drm/amd/powerplay/Makefile   |  2 +-
 drivers/gpu/drm/ast/Makefile |  2 --
 drivers/gpu/drm/ast/ast_ttm.c|  3 ++-
 drivers/gpu/drm/bochs/Makefile   |  1 -
 drivers/gpu/drm/bochs/bochs.h|  4 ++--
 drivers/gpu/drm/bridge/Makefile  |  2 --
 drivers/gpu/drm/bridge/nxp-ptn3460.c | 12 +-
 drivers/gpu/drm/bridge/parade-ps8622.c   | 10 -
 drivers/gpu/drm/cirrus/Makefile  |  1 -
 drivers/gpu/drm/cirrus/cirrus_ttm.c  |  3 ++-
 drivers/gpu/drm/gma500/Makefile  |  1 -
 drivers/gpu/drm/hisilicon/hibmc/Makefile |  1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c  |  2 +-
 drivers/gpu/drm/i2c/Makefile |  2 --
 drivers/gpu/drm/i810/Makefile|  1 -
 drivers/gpu/drm/mga/Makefile |  1 -
 drivers/gpu/drm/mgag200/Makefile  

[PATCH v2 01/29] drm: make drm_panel.h self-contained

2017-04-23 Thread Masahiro Yamada
-ENOSYS and -EINVAL are referenced in some static inline functions.
of_drm_find_pane() takes a pointer to struct device_node.

Make this header self-contained to not depend on specific include
order.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 include/drm/drm_panel.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 1b364b0..14ac240 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -24,8 +24,10 @@
 #ifndef __DRM_PANEL_H__
 #define __DRM_PANEL_H__
 
+#include 
 #include 
 
+struct device_node;
 struct drm_connector;
 struct drm_device;
 struct drm_panel;
-- 
2.7.4



[PATCH v2 00/29] gpu/drm: remove -Iinclude/drm compiler flags from Makefile

2017-04-23 Thread Masahiro Yamada
Many Makefiles needed to add -Iinclude/drm as an include path,
but the right thing to do is to include headers in the form
  #include 

This series fixes the source files, then rip off -Iinclude/drm flags.


Masahiro Yamada (29):
  drm: make drm_panel.h self-contained
  drm/ttm: fix include notation and remove -Iinclude/drm flag
  drm/amd: fix include notation and remove -Iinclude/drm flag
  drm/ast: fix include notation and remove -Iinclude/drm flag
  drm/bochs: fix include notation and remove -Iinclude/drm flag
  drm/bridge: fix include notation and remove -Iinclude/drm flag
  drm/cirrus: fix include notation and remove -Iinclude/drm flag
  drm/hisilicon: fix include notation and remove -Iinclude/drm flag
  drm/mgag200: fix include notation and remove -Iinclude/drm flag
  drm/msm: fix include notation and remove -Iinclude/drm flag
  drm/nouveau: fix include notation and remove -Iinclude/drm flag
  drm/qxl: fix include notation and remove -Iinclude/drm flag
  drm/radeon: fix include notation and remove -Iinclude/drm flag
  drm/tilcdc: fix include notation and remove -Iinclude/drm flag
  drm/vc4: fix include notation and remove -Iinclude/drm flag
  drm/virtio: fix include notation and remove -Iinclude/drm flag
  drm/vmwgfx: fix include notation and remove -Iinclude/drm flag
  drm/gma500: remove unneeded -Iinclude/drm compiler flag
  drm/i810: remove unneeded -Iinclude/drm compiler flag
  drm/i2c: remove unneeded -Iinclude/drm compiler flag
  drm/mga: remove unneeded -Iinclude/drm compiler flag
  drm/omap: remove unneeded -Iinclude/drm compiler flag
  drm/r128: remove unneeded -Iinclude/drm compiler flag
  drm/savage: remove unneeded -Iinclude/drm compiler flag
  drm/sis: remove unneeded -Iinclude/drm compiler flag
  drm/tdfx: remove unneeded -Iinclude/drm compiler flag
  drm/udl: remove unneeded -Iinclude/drm compiler flag
  drm/vgem: remove unneeded -Iinclude/drm compiler flag
  drm/via: remove unneeded -Iinclude/drm compiler flag

 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h  | 10 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 10 -
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/ci_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cz_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/si.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/vi.c  |  2 +-
 drivers/gpu/drm/amd/amdkfd/Makefile  |  2 +-
 drivers/gpu/drm/amd/powerplay/Makefile   |  2 +-
 drivers/gpu/drm/ast/Makefile |  2 --
 drivers/gpu/drm/ast/ast_ttm.c|  3 ++-
 drivers/gpu/drm/bochs/Makefile   |  1 -
 drivers/gpu/drm/bochs/bochs.h|  4 ++--
 drivers/gpu/drm/bridge/Makefile  |  2 --
 drivers/gpu/drm/bridge/nxp-ptn3460.c | 12 +-
 drivers/gpu/drm/bridge/parade-ps8622.c   | 10 -
 drivers/gpu/drm/cirrus/Makefile  |  1 -
 drivers/gpu/drm/cirrus/cirrus_ttm.c  |  3 ++-
 drivers/gpu/drm/gma500/Makefile  |  1 -
 drivers/gpu/drm/hisilicon/hibmc/Makefile |  1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c  |  2 +-
 drivers/gpu/drm/i2c/Makefile |  2 --
 drivers/gpu/drm/i810/Makefile|  1 -
 drivers/gpu/drm/mga/Makefile |  1 -
 drivers/gpu/drm/mgag200/Makefile  

[PATCH v2 26/29] drm/tdfx: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/tdfx/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/tdfx/Makefile b/drivers/gpu/drm/tdfx/Makefile
index 0379f29..74bd4ae3 100644
--- a/drivers/gpu/drm/tdfx/Makefile
+++ b/drivers/gpu/drm/tdfx/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 tdfx-y := tdfx_drv.o
 
 obj-$(CONFIG_DRM_TDFX) += tdfx.o
-- 
2.7.4



[PATCH v2 26/29] drm/tdfx: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/tdfx/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/tdfx/Makefile b/drivers/gpu/drm/tdfx/Makefile
index 0379f29..74bd4ae3 100644
--- a/drivers/gpu/drm/tdfx/Makefile
+++ b/drivers/gpu/drm/tdfx/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 tdfx-y := tdfx_drv.o
 
 obj-$(CONFIG_DRM_TDFX) += tdfx.o
-- 
2.7.4



[PATCH v2 03/29] drm/amd: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
Reviewed-by: Michel Dänzer 
---

Changes in v2: None

 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h  | 10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 10 +-
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/ci_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cz_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/si.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/vi.c  |  2 +-
 drivers/gpu/drm/amd/amdkfd/Makefile  |  2 +-
 drivers/gpu/drm/amd/powerplay/Makefile   |  2 +-
 36 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
b/drivers/gpu/drm/amd/amdgpu/Makefile
index 660786a..20bde72 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -4,7 +4,7 @@
 
 FULL_AMD_PATH=$(src)/..
 
-ccflags-y := -Iinclude/drm -I$(FULL_AMD_PATH)/include/asic_reg \
+ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
-I$(FULL_AMD_PATH)/include \
-I$(FULL_AMD_PATH)/amdgpu \
-I$(FULL_AMD_PATH)/scheduler \
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 6a81299..0ecf31d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -36,11 +36,11 @@
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
index 38e9b0d..1cb52fd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "amdgpu.h"
 #include "amdgpu_atombios.h"
 #include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 4e0f7d2..a86d2a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -39,7 +39,7 @@
 #include 
 #include 
 #include 
-#include "drm_crtc_helper.h"
+#include 
 
 #include "amdgpu.h"
 #include "amdgpu_irq.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index ed6e579..e6cf91c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -24,7 +24,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "amdgpu.h"
 #include "amdgpu_psp.h"
 #include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 35d53a0..6a3028c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -29,11 +29,11 @@
  *Thomas Hellstrom 
  *Dave Airlie
  */
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c 
b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 11ccda8..625b7fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "amdgpu.h"
 #include "amdgpu_pm.h"
 #include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_smc.c 
b/drivers/gpu/drm/amd/amdgpu/ci_smc.c
index 7eb9069..b8ba51e 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_smc.c
+++ 

[PATCH v2 21/29] drm/mga: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/mga/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/mga/Makefile b/drivers/gpu/drm/mga/Makefile
index 6068478..49e972c 100644
--- a/drivers/gpu/drm/mga/Makefile
+++ b/drivers/gpu/drm/mga/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 mga-y := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
 
 mga-$(CONFIG_COMPAT) += mga_ioc32.o
-- 
2.7.4



[PATCH v2 21/29] drm/mga: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/mga/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/mga/Makefile b/drivers/gpu/drm/mga/Makefile
index 6068478..49e972c 100644
--- a/drivers/gpu/drm/mga/Makefile
+++ b/drivers/gpu/drm/mga/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 mga-y := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
 
 mga-$(CONFIG_COMPAT) += mga_ioc32.o
-- 
2.7.4



[PATCH v2 03/29] drm/amd: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
Reviewed-by: Michel Dänzer 
---

Changes in v2: None

 drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h  | 10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 10 +-
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/ci_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/cz_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/si.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_dpm.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/si_smc.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/soc15.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/vi.c  |  2 +-
 drivers/gpu/drm/amd/amdkfd/Makefile  |  2 +-
 drivers/gpu/drm/amd/powerplay/Makefile   |  2 +-
 36 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
b/drivers/gpu/drm/amd/amdgpu/Makefile
index 660786a..20bde72 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -4,7 +4,7 @@
 
 FULL_AMD_PATH=$(src)/..
 
-ccflags-y := -Iinclude/drm -I$(FULL_AMD_PATH)/include/asic_reg \
+ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
-I$(FULL_AMD_PATH)/include \
-I$(FULL_AMD_PATH)/amdgpu \
-I$(FULL_AMD_PATH)/scheduler \
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 6a81299..0ecf31d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -36,11 +36,11 @@
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
index 38e9b0d..1cb52fd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
@@ -22,7 +22,7 @@
  * Authors: Alex Deucher
  */
 
-#include "drmP.h"
+#include 
 #include "amdgpu.h"
 #include "amdgpu_atombios.h"
 #include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 4e0f7d2..a86d2a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -39,7 +39,7 @@
 #include 
 #include 
 #include 
-#include "drm_crtc_helper.h"
+#include 
 
 #include "amdgpu.h"
 #include "amdgpu_irq.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index ed6e579..e6cf91c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -24,7 +24,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "amdgpu.h"
 #include "amdgpu_psp.h"
 #include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 35d53a0..6a3028c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -29,11 +29,11 @@
  *Thomas Hellstrom 
  *Dave Airlie
  */
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c 
b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 11ccda8..625b7fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#include "drmP.h"
+#include 
 #include "amdgpu.h"
 #include "amdgpu_pm.h"
 #include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_smc.c 
b/drivers/gpu/drm/amd/amdgpu/ci_smc.c
index 7eb9069..b8ba51e 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_smc.c
@@ -23,7 +23,7 @@
  */
 
 

[PATCH v2 15/29] drm/vc4: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

While we are here, use <...> instead of "..." for include/linux/*.h
headers too.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/vc4/Makefile|  2 --
 drivers/gpu/drm/vc4/vc4_crtc.c  | 14 +++---
 drivers/gpu/drm/vc4/vc4_dpi.c   | 16 
 drivers/gpu/drm/vc4/vc4_drv.c   |  2 +-
 drivers/gpu/drm/vc4/vc4_drv.h   |  5 ++---
 drivers/gpu/drm/vc4/vc4_dsi.c   | 28 ++--
 drivers/gpu/drm/vc4/vc4_hdmi.c  | 20 ++--
 drivers/gpu/drm/vc4/vc4_hvs.c   |  2 +-
 drivers/gpu/drm/vc4/vc4_kms.c   | 12 ++--
 drivers/gpu/drm/vc4/vc4_plane.c |  9 +
 drivers/gpu/drm/vc4/vc4_v3d.c   |  4 ++--
 11 files changed, 56 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile
index 61f45d1..f0efc7eb 100644
--- a/drivers/gpu/drm/vc4/Makefile
+++ b/drivers/gpu/drm/vc4/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 # Please keep these build lists sorted!
 
 # core driver code
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index d86c8cc..34d2e8a 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -32,13 +32,13 @@
  * ones that set the clock.
  */
 
-#include "drm_atomic.h"
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "linux/clk.h"
-#include "drm_fb_cma_helper.h"
-#include "linux/component.h"
-#include "linux/of_device.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index c6d7039..39d6808 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -22,14 +22,14 @@
  * ALT2 function.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "drm_panel.h"
-#include "linux/clk.h"
-#include "linux/component.h"
-#include "linux/of_graph.h"
-#include "linux/of_platform.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 61e674b..2037a5f 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -31,7 +31,7 @@
 #include 
 #include 
 #include 
-#include "drm_fb_cma_helper.h"
+#include 
 #include 
 
 #include "uapi/drm/vc4_drm.h"
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index dffce629..ebfef52 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -6,10 +6,9 @@
  * published by the Free Software Foundation.
  */
 
-#include "drmP.h"
-#include "drm_gem_cma_helper.h"
-
+#include 
 #include 
+#include 
 
 struct vc4_dev {
struct drm_device *dev;
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 160f981..d18c9b1 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -29,20 +29,20 @@
  * hopefully present.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "drm_mipi_dsi.h"
-#include "drm_panel.h"
-#include "linux/clk.h"
-#include "linux/clk-provider.h"
-#include "linux/completion.h"
-#include "linux/component.h"
-#include "linux/dmaengine.h"
-#include "linux/i2c.h"
-#include "linux/of_address.h"
-#include "linux/of_platform.h"
-#include "linux/pm_runtime.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index e9cbe26..c91591c 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -42,16 +42,16 @@
  * encoder block has CEC support.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "linux/clk.h"
-#include "linux/component.h"
-#include "linux/i2c.h"
-#include "linux/of_address.h"
-#include "linux/of_gpio.h"
-#include "linux/of_platform.h"
-#include "linux/rational.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "sound/dmaengine_pcm.h"
 #include "sound/pcm_drm_eld.h"
 #include "sound/pcm_params.h"
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index fd421ba..2b62fc5 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -22,7 +22,7 @@
  * each CRTC.
  */
 
-#include "linux/component.h"
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index ad7925a..3f2e64e 100644
--- 

[PATCH v2 17/29] drm/vmwgfx: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/vmwgfx/Makefile | 3 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c  | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 ++-
 7 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makefile
index aac17a6..a365330 100644
--- a/drivers/gpu/drm/vmwgfx/Makefile
+++ b/drivers/gpu/drm/vmwgfx/Makefile
@@ -1,6 +1,3 @@
-
-ccflags-y := -Iinclude/drm
-
 vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_buffer.o \
vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
index 77cb7c6..99a7f4a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
@@ -25,8 +25,9 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
-#include "ttm/ttm_bo_api.h"
 
 /*
  * Size of inline command buffers. Try to make sure that a page size is a
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index 443d1ed..bcc6d41 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -25,10 +25,11 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_binding.h"
-#include "ttm/ttm_placement.h"
 
 struct vmw_user_context {
struct ttm_base_object base;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
index 265c81e..6c026d7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
@@ -30,9 +30,10 @@
  * whenever the backing MOB is evicted.
  */
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
-#include 
 #include "vmwgfx_so.h"
 
 /**
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e57a0ba..6063c96 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -30,7 +30,7 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
+#include 
 #include "vmwgfx_msg.h"
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 92f8b1d..68f135c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -25,10 +25,11 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_binding.h"
-#include "ttm/ttm_placement.h"
 
 struct vmw_shader {
struct vmw_resource res;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7681341..5900cff 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -25,11 +25,12 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_so.h"
 #include "vmwgfx_binding.h"
-#include 
 #include "device_include/svga3d_surfacedefs.h"
 
 
-- 
2.7.4



[PATCH v2 25/29] drm/sis: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/sis/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/sis/Makefile b/drivers/gpu/drm/sis/Makefile
index 441c061..7bf4c13 100644
--- a/drivers/gpu/drm/sis/Makefile
+++ b/drivers/gpu/drm/sis/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y = -Iinclude/drm
 sis-y := sis_drv.o sis_mm.o
 
 obj-$(CONFIG_DRM_SIS)   += sis.o
-- 
2.7.4



[PATCH v2 15/29] drm/vc4: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

While we are here, use <...> instead of "..." for include/linux/*.h
headers too.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/vc4/Makefile|  2 --
 drivers/gpu/drm/vc4/vc4_crtc.c  | 14 +++---
 drivers/gpu/drm/vc4/vc4_dpi.c   | 16 
 drivers/gpu/drm/vc4/vc4_drv.c   |  2 +-
 drivers/gpu/drm/vc4/vc4_drv.h   |  5 ++---
 drivers/gpu/drm/vc4/vc4_dsi.c   | 28 ++--
 drivers/gpu/drm/vc4/vc4_hdmi.c  | 20 ++--
 drivers/gpu/drm/vc4/vc4_hvs.c   |  2 +-
 drivers/gpu/drm/vc4/vc4_kms.c   | 12 ++--
 drivers/gpu/drm/vc4/vc4_plane.c |  9 +
 drivers/gpu/drm/vc4/vc4_v3d.c   |  4 ++--
 11 files changed, 56 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile
index 61f45d1..f0efc7eb 100644
--- a/drivers/gpu/drm/vc4/Makefile
+++ b/drivers/gpu/drm/vc4/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 # Please keep these build lists sorted!
 
 # core driver code
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index d86c8cc..34d2e8a 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -32,13 +32,13 @@
  * ones that set the clock.
  */
 
-#include "drm_atomic.h"
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "linux/clk.h"
-#include "drm_fb_cma_helper.h"
-#include "linux/component.h"
-#include "linux/of_device.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index c6d7039..39d6808 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -22,14 +22,14 @@
  * ALT2 function.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "drm_panel.h"
-#include "linux/clk.h"
-#include "linux/component.h"
-#include "linux/of_graph.h"
-#include "linux/of_platform.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 61e674b..2037a5f 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -31,7 +31,7 @@
 #include 
 #include 
 #include 
-#include "drm_fb_cma_helper.h"
+#include 
 #include 
 
 #include "uapi/drm/vc4_drm.h"
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index dffce629..ebfef52 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -6,10 +6,9 @@
  * published by the Free Software Foundation.
  */
 
-#include "drmP.h"
-#include "drm_gem_cma_helper.h"
-
+#include 
 #include 
+#include 
 
 struct vc4_dev {
struct drm_device *dev;
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 160f981..d18c9b1 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -29,20 +29,20 @@
  * hopefully present.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "drm_mipi_dsi.h"
-#include "drm_panel.h"
-#include "linux/clk.h"
-#include "linux/clk-provider.h"
-#include "linux/completion.h"
-#include "linux/component.h"
-#include "linux/dmaengine.h"
-#include "linux/i2c.h"
-#include "linux/of_address.h"
-#include "linux/of_platform.h"
-#include "linux/pm_runtime.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index e9cbe26..c91591c 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -42,16 +42,16 @@
  * encoder block has CEC support.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "linux/clk.h"
-#include "linux/component.h"
-#include "linux/i2c.h"
-#include "linux/of_address.h"
-#include "linux/of_gpio.h"
-#include "linux/of_platform.h"
-#include "linux/rational.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "sound/dmaengine_pcm.h"
 #include "sound/pcm_drm_eld.h"
 #include "sound/pcm_params.h"
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index fd421ba..2b62fc5 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -22,7 +22,7 @@
  * each CRTC.
  */
 
-#include "linux/component.h"
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index ad7925a..3f2e64e 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ 

[PATCH v2 17/29] drm/vmwgfx: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/vmwgfx/Makefile | 3 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c  | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 ++-
 7 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makefile
index aac17a6..a365330 100644
--- a/drivers/gpu/drm/vmwgfx/Makefile
+++ b/drivers/gpu/drm/vmwgfx/Makefile
@@ -1,6 +1,3 @@
-
-ccflags-y := -Iinclude/drm
-
 vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_buffer.o \
vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
index 77cb7c6..99a7f4a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
@@ -25,8 +25,9 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
-#include "ttm/ttm_bo_api.h"
 
 /*
  * Size of inline command buffers. Try to make sure that a page size is a
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index 443d1ed..bcc6d41 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -25,10 +25,11 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_binding.h"
-#include "ttm/ttm_placement.h"
 
 struct vmw_user_context {
struct ttm_base_object base;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
index 265c81e..6c026d7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
@@ -30,9 +30,10 @@
  * whenever the backing MOB is evicted.
  */
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
-#include 
 #include "vmwgfx_so.h"
 
 /**
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e57a0ba..6063c96 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -30,7 +30,7 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
+#include 
 #include "vmwgfx_msg.h"
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 92f8b1d..68f135c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -25,10 +25,11 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_binding.h"
-#include "ttm/ttm_placement.h"
 
 struct vmw_shader {
struct vmw_resource res;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7681341..5900cff 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -25,11 +25,12 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_so.h"
 #include "vmwgfx_binding.h"
-#include 
 #include "device_include/svga3d_surfacedefs.h"
 
 
-- 
2.7.4



[PATCH v2 25/29] drm/sis: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/sis/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/sis/Makefile b/drivers/gpu/drm/sis/Makefile
index 441c061..7bf4c13 100644
--- a/drivers/gpu/drm/sis/Makefile
+++ b/drivers/gpu/drm/sis/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y = -Iinclude/drm
 sis-y := sis_drv.o sis_mm.o
 
 obj-$(CONFIG_DRM_SIS)   += sis.o
-- 
2.7.4



[PATCH v2 22/29] drm/omap: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/omapdrm/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 48b7b75..b391be7 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -6,7 +6,6 @@
 obj-y += dss/
 obj-y += displays/
 
-ccflags-y := -Iinclude/drm
 omapdrm-y := omap_drv.o \
omap_irq.o \
omap_debugfs.o \
-- 
2.7.4



[PATCH v2 22/29] drm/omap: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/omapdrm/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 48b7b75..b391be7 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -6,7 +6,6 @@
 obj-y += dss/
 obj-y += displays/
 
-ccflags-y := -Iinclude/drm
 omapdrm-y := omap_drv.o \
omap_irq.o \
omap_debugfs.o \
-- 
2.7.4



[PATCH v2 28/29] drm/vgem: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/vgem/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile
index bfcdea1..cb5d413 100644
--- a/drivers/gpu/drm/vgem/Makefile
+++ b/drivers/gpu/drm/vgem/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 vgem-y := vgem_drv.o vgem_fence.o
 
 obj-$(CONFIG_DRM_VGEM) += vgem.o
-- 
2.7.4



[PATCH v2 24/29] drm/savage: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/savage/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/savage/Makefile b/drivers/gpu/drm/savage/Makefile
index d8f84ac..cfd436b 100644
--- a/drivers/gpu/drm/savage/Makefile
+++ b/drivers/gpu/drm/savage/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y = -Iinclude/drm
 savage-y := savage_drv.o savage_bci.o savage_state.o
 
 obj-$(CONFIG_DRM_SAVAGE)+= savage.o
-- 
2.7.4



[PATCH v2 28/29] drm/vgem: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/vgem/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile
index bfcdea1..cb5d413 100644
--- a/drivers/gpu/drm/vgem/Makefile
+++ b/drivers/gpu/drm/vgem/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 vgem-y := vgem_drv.o vgem_fence.o
 
 obj-$(CONFIG_DRM_VGEM) += vgem.o
-- 
2.7.4



[PATCH v2 24/29] drm/savage: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/savage/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/savage/Makefile b/drivers/gpu/drm/savage/Makefile
index d8f84ac..cfd436b 100644
--- a/drivers/gpu/drm/savage/Makefile
+++ b/drivers/gpu/drm/savage/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y = -Iinclude/drm
 savage-y := savage_drv.o savage_bci.o savage_state.o
 
 obj-$(CONFIG_DRM_SAVAGE)+= savage.o
-- 
2.7.4



[PATCH v2 19/29] drm/i810: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/i810/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i810/Makefile b/drivers/gpu/drm/i810/Makefile
index 43844ec..639f859 100644
--- a/drivers/gpu/drm/i810/Makefile
+++ b/drivers/gpu/drm/i810/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 i810-y := i810_drv.o i810_dma.o
 
 obj-$(CONFIG_DRM_I810) += i810.o
-- 
2.7.4



[PATCH v2 29/29] drm/via: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/via/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/via/Makefile b/drivers/gpu/drm/via/Makefile
index d59e258..751fa8b 100644
--- a/drivers/gpu/drm/via/Makefile
+++ b/drivers/gpu/drm/via/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 via-y:= via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o 
via_video.o via_dmablit.o
 
 obj-$(CONFIG_DRM_VIA)  +=via.o
-- 
2.7.4



[PATCH v2 19/29] drm/i810: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/i810/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i810/Makefile b/drivers/gpu/drm/i810/Makefile
index 43844ec..639f859 100644
--- a/drivers/gpu/drm/i810/Makefile
+++ b/drivers/gpu/drm/i810/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 i810-y := i810_drv.o i810_dma.o
 
 obj-$(CONFIG_DRM_I810) += i810.o
-- 
2.7.4



[PATCH v2 29/29] drm/via: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/via/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/via/Makefile b/drivers/gpu/drm/via/Makefile
index d59e258..751fa8b 100644
--- a/drivers/gpu/drm/via/Makefile
+++ b/drivers/gpu/drm/via/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 via-y:= via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o 
via_video.o via_dmablit.o
 
 obj-$(CONFIG_DRM_VIA)  +=via.o
-- 
2.7.4



[PATCH v2 18/29] drm/gma500: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/gma500/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile
index 190e55f..c1c8dc1 100644
--- a/drivers/gpu/drm/gma500/Makefile
+++ b/drivers/gpu/drm/gma500/Makefile
@@ -1,7 +1,6 @@
 #
 #  KMS driver for the GMA500
 #
-ccflags-y += -I$(srctree)/include/drm
 
 gma500_gfx-y += \
  accel_2d.o \
-- 
2.7.4



[PATCH v2 20/29] drm/i2c: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/i2c/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 43aa33b..a77acfc 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 ch7006-y := ch7006_drv.o ch7006_mode.o
 obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
 
-- 
2.7.4



[PATCH v2 18/29] drm/gma500: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/gma500/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile
index 190e55f..c1c8dc1 100644
--- a/drivers/gpu/drm/gma500/Makefile
+++ b/drivers/gpu/drm/gma500/Makefile
@@ -1,7 +1,6 @@
 #
 #  KMS driver for the GMA500
 #
-ccflags-y += -I$(srctree)/include/drm
 
 gma500_gfx-y += \
  accel_2d.o \
-- 
2.7.4



[PATCH v2 20/29] drm/i2c: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/i2c/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 43aa33b..a77acfc 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 ch7006-y := ch7006_drv.o ch7006_mode.o
 obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
 
-- 
2.7.4



Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-23 Thread Minchan Kim
On Fri, Apr 21, 2017 at 08:29:30PM +0800, Huang, Ying wrote:
> "Huang, Ying"  writes:
> 
> > Minchan Kim  writes:
> >
> >> On Wed, Apr 19, 2017 at 04:14:43PM +0800, Huang, Ying wrote:
> >>> Minchan Kim  writes:
> >>> 
> >>> > Hi Huang,
> >>> >
> >>> > On Fri, Apr 07, 2017 at 02:49:01PM +0800, Huang, Ying wrote:
> >>> >> From: Huang Ying 
> >>> >> 
> >>> >>  void swapcache_free_entries(swp_entry_t *entries, int n)
> >>> >>  {
> >>> >>struct swap_info_struct *p, *prev;
> >>> >> @@ -1075,6 +1083,10 @@ void swapcache_free_entries(swp_entry_t 
> >>> >> *entries, int n)
> >>> >>  
> >>> >>prev = NULL;
> >>> >>p = NULL;
> >>> >> +
> >>> >> +  /* Sort swap entries by swap device, so each lock is only taken 
> >>> >> once. */
> >>> >> +  if (nr_swapfiles > 1)
> >>> >> +  sort(entries, n, sizeof(entries[0]), swp_entry_cmp, 
> >>> >> NULL);
> >>> >
> >>> > Let's think on other cases.
> >>> >
> >>> > There are two swaps and they are configured by priority so a swap's 
> >>> > usage
> >>> > would be zero unless other swap used up. In case of that, this sorting
> >>> > is pointless.
> >>> >
> >>> > As well, nr_swapfiles is never decreased so if we enable multiple
> >>> > swaps and then disable until a swap is remained, this sorting is
> >>> > pointelss, too.
> >>> >
> >>> > How about lazy sorting approach? IOW, if we found prev != p and,
> >>> > then we can sort it.
> >>> 
> >>> Yes.  That should be better.  I just don't know whether the added
> >>> complexity is necessary, given the array is short and sort is fast.
> >>
> >> Huh?
> >>
> >> 1. swapon /dev/XXX1
> >> 2. swapon /dev/XXX2
> >> 3. swapoff /dev/XXX2
> >> 4. use only one swap
> >> 5. then, always pointless sort.
> >
> > Yes.  In this situation we will do unnecessary sorting.  What I don't
> > know is whether the unnecessary sorting will hurt performance in real
> > life.  I can do some measurement.
> 
> I tested the patch with 1 swap device and 1 process to eat memory
> (remove the "if (nr_swapfiles > 1)" for test).  I think this is the
> worse case because there is no lock contention.  The memory freeing time
> increased from 1.94s to 2.12s (increase ~9.2%).  So there is some
> overhead for some cases.  I change the algorithm to something like
> below,
> 
>  void swapcache_free_entries(swp_entry_t *entries, int n)
>  {
>   struct swap_info_struct *p, *prev;
>   int i;
> + swp_entry_t entry;
> + unsigned int prev_swp_type;
>  
>   if (n <= 0)
>   return;
>  
> + prev_swp_type = swp_type(entries[0]);
> + for (i = n - 1; i > 0; i--) {
> + if (swp_type(entries[i]) != prev_swp_type)
> + break;
> + }

That's really what I want to avoid. For many swap usecases,
it adds unnecessary overhead.

> +
> + /* Sort swap entries by swap device, so each lock is only taken once. */
> + if (i)
> + sort(entries, n, sizeof(entries[0]), swp_entry_cmp, NULL);
>   prev = NULL;
>   p = NULL;
>   for (i = 0; i < n; ++i) {
> - p = swap_info_get_cont(entries[i], prev);
> + entry = entries[i];
> + p = swap_info_get_cont(entry, prev);
>   if (p)
> - swap_entry_free(p, entries[i]);
> + swap_entry_free(p, entry);
>   prev = p;
>   }
>   if (p)
> 
> With this patch, the memory freeing time increased from 1.94s to 1.97s.
> I think this is good enough.  Do you think so?

What I mean is as follows(I didn't test it at all):

With this, sort entries if we found multiple entries in current
entries. It adds some condition checks for non-multiple swap
usecase but it would be more cheaper than the sorting.
And it adds a [un]lock overhead for multiple swap usecase but
it should be a compromise for single-swap usecase which is more
popular.

diff --git a/mm/swapfile.c b/mm/swapfile.c
index f23c56e9be39..0d76a492786f 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1073,30 +1073,40 @@ static int swp_entry_cmp(const void *ent1, const void 
*ent2)
return (long)(swp_type(*e1) - swp_type(*e2));
 }
 
-void swapcache_free_entries(swp_entry_t *entries, int n)
+void swapcache_free_entries(swp_entry_t *entries, int nr)
 {
-   struct swap_info_struct *p, *prev;
int i;
+   struct swap_info_struct *cur, *prev = NULL;
+   bool sorted = false;
 
-   if (n <= 0)
+   if (nr <= 0)
return;
 
-   prev = NULL;
-   p = NULL;
-
-   /* Sort swap entries by swap device, so each lock is only taken once. */
-   if (nr_swapfiles > 1)
-   sort(entries, n, sizeof(entries[0]), swp_entry_cmp, NULL);
-   for (i = 0; i < n; ++i) {
-   p = swap_info_get_cont(entries[i], prev);
-   if (p)
-   swap_entry_free(p, entries[i]);
-   else
+   for (i = 0; i < nr; 

[PATCH v2 27/29] drm/udl: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/udl/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/udl/Makefile b/drivers/gpu/drm/udl/Makefile
index 195bcac..36f2e82 100644
--- a/drivers/gpu/drm/udl/Makefile
+++ b/drivers/gpu/drm/udl/Makefile
@@ -1,6 +1,3 @@
-
-ccflags-y := -Iinclude/drm
-
 udl-y := udl_drv.o udl_modeset.o udl_connector.o udl_encoder.o udl_main.o 
udl_fb.o udl_transfer.o udl_gem.o udl_dmabuf.o
 
 obj-$(CONFIG_DRM_UDL) := udl.o
-- 
2.7.4



Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-23 Thread Minchan Kim
On Fri, Apr 21, 2017 at 08:29:30PM +0800, Huang, Ying wrote:
> "Huang, Ying"  writes:
> 
> > Minchan Kim  writes:
> >
> >> On Wed, Apr 19, 2017 at 04:14:43PM +0800, Huang, Ying wrote:
> >>> Minchan Kim  writes:
> >>> 
> >>> > Hi Huang,
> >>> >
> >>> > On Fri, Apr 07, 2017 at 02:49:01PM +0800, Huang, Ying wrote:
> >>> >> From: Huang Ying 
> >>> >> 
> >>> >>  void swapcache_free_entries(swp_entry_t *entries, int n)
> >>> >>  {
> >>> >>struct swap_info_struct *p, *prev;
> >>> >> @@ -1075,6 +1083,10 @@ void swapcache_free_entries(swp_entry_t 
> >>> >> *entries, int n)
> >>> >>  
> >>> >>prev = NULL;
> >>> >>p = NULL;
> >>> >> +
> >>> >> +  /* Sort swap entries by swap device, so each lock is only taken 
> >>> >> once. */
> >>> >> +  if (nr_swapfiles > 1)
> >>> >> +  sort(entries, n, sizeof(entries[0]), swp_entry_cmp, 
> >>> >> NULL);
> >>> >
> >>> > Let's think on other cases.
> >>> >
> >>> > There are two swaps and they are configured by priority so a swap's 
> >>> > usage
> >>> > would be zero unless other swap used up. In case of that, this sorting
> >>> > is pointless.
> >>> >
> >>> > As well, nr_swapfiles is never decreased so if we enable multiple
> >>> > swaps and then disable until a swap is remained, this sorting is
> >>> > pointelss, too.
> >>> >
> >>> > How about lazy sorting approach? IOW, if we found prev != p and,
> >>> > then we can sort it.
> >>> 
> >>> Yes.  That should be better.  I just don't know whether the added
> >>> complexity is necessary, given the array is short and sort is fast.
> >>
> >> Huh?
> >>
> >> 1. swapon /dev/XXX1
> >> 2. swapon /dev/XXX2
> >> 3. swapoff /dev/XXX2
> >> 4. use only one swap
> >> 5. then, always pointless sort.
> >
> > Yes.  In this situation we will do unnecessary sorting.  What I don't
> > know is whether the unnecessary sorting will hurt performance in real
> > life.  I can do some measurement.
> 
> I tested the patch with 1 swap device and 1 process to eat memory
> (remove the "if (nr_swapfiles > 1)" for test).  I think this is the
> worse case because there is no lock contention.  The memory freeing time
> increased from 1.94s to 2.12s (increase ~9.2%).  So there is some
> overhead for some cases.  I change the algorithm to something like
> below,
> 
>  void swapcache_free_entries(swp_entry_t *entries, int n)
>  {
>   struct swap_info_struct *p, *prev;
>   int i;
> + swp_entry_t entry;
> + unsigned int prev_swp_type;
>  
>   if (n <= 0)
>   return;
>  
> + prev_swp_type = swp_type(entries[0]);
> + for (i = n - 1; i > 0; i--) {
> + if (swp_type(entries[i]) != prev_swp_type)
> + break;
> + }

That's really what I want to avoid. For many swap usecases,
it adds unnecessary overhead.

> +
> + /* Sort swap entries by swap device, so each lock is only taken once. */
> + if (i)
> + sort(entries, n, sizeof(entries[0]), swp_entry_cmp, NULL);
>   prev = NULL;
>   p = NULL;
>   for (i = 0; i < n; ++i) {
> - p = swap_info_get_cont(entries[i], prev);
> + entry = entries[i];
> + p = swap_info_get_cont(entry, prev);
>   if (p)
> - swap_entry_free(p, entries[i]);
> + swap_entry_free(p, entry);
>   prev = p;
>   }
>   if (p)
> 
> With this patch, the memory freeing time increased from 1.94s to 1.97s.
> I think this is good enough.  Do you think so?

What I mean is as follows(I didn't test it at all):

With this, sort entries if we found multiple entries in current
entries. It adds some condition checks for non-multiple swap
usecase but it would be more cheaper than the sorting.
And it adds a [un]lock overhead for multiple swap usecase but
it should be a compromise for single-swap usecase which is more
popular.

diff --git a/mm/swapfile.c b/mm/swapfile.c
index f23c56e9be39..0d76a492786f 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1073,30 +1073,40 @@ static int swp_entry_cmp(const void *ent1, const void 
*ent2)
return (long)(swp_type(*e1) - swp_type(*e2));
 }
 
-void swapcache_free_entries(swp_entry_t *entries, int n)
+void swapcache_free_entries(swp_entry_t *entries, int nr)
 {
-   struct swap_info_struct *p, *prev;
int i;
+   struct swap_info_struct *cur, *prev = NULL;
+   bool sorted = false;
 
-   if (n <= 0)
+   if (nr <= 0)
return;
 
-   prev = NULL;
-   p = NULL;
-
-   /* Sort swap entries by swap device, so each lock is only taken once. */
-   if (nr_swapfiles > 1)
-   sort(entries, n, sizeof(entries[0]), swp_entry_cmp, NULL);
-   for (i = 0; i < n; ++i) {
-   p = swap_info_get_cont(entries[i], prev);
-   if (p)
-   swap_entry_free(p, entries[i]);
-   else
+   for (i = 0; i < nr; i++) {
+   cur = swap_info_get_cont(entries[i], prev);
+   

[PATCH v2 27/29] drm/udl: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/udl/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/udl/Makefile b/drivers/gpu/drm/udl/Makefile
index 195bcac..36f2e82 100644
--- a/drivers/gpu/drm/udl/Makefile
+++ b/drivers/gpu/drm/udl/Makefile
@@ -1,6 +1,3 @@
-
-ccflags-y := -Iinclude/drm
-
 udl-y := udl_drv.o udl_modeset.o udl_connector.o udl_encoder.o udl_main.o 
udl_fb.o udl_transfer.o udl_gem.o udl_dmabuf.o
 
 obj-$(CONFIG_DRM_UDL) := udl.o
-- 
2.7.4



[PATCH v2 23/29] drm/r128: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/r128/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/r128/Makefile b/drivers/gpu/drm/r128/Makefile
index 1cc72ae..1a6700e 100644
--- a/drivers/gpu/drm/r128/Makefile
+++ b/drivers/gpu/drm/r128/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 r128-y   := r128_drv.o r128_cce.o r128_state.o r128_irq.o
 
 r128-$(CONFIG_COMPAT)   += r128_ioc32.o
-- 
2.7.4



[PATCH v2 23/29] drm/r128: remove unneeded -Iinclude/drm compiler flag

2017-04-23 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/r128/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/r128/Makefile b/drivers/gpu/drm/r128/Makefile
index 1cc72ae..1a6700e 100644
--- a/drivers/gpu/drm/r128/Makefile
+++ b/drivers/gpu/drm/r128/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 r128-y   := r128_drv.o r128_cce.o r128_state.o r128_irq.o
 
 r128-$(CONFIG_COMPAT)   += r128_ioc32.o
-- 
2.7.4



[PATCH v2 14/29] drm/tilcdc: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/tilcdc/Makefile | 1 -
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/Makefile b/drivers/gpu/drm/tilcdc/Makefile
index 6f67517..55ebd51 100644
--- a/drivers/gpu/drm/tilcdc/Makefile
+++ b/drivers/gpu/drm/tilcdc/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 ifeq (, $(findstring -W,$(EXTRA_CFLAGS)))
ccflags-y += -Werror
 endif
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index d7ae5be..d67e189 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
@@ -29,8 +30,6 @@
 #include "tilcdc_panel.h"
 #include "tilcdc_external.h"
 
-#include "drm_fb_helper.h"
-
 static LIST_HEAD(module_list);
 
 static const u32 tilcdc_rev1_formats[] = { DRM_FORMAT_RGB565 };
-- 
2.7.4



[PATCH v2 14/29] drm/tilcdc: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/tilcdc/Makefile | 1 -
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/Makefile b/drivers/gpu/drm/tilcdc/Makefile
index 6f67517..55ebd51 100644
--- a/drivers/gpu/drm/tilcdc/Makefile
+++ b/drivers/gpu/drm/tilcdc/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 ifeq (, $(findstring -W,$(EXTRA_CFLAGS)))
ccflags-y += -Werror
 endif
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index d7ae5be..d67e189 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
@@ -29,8 +30,6 @@
 #include "tilcdc_panel.h"
 #include "tilcdc_external.h"
 
-#include "drm_fb_helper.h"
-
 static LIST_HEAD(module_list);
 
 static const u32 tilcdc_rev1_formats[] = { DRM_FORMAT_RGB565 };
-- 
2.7.4



[PATCH v2 16/29] drm/virtio: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/virtio/Makefile  |  2 --
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c |  4 ++--
 drivers/gpu/drm/virtio/virtgpu_drv.h |  8 
 drivers/gpu/drm/virtio/virtgpu_ioctl.c   |  5 +++--
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-
 6 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Makefile b/drivers/gpu/drm/virtio/Makefile
index 3fb8eac..7684f61 100644
--- a/drivers/gpu/drm/virtio/Makefile
+++ b/drivers/gpu/drm/virtio/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
-
 virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \
virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \
virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o \
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c 
b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index f51240a..73dc990 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -24,8 +24,8 @@
  */
 
 #include 
+#include 
 
-#include "drmP.h"
 #include "virtgpu_drv.h"
 
 static int
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c 
b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 2d29b01..63d35c7 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -29,8 +29,8 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
-#include "drm/drm.h"
+#include 
+#include 
 
 #include "virtgpu_drv.h"
 static struct drm_driver driver;
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h 
b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 1328185..3a66abb 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -36,10 +36,10 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 
 #define DRIVER_NAME "virtio_gpu"
 #define DRIVER_DESC "virtio GPU"
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 61f3a96..06cb16d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -26,9 +26,10 @@
  */
 
 #include 
-#include "virtgpu_drv.h"
 #include 
-#include "ttm/ttm_execbuf_util.h"
+#include 
+
+#include "virtgpu_drv.h"
 
 static void convert_to_hw_box(struct virtio_gpu_box *dst,
  const struct drm_virtgpu_3d_box *src)
diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c 
b/drivers/gpu/drm/virtio/virtgpu_ttm.c
index 4e8e27d..c1f2af4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
@@ -25,11 +25,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH v2 16/29] drm/virtio: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2: None

 drivers/gpu/drm/virtio/Makefile  |  2 --
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c |  4 ++--
 drivers/gpu/drm/virtio/virtgpu_drv.h |  8 
 drivers/gpu/drm/virtio/virtgpu_ioctl.c   |  5 +++--
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-
 6 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Makefile b/drivers/gpu/drm/virtio/Makefile
index 3fb8eac..7684f61 100644
--- a/drivers/gpu/drm/virtio/Makefile
+++ b/drivers/gpu/drm/virtio/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
-
 virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \
virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \
virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o \
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c 
b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index f51240a..73dc990 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -24,8 +24,8 @@
  */
 
 #include 
+#include 
 
-#include "drmP.h"
 #include "virtgpu_drv.h"
 
 static int
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c 
b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 2d29b01..63d35c7 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -29,8 +29,8 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
-#include "drm/drm.h"
+#include 
+#include 
 
 #include "virtgpu_drv.h"
 static struct drm_driver driver;
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h 
b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 1328185..3a66abb 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -36,10 +36,10 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 
 #define DRIVER_NAME "virtio_gpu"
 #define DRIVER_DESC "virtio GPU"
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 61f3a96..06cb16d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -26,9 +26,10 @@
  */
 
 #include 
-#include "virtgpu_drv.h"
 #include 
-#include "ttm/ttm_execbuf_util.h"
+#include 
+
+#include "virtgpu_drv.h"
 
 static void convert_to_hw_box(struct virtio_gpu_box *dst,
  const struct drm_virtgpu_3d_box *src)
diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c 
b/drivers/gpu/drm/virtio/virtgpu_ttm.c
index 4e8e27d..c1f2af4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
@@ -25,11 +25,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH v2 10/29] drm/msm: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

While we are here, sort the touched parts with public headers first.
mdp4_kms.h must declare struct device_node to be self-contained.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort includes

 drivers/gpu/drm/msm/Makefile |  2 +-
 drivers/gpu/drm/msm/dsi/dsi.h|  6 +++---
 drivers/gpu/drm/msm/edp/edp.h|  4 ++--
 drivers/gpu/drm/msm/edp/edp_ctrl.c   |  6 +++---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 10 +-
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c  |  6 +++---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  |  7 +++
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h  |  4 +++-
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c |  6 +++---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c  |  6 +++---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 10 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c  |  6 +++---
 drivers/gpu/drm/msm/msm_fb.c |  6 +++---
 drivers/gpu/drm/msm/msm_fbdev.c  |  6 +++---
 14 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 5241ac8..33008fa 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -1,4 +1,4 @@
-ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/msm
+ccflags-y := -Idrivers/gpu/drm/msm
 ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi
 
 msm-y := \
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 3236997..9e60173 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -17,9 +17,9 @@
 #include 
 #include 
 
-#include "drm_crtc.h"
-#include "drm_mipi_dsi.h"
-#include "drm_panel.h"
+#include 
+#include 
+#include 
 
 #include "msm_drv.h"
 
diff --git a/drivers/gpu/drm/msm/edp/edp.h b/drivers/gpu/drm/msm/edp/edp.h
index ba5bedd..e0f5818 100644
--- a/drivers/gpu/drm/msm/edp/edp.h
+++ b/drivers/gpu/drm/msm/edp/edp.h
@@ -18,9 +18,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
-#include "drm_crtc.h"
-#include "drm_dp_helper.h"
 #include "msm_drv.h"
 
 #define edp_read(offset) msm_readl((offset))
diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c 
b/drivers/gpu/drm/msm/edp/edp_ctrl.c
index 149bfe7..e32a4a4 100644
--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c
+++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c
@@ -14,10 +14,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
-#include "drm_crtc.h"
-#include "drm_dp_helper.h"
-#include "drm_edid.h"
 #include "edp.h"
 #include "edp.xml.h"
 
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
index f29194a..698e514 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
@@ -15,12 +15,12 @@
  * this program.  If not, see .
  */
 
-#include "mdp4_kms.h"
-
+#include 
+#include 
+#include 
 #include 
-#include "drm_crtc.h"
-#include "drm_crtc_helper.h"
-#include "drm_flip_work.h"
+
+#include "mdp4_kms.h"
 
 struct mdp4_crtc {
struct drm_crtc base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
index 106f0e7..6a1ebda 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
@@ -17,10 +17,10 @@
  * this program.  If not, see .
  */
 
-#include "mdp4_kms.h"
+#include 
+#include 
 
-#include "drm_crtc.h"
-#include "drm_crtc_helper.h"
+#include "mdp4_kms.h"
 
 struct mdp4_dsi_encoder {
struct drm_encoder base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
index 24258e3..ba8e587 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
@@ -15,11 +15,10 @@
  * this program.  If not, see .
  */
 
-#include "mdp4_kms.h"
-
-#include "drm_crtc.h"
-#include "drm_crtc_helper.h"
+#include 
+#include 
 
+#include "mdp4_kms.h"
 
 struct mdp4_dtv_encoder {
struct drm_encoder base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
index 62712ca..c413779 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
@@ -18,12 +18,14 @@
 #ifndef __MDP4_KMS_H__
 #define __MDP4_KMS_H__
 
+#include 
+
 #include "msm_drv.h"
 #include "msm_kms.h"
 #include "mdp/mdp_kms.h"
 #include "mdp4.xml.h"
 
-#include "drm_panel.h"
+struct device_node;
 
 struct mdp4_kms {
struct mdp_kms base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
index a06b064..4a64592 100644
--- 

[PATCH v2 09/29] drm/mgag200: fix include notation and remove -Iinclude/drm flag

2017-04-23 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Sort the touched part alphabetically

 drivers/gpu/drm/mgag200/Makefile  | 1 -
 drivers/gpu/drm/mgag200/mgag200_ttm.c | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/Makefile b/drivers/gpu/drm/mgag200/Makefile
index a9a0300..3d91d1d 100644
--- a/drivers/gpu/drm/mgag200/Makefile
+++ b/drivers/gpu/drm/mgag200/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 mgag200-y   := mgag200_main.o mgag200_mode.o mgag200_cursor.o \
mgag200_drv.o mgag200_fb.o mgag200_i2c.o mgag200_ttm.o
 
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c 
b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 565a217..3e7e1cd 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -26,8 +26,9 @@
  * Authors: Dave Airlie 
  */
 #include 
+#include 
+
 #include "mgag200_drv.h"
-#include 
 
 static inline struct mga_device *
 mgag200_bdev(struct ttm_bo_device *bd)
-- 
2.7.4



  1   2   3   4   5   6   7   >