Skip to contentSkip to conversation

hw_breakpoint: Fix build warnings with clang

PATCH Applied Ravi Bangoria 4 participants 5 messages Jun 2, 2020 – Jun 9, 2020 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw_breakpoint: Fix build warnings with clang

kbuild test robot reported few build warnings with hw_breakpoint code when compiled with clang[1]. Fix those.

[1]: https://lore.kernel.org/linuxppc-dev/202005192233.oi9CjRtA%[email protected]/

---
Note: Prepared on top of powerpc/next.

 arch/powerpc/include/asm/hw_breakpoint.h | 3 ---
 include/linux/hw_breakpoint.h            | 4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/hw_breakpoint.h +0 -3
index f42a55eb77d2..cb424799da0d 100644
@@ -70,9 +70,6 @@ extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
 						unsigned long val, void *data);
 int arch_install_hw_breakpoint(struct perf_event *bp);
 void arch_uninstall_hw_breakpoint(struct perf_event *bp);
-int arch_reserve_bp_slot(struct perf_event *bp);
-void arch_release_bp_slot(struct perf_event *bp);
-void arch_unregister_hw_breakpoint(struct perf_event *bp);
 void hw_breakpoint_pmu_read(struct perf_event *bp);
 extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk);
 
include/linux/hw_breakpoint.h +4 -0
index 6058c3844a76..521481f0d320 100644
@@ -80,6 +80,10 @@ extern int dbg_reserve_bp_slot(struct perf_event *bp);
 extern int dbg_release_bp_slot(struct perf_event *bp);
 extern int reserve_bp_slot(struct perf_event *bp);
 extern void release_bp_slot(struct perf_event *bp);
+extern int hw_breakpoint_weight(struct perf_event *bp);
+extern int arch_reserve_bp_slot(struct perf_event *bp);
+extern void arch_release_bp_slot(struct perf_event *bp);
+extern void arch_unregister_hw_breakpoint(struct perf_event *bp);
 
 extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk);
 
Signature · 1 line
2.26.2
#1 lore raw

Le 02/06/2020 à 06:12, Ravi Bangoria a écrit :

Quoted 33 lines

kbuild test robot reported few build warnings with hw_breakpoint code when compiled with clang[1]. Fix those.

[1]: https://lore.kernel.org/linuxppc-dev/202005192233.oi9CjRtA%[email protected]/

---
Note: Prepared on top of powerpc/next.

  arch/powerpc/include/asm/hw_breakpoint.h | 3 ---
  include/linux/hw_breakpoint.h            | 4 ++++
  2 files changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/hw_breakpoint.h +0 -3
index f42a55eb77d2..cb424799da0d 100644
@@ -70,9 +70,6 @@ extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
  						unsigned long val, void *data);
  int arch_install_hw_breakpoint(struct perf_event *bp);
  void arch_uninstall_hw_breakpoint(struct perf_event *bp);
-int arch_reserve_bp_slot(struct perf_event *bp);
-void arch_release_bp_slot(struct perf_event *bp);
-void arch_unregister_hw_breakpoint(struct perf_event *bp);
  void hw_breakpoint_pmu_read(struct perf_event *bp);
  extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk);
 
include/linux/hw_breakpoint.h +0 -0
index 6058c3844a76..521481f0d320 100644

include/linux/hw_breakpoint.h extern int dbg_reserve_bp_slot(struct perf_event *bp); · line 86

Quoted 7 lines
include/linux/hw_breakpoint.h +4 -0
@@ -80,6 +80,10 @@ extern int dbg_reserve_bp_slot(struct perf_event *bp);
  extern int dbg_release_bp_slot(struct perf_event *bp);
  extern int reserve_bp_slot(struct perf_event *bp);
  extern void release_bp_slot(struct perf_event *bp);
+extern int hw_breakpoint_weight(struct perf_event *bp);
+extern int arch_reserve_bp_slot(struct perf_event *bp);
+extern void arch_release_bp_slot(struct perf_event *bp);
+extern void arch_unregister_hw_breakpoint(struct perf_event *bp);

Please no new 'extern'. In the old days 'extern' keyword was used, but new code shall not introduce new unnecessary usage of 'extern' keyword. See report from Checkpatch below:

WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #9:
[1]: https://lore.kernel.org/linuxppc-dev/202005192233.oi9CjRtA%[email protected]/

CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #40: FILE: include/linux/hw_breakpoint.h:83:
+extern int hw_breakpoint_weight(struct perf_event *bp);

CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #41: FILE: include/linux/hw_breakpoint.h:84:
+extern int arch_reserve_bp_slot(struct perf_event *bp);

CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #42: FILE: include/linux/hw_breakpoint.h:85:
+extern void arch_release_bp_slot(struct perf_event *bp);

CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #43: FILE: include/linux/hw_breakpoint.h:86:
+extern void arch_unregister_hw_breakpoint(struct perf_event *bp);

total: 0 errors, 1 warnings, 4 checks, 19 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.

the.patch has style problems, please review.

NOTE: Ignored message types: ARCH_INCLUDE_LINUX BIT_MACRO COMPARISON_TO_NULL DT_SPLIT_BINDING_PATCH EMAIL_SUBJECT FILE_PATH_CHANGES GLOBAL_INITIALISERS LINE_SPACING MULTIPLE_ASSIGNMENTS

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

Christophe

#2 lore raw
Quoted 6 lines · Christophe Leroy

