Skip to contentSkip to conversation

Conditional compilation updates in kernel/lockdep.c

PATCH In review Luis Henriques 2 participants 2 messages Dec 14, 2008 – Dec 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Conditional compilation updates in kernel/lockdep.c

This patch removes the following warning:

kernel/lockdep.c:580: warning: ‘print_lock_dependencies’ defined but not used

Now functions print_lock_dependencies and print_lock_class_header are now compiled only if both CONFIG_TRACE_IRQFLAGS and CONFIG_PROVE_LOCKING are defined; function lockdep_dependency_visit and variable lockdep_dependency_gen_id are compiled only if CONFIG_PROVE_LOCKING is defined

---
 kernel/lockdep.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
kernel/lockdep.c +5 -0
index 46a4041..f2eebc7 100644
@@ -381,6 +381,7 @@ unsigned int nr_process_chains;
 unsigned int max_lockdep_depth;
 unsigned int max_recursion_depth;
 
+#ifdef CONFIG_PROVE_LOCKING
 static unsigned int lockdep_dependency_gen_id;
 
 static bool lockdep_dependency_visit(struct lock_class *source,
@@ -393,6 +394,7 @@ static bool lockdep_dependency_visit(struct lock_class *source,
 	source->dep_gen_id = lockdep_dependency_gen_id;
 	return false;
 }
+#endif
 
 #ifdef CONFIG_DEBUG_LOCKDEP
 /*
@@ -549,6 +551,8 @@ static void lockdep_print_held_locks(struct task_struct *curr)
 	}
 }
 
+#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
+
 static void print_lock_class_header(struct lock_class *class, int depth)
 {
 	int bit;
@@ -599,6 +603,7 @@ static void print_lock_dependencies(struct lock_class *class, int depth)
 		printk("\n");
 	}
 }
+#endif
 
 static void print_kernel_version(void)
 {
Signature · 1 line
Luis Henriques
#1 lore raw
Quoted 45 lines · Luis Henriques

This patch removes the following warning:

kernel/lockdep.c:580: warning: ‘print_lock_dependencies’ defined but not used

Now functions print_lock_dependencies and print_lock_class_header are now compiled only if both CONFIG_TRACE_IRQFLAGS and CONFIG_PROVE_LOCKING are defined; function lockdep_dependency_visit and variable lockdep_dependency_gen_id are compiled only if CONFIG_PROVE_LOCKING is defined

---
 kernel/lockdep.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
kernel/lockdep.c +4 -0
index 46a4041..f2eebc7 100644
@@ -381,6 +381,7 @@ unsigned int nr_process_chains;
 unsigned int max_lockdep_depth;
 unsigned int max_recursion_depth;
 
+#ifdef CONFIG_PROVE_LOCKING
 static unsigned int lockdep_dependency_gen_id;
 
 static bool lockdep_dependency_visit(struct lock_class *source,
@@ -393,6 +394,7 @@ static bool lockdep_dependency_visit(struct lock_class *source,
 	source->dep_gen_id = lockdep_dependency_gen_id;
 	return false;
 }
+#endif
 
 #ifdef CONFIG_DEBUG_LOCKDEP
 /*
@@ -549,6 +551,8 @@ static void lockdep_print_held_locks(struct task_struct *curr)
 	}
 }
 
+#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
+
 static void print_lock_class_header(struct lock_class *class, int depth)
 {
 	int bit;

kernel/lockdep.c static void print_lock_dependencies(struct lock_class *class, int depth) · line 606

Quoted 4 lines
kernel/lockdep.c +1 -0
@@ -599,6 +603,7 @@ static void print_lock_dependencies(struct lock_class *class, int depth)
 		printk("\n");
 	}
 }
+#endif

hm, these many #ifdefs are ugly. Could we somehow improve the structure of this code by moving bits of it out into separate .c files, or by merging needless Kconfig options?

Ingo