linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: peterz@infradead.org, mingo@redhat.com
Cc: juri.lelli@redhat.com, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
	Qian Cai <cai@lca.pw>
Subject: [PATCH] sched/cputime: silence a -Wunused-function warning
Date: Fri,  6 Mar 2020 10:41:44 -0500	[thread overview]
Message-ID: <1583509304-28508-1-git-send-email-cai@lca.pw> (raw)

account_other_time() is only used when CONFIG_IRQ_TIME_ACCOUNTING=y (in
irqtime_account_process_tick()) or CONFIG_VIRT_CPU_ACCOUNTING_GEN=y (in
get_vtime_delta()). When both are off, it will generate a compilation
warning from Clang,

kernel/sched/cputime.c:255:19: warning: unused function
'account_other_time' [-Wunused-function]
static inline u64 account_other_time(u64 max)

Rather than wrapping around this function with a macro expression,

 if defined(CONFIG_IRQ_TIME_ACCOUNTING) || \
    defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN)

just use __maybe_unused for this small function which seems like a good
trade-off.

Signed-off-by: Qian Cai <cai@lca.pw>
---
 kernel/sched/cputime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index cff3e656566d..85da4d6dee24 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -252,7 +252,7 @@ static __always_inline u64 steal_account_process_time(u64 maxtime)
 /*
  * Account how much elapsed time was spent in steal, irq, or softirq time.
  */
-static inline u64 account_other_time(u64 max)
+static inline __maybe_unused u64 account_other_time(u64 max)
 {
 	u64 accounted;
 
-- 
1.8.3.1


             reply	other threads:[~2020-03-06 15:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 15:41 Qian Cai [this message]
2020-03-06 17:13 ` [PATCH] sched/cputime: silence a -Wunused-function warning Nick Desaulniers
2020-03-06 17:25   ` Joe Perches
2020-03-06 18:38     ` Joe Perches
2020-03-06 19:02       ` Nick Desaulniers
2020-03-06 19:10         ` Joe Perches
2020-03-07  0:07         ` linux-kernel: Unused static inline functions Joe Perches
2020-04-23 18:57           ` Nick Desaulniers
2020-04-23 21:22             ` Joe Perches
2020-04-24 16:07               ` Julia Lawall
2020-11-29 23:56           ` Joe Perches
2020-05-09 13:12   ` [PATCH] sched/cputime: silence a -Wunused-function warning Qian Cai

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=1583509304-28508-1-git-send-email-cai@lca.pw \
    --to=cai@lca.pw \
    --cc=bsegall@google.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.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).