History

profile: hide unused functions when !CONFIG_PROC_FS

A couple of functions and variables in the profile implementation are used only on SMP systems by the procfs code, but are unused if either procfs is disabled or in uniprocessor kernels. gcc prints a harmless warning about the unused symbols: kernel/profile.c:243:13: error: 'profile_flip_buffers' defined but not used [-Werror=unused-function] static void profile_flip_buffers(void) ^ kernel/profile.c:266:13: error: 'profile_discard_flip_buffers' defined but not used [-Werror=unused-function] static void profile_discard_flip_buffers(void) ^ kernel/profile.c:330:12: error: 'profile_cpu_callback' defined but not used [-Werror=unused-function] static int profile_cpu_callback(struct notifier_block *info, ^ This adds further #ifdef to the file, to annotate exactly in which cases they are used. I have done several thousand ARM randconfig kernels with this patch applied and no longer get any warnings in this file.

Arnd Bergmann committed 10 years ago

Commit ade356b1 parent abc514c1 file · +2 −2Browse files

Unified · Split

kernel/profile.c+2−2
@@ -44,7 +44,7 @@ int prof_on __read_mostly; · 43 unmodified lines
44EXPORT_SYMBOL_GPL(prof_on);44EXPORT_SYMBOL_GPL(prof_on);
45 45
46static cpumask_var_t prof_cpu_mask;46static cpumask_var_t prof_cpu_mask;
47#ifdef CONFIG_SMP47#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
48static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits);48static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits);
49static DEFINE_PER_CPU(int, cpu_profile_flip);49static DEFINE_PER_CPU(int, cpu_profile_flip);
50static DEFINE_MUTEX(profile_flip_mutex);50static DEFINE_MUTEX(profile_flip_mutex);
@@ -202,7 +202,7 @@ int profile_event_unregister(enum profile_type type, struct notifier_block *n) · 151 unmodified lines
202}202}
203EXPORT_SYMBOL_GPL(profile_event_unregister);203EXPORT_SYMBOL_GPL(profile_event_unregister);
204 204
205#ifdef CONFIG_SMP205#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
206/*206/*
207 * Each cpu has a pair of open-addressed hashtables for pending207 * Each cpu has a pair of open-addressed hashtables for pending
208 * profile hits. read_profile() IPI's all cpus to request them208 * profile hits. read_profile() IPI's all cpus to request them