clk: basic: improve parent_names & return errors

This patch is the basic clk version of 'clk: core: copy parent_names &
return error codes'.

The registration functions are changed to allow the core code to copy
the array of strings and allow platforms to declare those arrays as
__initdata.

This patch also converts all of the basic clk registration functions to
return error codes which better aligns them with the existing clk.h api.

Signed-off-by: Mike Turquette <mturquette@linaro.org>
This commit is contained in:
Mike Turquette
2012-03-26 17:51:03 -07:00
parent d1302a36a7
commit 27d545915f
5 changed files with 64 additions and 56 deletions

View File

@@ -94,9 +94,10 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
u8 clk_mux_flags, spinlock_t *lock)
{
struct clk_mux *mux;
struct clk *clk;
/* allocate the mux */
mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL);
if (!mux) {
pr_err("%s: could not allocate mux clk\n", __func__);
return ERR_PTR(-ENOMEM);
@@ -109,6 +110,11 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
mux->flags = clk_mux_flags;
mux->lock = lock;
return clk_register(dev, name, &clk_mux_ops, &mux->hw,
clk = clk_register(dev, name, &clk_mux_ops, &mux->hw,
parent_names, num_parents, flags);
if (IS_ERR(clk))
kfree(mux);
return clk;
}