diff options
author | Mike Turquette <mturquette@linaro.org> | 2014-08-28 00:36:37 +0200 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-09-02 02:43:52 +0200 |
commit | 87e392164ab6c0f3f055f8483dc7dc3f1afa19ad (patch) | |
tree | cf29e87ab8c5243a4771e782106259ca4ab50ed2 /drivers/clk/mvebu/common.c | |
parent | Linux 3.17-rc3 (diff) | |
download | linux-87e392164ab6c0f3f055f8483dc7dc3f1afa19ad.tar.xz linux-87e392164ab6c0f3f055f8483dc7dc3f1afa19ad.zip |
clk: mvebu: share locks between gate clocks
Refactor mvebu_clk_gating_setup() to use a common spinlock instead of a
unique lock for every instance of a struct clk_gating_ctrl object. This
will be used later for a separate mux clock type that shares a register
with gate clock types and needs to use the same lock to protect access
to the register.
Cc: Andrew Lunn <andrew@lunn.ch>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/mvebu/common.c')
-rw-r--r-- | drivers/clk/mvebu/common.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c index 25ceccf939ad..8145c4efc381 100644 --- a/drivers/clk/mvebu/common.c +++ b/drivers/clk/mvebu/common.c @@ -89,8 +89,10 @@ void __init mvebu_coreclk_setup(struct device_node *np, * Clock Gating Control */ +DEFINE_SPINLOCK(ctrl_gating_lock); + struct clk_gating_ctrl { - spinlock_t lock; + spinlock_t *lock; struct clk **gates; int num_gates; }; @@ -138,7 +140,8 @@ void __init mvebu_clk_gating_setup(struct device_node *np, if (WARN_ON(!ctrl)) goto ctrl_out; - spin_lock_init(&ctrl->lock); + /* lock must already be initialized */ + ctrl->lock = &ctrl_gating_lock; /* Count, allocate, and register clock gates */ for (n = 0; desc[n].name;) @@ -155,7 +158,7 @@ void __init mvebu_clk_gating_setup(struct device_node *np, (desc[n].parent) ? desc[n].parent : default_parent; ctrl->gates[n] = clk_register_gate(NULL, desc[n].name, parent, desc[n].flags, base, desc[n].bit_idx, - 0, &ctrl->lock); + 0, ctrl->lock); WARN_ON(IS_ERR(ctrl->gates[n])); } |