clk: Add devm_clk_get()
Add a resource managed clk_get() to simplify clock usage in
drivers. This allows driver authors to "get and forget" about
their clocks by automatically calling clk_put() when the driver
is detached. This also encourages clock consumers to use the
clk_get() API correctly by passing in a struct device as an
argument.
Change-Id: I1ed53cd3c26c0390fa30cd3c3dca14bcdd59939f
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b9d46fa..ed3c8c8 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -43,6 +43,16 @@
struct clk *clk_get(struct device *dev, const char *id);
/**
+ * devm_clk_get - Resource managed clk_get()
+ * @dev: device for clk "consumer"
+ * @id: clk ID.
+ *
+ * Managed clk_get(). Clocks returned from this function are
+ * automatically clk_put() on driver detach.
+ */
+struct clk *devm_clk_get(struct device *dev, const char *id);
+
+/**
* clk_prepare - prepare a clock source
* @clk: clock source
*