linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Flavio Suligoi <f.suligoi@asem.it>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] watchdog: wdat: add param. to start wdog on module insertion
Date: Fri, 19 Feb 2021 12:54:47 +0200	[thread overview]
Message-ID: <20210219105447.GI2542@lahna.fi.intel.com> (raw)
In-Reply-To: <20210218163200.1154812-1-f.suligoi@asem.it>

Hi,

On Thu, Feb 18, 2021 at 05:32:00PM +0100, Flavio Suligoi wrote:
> Add the parameter "start_enable" to start the watchdog
> directly on module insertion.
> 
> In an embedded system, for some applications, the watchdog
> must be activated as soon as possible.
> 
> In some embedded x86 boards the watchdog can be activated
> directly by the BIOS (with an appropriate setting of the
> BIOS setup). In other cases, when this BIOS feature is not
> present, the possibility to start the watchdog immediately
> after the module loading can be very useful.
> 
> Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
> ---
>  drivers/watchdog/wdat_wdt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
> index cec7917790e5..b990d0197d2e 100644
> --- a/drivers/watchdog/wdat_wdt.c
> +++ b/drivers/watchdog/wdat_wdt.c
> @@ -61,6 +61,12 @@ module_param(timeout, int, 0);
>  MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
>  		 __MODULE_STRING(WDAT_DEFAULT_TIMEOUT) ")");
>  
> +#define START_DEFAULT	0
> +static int start_enabled = START_DEFAULT;
> +module_param(start_enabled, int, 0);
> +MODULE_PARM_DESC(start_enabled, "Watchdog is started on module insertion "
> +		 "(default=" __MODULE_STRING(START_DEFAULT) ")");
> +
>  static int wdat_wdt_read(struct wdat_wdt *wdat,
>  	 const struct wdat_instruction *instr, u32 *value)
>  {
> @@ -437,6 +443,8 @@ static int wdat_wdt_probe(struct platform_device *pdev)
>  	}
>  
>  	wdat_wdt_boot_status(wdat);
> +	if (start_enabled)
> +		wdat_wdt_start(&wdat->wdd);

No objections to this if it is really needed. However, I think it is
better start the watchdog after devm_watchdog_register_device() has been
called so we have everything initialized.

>  	wdat_wdt_set_running(wdat);
>  
>  	ret = wdat_wdt_enable_reboot(wdat);
> -- 
> 2.25.1

  reply	other threads:[~2021-02-19 10:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 16:32 [PATCH v1] watchdog: wdat: add param. to start wdog on module insertion Flavio Suligoi
2021-02-19 10:54 ` Mika Westerberg [this message]
2021-02-19 14:01   ` R: " Flavio Suligoi
2021-02-19 15:32     ` Guenter Roeck
2021-02-22 11:28       ` Flavio Suligoi
2021-02-22 21:30         ` 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=20210219105447.GI2542@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=f.suligoi@asem.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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;
as well as URLs for NNTP newsgroup(s).