mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>,
	Maxime Ripard <mripard@kernel.org>,
	 Alberto Ruiz <aruiz@redhat.com>,
	 Brendan Higgins <brendan.higgins@linux.dev>,
	David Gow <david@davidgow.net>,  Rae Moar <raemoar63@gmail.com>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	 Brian Masney <bmasney@redhat.com>
Subject: [PATCH v8 1/8] clk: test: export clk_dummy_rate_ops and clk_dummy_context() for other tests
Date: Fri, 27 Mar 2026 15:31:56 -0400	[thread overview]
Message-ID: <20260327-clk-scaling-v8-1-86cd0aba3c5f@redhat.com> (raw)
In-Reply-To: <20260327-clk-scaling-v8-0-86cd0aba3c5f@redhat.com>

Expose clk_dummy_rate_ops and struct clk_dummy_context so that they can
be used for other clk kunit tests.

This export will be used by the upcoming clk-divider test suite. For
consistency with clk-fixed-rate_test.c and drivers/clk/clk-gate_test.c,
the divider tests will be setup as it's own separate kernel module.

The file kunit/clk.h now contains a struct clk_hw embedded by value. If
kunit/clk.h is included before linux/clk-provider.h, then this will
yield a compiler error since it won't know the size of struct clk_hw.
Let's also go ahead and include clk-provider.h since it's a dependency
here, and this lets us drop the 'struct clk' and 'struct clk_hw' at the
top that are no longer needed.

Link: https://lore.kernel.org/linux-clk/aUSWU7UymULCXOeF@redhat.com/
Link: https://lpc.events/event/19/contributions/2152/
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/clk/clk_test.c |  9 +++------
 include/kunit/clk.h    | 11 +++++++++--
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
index a268d7b5d4cb28ec1f029f828c31107f8e130556..b286297bb902a0c6c8a0469d0f785009416ba9a5 100644
--- a/drivers/clk/clk_test.c
+++ b/drivers/clk/clk_test.c
@@ -15,6 +15,7 @@
 #include <kunit/of.h>
 #include <kunit/platform_device.h>
 #include <kunit/test.h>
+#include <kunit/visibility.h>
 
 #include "kunit_clk_assigned_rates.h"
 #include "clk_parent_data_test.h"
@@ -25,11 +26,6 @@ static const struct clk_ops empty_clk_ops = { };
 #define DUMMY_CLOCK_RATE_1	(142 * 1000 * 1000)
 #define DUMMY_CLOCK_RATE_2	(242 * 1000 * 1000)
 
-struct clk_dummy_context {
-	struct clk_hw hw;
-	unsigned long rate;
-};
-
 static unsigned long clk_dummy_recalc_rate(struct clk_hw *hw,
 					   unsigned long parent_rate)
 {
@@ -96,11 +92,12 @@ static u8 clk_dummy_single_get_parent(struct clk_hw *hw)
 	return 0;
 }
 
-static const struct clk_ops clk_dummy_rate_ops = {
+const struct clk_ops clk_dummy_rate_ops = {
 	.recalc_rate = clk_dummy_recalc_rate,
 	.determine_rate = clk_dummy_determine_rate,
 	.set_rate = clk_dummy_set_rate,
 };
+EXPORT_SYMBOL_IF_KUNIT(clk_dummy_rate_ops);
 
 static const struct clk_ops clk_dummy_maximize_rate_ops = {
 	.recalc_rate = clk_dummy_recalc_rate,
diff --git a/include/kunit/clk.h b/include/kunit/clk.h
index f226044cc78d11564f7adb4cc2450934aab04ce6..02ba1f1d09c50b37ba1674017b145792acf589cd 100644
--- a/include/kunit/clk.h
+++ b/include/kunit/clk.h
@@ -2,13 +2,20 @@
 #ifndef _CLK_KUNIT_H
 #define _CLK_KUNIT_H
 
-struct clk;
-struct clk_hw;
+#include <linux/clk-provider.h>
+
 struct device;
 struct device_node;
 struct of_phandle_args;
 struct kunit;
 
+struct clk_dummy_context {
+	struct clk_hw hw;
+	unsigned long rate;
+};
+
+extern const struct clk_ops clk_dummy_rate_ops;
+
 struct clk *
 clk_get_kunit(struct kunit *test, struct device *dev, const char *con_id);
 struct clk *

-- 
2.53.0


  reply	other threads:[~2026-03-27 19:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 19:31 [PATCH v8 0/8] clk: add support for v1 / v2 clock rate negotiation and kunit tests Brian Masney
2026-03-27 19:31 ` Brian Masney [this message]
2026-03-27 19:31 ` [PATCH v8 2/8] clk: divider: introduce divider " Brian Masney
2026-03-27 19:31 ` [PATCH v8 3/8] clk: introduce new helper clk_hw_get_children_lcm() to calculate LCM of all child rates Brian Masney
2026-10-20  9:57   ` Miquel Raynal
2026-03-27 19:31 ` [PATCH v8 4/8] clk: divider: test: introduce additional test case for parent rate change Brian Masney
2026-03-27 19:32 ` [PATCH v8 5/8] clk: introduce new flag CLK_V2_RATE_NEGOTIATION for sensitive clocks Brian Masney
2026-03-27 19:32 ` [PATCH v8 6/8] clk: divider: enable optional support for v2 rate negotiation Brian Masney
2026-03-27 19:32 ` [PATCH v8 7/8] clk: divider: test: introduce additional test case showing v2 rate change + LCM parent Brian Masney
2026-03-27 19:32 ` [PATCH v8 8/8] clk: divider: test: mark some tests as supporting only v1 negotiation Brian Masney
2026-10-20 10:11 ` [PATCH v8 0/8] clk: add support for v1 / v2 clock rate negotiation and kunit tests Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260327-clk-scaling-v8-1-86cd0aba3c5f@redhat.com \
    --to=bmasney@redhat.com \
    --cc=aruiz@redhat.com \
    --cc=brendan.higgins@linux.dev \
    --cc=david@davidgow.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=raemoar63@gmail.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®