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

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/profile.c+2−2
@@ -44,7 +44,7 @@ int prof_on __read_mostly; · 43 unmodified lines
4444 EXPORT_SYMBOL_GPL(prof_on);
4545
4646 static cpumask_var_t prof_cpu_mask;
47−#ifdef CONFIG_SMP
47+#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
4848 static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits);
4949 static DEFINE_PER_CPU(int, cpu_profile_flip);
5050 static DEFINE_MUTEX(profile_flip_mutex);
@@ -202,7 +202,7 @@ int profile_event_unregister(enum profile_type type, struct notifier_block *n) · 151 unmodified lines
202202 }
203203 EXPORT_SYMBOL_GPL(profile_event_unregister);
204204
205−#ifdef CONFIG_SMP
205+#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
206206 /*
207207 * Each cpu has a pair of open-addressed hashtables for pending
208208 * profile hits. read_profile() IPI's all cpus to request them