mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Tzung-Bi Shih <tzungbi@kernel.org>,
	Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Cc: wim@linux-watchdog.org, geert+renesas@glider.be,
	linux-watchdog@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Phil Edworthy <phil.edworthy@renesas.com>
Subject: Re: [PATCH v4 2/2] watchdog: Add Renesas RZ/N1 Watchdog driver
Date: Thu, 31 Mar 2022 19:26:50 -0700	[thread overview]
Message-ID: <a12c8a2a-1e8a-bfee-6812-969cccc6366e@roeck-us.net> (raw)
In-Reply-To: <YkVFc6Q6/6rxSw89@google.com>

On 3/30/22 23:08, Tzung-Bi Shih wrote:
> On Wed, Mar 30, 2022 at 12:08:29PM +0200, Jean-Jacques Hiblot wrote:
>> diff --git a/drivers/watchdog/rzn1_wdt.c b/drivers/watchdog/rzn1_wdt.c
> [...]
>> +/*
>> + * 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.
> 
> s/2018/2022/ ?
> 
>> +#define RZN1_WDT_RETRIGGER			0x0
>> +#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)
> 
> Do RZN1_WDT_RETRIGGER_RELOAD_VAL and RZN1_WDT_RETRIGGER_WDSI get 1 more tab
> indent intentionally?
> 

That only looks like it due to the "+" at the beginning of the line.
If you look at the actual code the alignment is ok.

>> +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.
> 
That would indeed be preferred. The static data structure isn't really useful.

>> +static const struct of_device_id rzn1_wdt_match[] = {
>> +	{ .compatible = "renesas,rzn1-wdt" },
>> +	{},
>> +};
>> +MODULE_DEVICE_TABLE(of, rzn1_wdt_match);
> 
> Doesn't it need to guard by CONFIG_OF?
> 
Only if of_match_ptr() is used below, and then I'd prefer __maybe_unused

>> +static struct platform_driver rzn1_wdt_driver = {
>> +	.probe		= rzn1_wdt_probe,
>> +	.driver		= {
>> +		.name		= KBUILD_MODNAME,
>> +		.of_match_table	= rzn1_wdt_match,
> 
> Does it makes more sense to use of_match_ptr()?
> 

Usually we leave that up to driver authors.

>> +	},
>> +};
>> +
>> +module_platform_driver(rzn1_wdt_driver);
> 
> To make it look like a whole thing, I prefer to remove the extra blank line
> in between struct platform_driver and module_platform_driver().

We usually leave that up to driver authors. Many watchdog driver leave
an empty line, so it is ok (as long as there are no two empty lines).

Thanks,
Guenter

  reply	other threads:[~2022-04-01  2:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 10:08 [PATCH v4 0/2] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
2022-03-30 10:08 ` [PATCH v4 1/2] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
2022-03-30 10:08 ` [PATCH v4 2/2] watchdog: Add Renesas RZ/N1 Watchdog driver Jean-Jacques Hiblot
2022-03-31  6:08   ` Tzung-Bi Shih
2022-04-01  2:26     ` Guenter Roeck [this message]
2022-04-01 13:03     ` Jean-Jacques Hiblot

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=a12c8a2a-1e8a-bfee-6812-969cccc6366e@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=geert+renesas@glider.be \
    --cc=jjhiblot@traphandler.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=phil.edworthy@renesas.com \
    --cc=tzungbi@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

all inboxes | Powered by JetHome®