From: Waiman Long <longman@redhat.com>
To: Qian Cai <cai@lca.pw>, peterz@infradead.org
Cc: catalin.marinas@arm.com, linux-kernel@vger.kernel.org,
clang-built-linux@googlegroups.com, mingo@redhat.com,
will@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH -next] arm64/spinlock: fix a -Wunused-function warning
Date: Thu, 23 Jan 2020 12:11:03 -0500 [thread overview]
Message-ID: <2fe3a534-feb6-490c-71c6-208607e6cdf6@redhat.com> (raw)
In-Reply-To: <20200123162945.7705-1-cai@lca.pw>
On 1/23/20 11:29 AM, Qian Cai wrote:
> 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.
>
> Since vcpu_is_preempted() had already been defined in
> include/linux/sched.h as false, just comment out the redundant macro, so
> it can still be served for the documentation purpose.
>
> Fixes: f5bfdc8e3947 ("locking/osq: Use optimized spinning loop for arm64")
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
> arch/arm64/include/asm/spinlock.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h
> index 102404dc1e13..b05f82e8ba19 100644
> --- a/arch/arm64/include/asm/spinlock.h
> +++ b/arch/arm64/include/asm/spinlock.h
> @@ -17,7 +17,8 @@
> *
> * See:
> * https://lore.kernel.org/lkml/20200110100612.GC2827@hirez.programming.kicks-ass.net
> + *
> + * #define vcpu_is_preempted(cpu) false
> */
> -#define vcpu_is_preempted(cpu) false
>
> #endif /* __ASM_SPINLOCK_H */
Does adding a __maybe_unused tag help to prevent the warning? Like
diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
index 6ef600aa0f47..0722655af34f 100644
--- a/kernel/locking/osq_lock.c
+++ b/kernel/locking/osq_lock.c
@@ -22,7 +22,7 @@ static inline int encode_cpu(int cpu_nr)
return cpu_nr + 1;
}
-static inline int node_cpu(struct optimistic_spin_node *node)
+static inline int __maybe_unused node_cpu(struct optimistic_spin_node
*node)
{
return node->cpu - 1;
}
Cheers,
Longman
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-01-23 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-23 16:29 [PATCH -next] arm64/spinlock: fix a -Wunused-function warning Qian Cai
2020-01-23 16:56 ` Will Deacon
2020-01-23 17:23 ` Qian Cai
2020-01-23 17:31 ` Qian Cai
2020-01-23 17:36 ` Waiman Long
2020-01-23 17:11 ` Waiman Long [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2fe3a534-feb6-490c-71c6-208607e6cdf6@redhat.com \
--to=longman@redhat.com \
--cc=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).