aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/tegra/cvb.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2016-04-08 15:16:28 +0200
committerThierry Reding <treding@nvidia.com>2016-04-28 12:41:54 +0200
commitf7c42d98621739d416cc4a739b721574fcbe910c (patch)
treecbd6f61c1a1b90780e63e7be5c3c4d3bd0988b5e /drivers/clk/tegra/cvb.c
parentclk: tegra: dfll: Make code more comprehensible (diff)
downloadlinux-dev-f7c42d98621739d416cc4a739b721574fcbe910c.tar.xz
linux-dev-f7c42d98621739d416cc4a739b721574fcbe910c.zip
clk: tegra: dfll: Properly clean up on failure and removal
Upon failure to probe the DFLL, the OPP table will not be cleaned up properly. Fix this and while at it make sure the OPP table will also be cleared upon driver removal. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/clk/tegra/cvb.c')
-rw-r--r--drivers/clk/tegra/cvb.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/clk/tegra/cvb.c b/drivers/clk/tegra/cvb.c
index 7a099b18c368..624115e82ff9 100644
--- a/drivers/clk/tegra/cvb.c
+++ b/drivers/clk/tegra/cvb.c
@@ -130,3 +130,19 @@ tegra_cvb_add_opp_table(struct device *dev, const struct cvb_table *tables,
return ERR_PTR(-EINVAL);
}
+
+void tegra_cvb_remove_opp_table(struct device *dev,
+ const struct cvb_table *table,
+ unsigned long max_freq)
+{
+ unsigned int i;
+
+ for (i = 0; i < MAX_DVFS_FREQS; i++) {
+ const struct cvb_table_freq_entry *entry = &table->entries[i];
+
+ if (!entry->freq || (entry->freq > max_freq))
+ break;
+
+ dev_pm_opp_remove(dev, entry->freq);
+ }
+}