File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -939,6 +939,25 @@ int clk_rate_exclusive_get(struct clk *clk)
939
939
}
940
940
EXPORT_SYMBOL_GPL (clk_rate_exclusive_get );
941
941
942
+ static void devm_clk_rate_exclusive_put (void * data )
943
+ {
944
+ struct clk * clk = data ;
945
+
946
+ clk_rate_exclusive_put (clk );
947
+ }
948
+
949
+ int devm_clk_rate_exclusive_get (struct device * dev , struct clk * clk )
950
+ {
951
+ int ret ;
952
+
953
+ ret = clk_rate_exclusive_get (clk );
954
+ if (ret )
955
+ return ret ;
956
+
957
+ return devm_add_action_or_reset (dev , devm_clk_rate_exclusive_put , clk );
958
+ }
959
+ EXPORT_SYMBOL_GPL (devm_clk_rate_exclusive_get );
960
+
942
961
static void clk_core_unprepare (struct clk_core * core )
943
962
{
944
963
lockdep_assert_held (& prepare_lock );
Original file line number Diff line number Diff line change @@ -201,6 +201,18 @@ bool clk_is_match(const struct clk *p, const struct clk *q);
201
201
*/
202
202
int clk_rate_exclusive_get (struct clk * clk );
203
203
204
+ /**
205
+ * devm_clk_rate_exclusive_get - devm variant of clk_rate_exclusive_get
206
+ * @dev: device the exclusivity is bound to
207
+ * @clk: clock source
208
+ *
209
+ * Calls clk_rate_exclusive_get() on @clk and registers a devm cleanup handler
210
+ * on @dev to call clk_rate_exclusive_put().
211
+ *
212
+ * Must not be called from within atomic context.
213
+ */
214
+ int devm_clk_rate_exclusive_get (struct device * dev , struct clk * clk );
215
+
204
216
/**
205
217
* clk_rate_exclusive_put - release exclusivity over the rate control of a
206
218
* producer
You can’t perform that action at this time.
0 commit comments