Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 11/11] watchdog: WatchDog Timer Driver Core - Remove llseek

24 views
Skip to first unread message

Wim Van Sebroeck

unread,
Jul 11, 2011, 10:30:02 AM7/11/11
to
No need to set no_llseek any more since it's the default now.

Signed-off-by: Arnd Bergmann <ar...@arndb.de>
Signed-off-by: Wim Van Sebroeck <w...@iguana.be>
---
drivers/watchdog/watchdog_dev.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index f6aa4b5..30a1d36 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -338,7 +338,6 @@ static int watchdog_release(struct inode *inode, struct file *file)

static const struct file_operations watchdog_fops = {
.owner = THIS_MODULE,
- .llseek = no_llseek,
.write = watchdog_write,
.unlocked_ioctl = watchdog_ioctl,
.open = watchdog_open,
--
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Wim Van Sebroeck

unread,
Jul 11, 2011, 10:30:02 AM7/11/11
to
Add support for the nowayout feature to the
WatchDog Timer Driver Core framework.
This feature prevents the watchdog timer from being
stopped.

Signed-off-by: Alan Cox <al...@lxorguk.ukuu.org.uk>


Signed-off-by: Wim Van Sebroeck <w...@iguana.be>
---

Documentation/watchdog/watchdog-kernel-api.txt | 13 ++++++++-----
drivers/watchdog/watchdog_dev.c | 18 +++++++++++++-----
include/linux/watchdog.h | 1 +
3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt
index 8e5867c..fb53001 100644
--- a/Documentation/watchdog/watchdog-kernel-api.txt
+++ b/Documentation/watchdog/watchdog-kernel-api.txt
@@ -57,8 +57,8 @@ It contains following fields:
* priv: a pointer to the private data of a watchdog device
* status: this field contains a number of status bits that give extra
information about the status of the device (Like: is the watchdog timer
- running/active, is the device opened via the /dev/watchdog interface or not,
- ...)
+ running/active, is the nowayout bit set, is the device opened via
+ the /dev/watchdog interface or not, ...)

The list of watchdog operations is defined as:

@@ -128,7 +128,10 @@ bit-operations. The status bits that are defined are:
* WDOG_ALLOW_RELEASE: this bit stores whether or not the magic close character
has been sent (so that we can support the magic close feature).
(This bit should only be used by the WatchDog Timer Driver Core).
+* WDOG_NO_WAY_OUT: this bit stores the nowayout setting for the watchdog.
+ If this bit is set then the watchdog timer will not be able to stop.

-Note: The WatchDog Timer Driver Core supports the magic close feature. To use
-the magic close feature you must set the WDIOF_MAGICCLOSE bit in the options
-field of the watchdog's info structure.
+Note: The WatchDog Timer Driver Core supports the magic close feature and
+the nowayout feature. To use the magic close feature you must set the
+WDIOF_MAGICCLOSE bit in the options field of the watchdog's info structure.
+The nowayout feature will overrule the magic close feature.
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index c9ab89e..ca60bea 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -109,11 +109,18 @@ static int watchdog_start(struct watchdog_device *wddev)
* Stop the watchdog if it is still active and unmark it active.
* This function returns zero on success or a negative errno code for
* failure.
+ * If the 'nowayout' feature was set, the watchdog cannot be stopped.
*/

static int watchdog_stop(struct watchdog_device *wddev)
{
- int err;
+ int err = -EBUSY;
+
+ if (test_bit(WDOG_NO_WAY_OUT, &wdd->status)) {
+ pr_info("%s: nowayout prevents watchdog to be stopped!\n",
+ wdd->info->identity);
+ return err;
+ }

if (test_bit(WDOG_ACTIVE, &wdd->status)) {
err = wddev->ops->stop(wddev);
@@ -134,7 +141,7 @@ static int watchdog_stop(struct watchdog_device *wddev)
*
* A write to a watchdog device is defined as a keepalive ping.
* Writing the magic 'V' sequence allows the next close to turn
- * off the watchdog.
+ * off the watchdog (if 'nowayout' is not set).
*/

static ssize_t watchdog_write(struct file *file, const char __user *data,
@@ -284,8 +291,8 @@ out:
* @file: file handle to device
*
* This is the code for when /dev/watchdog gets closed. We will only
- * stop the watchdog when we have received the magic char, else the
- * watchdog will keep running.
+ * stop the watchdog when we have received the magic char (and nowayout
+ * was not set), else the watchdog will keep running.
*/



static int watchdog_release(struct inode *inode, struct file *file)

@@ -294,7 +301,8 @@ static int watchdog_release(struct inode *inode, struct file *file)

/*
* We only stop the watchdog if we received the magic character
- * or if WDIOF_MAGICCLOSE is not set
+ * or if WDIOF_MAGICCLOSE is not set. If nowayout was set then
+ * watchdog_stop will fail.
*/
if (test_and_clear_bit(WDOG_ALLOW_RELEASE, &wdd->status) ||
!(wdd->info->options & WDIOF_MAGICCLOSE))
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 8406ed5..aa54fb1 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -86,6 +86,7 @@ struct watchdog_device {
#define WDOG_ACTIVE 0 /* Is the watchdog running/active */
#define WDOG_DEV_OPEN 1 /* Opened via /dev/watchdog ? */
#define WDOG_ALLOW_RELEASE 2 /* Did we receive the magic char ? */
+#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
};

/* drivers/watchdog/core/watchdog_core.c */

Wolfram Sang

unread,
Jul 11, 2011, 5:40:02 PM7/11/11
to
On Mon, Jul 11, 2011 at 04:24:39PM +0200, Wim Van Sebroeck wrote:
> No need to set no_llseek any more since it's the default now.
>
> Signed-off-by: Arnd Bergmann <ar...@arndb.de>
> Signed-off-by: Wim Van Sebroeck <w...@iguana.be>

I'd think we can squash this into patch 1? Arnd?

> ---
> drivers/watchdog/watchdog_dev.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index f6aa4b5..30a1d36 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -338,7 +338,6 @@ static int watchdog_release(struct inode *inode, struct file *file)
>
> static const struct file_operations watchdog_fops = {
> .owner = THIS_MODULE,
> - .llseek = no_llseek,
> .write = watchdog_write,
> .unlocked_ioctl = watchdog_ioctl,
> .open = watchdog_open,
> --
> 1.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majo...@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |

signature.asc

Arnd Bergmann

unread,
Jul 11, 2011, 5:50:01 PM7/11/11
to
On Monday 11 July 2011, Wolfram Sang wrote:
> On Mon, Jul 11, 2011 at 04:24:39PM +0200, Wim Van Sebroeck wrote:
> > No need to set no_llseek any more since it's the default now.
> >
> > Signed-off-by: Arnd Bergmann <ar...@arndb.de>
> > Signed-off-by: Wim Van Sebroeck <w...@iguana.be>
>
> I'd think we can squash this into patch 1? Arnd?

Yes, certainly if you like.

Arnd

0 new messages