From: "David S. Miller" <davem@davemloft.net>
To: torvalds@osdl.org
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
rmk@arm.linux.org.uk, ak@muc.de
Subject: Re: [NET]: Shut up warnings in net/core/flow.c
Date: Wed, 23 Nov 2005 15:20:31 -0800 (PST) [thread overview]
Message-ID: <20051123.152031.02282381.davem@davemloft.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0511230849380.13959@g5.osdl.org>
From: Linus Torvalds <torvalds@osdl.org>
Date: Wed, 23 Nov 2005 08:54:46 -0800 (PST)
> The way to handle it is to do
>
> static inline int maybe_ignored(int arg, ...)
> {
> return arg;
> }
>
> #define smp_call_function(func,info,retry,wait) \
> maybe_ignored(0, info, retry, wait)
>
> which is a very useful way to say: we don't care about "func", but we want
> to avoid unused warnings for "info", "retry" and "wait", and we want to
> return 0 regardless and compile it all away.
>
> If somebody tests this, puts the "maybe_ignored()" function in some nice
> generic header file, I'll apply it.
I quickly hacked this up and did a UP test build (patch at the end),
but there is another consequence to consider.
With this, we have to either:
1) Mark all IPI functions with ifdef CONFIG_SMP, or
2) Mark them with __attribute__((__unused__))) which is what
the net/core/flow.c case does
Because if we just leave the static IPI functions there without the
CONFIG_SMP ifdef and without the unused attribute, this new
smp_call_function() will generate an unused static function warning.
What we could do is hide that detail behind some kind of
"DEFINE_IPI_FUNC()" macro, and put the gore into a header file.
I'm sure there are other clean ways of handling it.
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b1e407a..1876d3c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -286,6 +286,11 @@ extern void dump_stack(void);
1; \
})
+static inline int maybe_ignored(int arg, ...)
+{
+ return arg;
+}
+
#endif /* __KERNEL__ */
#define SI_LOAD_SHIFT 16
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 9dfa3ee..2a513fe 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -94,7 +94,8 @@ void smp_prepare_boot_cpu(void);
*/
#define raw_smp_processor_id() 0
#define hard_smp_processor_id() 0
-#define smp_call_function(func,info,retry,wait) ({ 0; })
+#define smp_call_function(func,info,retry,wait) \
+ maybe_ignored(0, info, retry, wait)
#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; })
static inline void smp_send_reschedule(int cpu) { }
#define num_booting_cpus() 1
next prev parent reply other threads:[~2005-11-23 23:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200511230159.jAN1xeMl003154@hera.kernel.org>
2005-11-23 8:21 ` Andrew Morton
2005-11-23 8:55 ` David S. Miller
2005-11-23 9:11 ` Arjan van de Ven
2005-11-23 21:24 ` David S. Miller
2005-11-23 21:28 ` Arjan van de Ven
2005-11-23 22:02 ` David S. Miller
2005-11-23 16:54 ` Linus Torvalds
2005-11-23 23:20 ` David S. Miller [this message]
2005-11-23 23:29 ` Linus Torvalds
2005-11-24 0:53 ` David S. Miller
2005-11-24 7:46 ` Arjan van de Ven
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=20051123.152031.02282381.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®