History

clk: add terminate callback to clk_ops

Add a terminate callback to the clk_ops to release the resources claimed in .init()

Jerome Brunet committed 7 years ago

Commit f8737441 parent 89d079d2 files · +9 −1Browse files

Unified · Split

2 files
  1. drivers/clk/clk.c +6 −1
  2. include/linux/clk-provider.h +3 −0
drivers/clk/clk.c+6−1
@@ -3862,6 +3862,7 @@ static void clk_core_evict_parent_cache(struct clk_core *core) · 3861 unmodified lines
38623862 void clk_unregister(struct clk *clk)
38633863 {
38643864 unsigned long flags;
3865+ const struct clk_ops *ops;
38653866
38663867 if (!clk || WARN_ON_ONCE(IS_ERR(clk)))
38673868 return;
@@ -3870,7 +3871,8 @@ void clk_unregister(struct clk *clk) · 2 unmodified lines
38703871
38713872 clk_prepare_lock();
38723873
3873− if (clk->core->ops == &clk_nodrv_ops) {
3874+ ops = clk->core->ops;
3875+ if (ops == &clk_nodrv_ops) {
38743876 pr_err("%s: unregistered clock: %s\n", __func__,
38753877 clk->core->name);
38763878 goto unlock;
@@ -3883,6 +3885,9 @@ void clk_unregister(struct clk *clk) · 6 unmodified lines
38833885 clk->core->ops = &clk_nodrv_ops;
38843886 clk_enable_unlock(flags);
38853887
3888+ if (ops->terminate)
3889+ ops->terminate(clk->core->hw);
3890+
38863891 if (!hlist_empty(&clk->core->children)) {
38873892 struct clk_core *child;
38883893 struct hlist_node *t;
include/linux/clk-provider.h+3−0
@@ -197,6 +197,8 @@ struct clk_duty { · 196 unmodified lines
197197 * such as rate or parents.
198198 * Returns 0 on success, -EERROR otherwise.
199199 *
200+ * @terminate: Free any resource allocated by init.
201+ *
200202 * @debug_init: Set up type-specific debugfs entries for this clock. This
201203 * is called once, after the debugfs directory entry for this
202204 * clock has been created. The dentry pointer representing that
@@ -248,6 +250,7 @@ struct clk_ops { · 45 unmodified lines
248250 int (*set_duty_cycle)(struct clk_hw *hw,
249251 struct clk_duty *duty);
250252 int (*init)(struct clk_hw *hw);
253+ void (*terminate)(struct clk_hw *hw);
251254 void (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
252255 };
253256

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t