mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Conditional compilation updates in kernel/lockdep.c
@ 2008-12-14 20:52 Luis Henriques
  2008-12-16 21:03 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Luis Henriques @ 2008-12-14 20:52 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, Linux Kernel List

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

Signed-off-by: Luis Henriques <henrix@sapo.pt>
---
 kernel/lockdep.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 46a4041..f2eebc7 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -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)
 {
-- 
Luis Henriques


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Conditional compilation updates in kernel/lockdep.c
  2008-12-14 20:52 [PATCH] Conditional compilation updates in kernel/lockdep.c Luis Henriques
@ 2008-12-16 21:03 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-12-16 21:03 UTC (permalink / raw)
  To: Luis Henriques; +Cc: Ingo Molnar, Peter Zijlstra, Linux Kernel List


* Luis Henriques <henrix@sapo.pt> wrote:

> 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
> 
> Signed-off-by: Luis Henriques <henrix@sapo.pt>
> ---
>  kernel/lockdep.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index 46a4041..f2eebc7 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-16 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-14 20:52 [PATCH] Conditional compilation updates in kernel/lockdep.c Luis Henriques
2008-12-16 21:03 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®