Re: [PATCH] watchdog: fix nowayout setting in s3c2410_wdt

From: Wim Van Sebroeck
Date: Tue Nov 29 2011 - 05:01:22 EST


Hi Wolfram,

> > Set nowayout flag in probe function, otherwise option is useless.
> >
> > Signed-off-by: Marc Vertes <marc.vertes@xxxxxxxxxx>
>
> Similar as
>
> http://www.spinics.net/lists/linux-watchdog/msg00704.html
>
> which depends on
>
> http://www.spinics.net/lists/linux-watchdog/msg00703.html
>
> which has the advantage that it can be used for static initialization.

Hmm, I was more thinking about a wrapper function like the following:

diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 111843f..d8ef9b2 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -53,6 +53,8 @@ struct watchdog_info {

#ifdef __KERNEL__

+#include <linux/bitops.h>
+
#ifdef CONFIG_WATCHDOG_NOWAYOUT
#define WATCHDOG_NOWAYOUT 1
#else
@@ -122,6 +124,13 @@ struct watchdog_device {
#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
};

+/* Use the following function to set the nowayout feature */
+static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)
+{
+ if (nowayout)
+ set_bit(WDOG_NO_WAY_OUT, &wdd->status);
+}
+
/* Use the following functions to manipulate watchdog driver specific data */
static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
{

but: .status = WATCHDOG_NOWAYOUT_INIT_STATUS, is also a nice one to have.

I propose to add both options and to document them in the documentation.
Objections anyone?

Kind regards,
Wim.

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