From: Thierry Reding <[email protected]> Pass the driver-specific data via the syscore struct and use it in the syscore ops.
Signed-off-by: Thierry Reding <[email protected]> --- Changes in v3: - adjust for API changes and update commit message drivers/clk/mvebu/common.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c index 5adbbd91a6db..8797de93472c 100644 --- a/drivers/clk/mvebu/common.c +++ b/drivers/clk/mvebu/common.c @@ -189,6 +189,7 @@ void __init mvebu_coreclk_setup(struct device_node *np, DEFINE_SPINLOCK(ctrl_gating_lock); struct clk_gating_ctrl { + struct syscore syscore; spinlock_t *lock; struct clk **gates; int num_gates; @@ -196,11 +197,10 @@ struct clk_gating_ctrl { u32 saved_reg; }; -static struct clk_gating_ctrl *ctrl; - static struct clk *clk_gating_get_src( struct of_phandle_args *clkspec, void *data) { + struct clk_gating_ctrl *ctrl = data; int n; if (clkspec->args_count < 1) @@ -217,12 +217,16 @@ static struct clk *clk_gating_get_src( static int mvebu_clk_gating_suspend(void *data) { + struct clk_gating_ctrl *ctrl = data; + ctrl->saved_reg = readl(ctrl->base); return 0; } static void mvebu_clk_gating_resume(void *data) { + struct clk_gating_ctrl *ctrl = data; + writel(ctrl->saved_reg, ctrl->base); } @@ -231,13 +235,10 @@ static const struct syscore_ops clk_gate_syscore_ops = { .resume = mvebu_clk_gating_resume, }; -static struct syscore clk_gate_syscore = { - .ops = &clk_gate_syscore_ops, -}; - void __init mvebu_clk_gating_setup(struct device_node *np, const struct clk_gating_soc_desc *desc) { + static struct clk_gating_ctrl *ctrl; struct clk *clk; void __iomem *base; const char *default_parent = NULL; @@ -288,7 +289,9 @@ void __init mvebu_clk_gating_setup(struct device_node *np, of_clk_add_provider(np, clk_gating_get_src, ctrl); - register_syscore(&clk_gate_syscore); + ctrl->syscore.ops = &clk_gate_syscore_ops; + ctrl->syscore.data = ctrl; + register_syscore(&ctrl->syscore); return; gates_out: -- 2.51.0
