Skip to contentSkip to conversation

list: Remove redundant 'extern' for function prototypes

PATCH Applied Andy Shevchenko 3 participants 3 messages May 2, 2025 – May 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 list: Remove redundant 'extern' for function prototypes

The 'extern' keyword is redundant for function prototypes. list.h never used them and new code in general is better without them.

---
 include/linux/list.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/list.h +4 -4
index 29a375889fb8..e7e28afd28f8 100644
@@ -50,9 +50,9 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
  * Performs the full set of list corruption checks before __list_add().
  * On list corruption reports a warning, and returns false.
  */
-extern bool __list_valid_slowpath __list_add_valid_or_report(struct list_head *new,
-							     struct list_head *prev,
-							     struct list_head *next);
+bool __list_valid_slowpath __list_add_valid_or_report(struct list_head *new,
+						      struct list_head *prev,
+						      struct list_head *next);
 
 /*
  * Performs list corruption checks before __list_add(). Returns false if a
@@ -93,7 +93,7 @@ static __always_inline bool __list_add_valid(struct list_head *new,
  * Performs the full set of list corruption checks before __list_del_entry().
  * On list corruption reports a warning, and returns false.
  */
-extern bool __list_valid_slowpath __list_del_entry_valid_or_report(struct list_head *entry);
+bool __list_valid_slowpath __list_del_entry_valid_or_report(struct list_head *entry);
 
 /*
  * Performs list corruption checks before __list_del_entry(). Returns false if a
Signature · 1 line
2.47.2
#1 lore raw

include/linux/list.h static __always_inline bool __list_add_valid(struct list_head *new, · line 96

Quoted 10 lines · On Fri, 2 May 2025 15:17:42 +0300 Andy Shevchenko…

The 'extern' keyword is redundant for function prototypes. list.h never used them and new code in general is better without them.

...

include/linux/list.h +1 -1
-extern bool __list_valid_slowpath __list_del_entry_valid_or_report(struct list_head *entry);
+bool __list_valid_slowpath __list_del_entry_valid_or_report(struct list_head *entry);

I'll apply this because you continue to do significant work on list.h but I don't want to spend the next 5 years buried in little "remove externs" patches!

#2 lore raw

Sat, May 03, 2025 at 07:35:42PM -0700, Andrew Morton kirjoitti:

Quoted 5 lines · On Fri, 2 May 2025 15:17:42 +0300 Andy Shevchenko…
Quoted 4 lines

The 'extern' keyword is redundant for function prototypes. list.h never used them and new code in general is better without them.

...

Quoted 6 lines

include/linux/list.h static __always_inline bool __list_add_valid(struct list_head *new, · line 96

Quoted 2 lines
include/linux/list.h +1 -1
-extern bool __list_valid_slowpath __list_del_entry_valid_or_report(struct list_head *entry);
+bool __list_valid_slowpath __list_del_entry_valid_or_report(struct list_head *entry);

I'll apply this because you continue to do significant work on list.h but I don't want to spend the next 5 years buried in little "remove externs" patches!

Thank you!

FWIW, I made this change because (as stated in the commit message) list.h from the beginning hasn't used that keyword and a relatively new change brought this. It's not a part of any huge churn, and just a standalone ad-hoc change.

Signature · 2 lines
With Best Regards,
Andy Shevchenko