linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
To: Wim Van Sebroeck <wim@iguana.be>, Guenter Roeck <linux@roeck-us.net>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	Robin Gong <b38343@freescale.com>,
	<linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v3 3/6] watchdog: add pretimeout read-only device attribute to sysfs
Date: Tue, 7 Jun 2016 20:38:44 +0300	[thread overview]
Message-ID: <1465321127-19522-4-git-send-email-vladimir_zapolskiy@mentor.com> (raw)
In-Reply-To: <1465321127-19522-1-git-send-email-vladimir_zapolskiy@mentor.com>

The change allows for WDIOF_PRETIMEOUT capable watchdog devices to get
a configured pretimeout value over sysfs, the correspondent device
attribute name is "pretimeout".

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

 drivers/watchdog/watchdog_dev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 42ab86d..87bbae7 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -443,6 +443,15 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(state);
 
+static ssize_t pretimeout_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	struct watchdog_device *wdd = dev_get_drvdata(dev);
+
+	return sprintf(buf, "%u\n", wdd->pretimeout);
+}
+static DEVICE_ATTR_RO(pretimeout);
+
 static umode_t wdt_is_visible(struct kobject *kobj, struct attribute *attr,
 				int n)
 {
@@ -454,6 +463,9 @@ static umode_t wdt_is_visible(struct kobject *kobj, struct attribute *attr,
 		mode = 0;
 	else if (attr == &dev_attr_timeleft.attr && !wdd->ops->get_timeleft)
 		mode = 0;
+	else if (attr == &dev_attr_pretimeout.attr &&
+		 !(wdd->info->options & WDIOF_PRETIMEOUT))
+		mode = 0;
 
 	return mode;
 }
@@ -465,6 +477,7 @@ static struct attribute *wdt_attrs[] = {
 	&dev_attr_bootstatus.attr,
 	&dev_attr_status.attr,
 	&dev_attr_nowayout.attr,
+	&dev_attr_pretimeout.attr,
 	NULL,
 };
 
-- 
2.5.0

  parent reply	other threads:[~2016-06-07 17:41 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
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 ` Vladimir Zapolskiy [this message]
2016-06-08  6:57   ` [PATCH v3 3/6] watchdog: add pretimeout read-only device attribute to sysfs 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=1465321127-19522-4-git-send-email-vladimir_zapolskiy@mentor.com \
    --to=vladimir_zapolskiy@mentor.com \
    --cc=b38343@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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).