Commit 6b212f5a authored by Stephen Boyd's avatar Stephen Boyd Committed by Stephen Boyd

clk: mb86s7x: Migrate to clk_hw based OF and registration APIs

Now that we have clk_hw based provider APIs to register clks, we
can get rid of struct clk pointers while registering clks in
these drivers, allowing us to move closer to a clear split of
consumer and provider clk APIs.

Cc: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: default avatarStephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 9337631f
...@@ -327,10 +327,11 @@ static struct clk_ops clk_clc_ops = { ...@@ -327,10 +327,11 @@ static struct clk_ops clk_clc_ops = {
.set_rate = clc_set_rate, .set_rate = clc_set_rate,
}; };
struct clk *mb86s7x_clclk_register(struct device *cpu_dev) static struct clk_hw *mb86s7x_clclk_register(struct device *cpu_dev)
{ {
struct clk_init_data init; struct clk_init_data init;
struct cl_clk *clc; struct cl_clk *clc;
int ret;
clc = kzalloc(sizeof(*clc), GFP_KERNEL); clc = kzalloc(sizeof(*clc), GFP_KERNEL);
if (!clc) if (!clc)
...@@ -344,14 +345,17 @@ struct clk *mb86s7x_clclk_register(struct device *cpu_dev) ...@@ -344,14 +345,17 @@ struct clk *mb86s7x_clclk_register(struct device *cpu_dev)
init.flags = CLK_GET_RATE_NOCACHE; init.flags = CLK_GET_RATE_NOCACHE;
init.num_parents = 0; init.num_parents = 0;
return devm_clk_register(cpu_dev, &clc->hw); ret = devm_clk_hw_register(cpu_dev, &clc->hw);
if (ret)
return ERR_PTR(ret);
return &clc->hw;
} }
static int mb86s7x_clclk_of_init(void) static int mb86s7x_clclk_of_init(void)
{ {
int cpu, ret = -ENODEV; int cpu, ret = -ENODEV;
struct device_node *np; struct device_node *np;
struct clk *clk; struct clk_hw *hw;
np = of_find_compatible_node(NULL, NULL, "fujitsu,mb86s70-scb-1.0"); np = of_find_compatible_node(NULL, NULL, "fujitsu,mb86s70-scb-1.0");
if (!np || !of_device_is_available(np)) if (!np || !of_device_is_available(np))
...@@ -365,12 +369,12 @@ static int mb86s7x_clclk_of_init(void) ...@@ -365,12 +369,12 @@ static int mb86s7x_clclk_of_init(void)
continue; continue;
} }
clk = mb86s7x_clclk_register(cpu_dev); hw = mb86s7x_clclk_register(cpu_dev);
if (IS_ERR(clk)) { if (IS_ERR(hw)) {
pr_err("failed to register cpu%d clock\n", cpu); pr_err("failed to register cpu%d clock\n", cpu);
continue; continue;
} }
if (clk_register_clkdev(clk, NULL, dev_name(cpu_dev))) { if (clk_hw_register_clkdev(hw, NULL, dev_name(cpu_dev))) {
pr_err("failed to register cpu%d clock lookup\n", cpu); pr_err("failed to register cpu%d clock lookup\n", cpu);
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment