linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: linux-watchdog@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: [PATCH 2/7] watchdog: softdog: use watchdog core to init timeout value
Date: Wed, 25 May 2016 08:37:44 +0200	[thread overview]
Message-ID: <1464158269-2447-3-git-send-email-wsa@the-dreams.de> (raw)
In-Reply-To: <1464158269-2447-1-git-send-email-wsa@the-dreams.de>

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

Error string and comment say we fall back to a default, but in reality
we bailed out. Refactor the code to use the core helper which then
matches the described behaviour. While updating the init message anyhow,
shorten it while we are here; no need for versioning there as well and
the name is already given via pr_fmt.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/watchdog/softdog.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index 8bc0b164afc94b..a9ad27dd46502b 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -111,22 +111,15 @@ static struct watchdog_device softdog_dev = {
 	.info = &softdog_info,
 	.ops = &softdog_ops,
 	.min_timeout = 1,
-	.max_timeout = 0xFFFF
+	.max_timeout = 65535,
+	.timeout = TIMER_MARGIN,
 };
 
 static int __init watchdog_init(void)
 {
 	int ret;
 
-	/* Check that the soft_margin value is within it's range;
-	   if not reset to the default */
-	if (soft_margin < 1 || soft_margin > 65535) {
-		pr_info("soft_margin must be 0 < soft_margin < 65536, using %d\n",
-			TIMER_MARGIN);
-		return -EINVAL;
-	}
-	softdog_dev.timeout = soft_margin;
-
+	watchdog_init_timeout(&softdog_dev, soft_margin, NULL);
 	watchdog_set_nowayout(&softdog_dev, nowayout);
 	watchdog_stop_on_reboot(&softdog_dev);
 
@@ -134,8 +127,8 @@ static int __init watchdog_init(void)
 	if (ret)
 		return ret;
 
-	pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n",
-		soft_noboot, soft_margin, soft_panic, nowayout);
+	pr_info("initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n",
+		soft_noboot, softdog_dev.timeout, soft_panic, nowayout);
 
 	return 0;
 }
-- 
2.8.1


  parent reply	other threads:[~2016-05-25  6:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  6:37 [PATCH 0/7] watchdog: softdog: cleanups Wolfram Sang
2016-05-25  6:37 ` [PATCH 1/7] watchdog: softdog: remove obsolete comments Wolfram Sang
2016-05-25 17:30   ` Guenter Roeck
2016-05-25  6:37 ` Wolfram Sang [this message]
2016-05-25 17:30   ` [PATCH 2/7] watchdog: softdog: use watchdog core to init timeout value Guenter Roeck
2016-05-25  6:37 ` [PATCH 3/7] watchdog: softdog: consistently use softdog_ prefix Wolfram Sang
2016-05-25 17:30   ` Guenter Roeck
2016-05-25  6:37 ` [PATCH 4/7] watchdog: softdog: remove forward declaration Wolfram Sang
2016-05-25 17:31   ` Guenter Roeck
2016-05-25  6:37 ` [PATCH 5/7] watchdog: softdog: sort includes to avoid duplicates Wolfram Sang
2016-05-25 17:31   ` Guenter Roeck
2016-05-25  6:37 ` [PATCH 6/7] watchdog: softdog: drop superfluous set_timeout callback Wolfram Sang
2016-05-25 17:31   ` Guenter Roeck
2016-05-25  6:37 ` [PATCH 7/7] watchdog: softdog: improve coding style Wolfram Sang
2016-05-25 17:31   ` Guenter Roeck
2016-07-17 19:48 ` [PATCH 0/7] watchdog: softdog: cleanups Wim Van Sebroeck

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=1464158269-2447-3-git-send-email-wsa@the-dreams.de \
    --to=wsa@the-dreams.de \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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).