Skip to content

Commit 8c48921

Browse files
Dinh Nguyenbebarino
authored andcommitted
clk: socfpga: arria10: convert to use clk_hw
As recommended by Stephen Boyd, convert the Arria10 clock driver to use the clk_hw registration method. Suggested-by: Stephen Boyd <[email protected]> Signed-off-by: Dinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 2c2b9c6 commit 8c48921

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

drivers/clk/socfpga/clk-gate-a10.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void __init __socfpga_gate_init(struct device_node *node,
9898
u32 div_reg[3];
9999
u32 clk_phase[2];
100100
u32 fixed_div;
101-
struct clk *clk;
101+
struct clk_hw *hw_clk;
102102
struct socfpga_gate_clk *socfpga_clk;
103103
const char *clk_name = node->name;
104104
const char *parent_name[SOCFPGA_MAX_PARENTS];
@@ -159,13 +159,13 @@ static void __init __socfpga_gate_init(struct device_node *node,
159159
init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
160160
init.parent_names = parent_name;
161161
socfpga_clk->hw.hw.init = &init;
162+
hw_clk = &socfpga_clk->hw.hw;
162163

163-
clk = clk_register(NULL, &socfpga_clk->hw.hw);
164-
if (WARN_ON(IS_ERR(clk))) {
164+
if (clk_hw_register(NULL, hw_clk)) {
165165
kfree(socfpga_clk);
166166
return;
167167
}
168-
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
168+
rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
169169
if (WARN_ON(rc))
170170
return;
171171
}

drivers/clk/socfpga/clk-periph-a10.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static __init void __socfpga_periph_init(struct device_node *node,
6161
const struct clk_ops *ops)
6262
{
6363
u32 reg;
64-
struct clk *clk;
64+
struct clk_hw *hw_clk;
6565
struct socfpga_periph_clk *periph_clk;
6666
const char *clk_name = node->name;
6767
const char *parent_name[SOCFPGA_MAX_PARENTS];
@@ -104,12 +104,13 @@ static __init void __socfpga_periph_init(struct device_node *node,
104104

105105
periph_clk->hw.hw.init = &init;
106106

107-
clk = clk_register(NULL, &periph_clk->hw.hw);
108-
if (WARN_ON(IS_ERR(clk))) {
107+
hw_clk = &periph_clk->hw.hw;
108+
109+
if (clk_hw_register(NULL, hw_clk)) {
109110
kfree(periph_clk);
110111
return;
111112
}
112-
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
113+
rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
113114
if (rc < 0) {
114115
pr_err("Could not register clock provider for node:%s\n",
115116
clk_name);
@@ -119,7 +120,7 @@ static __init void __socfpga_periph_init(struct device_node *node,
119120
return;
120121

121122
err_clk:
122-
clk_unregister(clk);
123+
clk_hw_unregister(hw_clk);
123124
}
124125

125126
void __init socfpga_a10_periph_init(struct device_node *node)

drivers/clk/socfpga/clk-pll-a10.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ static const struct clk_ops clk_pll_ops = {
6363
.get_parent = clk_pll_get_parent,
6464
};
6565

66-
static struct clk * __init __socfpga_pll_init(struct device_node *node,
66+
static struct clk_hw * __init __socfpga_pll_init(struct device_node *node,
6767
const struct clk_ops *ops)
6868
{
6969
u32 reg;
70-
struct clk *clk;
70+
struct clk_hw *hw_clk;
7171
struct socfpga_pll *pll_clk;
7272
const char *clk_name = node->name;
7373
const char *parent_name[SOCFGPA_MAX_PARENTS];
@@ -101,14 +101,14 @@ static struct clk * __init __socfpga_pll_init(struct device_node *node,
101101
pll_clk->hw.hw.init = &init;
102102

103103
pll_clk->hw.bit_idx = SOCFPGA_PLL_EXT_ENA;
104+
hw_clk = &pll_clk->hw.hw;
104105

105-
clk = clk_register(NULL, &pll_clk->hw.hw);
106-
if (WARN_ON(IS_ERR(clk))) {
106+
if (clk_hw_register(NULL, hw_clk)) {
107107
kfree(pll_clk);
108108
return NULL;
109109
}
110-
of_clk_add_provider(node, of_clk_src_simple_get, clk);
111-
return clk;
110+
of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
111+
return hw_clk;
112112
}
113113

114114
void __init socfpga_a10_pll_init(struct device_node *node)

0 commit comments

Comments
 (0)