Le 02/06/2020 à 06:12, Ravi Bangoria a écrit :

Quoted 5 lines

kbuild test robot reported few build warnings with hw_breakpoint code when compiled with clang[1]. Fix those.

[1]: https://lore.kernel.org/linuxppc-dev/202005192233.oi9CjRtA%[email protected]/

This should have mentioned that some of the errors were recently introduced by your commit.

Quoted 46 lines
Quoted 28 lines

---
Note: Prepared on top of powerpc/next.

  arch/powerpc/include/asm/hw_breakpoint.h | 3 ---
  include/linux/hw_breakpoint.h            | 4 ++++
  2 files changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/hw_breakpoint.h +0 -3
index f42a55eb77d2..cb424799da0d 100644
@@ -70,9 +70,6 @@ extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
  						unsigned long val, void *data);
  int arch_install_hw_breakpoint(struct perf_event *bp);
  void arch_uninstall_hw_breakpoint(struct perf_event *bp);
-int arch_reserve_bp_slot(struct perf_event *bp);
-void arch_release_bp_slot(struct perf_event *bp);
-void arch_unregister_hw_breakpoint(struct perf_event *bp);
  void hw_breakpoint_pmu_read(struct perf_event *bp);
  extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk);
 
include/linux/hw_breakpoint.h +0 -0
index 6058c3844a76..521481f0d320 100644

include/linux/hw_breakpoint.h extern int dbg_reserve_bp_slot(struct perf_event *bp); · line 86

Quoted 7 lines
include/linux/hw_breakpoint.h +4 -0
@@ -80,6 +80,10 @@ extern int dbg_reserve_bp_slot(struct perf_event *bp);
  extern int dbg_release_bp_slot(struct perf_event *bp);
  extern int reserve_bp_slot(struct perf_event *bp);
  extern void release_bp_slot(struct perf_event *bp);
+extern int hw_breakpoint_weight(struct perf_event *bp);
+extern int arch_reserve_bp_slot(struct perf_event *bp);
+extern void arch_release_bp_slot(struct perf_event *bp);
+extern void arch_unregister_hw_breakpoint(struct perf_event *bp);

Please no new 'extern'. In the old days 'extern' keyword was used, but new code shall not introduce new unnecessary usage of 'extern' keyword. See report from Checkpatch below:

WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#9:
[1]:
https://lore.kernel.org/linuxppc-dev/202005192233.oi9CjRtA%[email protected]/

Quoted 3 lines

CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #40: FILE: include/linux/hw_breakpoint.h:83:
+extern int hw_breakpoint_weight(struct perf_event *bp);

I fixed it up when applying.

cheers

#3 lore raw
Quoted 10 lines · Michael Ellerman
Quoted 6 lines · Christophe Leroy

Le 02/06/2020 à 06:12, Ravi Bangoria a écrit :

Quoted 5 lines

kbuild test robot reported few build warnings with hw_breakpoint code when compiled with clang[1]. Fix those.

[1]: https://lore.kernel.org/linuxppc-dev/202005192233.oi9CjRtA%[email protected]/

This should have mentioned that some of the errors were recently introduced by your commit.

Sure, will take care next time.

Quoted 47 lines
Quoted 47 lines
Quoted 29 lines

---
Note: Prepared on top of powerpc/next.

   arch/powerpc/include/asm/hw_breakpoint.h | 3 ---
   include/linux/hw_breakpoint.h            | 4 ++++
   2 files changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/hw_breakpoint.h +0 -3
index f42a55eb77d2..cb424799da0d 100644
@@ -70,9 +70,6 @@ extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
   						unsigned long val, void *data);
   int arch_install_hw_breakpoint(struct perf_event *bp);
   void arch_uninstall_hw_breakpoint(struct perf_event *bp);
-int arch_reserve_bp_slot(struct perf_event *bp);
-void arch_release_bp_slot(struct perf_event *bp);
-void arch_unregister_hw_breakpoint(struct perf_event *bp);
   void hw_breakpoint_pmu_read(struct perf_event *bp);
   extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk);
 
include/linux/hw_breakpoint.h +0 -0
index 6058c3844a76..521481f0d320 100644

include/linux/hw_breakpoint.h extern int dbg_reserve_bp_slot(struct perf_event *bp); · line 86

Quoted 7 lines
include/linux/hw_breakpoint.h +4 -0
@@ -80,6 +80,10 @@ extern int dbg_reserve_bp_slot(struct perf_event *bp);
   extern int dbg_release_bp_slot(struct perf_event *bp);
   extern int reserve_bp_slot(struct perf_event *bp);
   extern void release_bp_slot(struct perf_event *bp);
+extern int hw_breakpoint_weight(struct perf_event *bp);
+extern int arch_reserve_bp_slot(struct perf_event *bp);
+extern void arch_release_bp_slot(struct perf_event *bp);
+extern void arch_unregister_hw_breakpoint(struct perf_event *bp);

Please no new 'extern'. In the old days 'extern' keyword was used, but new code shall not introduce new unnecessary usage of 'extern' keyword. See report from Checkpatch below:

WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#9:
[1]:
https://lore.kernel.org/linuxppc-dev/202005192233.oi9CjRtA%[email protected]/

Quoted 5 lines
Quoted 3 lines

CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #40: FILE: include/linux/hw_breakpoint.h:83:
+extern int hw_breakpoint_weight(struct perf_event *bp);

I fixed it up when applying.

Thanks Michael.

Ravi