summaryrefslogtreecommitdiff
path: root/rust/helpers/clk.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-11-21 17:22:21 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-11-21 17:22:21 -0800
commit4843f6873f7c4835e62f2c73ba0fd538e57a2f22 (patch)
treeee620501a1ffbad9a83141e3a70154e1fe641040 /rust/helpers/clk.c
downloadlinux-master.tar.gz
linux-master.zip
Merge tag 'sysctl-7.04-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctlgraftedHEADmaster
Pull sysctl fix from Joel Granados: "Fix sysctl jiffy / milliseconds conversion: - Writing a previously read value "X" shall keep the same "X" value - Remove truncation that was causing incorrect saturation of valid timeouts" * tag 'sysctl-7.04-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl: sysctl: Do jiffy / ms conversion in ulong space
Diffstat (limited to 'rust/helpers/clk.c')
-rw-r--r--rust/helpers/clk.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/rust/helpers/clk.c b/rust/helpers/clk.c
new file mode 100644
index 000000000..15fd7e469
--- /dev/null
+++ b/rust/helpers/clk.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/clk.h>
+
+/*
+ * The "inline" implementation of below helpers are only available when
+ * CONFIG_HAVE_CLK or CONFIG_HAVE_CLK_PREPARE aren't set.
+ */
+#ifndef CONFIG_HAVE_CLK
+__rust_helper struct clk *rust_helper_clk_get(struct device *dev,
+ const char *id)
+{
+ return clk_get(dev, id);
+}
+
+__rust_helper void rust_helper_clk_put(struct clk *clk)
+{
+ clk_put(clk);
+}
+
+__rust_helper int rust_helper_clk_enable(struct clk *clk)
+{
+ return clk_enable(clk);
+}
+
+__rust_helper void rust_helper_clk_disable(struct clk *clk)
+{
+ clk_disable(clk);
+}
+
+__rust_helper unsigned long rust_helper_clk_get_rate(struct clk *clk)
+{
+ return clk_get_rate(clk);
+}
+
+__rust_helper int rust_helper_clk_set_rate(struct clk *clk, unsigned long rate)
+{
+ return clk_set_rate(clk, rate);
+}
+#endif
+
+#ifndef CONFIG_HAVE_CLK_PREPARE
+__rust_helper int rust_helper_clk_prepare(struct clk *clk)
+{
+ return clk_prepare(clk);
+}
+
+__rust_helper void rust_helper_clk_unprepare(struct clk *clk)
+{
+ clk_unprepare(clk);
+}
+#endif
+
+__rust_helper struct clk *rust_helper_clk_get_optional(struct device *dev,
+ const char *id)
+{
+ return clk_get_optional(dev, id);
+}
+
+__rust_helper int rust_helper_clk_prepare_enable(struct clk *clk)
+{
+ return clk_prepare_enable(clk);
+}
+
+__rust_helper void rust_helper_clk_disable_unprepare(struct clk *clk)
+{
+ clk_disable_unprepare(clk);
+}