[PATCH] treewide: remove unnecessary <linux/version.h> inclusion

Masahiro Yamada posted 1 patch 1 year, 6 months ago
drivers/accessibility/speakup/genmap.c                | 1 -
drivers/accessibility/speakup/makemapdata.c           | 1 -
drivers/staging/media/atomisp/include/linux/atomisp.h | 1 -
samples/trace_events/trace_custom_sched.c             | 1 -
sound/soc/codecs/cs42l42.c                            | 1 -
5 files changed, 5 deletions(-)
[PATCH] treewide: remove unnecessary <linux/version.h> inclusion
Posted by Masahiro Yamada 1 year, 6 months ago
These files do not use any macros defined in <linux/version.h>.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 drivers/accessibility/speakup/genmap.c                | 1 -
 drivers/accessibility/speakup/makemapdata.c           | 1 -
 drivers/staging/media/atomisp/include/linux/atomisp.h | 1 -
 samples/trace_events/trace_custom_sched.c             | 1 -
 sound/soc/codecs/cs42l42.c                            | 1 -
 5 files changed, 5 deletions(-)

diff --git a/drivers/accessibility/speakup/genmap.c b/drivers/accessibility/speakup/genmap.c
index 0125000e00d9..0882bab10fb8 100644
--- a/drivers/accessibility/speakup/genmap.c
+++ b/drivers/accessibility/speakup/genmap.c
@@ -10,7 +10,6 @@
 #include <stdio.h>
 #include <libgen.h>
 #include <string.h>
-#include <linux/version.h>
 #include <ctype.h>
 #include "utils.h"
 
diff --git a/drivers/accessibility/speakup/makemapdata.c b/drivers/accessibility/speakup/makemapdata.c
index d7d41bb9b05f..55e4ef8a93dc 100644
--- a/drivers/accessibility/speakup/makemapdata.c
+++ b/drivers/accessibility/speakup/makemapdata.c
@@ -10,7 +10,6 @@
 #include <stdio.h>
 #include <libgen.h>
 #include <string.h>
-#include <linux/version.h>
 #include <ctype.h>
 #include "utils.h"
 
diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h
index 16c9da172c03..fefbe3cd08f3 100644
--- a/drivers/staging/media/atomisp/include/linux/atomisp.h
+++ b/drivers/staging/media/atomisp/include/linux/atomisp.h
@@ -20,7 +20,6 @@
 #define _ATOM_ISP_H
 
 #include <linux/types.h>
-#include <linux/version.h>
 
 /* struct media_device_info.hw_revision */
 #define ATOMISP_HW_REVISION_MASK	0x0000ff00
diff --git a/samples/trace_events/trace_custom_sched.c b/samples/trace_events/trace_custom_sched.c
index b99d9ab7db85..dd409b704b35 100644
--- a/samples/trace_events/trace_custom_sched.c
+++ b/samples/trace_events/trace_custom_sched.c
@@ -8,7 +8,6 @@
 #define pr_fmt(fmt) fmt
 
 #include <linux/trace_events.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index 60d366e53526..6400ac875e6f 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -11,7 +11,6 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/version.h>
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-- 
2.43.0
Re: [PATCH] treewide: remove unnecessary <linux/version.h> inclusion
Posted by Nicolas Schier 1 year, 6 months ago
On Thu 08 Aug 2024 02:47:28 GMT, Masahiro Yamada wrote:
> These files do not use any macros defined in <linux/version.h>.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  drivers/accessibility/speakup/genmap.c                | 1 -
>  drivers/accessibility/speakup/makemapdata.c           | 1 -
>  drivers/staging/media/atomisp/include/linux/atomisp.h | 1 -
>  samples/trace_events/trace_custom_sched.c             | 1 -
>  sound/soc/codecs/cs42l42.c                            | 1 -
>  5 files changed, 5 deletions(-)
> 

Re-checking with

    $ git grep -rle '#include <linux/version.h>' >files-including-version.h
    $ <files-including-version.h xargs git grep -lr -eLINUX_VERSION_{CODE,MAJOR,PATCHLEVEL,SUBLEVEL} -e KERNEL_VERSION >using-macros-from-version.h
    $ diff files-including-version.h using-macros-from-version.h 

reveals that also

    tools/testing/selftests/bpf/progs/dev_cgroup.c
    tools/testing/selftests/bpf/progs/netcnt_prog.c
    tools/testing/selftests/bpf/progs/test_map_lock.c
    tools/testing/selftests/bpf/progs/test_send_signal_kern.c
    tools/testing/selftests/bpf/progs/test_spin_lock.c
    tools/testing/selftests/bpf/progs/test_tcp_estats.c
    tools/testing/selftests/wireguard/qemu/init.c

are including but not using linux/version.h.  This shall probably not 
go through kbuild tree, so it looks complete (enough) to me, thanks!

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>