All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Yang <mmyangfl@gmail.com>
To: linux-clk@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org, David Yang <mmyangfl@gmail.com>
Subject: [PATCH v9 11/13] clk: hisilicon: hip04: Convert into platform driver module
Date: Fri, 12 Apr 2024 13:10:40 +0800	[thread overview]
Message-ID: <20240412051041.90376-13-mmyangfl@gmail.com> (raw)
In-Reply-To: <20240412051041.90376-2-mmyangfl@gmail.com>

Use common helper functions and register clks with a single of_device_id
data.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/clk/hisilicon/clk-hip04.c | 38 ++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/clk/hisilicon/clk-hip04.c b/drivers/clk/hisilicon/clk-hip04.c
index feb34e98af8c..8ba82675ff64 100644
--- a/drivers/clk/hisilicon/clk-hip04.c
+++ b/drivers/clk/hisilicon/clk-hip04.c
@@ -10,8 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/clk-provider.h>
-#include <linux/io.h>
-#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
 
 #include <dt-bindings/clock/hip04-clock.h>
 
@@ -24,16 +24,28 @@ static struct hisi_fixed_rate_clock hip04_fixed_rate_clks[] __initdata = {
 	{ HIP04_CLK_168M, "clk168m",  NULL, 0, 168750000, },
 };
 
-static void __init hip04_clk_init(struct device_node *np)
-{
-	struct hisi_clock_data *clk_data;
+static const struct hisi_clocks hip04_clks = {
+	.fixed_rate_clks = hip04_fixed_rate_clks,
+	.fixed_factor_clks_num = ARRAY_SIZE(hip04_fixed_rate_clks),
+};
+
+static const struct of_device_id hip04_clk_match_table[] = {
+	{ .compatible = "hisilicon,hip04-clock",
+	  .data = &hip04_clks },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, hip04_clk_match_table);
+
+static struct platform_driver hip04_clk_driver = {
+	.probe = hisi_clk_probe,
+	.remove_new = hisi_clk_remove,
+	.driver		= {
+		.name	= "hip04-clock",
+		.of_match_table = hip04_clk_match_table,
+	},
+};
 
-	clk_data = hisi_clk_init(np, HIP04_NR_CLKS);
-	if (!clk_data)
-		return;
+module_platform_driver(hip04_clk_driver);
 
-	hisi_clk_register_fixed_rate(hip04_fixed_rate_clks,
-				     ARRAY_SIZE(hip04_fixed_rate_clks),
-				     clk_data);
-}
-CLK_OF_DECLARE(hip04_clk, "hisilicon,hip04-clock", hip04_clk_init);
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("HiSilicon HiP04 Clock Driver");
-- 
2.43.0


  parent reply	other threads:[~2024-04-12  5:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12  5:10 [PATCH v9 00/13] clk: hisilicon: Migrate devm APIs David Yang
2024-04-12  5:10 ` [PATCH v9 01/13] clk: hisilicon: Add helper functions for platform driver David Yang
2024-04-12  5:10 ` [PATCH v9 02/13] clk: hisilicon: hi3516cv300: Use helper functions David Yang
2024-04-12  5:10 ` [PATCH v9 03/13] clk: hisilicon: hi3798cv200: " David Yang
2024-04-12  5:10 ` [PATCH v9 04/13] clk: hisilicon: Remove hisi_crg_funcs David Yang
2024-04-12  5:10 ` [PATCH v9 05/13] clk: hisilicon: hi3519: Use helper functions David Yang
2024-04-12  5:10 ` [PATCH v9 06/13] clk: hisilicon: hi3559a: " David Yang
2024-04-12  5:10 ` [PATCH v9 07/13] clk: hisilicon: hi3660: Convert into module David Yang
2024-04-12  5:10 ` [PATCH v9 08/13] clk: hisilicon: hi3670: " David Yang
2024-04-12  5:10 ` [PATCH v9 09/13] clk: hisilicon: hi3620: Convert into platform driver module David Yang
2024-04-12  5:10 ` [PATCH v9 10/13] clk: hisilicon: hi6220: " David Yang
2024-04-12  5:10 ` David Yang [this message]
2024-04-12  5:10 ` [PATCH v9 12/13] clk: hisilicon: hix5hd2: " David Yang
2024-04-12  5:10 ` [PATCH v9 13/13] clk: hisilicon: Migrate devm APIs David Yang
2024-04-12  5:59 ` [PATCH v9 00/13] " 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=20240412051041.90376-13-mmyangfl@gmail.com \
    --to=mmyangfl@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.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 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.