[PATCH 09/12] clocksource: initialize list value

Daniel Walker
2007-01-23T05:54:11Z

[-- Attachment #1: clocksource_list_init.patch --]
[-- Type: text/plain, Size: 1666 bytes --]

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@mvista.com>

---
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)

--