watchdog: add f71862fg support
PATCH v3 2/3 watchdog: add f71862fg support
from: Lutz Ballaschke <[email protected]>
ioctl WDIOC_GETTIMELEFT and helper function added to watchdog driver for common usage.
Signed-off-by Lutz Ballaschke <[email protected]>
---
drivers/watchdog/f71808e_wdt.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
drivers/watchdog/f71808e_wdt.c +24 -0
@@ -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 ;
Quoted 12 lines · Lutz Ballaschke
ioctl
WDIOC_GETTIMELEFTand helper function added to watchdog driver for common usage.... snip ...
drivers/watchdog/f71808e_wdt.c +7
-0+static int watchdog_time_left (void ) +{ +int ret =0 ; + +mutex_lock (&watchdog.lock); + ret =superio_enter (watchdog.sioaddr); +if (ret)
drivers/watchdog/f71808e_wdt.c exit_unlock: · line 284
Quoted 10 lines
drivers/watchdog/f71808e_wdt.c +10
-0+ 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.
Signature · 7 lines
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