diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2008-12-17 05:40:33 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-18 08:35:53 -0500 |
commit | 74c8a6130486bed224e960790f4aa72dd09c061e (patch) | |
tree | 0d6da9737c66ca2f4b2a20b7eb34e6c2d04ba4cc | |
parent | 6f8a0ed4e5d86c01db5e7e3f95d9003b7cf9cb87 (diff) |
locking, irq: enclose irq_desc_lock_class in CONFIG_LOCKDEP
Impact: simplify code
commit "08678b0: generic: sparse irqs: use irq_desc() [...]" introduced
the irq_desc_lock_class variable.
But it is used only if CONFIG_SPARSE_IRQ=Y or CONFIG_TRACE_IRQFLAGS=Y.
Otherwise, following warnings happen:
CC kernel/irq/handle.o
kernel/irq/handle.c:26: warning: 'irq_desc_lock_class' defined but not used
Actually, current early_init_irq_lock_class has a bit strange and messy ifdef.
In addition, it is not valueable.
1. this function is protected by !CONFIG_SPARSE_IRQ, but that is not necessary.
if CONFIG_SPARSE_IRQ=Y, desc of all irq number are initialized by NULL
at first - then this function calling is safe.
2. this function protected by CONFIG_TRACE_IRQFLAGS too. but it is not
necessary either, because lockdep_set_class() doesn't have bad side
effect even if CONFIG_TRACE_IRQFLAGS=n.
This patch bloat kernel size a bit on CONFIG_TRACE_IRQFLAGS=n and
CONFIG_SPARSE_IRQ=Y - but that's ok. early_init_irq_lock_class() is not
a fastpatch at all.
To avoid messy ifdefs is more important than a few bytes diet.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/lockdep.h | 2 | ||||
-rw-r--r-- | kernel/irq/handle.c | 5 |
2 files changed, 1 insertions, 6 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 29aec6e10020..9dba554c802c 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -377,7 +377,7 @@ do { \ | |||
377 | 377 | ||
378 | #endif /* CONFIG_LOCK_STAT */ | 378 | #endif /* CONFIG_LOCK_STAT */ |
379 | 379 | ||
380 | #if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) | 380 | #ifdef CONFIG_GENERIC_HARDIRQS |
381 | extern void early_init_irq_lock_class(void); | 381 | extern void early_init_irq_lock_class(void); |
382 | #else | 382 | #else |
383 | static inline void early_init_irq_lock_class(void) | 383 | static inline void early_init_irq_lock_class(void) |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index f1a23069c20a..6492400cb50d 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -422,11 +422,8 @@ out: | |||
422 | } | 422 | } |
423 | #endif | 423 | #endif |
424 | 424 | ||
425 | |||
426 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
427 | void early_init_irq_lock_class(void) | 425 | void early_init_irq_lock_class(void) |
428 | { | 426 | { |
429 | #ifndef CONFIG_SPARSE_IRQ | ||
430 | struct irq_desc *desc; | 427 | struct irq_desc *desc; |
431 | int i; | 428 | int i; |
432 | 429 | ||
@@ -436,9 +433,7 @@ void early_init_irq_lock_class(void) | |||
436 | 433 | ||
437 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); | 434 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); |
438 | } | 435 | } |
439 | #endif | ||
440 | } | 436 | } |
441 | #endif | ||
442 | 437 | ||
443 | #ifdef CONFIG_SPARSE_IRQ | 438 | #ifdef CONFIG_SPARSE_IRQ |
444 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 439 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |