Skip to content

Commit 1cfeec2

Browse files
committed
clk: renesas: r8a7778: Remove struct r8a7778_cpg
All but the data member of the r8a7778_cpg structure are unused, so the whole structure can be replaced by the single member used. Remove the mapping of the CPG registers, as no code uses the mapped registers. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/4123c1c40a901195f00a825d434553d2052829aa.1654694831.git.geert+renesas@glider.be
1 parent 3849716 commit 1cfeec2

1 file changed

Lines changed: 9 additions & 22 deletions

File tree

drivers/clk/renesas/clk-r8a7778.c

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
#include <linux/slab.h>
1212
#include <linux/soc/renesas/rcar-rst.h>
1313

14-
struct r8a7778_cpg {
15-
struct clk_onecell_data data;
16-
spinlock_t lock;
17-
void __iomem *reg;
18-
};
19-
2014
/* PLL multipliers per bits 11, 12, and 18 of MODEMR */
2115
static const struct {
2216
unsigned long plla_mult;
@@ -47,8 +41,7 @@ static u32 cpg_mode_rates __initdata;
4741
static u32 cpg_mode_divs __initdata;
4842

4943
static struct clk * __init
50-
r8a7778_cpg_register_clock(struct device_node *np, struct r8a7778_cpg *cpg,
51-
const char *name)
44+
r8a7778_cpg_register_clock(struct device_node *np, const char *name)
5245
{
5346
if (!strcmp(name, "plla")) {
5447
return clk_register_fixed_factor(NULL, "plla",
@@ -77,7 +70,7 @@ r8a7778_cpg_register_clock(struct device_node *np, struct r8a7778_cpg *cpg,
7770

7871
static void __init r8a7778_cpg_clocks_init(struct device_node *np)
7972
{
80-
struct r8a7778_cpg *cpg;
73+
struct clk_onecell_data *data;
8174
struct clk **clks;
8275
unsigned int i;
8376
int num_clks;
@@ -100,23 +93,17 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np)
10093
return;
10194
}
10295

103-
cpg = kzalloc(sizeof(*cpg), GFP_KERNEL);
96+
data = kzalloc(sizeof(*data), GFP_KERNEL);
10497
clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL);
105-
if (cpg == NULL || clks == NULL) {
98+
if (data == NULL || clks == NULL) {
10699
/* We're leaking memory on purpose, there's no point in cleaning
107100
* up as the system won't boot anyway.
108101
*/
109102
return;
110103
}
111104

112-
spin_lock_init(&cpg->lock);
113-
114-
cpg->data.clks = clks;
115-
cpg->data.clk_num = num_clks;
116-
117-
cpg->reg = of_iomap(np, 0);
118-
if (WARN_ON(cpg->reg == NULL))
119-
return;
105+
data->clks = clks;
106+
data->clk_num = num_clks;
120107

121108
for (i = 0; i < num_clks; ++i) {
122109
const char *name;
@@ -125,15 +112,15 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np)
125112
of_property_read_string_index(np, "clock-output-names", i,
126113
&name);
127114

128-
clk = r8a7778_cpg_register_clock(np, cpg, name);
115+
clk = r8a7778_cpg_register_clock(np, name);
129116
if (IS_ERR(clk))
130117
pr_err("%s: failed to register %pOFn %s clock (%ld)\n",
131118
__func__, np, name, PTR_ERR(clk));
132119
else
133-
cpg->data.clks[i] = clk;
120+
data->clks[i] = clk;
134121
}
135122

136-
of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
123+
of_clk_add_provider(np, of_clk_src_onecell_get, data);
137124

138125
cpg_mstp_add_clk_domain(np);
139126
}

0 commit comments

Comments
 (0)