diff options
author | Alex Frid <afrid@nvidia.com> | 2011-10-01 16:00:51 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:49:09 -0800 |
commit | aa7c1a90e996fa6c9f0baa353b715cdacb6aeef9 (patch) | |
tree | 7b34faa9bd4409fcc4320c4b46bade72d053373a /arch | |
parent | 36dbc27d0dd8e6a44758ce1631a45fb0458421e8 (diff) |
ARM: tegra: clock: Re-factor shared bus locking
Current code:
- on tegra2 unnecessary covers with bus lock shared user state update
- on tegra3 does not cover shared bus rate update at all
Modified to cover with bus lock shared bus rate update only on both
tegra2 and tegra3.
Change-Id: Iaa2597136a521adf4285c61eb579c917c2c7965c
Reviewed-on: http://git-master/r/55640
Tested-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Tested-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Rebase-Id: R1b28f32ae37d47c56855023b18c943bf8fd93c74
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/clock.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra2_clocks.c | 12 |
2 files changed, 4 insertions, 12 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index 155d22f1a637..4b14cbc765d3 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -648,10 +648,14 @@ EXPORT_SYMBOL(tegra_is_clk_enabled); int tegra_clk_shared_bus_update(struct clk *c) { int ret = 0; + unsigned long flags; + + clk_lock_save(c, &flags); if (c->ops && c->ops->shared_bus_update) ret = c->ops->shared_bus_update(c); + clk_unlock_restore(c, &flags); return ret; } diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c index 918c4de6b46f..3ae10fcb7e5d 100644 --- a/arch/arm/mach-tegra/tegra2_clocks.c +++ b/arch/arm/mach-tegra/tegra2_clocks.c @@ -1511,13 +1511,9 @@ static int tegra_clk_shared_bus_set_rate(struct clk *c, unsigned long rate) if (new_rate < 0) return new_rate; - clk_lock_save(c->parent, &flags); - c->u.shared_bus_user.rate = new_rate; ret = tegra_clk_shared_bus_update(c->parent); - clk_unlock_restore(c->parent, &flags); - return ret; } @@ -1531,15 +1527,11 @@ static int tegra_clk_shared_bus_enable(struct clk *c) unsigned long flags; int ret; - clk_lock_save(c->parent, &flags); - c->u.shared_bus_user.enabled = true; ret = tegra_clk_shared_bus_update(c->parent); if (strcmp(c->name, "avp.sclk") == 0) tegra2_statmon_start(); - clk_unlock_restore(c->parent, &flags); - return ret; } @@ -1548,15 +1540,11 @@ static void tegra_clk_shared_bus_disable(struct clk *c) unsigned long flags; int ret; - clk_lock_save(c->parent, &flags); - if (strcmp(c->name, "avp.sclk") == 0) tegra2_statmon_stop(); c->u.shared_bus_user.enabled = false; ret = tegra_clk_shared_bus_update(c->parent); WARN_ON_ONCE(ret); - - clk_unlock_restore(c->parent, &flags); } static struct clk_ops tegra_clk_shared_bus_ops = { |