clk: renesas: r8a7779: Remove struct r8a7779_cpg

All but the data member of the r8a7779_cpg structure are unused, so the
whole structure can be replaced by the single member used.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/eb94c0f6c54a4f3a7e0e07f12781333a700c0a05.1654694831.git.geert+renesas@glider.be
This commit is contained in:
Geert Uytterhoeven 2022-06-08 15:41:14 +02:00
parent 1cfeec2427
commit 4448779839

View File

@ -21,12 +21,6 @@
#define CPG_NUM_CLOCKS (R8A7779_CLK_OUT + 1) #define CPG_NUM_CLOCKS (R8A7779_CLK_OUT + 1)
struct r8a7779_cpg {
struct clk_onecell_data data;
spinlock_t lock;
void __iomem *reg;
};
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* CPG Clock Data * CPG Clock Data
*/ */
@ -87,7 +81,7 @@ static const unsigned int cpg_plla_mult[4] __initconst = { 42, 48, 56, 64 };
*/ */
static struct clk * __init static struct clk * __init
r8a7779_cpg_register_clock(struct device_node *np, struct r8a7779_cpg *cpg, r8a7779_cpg_register_clock(struct device_node *np,
const struct cpg_clk_config *config, const struct cpg_clk_config *config,
unsigned int plla_mult, const char *name) unsigned int plla_mult, const char *name)
{ {
@ -119,7 +113,7 @@ r8a7779_cpg_register_clock(struct device_node *np, struct r8a7779_cpg *cpg,
static void __init r8a7779_cpg_clocks_init(struct device_node *np) static void __init r8a7779_cpg_clocks_init(struct device_node *np)
{ {
const struct cpg_clk_config *config; const struct cpg_clk_config *config;
struct r8a7779_cpg *cpg; struct clk_onecell_data *data;
struct clk **clks; struct clk **clks;
unsigned int i, plla_mult; unsigned int i, plla_mult;
int num_clks; int num_clks;
@ -134,19 +128,17 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
return; return;
} }
cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
clks = kcalloc(CPG_NUM_CLOCKS, sizeof(*clks), GFP_KERNEL); clks = kcalloc(CPG_NUM_CLOCKS, sizeof(*clks), GFP_KERNEL);
if (cpg == NULL || clks == NULL) { if (data == NULL || clks == NULL) {
/* We're leaking memory on purpose, there's no point in cleaning /* We're leaking memory on purpose, there's no point in cleaning
* up as the system won't boot anyway. * up as the system won't boot anyway.
*/ */
return; return;
} }
spin_lock_init(&cpg->lock); data->clks = clks;
data->clk_num = num_clks;
cpg->data.clks = clks;
cpg->data.clk_num = num_clks;
config = &cpg_clk_configs[CPG_CLK_CONFIG_INDEX(mode)]; config = &cpg_clk_configs[CPG_CLK_CONFIG_INDEX(mode)];
plla_mult = cpg_plla_mult[CPG_PLLA_MULT_INDEX(mode)]; plla_mult = cpg_plla_mult[CPG_PLLA_MULT_INDEX(mode)];
@ -158,16 +150,15 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
of_property_read_string_index(np, "clock-output-names", i, of_property_read_string_index(np, "clock-output-names", i,
&name); &name);
clk = r8a7779_cpg_register_clock(np, cpg, config, clk = r8a7779_cpg_register_clock(np, config, plla_mult, name);
plla_mult, name);
if (IS_ERR(clk)) if (IS_ERR(clk))
pr_err("%s: failed to register %pOFn %s clock (%ld)\n", pr_err("%s: failed to register %pOFn %s clock (%ld)\n",
__func__, np, name, PTR_ERR(clk)); __func__, np, name, PTR_ERR(clk));
else else
cpg->data.clks[i] = clk; data->clks[i] = clk;
} }
of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); of_clk_add_provider(np, of_clk_src_onecell_get, data);
cpg_mstp_add_clk_domain(np); cpg_mstp_add_clk_domain(np);
} }