linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keguang Zhang <keguang.zhang@gmail.com>
To: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Yang Ling <gnaygnil@gmail.com>,
	Keguang Zhang <keguang.zhang@gmail.com>
Subject: [PATCH 2/2] watchdog: loongson1_wdt: Add DT support
Date: Fri,  7 Apr 2023 19:00:25 +0800	[thread overview]
Message-ID: <20230407110025.516405-3-keguang.zhang@gmail.com> (raw)
In-Reply-To: <20230407110025.516405-1-keguang.zhang@gmail.com>

This patch adds the of_match_table to enable DT support
of Loongson-1 watchdog driver.
And modify the parameter of devm_clk_get() accordingly.

Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
---
 drivers/watchdog/loongson1_wdt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/loongson1_wdt.c b/drivers/watchdog/loongson1_wdt.c
index bb3d075c0633..c2694222ea86 100644
--- a/drivers/watchdog/loongson1_wdt.c
+++ b/drivers/watchdog/loongson1_wdt.c
@@ -5,6 +5,7 @@
 
 #include <linux/clk.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/watchdog.h>
 #include <loongson1.h>
@@ -100,7 +101,7 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
 	if (IS_ERR(drvdata->base))
 		return PTR_ERR(drvdata->base);
 
-	drvdata->clk = devm_clk_get(dev, pdev->name);
+	drvdata->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(drvdata->clk))
 		return PTR_ERR(drvdata->clk);
 
@@ -142,10 +143,19 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id ls1x_wdt_dt_ids[] = {
+	{ .compatible = "loongson,ls1x-wdt", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ls1x_wdt_dt_ids);
+#endif
+
 static struct platform_driver ls1x_wdt_driver = {
 	.probe = ls1x_wdt_probe,
 	.driver = {
 		.name = "ls1x-wdt",
+		.of_match_table = ls1x_wdt_dt_ids,
 	},
 };
 
-- 
2.34.1


  parent reply	other threads:[~2023-04-07 11:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 11:00 [PATCH 0/2] Devicetree support for Loongson-1 watchdog Keguang Zhang
2023-04-07 11:00 ` [PATCH 1/2] dt-bindings: watchdog: Add " Keguang Zhang
2023-04-07 13:43   ` Krzysztof Kozlowski
2023-04-07 14:21   ` Rob Herring
2023-04-07 11:00 ` Keguang Zhang [this message]
2023-04-07 12:46   ` [PATCH 2/2] watchdog: loongson1_wdt: Add DT support Guenter Roeck
2023-04-08  6:12   ` kernel test robot

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=20230407110025.516405-3-keguang.zhang@gmail.com \
    --to=keguang.zhang@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnaygnil@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=wim@linux-watchdog.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;
as well as URLs for NNTP newsgroup(s).