From: Brian Masney <bmasney@redhat.com>
To: Chen-Yu Tsai <wenst@chromium.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: tests: Add tests for clk lookup by name
Date: Wed, 8 Oct 2025 19:58:00 -0400 [thread overview]
Message-ID: <aOb6iNR9T4R9Hp3R@redhat.com> (raw)
In-Reply-To: <20251002092036.2504858-1-wenst@chromium.org>
On Thu, Oct 02, 2025 at 05:20:35PM +0800, Chen-Yu Tsai wrote:
> Clk lookup (by name) recently gained some performance improvements at
> the expense of more complexity within the lookup code.
>
> To make sure that this works as intended and doesn't break, add some
> basic tests for this part of the CCF.
>
> A new "clk_hw_lookup()" function is added purely for running kunit
> tests.
>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> drivers/clk/clk.c | 11 +++++++
> drivers/clk/clk.h | 4 +++
> drivers/clk/clk_test.c | 66 +++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 80 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 85d2f2481acf..a17d0070d11f 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -778,6 +778,17 @@ struct clk *__clk_lookup(const char *name)
> return !core ? NULL : core->hw->clk;
> }
>
> +#if IS_ENABLED(CONFIG_CLK_KUNIT_TEST)
> +/* This is only provided for kunit tests to test the core lookup functions. */
> +struct clk_hw *clk_hw_lookup(const char *name)
> +{
> + struct clk_core *core = clk_core_lookup(name);
> +
> + return !core ? NULL : core->hw;
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_lookup);
> +#endif
Use EXPORT_SYMBOL_IF_KUNIT instead for consistency with the rest of the
kernel. In clk_test.c, you'll also need to add:
MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
Since clk_hw_lookup() is only used by kunit, why not just put this new
function in clk-test.c, and use EXPORT_SYMBOL_IF_KUNIT on
clk_core_lookup?
Brian
next prev parent reply other threads:[~2025-10-08 23:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 9:20 [PATCH] clk: tests: Add tests for clk lookup by name Chen-Yu Tsai
2025-10-08 23:58 ` Brian Masney [this message]
2025-10-09 3:24 ` Chen-Yu Tsai
2025-10-09 18:56 ` Brian Masney
2025-11-11 1:28 ` Stephen Boyd
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=aOb6iNR9T4R9Hp3R@redhat.com \
--to=bmasney@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=wenst@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.