summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-devres.c
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2018-08-31 12:45:55 +0800
committerStephen Boyd <sboyd@kernel.org>2018-10-16 15:42:49 -0700
commitf08c2e2865f6f9b172f37d7bbf24716f9ebad553 (patch)
treef4c5572f6bfe4f149c71a88a95896771337e8eab /drivers/clk/clk-devres.c
parent616e45df7c4aa71279c07cc803a1d51f43f89f37 (diff)
downloadlinux-f08c2e2865f6f9b172f37d7bbf24716f9ebad553.tar.bz2
clk: add managed version of clk_bulk_get_all
This patch introduces the managed version of clk_bulk_get_all. Cc: Michael Turquette <mturquette@baylibre.com> Cc: Stephen Boyd <sboyd@codeaurora.org> Tested-by: Thor Thayer <thor.thayer@linux.intel.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/clk-devres.c')
-rw-r--r--drivers/clk/clk-devres.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index d854e26a8ddb..12c87457eca1 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -70,6 +70,30 @@ int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
}
EXPORT_SYMBOL_GPL(devm_clk_bulk_get);
+int __must_check devm_clk_bulk_get_all(struct device *dev,
+ struct clk_bulk_data **clks)
+{
+ struct clk_bulk_devres *devres;
+ int ret;
+
+ devres = devres_alloc(devm_clk_bulk_release,
+ sizeof(*devres), GFP_KERNEL);
+ if (!devres)
+ return -ENOMEM;
+
+ ret = clk_bulk_get_all(dev, &devres->clks);
+ if (ret > 0) {
+ *clks = devres->clks;
+ devres->num_clks = ret;
+ devres_add(dev, devres);
+ } else {
+ devres_free(devres);
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all);
+
static int devm_clk_match(struct device *dev, void *res, void *data)
{
struct clk **c = res;