linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: Wim Van Sebroeck <wim@iguana.be>,
	Wolfram Sang <wsa@the-dreams.de>,
	Robin Gong <b38343@freescale.com>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/6] watchdog: add set_pretimeout interface
Date: Tue, 7 Jun 2016 13:32:58 -0700	[thread overview]
Message-ID: <20160607203258.GA8033@roeck-us.net> (raw)
In-Reply-To: <1465321127-19522-2-git-send-email-vladimir_zapolskiy@mentor.com>

On Tue, Jun 07, 2016 at 08:38:42PM +0300, Vladimir Zapolskiy wrote:
> From: Robin Gong <b38343@freescale.com>
> 
> Add set_pretimeout since our watchdog driver has those interfaces and
> obviously, the new common watchdog framework didn't implement this
> interface.
> 
> Signed-off-by: Robin Gong <b38343@freescale.com>
> [vzapolskiy: rebased, added an inline comment to describe new interface]
> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
> ---
> Changes from v2 to v3:
> * none, new change
> 
> Changes from v1 to v2:
> * none, new change
> 
>  include/linux/watchdog.h | 10 ++++++++++

Please also document the new API function and variable in
Documentation/watchdog/watchdog-kernel-api.txt.


>  1 file changed, 10 insertions(+)
> 
> diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
> index 51732d6..e3d23d3 100644
> --- a/include/linux/watchdog.h
> +++ b/include/linux/watchdog.h
> @@ -28,6 +28,7 @@ struct watchdog_core_data;
>   * @ping:	The routine that sends a keepalive ping to the watchdog device.
>   * @status:	The routine that shows the status of the watchdog device.
>   * @set_timeout:The routine for setting the watchdog devices timeout value (in seconds).
> + * @set_pretimeout:The routine for setting the watchdog devices pretimeout (in seconds).
>   * @get_timeleft:The routine that gets the time left before a reset (in seconds).
>   * @restart:	The routine for restarting the machine.
>   * @ioctl:	The routines that handles extra ioctl calls.
> @@ -46,6 +47,7 @@ struct watchdog_ops {
>  	int (*ping)(struct watchdog_device *);
>  	unsigned int (*status)(struct watchdog_device *);
>  	int (*set_timeout)(struct watchdog_device *, unsigned int);
> +	int (*set_pretimeout)(struct watchdog_device *, unsigned int);
>  	unsigned int (*get_timeleft)(struct watchdog_device *);
>  	int (*restart)(struct watchdog_device *, unsigned long, void *);
>  	long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
> @@ -95,6 +97,7 @@ struct watchdog_device {
>  	const struct watchdog_ops *ops;
>  	unsigned int bootstatus;
>  	unsigned int timeout;
> +	unsigned int pretimeout;
>  	unsigned int min_timeout;
>  	unsigned int max_timeout;
>  	unsigned int min_hw_heartbeat_ms;
> @@ -162,6 +165,13 @@ static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigne
>  		 t > wdd->max_timeout);
>  }
>  
> +/* Use the following function to check if a pretimeout value is invalid */
> +static inline bool watchdog_pretimeout_invalid(struct watchdog_device *wdd,
> +					       unsigned int t)
> +{
> +	return wdd->timeout && t >= wdd->timeout;
> +}

If no timeout is configured, this would happily accept timeout values larger
than the maximum supported timeout. Given that we can not evaluate true or false
if timeout is not set or not known, I think this will have to be something like
	return !wdd->timeout || t >= wdd->timeout;
(unless somone has a better idea).

I am missing a function to initialize the pretimeout from a driver, similar
to watchdog_init_timeout(). Is this an oversight or on purpose ?

Thanks,
Guenter

  reply	other threads:[~2016-06-07 20:33 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 17:38 [PATCH v3 0/6] watchdog: add watchdog pretimeout framework Vladimir Zapolskiy
2016-06-07 17:38 ` [PATCH v3 1/6] watchdog: add set_pretimeout interface Vladimir Zapolskiy
2016-06-07 20:32   ` Guenter Roeck [this message]
2016-06-08  6:34   ` Wolfram Sang
2016-06-08 12:58     ` Vladimir Zapolskiy
2016-06-09 21:12       ` Wolfram Sang
2016-06-07 17:38 ` [PATCH v3 2/6] watchdog: add WDIOC_SETPRETIMEOUT and WDIOC_GETPRETIMEOUT Vladimir Zapolskiy
2016-06-07 17:38 ` [PATCH v3 3/6] watchdog: add pretimeout read-only device attribute to sysfs Vladimir Zapolskiy
2016-06-08  6:57   ` Wolfram Sang
2016-06-07 17:38 ` [PATCH v3 4/6] watchdog: add watchdog pretimeout framework Vladimir Zapolskiy
2016-06-07 21:43   ` Guenter Roeck
2016-06-08 13:37     ` Vladimir Zapolskiy
2016-06-08 13:53       ` Guenter Roeck
2016-06-08 15:11         ` Vladimir Zapolskiy
2016-06-08 15:38           ` kbuild: default n removals? (was: Re: [PATCH v3 4/6] watchdog: add watchdog pretimeout framework) Joe Perches
2016-06-08 18:05             ` Guenter Roeck
2016-06-15 10:02             ` kbuild: default n removals? Michal Marek
2016-06-08  6:54   ` [PATCH v3 4/6] watchdog: add watchdog pretimeout framework Wolfram Sang
2016-06-08 14:08     ` Vladimir Zapolskiy
2016-06-08 18:20       ` Guenter Roeck
2016-06-09 21:22         ` Wolfram Sang
2016-06-09 21:14       ` Wolfram Sang
2016-06-07 17:38 ` [PATCH v3 5/6] watchdog: pretimeout: add panic pretimeout governor Vladimir Zapolskiy
2016-06-08  7:08   ` Wolfram Sang
2016-06-08 14:28     ` Vladimir Zapolskiy
2016-06-09 21:23       ` Wolfram Sang
2016-06-07 17:38 ` [PATCH v3 6/6] watchdog: pretimeout: add noop " Vladimir Zapolskiy
2016-06-08  7:10   ` Wolfram Sang
2016-06-08 14:32     ` Vladimir Zapolskiy
2016-06-08  7:56 ` [PATCH v3 0/6] watchdog: add watchdog pretimeout framework Wolfram Sang
2016-06-08 15:35   ` Vladimir Zapolskiy
2016-06-09 21:30     ` Wolfram Sang
2016-06-24  9:46 ` Wolfram Sang
2016-06-24 13:45   ` Guenter Roeck
2016-06-24 22:13     ` Vladimir Zapolskiy

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=20160607203258.GA8033@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=b38343@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=vladimir_zapolskiy@mentor.com \
    --cc=wim@iguana.be \
    --cc=wsa@the-dreams.de \
    /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).