lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240815005520.1192374-4-sboyd@kernel.org>
Date: Wed, 14 Aug 2024 17:55:09 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Michael Turquette <mturquette@...libre.com>,
	Stephen Boyd <sboyd@...nel.org>
Cc: linux-kernel@...r.kernel.org,
	linux-clk@...r.kernel.org,
	patches@...ts.linux.dev,
	Brendan Higgins <brendan.higgins@...ux.dev>,
	David Gow <davidgow@...gle.com>,
	Rae Moar <rmoar@...gle.com>,
	Nuno Sá <nuno.sa@...log.com>
Subject: [PATCH 03/12] clk: test: Introduce clk_put_kunit()

Tests will need to put a clk at a specific point during the test. Add a
clk_put_kunit() function that releases the kunit action created by a
function like clk_get_kunit() so that code is kept tidy.

Cc: Brendan Higgins <brendan.higgins@...ux.dev>
Cc: David Gow <davidgow@...gle.com>
Cc: Rae Moar <rmoar@...gle.com>
Cc: Nuno Sá <nuno.sa@...log.com>
Signed-off-by: Stephen Boyd <sboyd@...nel.org>
---
 drivers/clk/clk_kunit_helpers.c | 21 +++++++++++++++++++++
 include/kunit/clk.h             |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/clk/clk_kunit_helpers.c b/drivers/clk/clk_kunit_helpers.c
index 87f97329ae0c..ddb9f2de1083 100644
--- a/drivers/clk/clk_kunit_helpers.c
+++ b/drivers/clk/clk_kunit_helpers.c
@@ -153,6 +153,27 @@ clk_hw_get_clk_prepared_enabled_kunit(struct kunit *test, struct clk_hw *hw,
 }
 EXPORT_SYMBOL_GPL(clk_hw_get_clk_prepared_enabled_kunit);
 
+/**
+ * clk_put_kunit() - Force a clk_put() call on a clk managed by the @test
+ * @test: The test context
+ * @clk: Clk consumer to put with clk_put()
+ *
+ * Just like clk_put(), except the clk must be managed by the @test, i.e.
+ * returned from something like clk_get_kunit(). clk_put() will be called
+ * immediately and the deferred action will be removed.
+ *
+ * Return: 0 on success or a negative errno value on failure to find the
+ * deferred action.
+ */
+int clk_put_kunit(struct kunit *test, struct clk *clk)
+{
+	kunit_release_action(test, clk_put_wrapper, clk);
+	/* TODO: Find the action and fail */
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(clk_put_kunit);
+
 KUNIT_DEFINE_ACTION_WRAPPER(clk_hw_unregister_wrapper,
 			    clk_hw_unregister, struct clk_hw *);
 
diff --git a/include/kunit/clk.h b/include/kunit/clk.h
index c513fec8099b..d37fa6b87c2b 100644
--- a/include/kunit/clk.h
+++ b/include/kunit/clk.h
@@ -18,6 +18,7 @@ clk_hw_get_clk_kunit(struct kunit *test, struct clk_hw *hw, const char *con_id);
 struct clk *
 clk_hw_get_clk_prepared_enabled_kunit(struct kunit *test, struct clk_hw *hw,
 				      const char *con_id);
+int clk_put_kunit(struct kunit *test, struct clk *clk);
 
 int clk_prepare_enable_kunit(struct kunit *test, struct clk *clk);
 
-- 
https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/
https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