Hi Yong,
We're getting pretty close - just a couple of changes:
} else {
struct preinit_clk *p;
mutex_lock(&preinit_lock);
p = kmalloc(sizeof(*p), GFP_KERNEL);
if (!p)
goto unlock;
p->clk = clk;
list_add(&p->list, &preinit_clks);
+unlock:
mutex_unlock(&preinit_lock);
}
Might be best to avoid the goto:
} else { struct preinit_clk *p; mutex_lock(&preinit_lock); p = kmalloc(sizeof(*p), GFP_KERNEL); if (p) { p->clk = clk; list_add(&p->list, &preinit_clks); } mutex_unlock(&preinit_lock); }
+static int __init clk_debugfs_init(void) +{
- struct preinit_clk *pclk, *tmp;
- if (debugfs_initialized())
init_done = 1;
No need to check debugfs_initialised() here; if it's not initialised we're in trouble anyway.
- list_for_each_entry(pclk, &preinit_clks, list) {
clk_debug_register(pclk->clk);
- }
You should hold preinit_lock while traversing the list here.
Cheers,
Jeremy