Skip to contentSkip to conversation

arm64/spinlock: fix a -Wunused-function warning

PATCH In review Qian Cai 3 participants 3 messages Jan 23, 2020 – Feb 3, 2020

Subsystems (2)
lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH v2 1/1 arm64/spinlock: fix a -Wunused-function warning

The commit f5bfdc8e3947 ("locking/osq: Use optimized spinning loop for arm64") introduced a warning from Clang because vcpu_is_preempted() is compiled away,

kernel/locking/osq_lock.c:25:19: warning: unused function 'node_cpu' [-Wunused-function]
static inline int node_cpu(struct optimistic_spin_node *node)

                  ^

1 warning generated.

Fix it by converting vcpu_is_preempted() to a static inline function.

Fixes f5bfdc8e3947 ("locking/osq: Use optimized spinning loop for arm64")

---

v2: convert vcpu_is_preempted() to a static inline function.

 arch/arm64/include/asm/spinlock.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/include/asm/spinlock.h +5 -1
index 102404dc1e13..9083d6992603 100644
@@ -18,6 +18,10 @@
  * See:
  * https://lore.kernel.org/lkml/[email protected]
  */
-#define vcpu_is_preempted(cpu)	false
+#define vcpu_is_preempted vcpu_is_preempted
+static inline bool vcpu_is_preempted(int cpu)
+{
+	return false;
+}
 
 #endif /* __ASM_SPINLOCK_H */
Signature · 1 line
2.21.0 (Apple Git-122.2)
reviewer Acked-by on v2 1/1
#1 lore raw
Quoted 27 lines · Qian Cai

The commit f5bfdc8e3947 ("locking/osq: Use optimized spinning loop for arm64") introduced a warning from Clang because vcpu_is_preempted() is compiled away,

kernel/locking/osq_lock.c:25:19: warning: unused function 'node_cpu' [-Wunused-function]
static inline int node_cpu(struct optimistic_spin_node *node)

                  ^

1 warning generated.

Fix it by converting vcpu_is_preempted() to a static inline function.

Fixes f5bfdc8e3947 ("locking/osq: Use optimized spinning loop for arm64")

---

v2: convert vcpu_is_preempted() to a static inline function.

 arch/arm64/include/asm/spinlock.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/include/asm/spinlock.h +0 -0
index 102404dc1e13..9083d6992603 100644
@@ -18,6 +18,10 @@
  * See:

arch/arm64/include/asm/spinlock.h line 27

Quoted 10 lines
arch/arm64/include/asm/spinlock.h +5 -1
  * https://lore.kernel.org/lkml/[email protected]
  */
-#define vcpu_is_preempted(cpu)	false
+#define vcpu_is_preempted vcpu_is_preempted
+static inline bool vcpu_is_preempted(int cpu)
+{
+	return false;
+}
 
 #endif /* __ASM_SPINLOCK_H */
maintainer
#2 lore raw
In reply to Qian Cai
Quoted 26 lines · Qian Cai

The commit f5bfdc8e3947 ("locking/osq: Use optimized spinning loop for arm64") introduced a warning from Clang because vcpu_is_preempted() is compiled away,

kernel/locking/osq_lock.c:25:19: warning: unused function 'node_cpu' [-Wunused-function]
static inline int node_cpu(struct optimistic_spin_node *node)

                  ^

1 warning generated.

Fix it by converting vcpu_is_preempted() to a static inline function.

Fixes f5bfdc8e3947 ("locking/osq: Use optimized spinning loop for arm64")

---

v2: convert vcpu_is_preempted() to a static inline function.

 arch/arm64/include/asm/spinlock.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/include/asm/spinlock.h +0 -0
index 102404dc1e13..9083d6992603 100644

arch/arm64/include/asm/spinlock.h line 25

Quoted 9 lines
arch/arm64/include/asm/spinlock.h +5 -1
@@ -18,6 +18,10 @@
  * See:
  * https://lore.kernel.org/lkml/[email protected]
  */
-#define vcpu_is_preempted(cpu)	false
+#define vcpu_is_preempted vcpu_is_preempted
+static inline bool vcpu_is_preempted(int cpu)
+{
+	return false;
+}

Cheers, I'll queue this at -rc1.

Will