[PATCH 09/12] clocksource: initialize list value

From: Daniel Walker
Date: Tue Jan 23 2007 - 00:55:06 EST


A change to clocksource initialization. If the list field is initialized
it allows clocksource_register to complete faster since it doesn't have
to scan the list of clocks doing strcmp on each looking for duplicates.

Signed-Off-By: Daniel Walker <dwalker@xxxxxxxxxx>

---
kernel/time/clocksource.c | 3 +--
kernel/time/jiffies.c | 1 +
2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.19/kernel/time/clocksource.c
===================================================================
--- linux-2.6.19.orig/kernel/time/clocksource.c
+++ linux-2.6.19/kernel/time/clocksource.c
@@ -186,12 +186,11 @@ int clocksource_register(struct clocksou
unsigned long flags;

spin_lock_irqsave(&clocksource_lock, flags);
- if (unlikely(!list_empty(&c->list) && __is_registered(c->name))) {
+ if (unlikely(!list_empty(&c->list))) {
printk("register_clocksource: Cannot register %s clocksource. "
"Already registered!", c->name);
ret = -EBUSY;
} else {
- INIT_LIST_HEAD(&c->list);
__sorted_list_add(c);
/* scan the registered clocksources, and pick the best one */
next_clocksource = select_clocksource();
Index: linux-2.6.19/kernel/time/jiffies.c
===================================================================
--- linux-2.6.19.orig/kernel/time/jiffies.c
+++ linux-2.6.19/kernel/time/jiffies.c
@@ -63,6 +63,7 @@ struct clocksource clocksource_jiffies =
.mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
.shift = JIFFIES_SHIFT,
.is_continuous = 0, /* tick based, not free running */
+ .list = LIST_HEAD_INIT(clocksource_jiffies.list),
};

static int __init init_jiffies_clocksource(void)

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/