public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] drivers: watchdog: at91sam9_wdt: add new feature support
Date: Tue, 28 Jul 2015 18:22:41 -0700	[thread overview]
Message-ID: <55B82AE1.2050906@roeck-us.net> (raw)
In-Reply-To: <B256D81BAE5131468A838E5D7A243641C9F820CB@penmbx01>

On 07/28/2015 05:38 PM, Yang, Wenyou wrote:
> Hi Guenter,
>
> Thank you very much for your review.
>
>> -----Original Message-----
>> From: Guenter Roeck [mailto:linux at roeck-us.net]
>> Sent: 2015?7?28? 15:14
>> To: Yang, Wenyou; wim at iguana.be; robh+dt at kernel.org; pawel.moll at arm.com;
>> mark.rutland at arm.com; ijc+devicetree at hellion.org.uk; galak at codeaurora.org
>> Cc: sylvain.rochet at finsecur.com; Ferre, Nicolas; boris.brezillon at free-
>> electrons.com; devicetree at vger.kernel.org; linux-kernel at vger.kernel.org; linux-
>> watchdog at vger.kernel.org; linux-arm-kernel at lists.infradead.org
>> Subject: Re: [PATCH 1/2] drivers: watchdog: at91sam9_wdt: add new feature
>> support
>>
>> On 07/28/2015 12:00 AM, Wenyou Yang wrote:
>>> In the datasheet, the new feature is describled as "WDT_MR can be
>>> written until a LOCKMR command is issued in WDT_CR".
>>> That is to say, as long as the bootstrap and u-boot don't issue a
>>> LOCKMR command, WDT_MR can be written in kernel.
>>>
>>> So the driver can enable/disable the watchdog timer hardware, set
>>> WDV(Watchdog Counter Value) and WDD(Watchdog Delta Value) fields of
>>> WDT_MR register to set the watchdog timer timeout.
>>>
>>> The timer is not necessary that regularly sends a keepalive ping to
>>> the watchdog timer hardware.
>>>
>>> It is introduced from sama5d4 SoCs.
>>>
>> Since there are so many changes, I wonder is a separate driver would make more
>> sense.
> Yes, a bit many changes.
> I thought reuse the driver code.
> If a separate driver, I am afraid it includes much duplicated code.
> After all, it is for the same device with different feature.
>
> I don't think it is necessary to have multiple drivers for the same peripheral with different feature.
>

The concept for the two mechanisms is all different: In one, the watchdog keepalive is triggered
from timer code. In the other, the watchdog timeout is triggered directly from the heartbeat
function. One assumes that the watchdog is always running, and that it must be pinged even
if closed. The other disables the watchdog on close.

What I _can_ see is that the driver is becoming an unmaintainable mess, with lots of if/else
in pretty much every function. I consider this much less desirable than a bit of code
duplication - if there is any. Seriously, most of the added code might as well be for
a completely different chip.

Guenter

  reply	other threads:[~2015-07-29  1:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28  7:00 [PATCH 0/2] watchdog: at91sam9_wdt: add new feature support Wenyou Yang
2015-07-28  7:00 ` [PATCH 1/2] drivers: " Wenyou Yang
2015-07-28  7:14   ` Guenter Roeck
2015-07-29  0:38     ` Yang, Wenyou
2015-07-29  1:22       ` Guenter Roeck [this message]
2015-07-29  1:50         ` Yang, Wenyou
2015-07-28  7:00 ` [PATCH 2/2] Documentation: dt: binding: atmel-wdt: add a new compitable Wenyou Yang

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=55B82AE1.2050906@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-arm-kernel@lists.infradead.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