linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Martyn Welch <martyn.welch@collabora.co.uk>,
	Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v4] Zodiac Aerospace RAVE Switch Watchdog Processor Driver
Date: Mon, 30 Nov 2015 10:10:35 -0800	[thread overview]
Message-ID: <565C911B.5010400@roeck-us.net> (raw)
In-Reply-To: <565C86DF.3080608@collabora.co.uk>

On 11/30/2015 09:26 AM, Martyn Welch wrote:
> On 30/11/15 15:55, Guenter Roeck wrote:
>> Hi Martyn,
>>
>> On 11/25/2015 09:15 AM, Martyn Welch wrote:
>>> This patch adds a driver for the Zodiac Aerospace RAVE Watchdog Procesor.
>>> This device implements a watchdog timer, accessible over I2C.
>>>
>> Mostly there, still a few nitpicks and a problem with DT properties.
>>
[ ... ]

>>> +
>>> +static int ziirave_wdt_init_duration(struct i2c_client *client, int
>>> duration)
>>> +{

Separate note: The "duration" parameter here doesn't really add value.
It just reflects the module parameter. It would only make sense if the code
to obtain the duration (either from reset_duration or from DT)
would be in a separate function, such as in

	duration = ziirave_get_duration(client);
	if (duration < 0)
		return duration;
	if (duration) {
		ret = ziirave_wdt_init_duration(client, duration);
		if (ret)
			return ret;
	}

or similar.

>>> +    int ret;
>>> +
>>> +    if (!duration) {
>>> +        /* See if the reset pulse duration is provided in an of_node */
>>> +        if (client->dev.of_node == NULL)
>>> +            return -ENODEV;
>>> +
>> Please write as "if (!client->dev.of_node)" (see checkpatch --strict).
>>
>
> ok
>
>> Also, is it really necessary to mandate DT support ? There is no mandatory
>> property to be read, so this driver would (or should) work fine on a non-DT
>> system.
>>
>
> The error doesn't cause the probe to fail. If it takes that path, it results in a message that the default value is being used and continues with that.
>
>>> +        ret = of_property_read_u32(client->dev.of_node,
>>> +                       "reset-duration-ms", &duration);
>>
>> reset-duration-ms is listed as optional property, thus it should not be
>> an error
>> if it is not provided. Can you set some default in this case ? Or do
>> nothing ?
>>
>
> It takes module parameter, DT entry or falls back to built in default.
>

Hmm, you are right. Problem with that though is that it also accepts _invalid_
parameters.

I think it would be better to only return an error if the value is really wrong,
and abort in that case. Otherwise a duration of, say, 1000, will only result
in "unable to set duration", which is likely going to be overlooked.

The current code not distinguish between "no duration provided", "bad duration",
and "duration not accepted by hardware". It seems to me that the latter two
should be fatal and not just be ignored.

Thanks,
Guenter


  reply	other threads:[~2015-11-30 18:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 12:03 [PATCH v3 1/2] Add binding documentation for Zodiac Watchdog Timer Martyn Welch
2015-11-25 12:03 ` [PATCH v3 2/2] Zodiac Aerospace RAVE Switch Watchdog Processor Driver Martyn Welch
2015-11-25 14:52   ` Guenter Roeck
2015-11-25 15:36     ` Martyn Welch
2015-11-25 16:10       ` Guenter Roeck
2015-11-25 16:12         ` Martyn Welch
2015-11-25 17:15     ` [PATCH v4] " Martyn Welch
2015-11-30  9:30       ` Martyn Welch
2015-11-30 14:48         ` Guenter Roeck
2015-11-30 15:55       ` Guenter Roeck
2015-11-30 17:26         ` Martyn Welch
2015-11-30 18:10           ` Guenter Roeck [this message]
2015-12-01 10:13             ` [PATCH v5] " Martyn Welch
2015-12-01 15:19               ` Guenter Roeck
2015-12-01 15:32             ` [PATCH v6] watchdog: " Martyn Welch
2015-12-28 21:54               ` Wim Van Sebroeck
2015-11-25 20:06 ` [PATCH v3 1/2] Add binding documentation for Zodiac Watchdog Timer Rob Herring
2015-12-01 15:15 ` [v3,1/2] " Guenter Roeck
2015-12-01 15:38   ` Martyn Welch
2015-12-01 20:24     ` Guenter Roeck

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=565C911B.5010400@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=martyn.welch@collabora.co.uk \
    --cc=wim@iguana.be \
    /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).