aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-14 12:37:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-14 12:37:41 -0700
commit1430858fa827e0c11921f26f429ccf22188d4a56 (patch)
tree78316691167fee8d794d7977d97338d512872387 /include
parentMerge tag 'pci-v4.13-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci (diff)
parentclk: Provide bulk prepare_enable disable_unprepare variants (diff)
downloadwireguard-linux-1430858fa827e0c11921f26f429ccf22188d4a56.tar.xz
wireguard-linux-1430858fa827e0c11921f26f429ccf22188d4a56.zip
Merge tag 'clk-bulk-get-prep-enable' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk api update from Stephen Boyd: "Small patch to add the clk_bulk_prepare_enable() and clk_bulk_disable_unprepare() API to the newly introduced clk bulk APIs. It would be good to get this into the -rc1 so that other driver trees can use it for code targeted for the next merge window" * tag 'clk-bulk-get-prep-enable' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: Provide bulk prepare_enable disable_unprepare variants
Diffstat (limited to 'include')
-rw-r--r--include/linux/clk.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 91bd464f4c9b..12c96d94d1fa 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -657,6 +657,28 @@ static inline void clk_disable_unprepare(struct clk *clk)
clk_unprepare(clk);
}
+static inline int clk_bulk_prepare_enable(int num_clks,
+ struct clk_bulk_data *clks)
+{
+ int ret;
+
+ ret = clk_bulk_prepare(num_clks, clks);
+ if (ret)
+ return ret;
+ ret = clk_bulk_enable(num_clks, clks);
+ if (ret)
+ clk_bulk_unprepare(num_clks, clks);
+
+ return ret;
+}
+
+static inline void clk_bulk_disable_unprepare(int num_clks,
+ struct clk_bulk_data *clks)
+{
+ clk_bulk_disable(num_clks, clks);
+ clk_bulk_unprepare(num_clks, clks);
+}
+
#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
struct clk *of_clk_get(struct device_node *np, int index);
struct clk *of_clk_get_by_name(struct device_node *np, const char *name);