Atsushi Nemoto wrote:
Well, it seems simpler, but I suppose clk_register() is very useful ;)
Thinking about it, it seems to me that a clock is very static. I can't think of a use case that would need to register a new clock after the kernel has booted. Do you have a use case in mind ? cpu hotplug perhaps ? I'm a bit worry because if we go that way, we must be sure that clk_register() can be called very early in the boot process. For example, when using early printk thing...
+static void clk_kref_release(struct kref *kref) +{ + /* Nothing to do */ +} + +static void __clk_disable(struct clk *clk) +{ + if (clk->flags & CLK_ALWAYS_ENABLED) + return; + + kref_put(&clk->kref, clk_kref_release); +} + +void clk_disable(struct clk *clk) +{ + unsigned long flags; + + spin_lock_irqsave(&clock_lock, flags); + __clk_disable(clk); + spin_unlock_irqrestore(&clock_lock, flags); +} +EXPORT_SYMBOL_GPL(clk_disable);
It seems that you stripped too much here: where clk->disable() method is called ?
+struct clk; + +struct clk_ops { + void (*init)(struct clk *clk); + void (*enable)(struct clk *clk); + void (*disable)(struct clk *clk); + int (*set_rate)(struct clk *clk, unsigned long rate); +}; + +struct clk { + struct list_head node; + const char *name; + int id; + + struct clk *parent;
Is this field used by board code ? --- Franck