warning: ‘x86_get_event_constraints’ defined but not used

From: Kevin Winchester
Date: Mon Aug 15 2011 - 19:40:21 EST


Hi,

From:

gcc (GCC) 4.6.1

I get the following warning:

arch/x86/kernel/cpu/perf_event.c:1444:1: warning:
‘x86_get_event_constraints’ defined but not used [-Wunused-function]

It appears that function is only called in some of the C files that
are included into perf_event.c, namely perf_event_intel.c,
perf_event_p4.c and perf_event_p6.c. Each of those files is
completely dependent on CONFIG_CPU_SUP_INTEL, which I obviously do not
have enabled.

At the moment, I have eliminated the warning with the patch below, but
I do not consider that to be optimal. Is there are reason why those C
files are included directly in another C file rather than being linked
together? Or is there some other way the code could be improved and
also remove the warning at the same time?

I do not mind doing some coding here to make this happen. I am very
close to a warning-free build, so I would definitely like to take care
of this one.

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 4ee3abf..a37e7e9 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1440,6 +1440,7 @@ static __read_mostly struct notifier_block
perf_event_nmi_notifier = {
static struct event_constraint unconstrained;
static struct event_constraint emptyconstraint;

+#ifdef CONFIG_CPU_SUP_INTEL
static struct event_constraint *
x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
{
@@ -1454,6 +1455,7 @@ x86_get_event_constraints(struct cpu_hw_events
*cpuc, struct perf_event *event)

return &unconstrained;
}
+#endif

#include "perf_event_amd.c"
#include "perf_event_p6.c"


Thanks,

--
Kevin Winchester
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/