clk: at91: Migrate to clk_hw based registration and OF APIs
Now that we have clk_hw based provider APIs to register clks, we can get rid of struct clk pointers in this driver, allowing us to move closer to a clear split of consumer and provider clk APIs. Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:

کامیت شده توسط
Stephen Boyd

والد
b19f009d45
کامیت
f5644f10dc
@@ -75,13 +75,14 @@ static const struct clk_ops plldiv_ops = {
|
||||
.set_rate = clk_plldiv_set_rate,
|
||||
};
|
||||
|
||||
static struct clk * __init
|
||||
static struct clk_hw * __init
|
||||
at91_clk_register_plldiv(struct regmap *regmap, const char *name,
|
||||
const char *parent_name)
|
||||
{
|
||||
struct clk_plldiv *plldiv;
|
||||
struct clk *clk = NULL;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data init;
|
||||
int ret;
|
||||
|
||||
plldiv = kzalloc(sizeof(*plldiv), GFP_KERNEL);
|
||||
if (!plldiv)
|
||||
@@ -96,18 +97,20 @@ at91_clk_register_plldiv(struct regmap *regmap, const char *name,
|
||||
plldiv->hw.init = &init;
|
||||
plldiv->regmap = regmap;
|
||||
|
||||
clk = clk_register(NULL, &plldiv->hw);
|
||||
|
||||
if (IS_ERR(clk))
|
||||
hw = &plldiv->hw;
|
||||
ret = clk_hw_register(NULL, &plldiv->hw);
|
||||
if (ret) {
|
||||
kfree(plldiv);
|
||||
hw = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return clk;
|
||||
return hw;
|
||||
}
|
||||
|
||||
static void __init
|
||||
of_at91sam9x5_clk_plldiv_setup(struct device_node *np)
|
||||
{
|
||||
struct clk *clk;
|
||||
struct clk_hw *hw;
|
||||
const char *parent_name;
|
||||
const char *name = np->name;
|
||||
struct regmap *regmap;
|
||||
@@ -120,12 +123,11 @@ of_at91sam9x5_clk_plldiv_setup(struct device_node *np)
|
||||
if (IS_ERR(regmap))
|
||||
return;
|
||||
|
||||
clk = at91_clk_register_plldiv(regmap, name, parent_name);
|
||||
if (IS_ERR(clk))
|
||||
hw = at91_clk_register_plldiv(regmap, name, parent_name);
|
||||
if (IS_ERR(hw))
|
||||
return;
|
||||
|
||||
of_clk_add_provider(np, of_clk_src_simple_get, clk);
|
||||
return;
|
||||
of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw);
|
||||
}
|
||||
CLK_OF_DECLARE(at91sam9x5_clk_plldiv, "atmel,at91sam9x5-clk-plldiv",
|
||||
of_at91sam9x5_clk_plldiv_setup);
|
||||
|
مرجع در شماره جدید
Block a user