From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/4] clk: of: drop arguments from of_clk_init()
Date: Wed, 22 Mar 2023 09:32:43 +0100 [thread overview]
Message-ID: <20230322083245.251340-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20230322083245.251340-1-s.hauer@pengutronix.de>
of_clk_init() should be used to register clock drivers declared with
CLK_OF_DECLARE and nothing else, so there shouldn't be a need to call
it with a non NULL "matches" argument.
Also there is no point in calling this function with another device tree
than the barebox live tree.
Drop both arguments.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/clk/clk.c | 10 +++-------
drivers/of/base.c | 2 +-
include/linux/clk.h | 5 ++---
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 30fe43032b..c7ee6878c2 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -849,28 +849,24 @@ static int parent_ready(struct device_node *np)
/**
* of_clk_init() - Scan and init clock providers from the DT
- * @root: parent of the first level to probe or NULL for the root of the tree
- * @matches: array of compatible values and init functions for providers.
*
* This function scans the device tree for matching clock providers and
* calls their initialization functions
*
* Returns 0 on success, < 0 on failure.
*/
-int of_clk_init(struct device_node *root, const struct of_device_id *matches)
+int of_clk_init(void)
{
+ struct device_node *root = of_get_root_node();
+ const struct of_device_id *matches = __clk_of_table_start;
struct clock_provider *clk_provider, *next;
bool is_init_done;
bool force = false;
LIST_HEAD(clk_provider_list);
const struct of_device_id *match;
- if (!root)
- root = of_find_node_by_path("/");
if (!root)
return -EINVAL;
- if (!matches)
- matches = __clk_of_table_start;
/* First prepare the list of the clocks providers */
for_each_matching_node_and_match(root, matches, &match) {
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ea4be9c512..acebba29a1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1757,7 +1757,7 @@ int barebox_register_of(struct device_node *root)
of_fix_tree(root);
if (IS_ENABLED(CONFIG_OFDEVICE)) {
- of_clk_init(root, NULL);
+ of_clk_init();
if (!deep_probe_is_supported())
return of_probe();
}
diff --git a/include/linux/clk.h b/include/linux/clk.h
index bffed2bdcf..29c697a00b 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -686,7 +686,7 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
unsigned int of_clk_get_parent_count(struct device_node *np);
int of_clk_parent_fill(struct device_node *np, const char **parents,
unsigned int size);
-int of_clk_init(struct device_node *root, const struct of_device_id *matches);
+int of_clk_init(void);
int of_clk_add_provider(struct device_node *np,
struct clk *(*clk_src_get)(struct of_phandle_args *args,
void *data),
@@ -742,8 +742,7 @@ static inline unsigned int of_clk_get_parent_count(struct device_node *np)
{
return 0;
}
-static inline int of_clk_init(struct device_node *root,
- const struct of_device_id *matches)
+static inline int of_clk_init(void)
{
return 0;
}
--
2.30.2
next prev parent reply other threads:[~2023-03-22 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 8:32 [PATCH 0/4] Allow to probe clks added in overlays Sascha Hauer
2023-03-22 8:32 ` [PATCH 1/4] clk: clk-gpio: Turn into driver Sascha Hauer
2023-03-22 8:32 ` Sascha Hauer [this message]
2023-03-22 8:32 ` [PATCH 3/4] clk: of: make of_clk_init() safe for being called multiple times Sascha Hauer
2023-03-22 8:32 ` [PATCH 4/4] commands: of_overlay: Allow to register clocks from overlay Sascha Hauer
2023-03-22 9:25 ` Sascha Hauer
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=20230322083245.251340-3-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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