linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 2/3] watchdog: add f71862fg support
@ 2010-09-26 14:32 Lutz Ballaschke
  2010-09-26 15:19 ` Giel van Schijndel
  0 siblings, 1 reply; 2+ messages in thread
From: Lutz Ballaschke @ 2010-09-26 14:32 UTC (permalink / raw)
  To: Giel van Schijndel; +Cc: wim, linux-watchdog, linux-kernel

from: Lutz Ballaschke <vegan.grindcore@googlemail.com>

ioctl WDIOC_GETTIMELEFT and helper function added to watchdog driver 
for common usage.

Signed-off-by: Lutz Ballaschke <vegan.grindcore@googlemail.com>
---

 drivers/watchdog/f71808e_wdt.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)


diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c
index 546cef6..d070086 100644
--- a/drivers/watchdog/f71808e_wdt.c
+++ b/drivers/watchdog/f71808e_wdt.c
@@ -265,6 +265,24 @@ exit_unlock:
 	return err;
 }
 
+static int watchdog_time_left(void)
+{
+	int ret = 0;
+
+	mutex_lock(&watchdog.lock);
+	ret = superio_enter(watchdog.sioaddr);
+	if (ret)
+		goto exit_unlock;
+
+	superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT);
+	ret = superio_inb(watchdog.sioaddr, F71808FG_REG_WD_TIME);
+	superio_exit(watchdog.sioaddr);
+
+exit_unlock:
+	mutex_unlock(&watchdog.lock);
+	return ret;
+}
+
 static int watchdog_keepalive(void)
 {
 	int err = 0;
@@ -590,6 +608,12 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
 	case WDIOC_GETTIMEOUT:
 		return put_user(watchdog.timeout, uarg.i);
 
+	case WDIOC_GETTIMELEFT:
+		status = watchdog_time_left();
+		if (status < 0)
+			return status;
+		return put_user(status, uarg.i);
+
 	default:
 		return -ENOTTY;
 

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

* Re: [PATCHv3 2/3] watchdog: add f71862fg support
  2010-09-26 14:32 [PATCHv3 2/3] watchdog: add f71862fg support Lutz Ballaschke
@ 2010-09-26 15:19 ` Giel van Schijndel
  0 siblings, 0 replies; 2+ messages in thread
From: Giel van Schijndel @ 2010-09-26 15:19 UTC (permalink / raw)
  To: Lutz Ballaschke; +Cc: wim, linux-watchdog, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

On Sun, Sep 26, 2010 at 04:32:41PM +0200, Lutz Ballaschke wrote:
> ioctl WDIOC_GETTIMELEFT and helper function added to watchdog driver 
> for common usage.
> 
> ... snip ...
> 
> +static int watchdog_time_left(void)
> +{
> +	int ret = 0;
> +
> +	mutex_lock(&watchdog.lock);
> +	ret = superio_enter(watchdog.sioaddr);
> +	if (ret)
> +		goto exit_unlock;
> +
> +	superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT);
> +	ret = superio_inb(watchdog.sioaddr, F71808FG_REG_WD_TIME);
> +	superio_exit(watchdog.sioaddr);
> +
> +exit_unlock:
> +	mutex_unlock(&watchdog.lock);
> +	return ret;
> +}

This function still has the problem I described earlier, namely that of
returning minutes to userspace (which expects seconds) when minutes_mode
is true.

I would thus suggest not to commit this patch as it violates the
Watchdog API.

-- 
Met vriendelijke groet,
With kind regards,
Giel van Schijndel
--
"There are only two kinds of languages: the ones people complain about
 and the ones nobody uses."
  -- Bjarne Stroustrup

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2010-09-26 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-26 14:32 [PATCHv3 2/3] watchdog: add f71862fg support Lutz Ballaschke
2010-09-26 15:19 ` Giel van Schijndel

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).