diff mbox series

[5/5] powerpc/kprobes: Remove unnecessary headers from kprobes

Message ID bf3c70d498a24a0c466657f396291f2298744ef8.1666262278.git.naveen.n.rao@linux.vnet.ibm.com (mailing list archive)
State New
Headers show
Series powerpc/kprobes: preempt related changes and cleanups | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.

Commit Message

Naveen N. Rao Oct. 20, 2022, 5:29 p.m. UTC
Many of these headers are not necessary since those are included
indirectly, or the code using those headers has been removed.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/kprobes-ftrace.c | 4 ----
 arch/powerpc/kernel/kprobes.c        | 2 --
 2 files changed, 6 deletions(-)

Comments

Christophe Leroy Nov. 2, 2022, 8:36 a.m. UTC | #1
Le 20/10/2022 à 19:29, Naveen N. Rao a écrit :
> Many of these headers are not necessary since those are included
> indirectly, or the code using those headers has been removed.

It is usually not a good idea to not include headers because they are 
already included indirectly. If one day for some reason de indirect link 
gets removed, then your file doesn't build anymore.

> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
>   arch/powerpc/kernel/kprobes-ftrace.c | 4 ----
>   arch/powerpc/kernel/kprobes.c        | 2 --
>   2 files changed, 6 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/kprobes-ftrace.c b/arch/powerpc/kernel/kprobes-ftrace.c
> index 072ebe7f290ba7..08ed8a158fd724 100644
> --- a/arch/powerpc/kernel/kprobes-ftrace.c
> +++ b/arch/powerpc/kernel/kprobes-ftrace.c
> @@ -7,10 +7,6 @@
>    *		  IBM Corporation
>    */
>   #include <linux/kprobes.h>
> -#include <linux/ptrace.h>
> -#include <linux/hardirq.h>
> -#include <linux/preempt.h>
> -#include <linux/ftrace.h>
>   
>   /* Ftrace callback handler for kprobes */
>   void kprobe_ftrace_handler(unsigned long nip, unsigned long parent_nip,
> diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
> index 86ca5a61ea9afb..3bf2507f07e6c6 100644
> --- a/arch/powerpc/kernel/kprobes.c
> +++ b/arch/powerpc/kernel/kprobes.c
> @@ -14,8 +14,6 @@
>    */
>   
>   #include <linux/kprobes.h>
> -#include <linux/ptrace.h>
> -#include <linux/preempt.h>
>   #include <linux/extable.h>
>   #include <linux/kdebug.h>
>   #include <linux/slab.h>
Naveen N. Rao Nov. 8, 2022, 10:06 a.m. UTC | #2
Christophe Leroy wrote:
> 
> 
> Le 20/10/2022 à 19:29, Naveen N. Rao a écrit :
>> Many of these headers are not necessary since those are included
>> indirectly, or the code using those headers has been removed.
> 
> It is usually not a good idea to not include headers because they are 
> already included indirectly. If one day for some reason de indirect link 
> gets removed, then your file doesn't build anymore.

I agree with that in general.

The motivation for this patch was to remove <linux/preempt.h> from 
kprobes-ftrace.c since we got rid of explicit preempt disable/enable 
calls in the past. We have also removed explicit irq disable from this 
path. <linux/kprobes.h> includes <linux/ftrace.h> and <asm/kprobes.h> 
includes <linux/ptrace.h> so those could go too.

I don't expect those header dependencies to change, so I think this 
patch is ok.


- Naveen
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/kprobes-ftrace.c b/arch/powerpc/kernel/kprobes-ftrace.c
index 072ebe7f290ba7..08ed8a158fd724 100644
--- a/arch/powerpc/kernel/kprobes-ftrace.c
+++ b/arch/powerpc/kernel/kprobes-ftrace.c
@@ -7,10 +7,6 @@ 
  *		  IBM Corporation
  */
 #include <linux/kprobes.h>
-#include <linux/ptrace.h>
-#include <linux/hardirq.h>
-#include <linux/preempt.h>
-#include <linux/ftrace.h>
 
 /* Ftrace callback handler for kprobes */
 void kprobe_ftrace_handler(unsigned long nip, unsigned long parent_nip,
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 86ca5a61ea9afb..3bf2507f07e6c6 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -14,8 +14,6 @@ 
  */
 
 #include <linux/kprobes.h>
-#include <linux/ptrace.h>
-#include <linux/preempt.h>
 #include <linux/extable.h>
 #include <linux/kdebug.h>
 #include <linux/slab.h>