All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Watchdog: Fix for settimeout issue
@ 2012-04-30  6:40 Ashish Jangam
  2012-05-23 18:36 ` Wim Van Sebroeck
  0 siblings, 1 reply; 3+ messages in thread
From: Ashish Jangam @ 2012-04-30  6:40 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: linux-kernel, linux-watchdog, Anthony Olech, sameo

Some devices have a fixed minimum elapse time and a ping before this
elapse time causes error condition. This patch fix this issue in the
settimeout operation.
---
 drivers/watchdog/watchdog_dev.c |    7 ++++++-
 include/linux/watchdog.h        |    3 +++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 8558da9..fb6076c 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -41,6 +41,7 @@
 #include <linux/miscdevice.h>	/* For handling misc devices */
 #include <linux/init.h>		/* For __init/__exit/... */
 #include <linux/uaccess.h>	/* For copy_to_user/put_user/... */
+#include <linux/delay.h>	/* For delay (like mdelay) */
 
 /* make sure we only register one /dev/watchdog device */
 static unsigned long watchdog_dev_busy;
@@ -228,7 +229,11 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
 			return err;
 		/* If the watchdog is active then we send a keepalive ping
 		 * to make sure that the watchdog keep's running (and if
-		 * possible that it takes the new timeout) */
+		 * possible that it takes the new timeout) Also we care
+		 * for watchdog which needs min elapse time before a ping.
+		 */
+		if (wdd->min_elapse_time)
+			mdelay(wdd->min_elapse_time);
 		watchdog_ping(wdd);
 		/* Fall */
 	case WDIOC_GETTIMEOUT:
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index ac40716..37d25b8 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -95,6 +95,8 @@ struct watchdog_ops {
  * @timeout:	The watchdog devices timeout value.
  * @min_timeout:The watchdog devices minimum timeout value.
  * @max_timeout:The watchdog devices maximum timeout value.
+ * @min_elapse_time: The watchdog devices minimum elapse time before
+ *		the ping.
  * @driver-data:Pointer to the drivers private data.
  * @status:	Field that contains the devices internal status bits.
  *
@@ -111,6 +113,7 @@ struct watchdog_device {
 	unsigned int timeout;
 	unsigned int min_timeout;
 	unsigned int max_timeout;
+	unsigned int min_elapse_time;
 	void *driver_data;
 	unsigned long status;
 /* Bit numbers for status flags */



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Watchdog: Fix for settimeout issue
  2012-04-30  6:40 [PATCH] Watchdog: Fix for settimeout issue Ashish Jangam
@ 2012-05-23 18:36 ` Wim Van Sebroeck
  2012-05-24 10:19   ` Ashish Jangam
  0 siblings, 1 reply; 3+ messages in thread
From: Wim Van Sebroeck @ 2012-05-23 18:36 UTC (permalink / raw)
  To: Ashish Jangam; +Cc: linux-kernel, linux-watchdog, Anthony Olech, sameo

Hi Ashish,

> Some devices have a fixed minimum elapse time and a ping before this
> elapse time causes error condition. This patch fix this issue in the
> settimeout operation.

Won't add this patch. The driver needs to take care of the mdelay.
PS: for da9052_wdt: start (=set_timeout) + ping will also give you
the same problem.

Kind regards,
Wim.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Watchdog: Fix for settimeout issue
  2012-05-23 18:36 ` Wim Van Sebroeck
@ 2012-05-24 10:19   ` Ashish Jangam
  0 siblings, 0 replies; 3+ messages in thread
From: Ashish Jangam @ 2012-05-24 10:19 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: linux-kernel, linux-watchdog, Anthony Olech, sameo

> -----Original Message-----
> From: wimvs@spo001.leaseweb.com [mailto:wimvs@spo001.leaseweb.com] On
> Behalf Of Wim Van Sebroeck
> Sent: Thursday, May 24, 2012 12:06 AM
> To: Ashish Jangam
> Cc: linux-kernel@vger.kernel.org; linux-watchdog@vger.kernel.org; Anthony
> Olech; sameo@linux.intel.com
> Subject: Re: [PATCH] Watchdog: Fix for settimeout issue
> 
> Hi Ashish,
> 
> > Some devices have a fixed minimum elapse time and a ping before this
> > elapse time causes error condition. This patch fix this issue in the
> > settimeout operation.
> 
> Won't add this patch. The driver needs to take care of the mdelay.
> PS: for da9052_wdt: start (=set_timeout) + ping will also give you
> the same problem.

Ok, re-sending the patch with this fix....Ashish
> 
> Kind regards,
> Wim.
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-24 10:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-30  6:40 [PATCH] Watchdog: Fix for settimeout issue Ashish Jangam
2012-05-23 18:36 ` Wim Van Sebroeck
2012-05-24 10:19   ` Ashish Jangam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.