On Wed, Mar 30, 2022 at 12:08:29PM +0200, Jean-Jacques Hiblot wrote:This driver wasn't written by me originally. So I'd rather not change this line.
diff --git a/drivers/watchdog/rzn1_wdt.c b/drivers/watchdog/rzn1_wdt.c[...]
+/*s/2018/2022/ ?
+ * Renesas RZ/N1 Watchdog timer.
+ * This is a 12-bit timer driver from a (62.5/16384) MHz clock. It can't even
+ * cope with 2 seconds.
+ *
+ * Copyright 2018 Renesas Electronics Europe Ltd.
I'll rework this. Thanks for the review
+#define RZN1_WDT_RETRIGGER 0x0Do RZN1_WDT_RETRIGGER_RELOAD_VAL and RZN1_WDT_RETRIGGER_WDSI get 1 more tab
+#define RZN1_WDT_RETRIGGER_RELOAD_VAL 0
+#define RZN1_WDT_RETRIGGER_RELOAD_VAL_MASK 0xfff
+#define RZN1_WDT_RETRIGGER_PRESCALE BIT(12)
+#define RZN1_WDT_RETRIGGER_ENABLE BIT(13)
+#define RZN1_WDT_RETRIGGER_WDSI (0x2 << 14)
indent intentionally?
+static const struct watchdog_device rzn1_wdt = {[...]
+ .info = &rzn1_wdt_info,
+ .ops = &rzn1_wdt_ops,
+ .status = WATCHDOG_NOWAYOUT_INIT_STATUS,
+};
+static int rzn1_wdt_probe(struct platform_device *pdev)[...]
+{
+ wdt->wdt = rzn1_wdt;Does it really need to copy the memory? For example,
1. Use the memory in `wdt` directly and fill the `wdd`.
struct watchdog_device *wdd = &wdt->wdt;
wdd->info = &rzn1_wdt_info;
wdd->ops = &rzn1_wdt_ops;
...
2. Use drvdata instead of container_of().
Use watchdog_set_drvdata() in _probe and watchdog_get_drvdata() in the
watchdog ops to get struct rzn1_watchdog.
+static const struct of_device_id rzn1_wdt_match[] = {Doesn't it need to guard by CONFIG_OF?
+ { .compatible = "renesas,rzn1-wdt" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rzn1_wdt_match);
+static struct platform_driver rzn1_wdt_driver = {Does it makes more sense to use of_match_ptr()?
+ .probe = rzn1_wdt_probe,
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .of_match_table = rzn1_wdt_match,
+ },To make it look like a whole thing, I prefer to remove the extra blank line
+};
+
+module_platform_driver(rzn1_wdt_driver);
in between struct platform_driver and module_platform_driver().