From: Oren Weil <oren.jer.weil@intel.com>
To: gregkh@suse.de
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
linux-watchdog@vger.kernel.org, alan@linux.intel.com,
wim@iguana.be, tomas.winkler@intel.com,
Oren Weil <oren.jer.weil@intel.com>
Subject: [PATCH 06/12] staging: mei: adding set_timeout watchdog function
Date: Wed, 31 Aug 2011 16:42:42 +0300 [thread overview]
Message-ID: <1314798168-15613-7-git-send-email-oren.jer.weil@intel.com> (raw)
In-Reply-To: <1314798168-15613-1-git-send-email-oren.jer.weil@intel.com>
add the ability to let the watchdog core set
the AMT watchdog timeout value.
the default value will be only set in the start function.
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
---
drivers/staging/mei/interface.h | 2 +-
drivers/staging/mei/main.c | 1 -
drivers/staging/mei/wd.c | 40 ++++++++++++++++++++++++++++++++++----
3 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/mei/interface.h b/drivers/staging/mei/interface.h
index 2b5a22c..7bd38ae 100644
--- a/drivers/staging/mei/interface.h
+++ b/drivers/staging/mei/interface.h
@@ -51,7 +51,7 @@ int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *cl);
int mei_wd_send(struct mei_device *dev);
int mei_wd_stop(struct mei_device *dev, bool preserve);
bool mei_wd_host_init(struct mei_device *dev);
-void mei_wd_start_setup(struct mei_device *dev);
+void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout);
int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl);
diff --git a/drivers/staging/mei/main.c b/drivers/staging/mei/main.c
index 60003cd..8d124724 100644
--- a/drivers/staging/mei/main.c
+++ b/drivers/staging/mei/main.c
@@ -1153,7 +1153,6 @@ static int mei_pci_resume(struct device *device)
/* Start watchdog if stopped in suspend */
if (dev->wd_timeout) {
- mei_wd_start_setup(dev);
dev->wd_due_counter = 1;
schedule_delayed_work(&dev->wd_work, HZ);
}
diff --git a/drivers/staging/mei/wd.c b/drivers/staging/mei/wd.c
index 0bb18dc..322f80d 100644
--- a/drivers/staging/mei/wd.c
+++ b/drivers/staging/mei/wd.c
@@ -51,12 +51,12 @@ const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89,
0x32, 0xAB);
-void mei_wd_start_setup(struct mei_device *dev)
+void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout)
{
- dev_dbg(&dev->pdev->dev, "dev->wd_timeout=%d.\n", dev->wd_timeout);
+ dev_dbg(&dev->pdev->dev, "timeout=%d.\n", timeout);
memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_PARAMS_SIZE);
memcpy(dev->wd_data + MEI_WD_PARAMS_SIZE,
- &dev->wd_timeout, sizeof(u16));
+ &timeout, sizeof(u16));
}
/**
@@ -75,7 +75,6 @@ bool mei_wd_host_init(struct mei_device *dev)
dev->wd_timeout = watchdog_timeout;
if (dev->wd_timeout > 0) {
- mei_wd_start_setup(dev);
/* find ME WD client */
mei_find_me_client_update_filext(dev, &dev->wd_cl,
&mei_wd_guid, MEI_WD_HOST_CLIENT_ID);
@@ -224,7 +223,7 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev)
goto end_unlock;
}
- mei_wd_start_setup(dev);
+ mei_wd_set_start_timeout(dev, dev->wd_timeout);
err = 0;
end_unlock:
@@ -306,6 +305,36 @@ end:
}
/*
+ * mei_wd_ops_set_timeout - wd set timeout command from the watchdog core.
+ *
+ * @wd_dev - watchdog device struct
+ * @timeout - timeout value to set
+ *
+ * returns 0 if success, negative errno code for failure
+ */
+static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout)
+{
+ struct mei_device *dev;
+ dev = pci_get_drvdata(mei_device);
+
+ if (!dev)
+ return -ENODEV;
+
+ /* Check Timeout value */
+ if (timeout < AMT_WD_MIN_TIMEOUT || timeout > AMT_WD_MAX_TIMEOUT)
+ return -EINVAL;
+
+ mutex_lock(&dev->device_lock);
+
+ dev->wd_timeout = timeout;
+ mei_wd_set_start_timeout(dev, dev->wd_timeout);
+
+ mutex_unlock(&dev->device_lock);
+
+ return 0;
+}
+
+/*
* Watchdog Device structs
*/
const struct watchdog_ops wd_ops = {
@@ -313,6 +342,7 @@ const struct watchdog_ops wd_ops = {
.start = mei_wd_ops_start,
.stop = mei_wd_ops_stop,
.ping = mei_wd_ops_ping,
+ .set_timeout = mei_wd_ops_set_timeout,
};
const struct watchdog_info wd_info = {
.identity = INTEL_AMT_WATCHDOG_ID,
--
1.7.4.1
next prev parent reply other threads:[~2011-08-31 13:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 13:42 [PATCH 00/12] staging: mei: adding new watchdog core support Oren Weil
2011-08-31 13:42 ` [PATCH 01/12] staging: mei: removing dependency between WD and AMTHI init function Oren Weil
2011-08-31 13:42 ` [PATCH 02/12] staging: mei: fix register access function comments Oren Weil
2011-08-31 13:42 ` [PATCH 03/12] staging: mei: registering the MEI driver with the kernel watchdog core interface Oren Weil
2011-08-31 13:42 ` [PATCH 04/12] staging: mei: adding watchdog ops Oren Weil
2011-08-31 13:42 ` [PATCH 05/12] staging: mei: adding watchdog ping Oren Weil
2011-08-31 16:52 ` Dan Carpenter
2011-09-06 23:48 ` Greg KH
2011-08-31 13:42 ` Oren Weil [this message]
2011-08-31 13:42 ` [PATCH 07/12] staging: mei: renaming delayed work field and function to a meaningful name Oren Weil
2011-08-31 13:42 ` [PATCH 08/12] staging: mei: resuming timer regardless of the watchdog timeout value Oren Weil
2011-08-31 13:42 ` [PATCH 09/12] stagign: mei: client init code cleanup Oren Weil
2011-08-31 13:42 ` [PATCH 10/12] staging: mei: removing wd module parameters Oren Weil
2011-08-31 13:42 ` [PATCH 11/12] staging: mei: adding mei_wd_stop function comment Oren Weil
2011-08-31 13:42 ` [PATCH 12/12] staging: mei: adding watchdog core dependency to kconfig Oren Weil
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=1314798168-15613-7-git-send-email-oren.jer.weil@intel.com \
--to=oren.jer.weil@intel.com \
--cc=alan@linux.intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=tomas.winkler@intel.com \
--cc=wim@iguana.be \
/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).