Skip to content

Commit ade356b

Browse files
arndbtorvalds
authored andcommitted
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. Signed-off-by: Arnd Bergmann <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Robin Holt <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent abc514c commit ade356b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/profile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int prof_on __read_mostly;
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)
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

0 commit comments

Comments
 (0)