[PATCH] Remove a number of duplicate includes

Jesper Juhl posted 1 patch 2 years, 7 months ago
drivers/base/node.c                     | 1 -
drivers/bus/bt1-apb.c                   | 1 -
drivers/char/hw_random/core.c           | 1 -
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 -
drivers/gpu/drm/drm_gem_shmem_helper.c  | 1 -
fs/fscache/io.c                         | 1 -
fs/overlayfs/inode.c                    | 1 -
kernel/sched/build_utility.c            | 1 -
kernel/sched/core.c                     | 3 ---
kernel/sched/fair.c                     | 2 --
10 files changed, 13 deletions(-)
[PATCH] Remove a number of duplicate includes
Posted by Jesper Juhl 2 years, 7 months ago
From 09d653f07a8bbb2aea52b735a731ca781f5f401c Mon Sep 17 00:00:00 2001
From: Jesper Juhl <jesperjuhl76@gmail.com>
Date: Thu, 26 Jan 2023 02:16:59 +0100
Subject: [PATCH] Remove a number of duplicate includes

Including the same header multiple times when there's no functional reason
to do so is just pointless clutter and potentially slows down builds.

Signed-off-by: Jesper Juhl <jesperjuhl76@gmail.com>
---
  drivers/base/node.c                     | 1 -
  drivers/bus/bt1-apb.c                   | 1 -
  drivers/char/hw_random/core.c           | 1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 -
  drivers/gpu/drm/drm_gem_shmem_helper.c  | 1 -
  fs/fscache/io.c                         | 1 -
  fs/overlayfs/inode.c                    | 1 -
  kernel/sched/build_utility.c            | 1 -
  kernel/sched/core.c                     | 3 ---
  kernel/sched/fair.c                     | 2 --
  10 files changed, 13 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index faf3597a96da..4306611ac092 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -20,7 +20,6 @@
  #include <linux/pm_runtime.h>
  #include <linux/swap.h>
  #include <linux/slab.h>
-#include <linux/hugetlb.h>

  static struct bus_type node_subsys = {
  	.name = "node",
diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c
index 63b1b4a76671..fd198577cdb3 100644
--- a/drivers/bus/bt1-apb.c
+++ b/drivers/bus/bt1-apb.c
@@ -22,7 +22,6 @@
  #include <linux/clk.h>
  #include <linux/reset.h>
  #include <linux/time64.h>
-#include <linux/clk.h>
  #include <linux/sysfs.h>

  #define APB_EHB_ISR			0x00
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index f34d356fe2c0..ead998ca0c40 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -21,7 +21,6 @@
  #include <linux/sched/signal.h>
  #include <linux/miscdevice.h>
  #include <linux/module.h>
-#include <linux/random.h>
  #include <linux/sched.h>
  #include <linux/slab.h>
  #include <linux/uaccess.h>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 55e0284b2bdd..f99251861c08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -43,7 +43,6 @@
  #include <linux/sizes.h>
  #include <linux/module.h>

-#include <drm/drm_drv.h>
  #include <drm/ttm/ttm_bo_api.h>
  #include <drm/ttm/ttm_bo_driver.h>
  #include <drm/ttm/ttm_placement.h>
diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index b602cd72a120..6f794db17059 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -10,7 +10,6 @@
  #include <linux/shmem_fs.h>
  #include <linux/slab.h>
  #include <linux/vmalloc.h>
-#include <linux/module.h>

  #ifdef CONFIG_X86
  #include <asm/set_memory.h>
diff --git a/fs/fscache/io.c b/fs/fscache/io.c
index 0d2b8dec8f82..ac9f19388bfb 100644
--- a/fs/fscache/io.c
+++ b/fs/fscache/io.c
@@ -9,7 +9,6 @@
  #include <linux/uio.h>
  #include <linux/bvec.h>
  #include <linux/slab.h>
-#include <linux/uio.h>
  #include "internal.h"

  /**
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index ee6dfa577c93..e6aba8c21efc 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -8,7 +8,6 @@
  #include <linux/slab.h>
  #include <linux/cred.h>
  #include <linux/xattr.h>
-#include <linux/posix_acl.h>
  #include <linux/ratelimit.h>
  #include <linux/fiemap.h>
  #include <linux/fileattr.h>
diff --git a/kernel/sched/build_utility.c b/kernel/sched/build_utility.c
index 99bdd96f454f..80a3df49ab47 100644
--- a/kernel/sched/build_utility.c
+++ b/kernel/sched/build_utility.c
@@ -34,7 +34,6 @@
  #include <linux/nospec.h>
  #include <linux/proc_fs.h>
  #include <linux/psi.h>
-#include <linux/psi.h>
  #include <linux/ptrace_api.h>
  #include <linux/sched_clock.h>
  #include <linux/security.h>
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e838feb6adc5..f3bba4b8c430 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -84,12 +84,9 @@

  #include "sched.h"
  #include "stats.h"
-#include "autogroup.h"
-
  #include "autogroup.h"
  #include "pelt.h"
  #include "smp.h"
-#include "stats.h"

  #include "../workqueue_internal.h"
  #include "../../io_uring/io-wq.h"
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0f8736991427..e6a11380b47b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -50,8 +50,6 @@

  #include <asm/switch_to.h>

-#include <linux/sched/cond_resched.h>
-
  #include "sched.h"
  #include "stats.h"
  #include "autogroup.h"
-- 
2.39.1
Re: [PATCH] Remove a number of duplicate includes
Posted by Greg Kroah-Hartman 2 years, 7 months ago
On Tue, Jan 31, 2023 at 10:27:23PM +0100, Jesper Juhl wrote:
> > From 09d653f07a8bbb2aea52b735a731ca781f5f401c Mon Sep 17 00:00:00 2001
> From: Jesper Juhl <jesperjuhl76@gmail.com>
> Date: Thu, 26 Jan 2023 02:16:59 +0100
> Subject: [PATCH] Remove a number of duplicate includes

Why is this in the body of the changelog?


> 
> Including the same header multiple times when there's no functional reason
> to do so is just pointless clutter and potentially slows down builds.
> 
> Signed-off-by: Jesper Juhl <jesperjuhl76@gmail.com>
> ---
>  drivers/base/node.c                     | 1 -
>  drivers/bus/bt1-apb.c                   | 1 -
>  drivers/char/hw_random/core.c           | 1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 -
>  drivers/gpu/drm/drm_gem_shmem_helper.c  | 1 -
>  fs/fscache/io.c                         | 1 -
>  fs/overlayfs/inode.c                    | 1 -
>  kernel/sched/build_utility.c            | 1 -
>  kernel/sched/core.c                     | 3 ---
>  kernel/sched/fair.c                     | 2 --
>  10 files changed, 13 deletions(-)

Please properly split this up into subsystem-related patches and send
them that way.

thanks,

greg k-h