devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
To: PrasannaKumar Muralidharan
	<prasannatsmkumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Paul Cercueil <paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
Cc: Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux-MIPS <linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
	open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 3/8] watchdog: JZ4740: Register a restart handler
Date: Sat, 20 Jan 2018 07:45:46 -0800	[thread overview]
Message-ID: <20061de8-fa1f-93eb-eb9b-089c699018aa@roeck-us.net> (raw)
In-Reply-To: <CANc+2y7CT150cO61RfRgc6hCLEasx+NmqCacZtaFPKLgTPyt4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 01/19/2018 11:31 PM, PrasannaKumar Muralidharan wrote:
> Hi Paul,
> 
> On 30 December 2017 at 19:21, Paul Cercueil <paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org> wrote:
>> The watchdog driver can restart the system by simply configuring the
>> hardware for a timeout of 0 seconds.
>>
>> Signed-off-by: Paul Cercueil <paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
>> Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
>> ---
>>   drivers/watchdog/jz4740_wdt.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>>   v2: No change
>>
>> diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c
>> index 92d6ca8ceb49..fa7f49a3212c 100644
>> --- a/drivers/watchdog/jz4740_wdt.c
>> +++ b/drivers/watchdog/jz4740_wdt.c
>> @@ -130,6 +130,14 @@ static int jz4740_wdt_stop(struct watchdog_device *wdt_dev)
>>          return 0;
>>   }
>>
>> +static int jz4740_wdt_restart(struct watchdog_device *wdt_dev,
>> +                             unsigned long action, void *data)
>> +{
>> +       wdt_dev->timeout = 0;
>> +       jz4740_wdt_start(wdt_dev);
>> +       return 0;
>> +}
>> +
>>   static const struct watchdog_info jz4740_wdt_info = {
>>          .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
>>          .identity = "jz4740 Watchdog",
>> @@ -141,6 +149,7 @@ static const struct watchdog_ops jz4740_wdt_ops = {
>>          .stop = jz4740_wdt_stop,
>>          .ping = jz4740_wdt_ping,
>>          .set_timeout = jz4740_wdt_set_timeout,
>> +       .restart = jz4740_wdt_restart,
>>   };
>>
>>   #ifdef CONFIG_OF
>> --
>> 2.11.0
>>
>>
> 
> Noticed that min_timeout of the watchdog device is set to 1 but this
> function calls start with timeout set to 0. Even though this works I
> feel it is better to set min_timeout to 0.
> 

No. That would be wrong. If you want to be pedantic, write a new function
__jz4740_wdt_set_timeout(u16 clock_div, u16 timeout_value) and call it
instead, but don't mess with min_timeout.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-01-20 15:45 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-28 16:29 [PATCH 0/7] jz4740 watchdog driver & platform cleanups Paul Cercueil
2017-12-28 16:29 ` [PATCH 1/7] watchdog: JZ4740: Disable clock after stopping counter Paul Cercueil
     [not found]   ` <20171228162939.3928-2-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
2017-12-28 18:38     ` Guenter Roeck
2017-12-30 13:51   ` [PATCH v2 1/8] " Paul Cercueil
2017-12-30 13:51     ` [PATCH v2 2/8] watchdog: jz4740: Use devm_* functions Paul Cercueil
2017-12-30 16:08       ` Guenter Roeck
     [not found]     ` <20171230135108.6834-1-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
2017-12-30 13:51       ` [PATCH v2 3/8] watchdog: JZ4740: Register a restart handler Paul Cercueil
     [not found]         ` <20171230135108.6834-3-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
2018-01-20  7:31           ` PrasannaKumar Muralidharan
     [not found]             ` <CANc+2y7CT150cO61RfRgc6hCLEasx+NmqCacZtaFPKLgTPyt4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-20 15:45               ` Guenter Roeck [this message]
     [not found]                 ` <20061de8-fa1f-93eb-eb9b-089c699018aa-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2018-01-20 16:04                   ` PrasannaKumar Muralidharan
     [not found]                     ` <CANc+2y52ObW773=20=-gbztvoH0DSRSO1N5Srf3WYcKLZbPNBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-20 17:56                       ` Guenter Roeck
2017-12-30 13:51     ` [PATCH v2 4/8] watchdog: JZ4740: Drop module remove function Paul Cercueil
     [not found]       ` <20171230135108.6834-4-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
2017-12-30 16:08         ` Guenter Roeck
2018-01-20  7:41         ` PrasannaKumar Muralidharan
     [not found]           ` <CANc+2y4z-_++zUG8DUR6+zZYjc26AyJjU-yX+Lx37TSRXb4u0g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-20 15:50             ` Guenter Roeck
     [not found]               ` <71845801-7edf-9e49-8591-2a4caf11c45b-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2018-01-20 15:59                 ` PrasannaKumar Muralidharan
2017-12-30 13:51     ` [PATCH v2 5/8] MIPS: jz4740: dts: Add bindings for the jz4740-wdt driver Paul Cercueil
     [not found]       ` <20171230135108.6834-5-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
2018-01-02 16:37         ` PrasannaKumar Muralidharan
     [not found]           ` <CANc+2y5ZUM_ZzXaGgbx9b7O1GF4GrbaYsv97G+akvhP2d2VVUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-02 16:48             ` Paul Cercueil
     [not found]               ` <1514911698.3623.1-nb6JAIIttxhEPksTRSfcJOTW4wlIGRCZ@public.gmane.org>
2018-01-03  4:46                 ` Guenter Roeck
     [not found]                   ` <698e7ae5-9f19-1282-7b82-0e2fd2080906-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2018-01-03 12:01                     ` Paul Cercueil
2018-01-03 14:28                     ` PrasannaKumar Muralidharan
2017-12-30 13:51     ` [PATCH v2 6/8] MIPS: jz4780: dts: Fix watchdog node Paul Cercueil
2018-03-05 18:25       ` James Hogan
2017-12-30 13:51     ` [PATCH v2 7/8] MIPS: qi_lb60: Enable the jz4740-wdt driver Paul Cercueil
2018-03-05 18:28       ` James Hogan
2017-12-30 13:51     ` [PATCH v2 8/8] MIPS: jz4740: Drop old platform reset code Paul Cercueil
2018-03-05 18:31       ` James Hogan
2017-12-28 16:29 ` [PATCH 2/7] watchdog: jz4740: Use devm_* functions Paul Cercueil
2017-12-28 17:48   ` Guenter Roeck
     [not found]     ` <9778afd4-5841-0d48-cde3-c02872623a5f-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2017-12-28 19:59       ` Paul Cercueil
     [not found]         ` <1514491167.6093.0-nb6JAIIttxhEPksTRSfcJOTW4wlIGRCZ@public.gmane.org>
2017-12-28 20:19           ` Guenter Roeck
     [not found]             ` <994187b3-113c-88ef-8ebd-cd57d0c833a0-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2017-12-28 20:22               ` Paul Cercueil
     [not found]                 ` <1514492538.6093.1-nb6JAIIttxhEPksTRSfcJOTW4wlIGRCZ@public.gmane.org>
2017-12-28 21:03                   ` Guenter Roeck
     [not found]   ` <20171228162939.3928-3-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
2017-12-28 18:40     ` Guenter Roeck
2017-12-28 16:29 ` [PATCH 3/7] watchdog: JZ4740: Register a restart handler Paul Cercueil
     [not found]   ` <20171228162939.3928-4-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
2017-12-28 18:40     ` Guenter Roeck
2017-12-28 16:29 ` [PATCH 4/7] MIPS: jz4740: dts: Add bindings for the jz4740-wdt driver Paul Cercueil
2017-12-28 16:29 ` [PATCH 5/7] MIPS: jz4780: dts: Fix watchdog node Paul Cercueil
2017-12-28 17:33   ` Mathieu Malaterre
2017-12-28 16:29 ` [PATCH 6/7] MIPS: qi_lb60: Enable the jz4740-wdt driver Paul Cercueil
2017-12-28 16:29 ` [PATCH 7/7] MIPS: jz4740: Drop old platform reset code Paul Cercueil

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=20061de8-fa1f-93eb-eb9b-089c699018aa@roeck-us.net \
    --to=linux-0h96xk9xttrk1umjsbkqmq@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org \
    --cc=prasannatsmkumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.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).