Skip to contentSkip to conversation

refcount: trim headers

PATCH Superseded Alexey Dobriyan 2 participants 4 messages Mar 13, 2018 – Mar 31, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 refcount: trim headers

kernel.h is not needed, but compiler.h is.

mutex.h is not needed only a forward declaration.

spinlock.h is not needed, spinlock_types.h is enough.

---

 include/linux/refcount.h |    7 ++++---
 lib/refcount.c           |    2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)
include/linux/refcount.h +4 -3
@@ -3,9 +3,10 @@
 #define _LINUX_REFCOUNT_H
 
 #include <linux/atomic.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
-#include <linux/kernel.h>
+#include <linux/compiler.h>
+#include <linux/spinlock_types.h>
+
+struct mutex;
 
 /**
  * struct refcount_t - variant of atomic_t specialized for reference counts
lib/refcount.c +2 -0
@@ -35,7 +35,9 @@
  *
  */
 
+#include <linux/mutex.h>
 #include <linux/refcount.h>
+#include <linux/spinlock.h>
 #include <linux/bug.h>
 
 #ifdef CONFIG_REFCOUNT_FULL
#1 lore raw
Quoted 32 lines · Alexey Dobriyan

kernel.h is not needed, but compiler.h is.

mutex.h is not needed only a forward declaration.

spinlock.h is not needed, spinlock_types.h is enough.

---

 include/linux/refcount.h |    7 ++++---
 lib/refcount.c           |    2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)
include/linux/refcount.h +4 -3
@@ -3,9 +3,10 @@
 #define _LINUX_REFCOUNT_H
 
 #include <linux/atomic.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
-#include <linux/kernel.h>
+#include <linux/compiler.h>
+#include <linux/spinlock_types.h>
+
+struct mutex;
 
 /**
  * struct refcount_t - variant of atomic_t specialized for reference counts

lib/refcount.c line 41

Quoted 7 lines
lib/refcount.c +2 -0
@@ -35,7 +35,9 @@
  *
  */
 
+#include <linux/mutex.h>
 #include <linux/refcount.h>
+#include <linux/spinlock.h>
 #include <linux/bug.h>

Doesn't build on x86-64 defconfig...

Thanks,

Ingo

#2 lore raw
Quoted 4 lines · Ingo Molnar
Quoted 4 lines
include/linux/refcount.h +0 -1
 #include <linux/atomic.h>
-#include <linux/mutex.h>
Quoted 8 lines

include/linux/refcount.h line 9

Quoted 6 lines
include/linux/refcount.h +4 -2
-#include <linux/spinlock.h>
-#include <linux/kernel.h>
+#include <linux/compiler.h>
+#include <linux/spinlock_types.h>
+
+struct mutex;

Doesn't build on x86-64 defconfig...

Yeah, it doesn't :-(
Is this going to go through -tip?
Or I'll build test over both trees.

#3 lore raw
Quoted 14 lines · Alexey Dobriyan
Quoted 4 lines · Ingo Molnar
Quoted 4 lines
include/linux/refcount.h +0 -1
 #include <linux/atomic.h>
-#include <linux/mutex.h>
Quoted 8 lines

include/linux/refcount.h line 9

Quoted 6 lines
include/linux/refcount.h +4 -2
-#include <linux/spinlock.h>
-#include <linux/kernel.h>
+#include <linux/compiler.h>
+#include <linux/spinlock_types.h>
+
+struct mutex;

Doesn't build on x86-64 defconfig...

Quoted 3 lines

Yeah, it doesn't :-(
Is this going to go through -tip?
Or I'll build test over both trees.

Yeah, refcount changes go through the locking tree, so testing it against -tip would be useful.

Thanks,

Ingo