提交 0c06090c 编写于 作者: W Wim Van Sebroeck

[WATCHDOG] Coding style - Indentation - part 2

This brings the watchdog drivers into line with coding style.
This patch takes cares of the indentation as described in chapter 1.
Main changes:
* Re-structure the ioctl switch call for all drivers as follows:
	switch (cmd) {
	case WDIOC_GETSUPPORT:
	case WDIOC_GETSTATUS:
	case WDIOC_GETBOOTSTATUS:
	case WDIOC_GETTEMP:
	case WDIOC_SETOPTIONS:
	case WDIOC_KEEPALIVE:
	case WDIOC_SETTIMEOUT:
	case WDIOC_GETTIMEOUT:
	case WDIOC_GETTIMELEFT:
	default:
	}

This to make the migration from the drivers to the uniform watchdog
device driver easier in the future.
Signed-off-by: NWim Van Sebroeck <wim@iguana.be>
上级 5eb82498
...@@ -164,13 +164,6 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -164,13 +164,6 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
acq_keepalive();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
if (get_user(options, p)) if (get_user(options, p))
...@@ -185,6 +178,13 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -185,6 +178,13 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
acq_keepalive();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -152,19 +152,6 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -152,19 +152,6 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
advwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (advwdt_set_heartbeat(new_timeout))
return -EINVAL;
advwdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
...@@ -181,6 +168,19 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -181,6 +168,19 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
advwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (advwdt_set_heartbeat(new_timeout))
return -EINVAL;
advwdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -195,9 +195,6 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -195,9 +195,6 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
ali_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -214,6 +211,9 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -214,6 +211,9 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
ali_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
int new_timeout; int new_timeout;
......
...@@ -251,9 +251,6 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -251,9 +251,6 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -270,6 +267,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -270,6 +267,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
int new_timeout; int new_timeout;
......
...@@ -251,8 +251,6 @@ static long ar7_wdt_ioctl(struct file *file, ...@@ -251,8 +251,6 @@ static long ar7_wdt_ioctl(struct file *file,
int new_margin; int new_margin;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, if (copy_to_user((struct watchdog_info *)arg, &ident,
sizeof(ident))) sizeof(ident)))
...@@ -281,6 +279,8 @@ static long ar7_wdt_ioctl(struct file *file, ...@@ -281,6 +279,8 @@ static long ar7_wdt_ioctl(struct file *file,
if (put_user(margin, (int *)arg)) if (put_user(margin, (int *)arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
default:
return -ENOTTY;
} }
} }
......
...@@ -221,27 +221,10 @@ static long at32_wdt_ioctl(struct file *file, ...@@ -221,27 +221,10 @@ static long at32_wdt_ioctl(struct file *file,
int __user *p = argp; int __user *p = argp;
switch (cmd) { switch (cmd) {
case WDIOC_KEEPALIVE:
at32_wdt_pat();
ret = 0;
break;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
ret = copy_to_user(argp, &at32_wdt_info, ret = copy_to_user(argp, &at32_wdt_info,
sizeof(at32_wdt_info)) ? -EFAULT : 0; sizeof(at32_wdt_info)) ? -EFAULT : 0;
break; break;
case WDIOC_SETTIMEOUT:
ret = get_user(time, p);
if (ret)
break;
ret = at32_wdt_settimeout(time);
if (ret)
break;
/* Enable new time value */
at32_wdt_start();
/* fall through */
case WDIOC_GETTIMEOUT:
ret = put_user(wdt->timeout, p);
break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
ret = put_user(0, p); ret = put_user(0, p);
break; break;
...@@ -258,6 +241,23 @@ static long at32_wdt_ioctl(struct file *file, ...@@ -258,6 +241,23 @@ static long at32_wdt_ioctl(struct file *file,
at32_wdt_start(); at32_wdt_start();
ret = 0; ret = 0;
break; break;
case WDIOC_KEEPALIVE:
at32_wdt_pat();
ret = 0;
break;
case WDIOC_SETTIMEOUT:
ret = get_user(time, p);
if (ret)
break;
ret = at32_wdt_settimeout(time);
if (ret)
break;
/* Enable new time value */
at32_wdt_start();
/* fall through */
case WDIOC_GETTIMEOUT:
ret = put_user(wdt->timeout, p);
break;
} }
return ret; return ret;
......
...@@ -137,23 +137,9 @@ static long at91_wdt_ioct(struct file *file, ...@@ -137,23 +137,9 @@ static long at91_wdt_ioct(struct file *file,
int new_value; int new_value;
switch (cmd) { switch (cmd) {
case WDIOC_KEEPALIVE:
at91_wdt_reload(); /* pat the watchdog */
return 0;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &at91_wdt_info, return copy_to_user(argp, &at91_wdt_info,
sizeof(at91_wdt_info)) ? -EFAULT : 0; sizeof(at91_wdt_info)) ? -EFAULT : 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_value, p))
return -EFAULT;
if (at91_wdt_settimeout(new_value))
return -EINVAL;
/* Enable new time value */
at91_wdt_start();
/* Return current value */
return put_user(wdt_time, p);
case WDIOC_GETTIMEOUT:
return put_user(wdt_time, p);
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
...@@ -165,6 +151,20 @@ static long at91_wdt_ioct(struct file *file, ...@@ -165,6 +151,20 @@ static long at91_wdt_ioct(struct file *file,
if (new_value & WDIOS_ENABLECARD) if (new_value & WDIOS_ENABLECARD)
at91_wdt_start(); at91_wdt_start();
return 0; return 0;
case WDIOC_KEEPALIVE:
at91_wdt_reload(); /* pat the watchdog */
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_value, p))
return -EFAULT;
if (at91_wdt_settimeout(new_value))
return -EINVAL;
/* Enable new time value */
at91_wdt_start();
/* Return current value */
return put_user(wdt_time, p);
case WDIOC_GETTIMEOUT:
return put_user(wdt_time, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -265,20 +265,6 @@ static long bfin_wdt_ioctl(struct file *file, ...@@ -265,20 +265,6 @@ static long bfin_wdt_ioctl(struct file *file,
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p); return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
case WDIOC_KEEPALIVE:
bfin_wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: {
int new_timeout;
if (get_user(new_timeout, p))
return -EFAULT;
if (bfin_wdt_set_timeout(new_timeout))
return -EINVAL;
}
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS: { case WDIOC_SETOPTIONS: {
unsigned long flags; unsigned long flags;
int options, ret = -EINVAL; int options, ret = -EINVAL;
...@@ -298,6 +284,20 @@ static long bfin_wdt_ioctl(struct file *file, ...@@ -298,6 +284,20 @@ static long bfin_wdt_ioctl(struct file *file,
spin_unlock_irqrestore(&bfin_wdt_spinlock, flags); spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
return ret; return ret;
} }
case WDIOC_KEEPALIVE:
bfin_wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: {
int new_timeout;
if (get_user(new_timeout, p))
return -EFAULT;
if (bfin_wdt_set_timeout(new_timeout))
return -EINVAL;
}
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -99,6 +99,15 @@ static long booke_wdt_ioctl(struct file *file, ...@@ -99,6 +99,15 @@ static long booke_wdt_ioctl(struct file *file,
tmp = mfspr(SPRN_TSR) & TSR_WRS(3); tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
/* returns 1 if last reset was caused by the WDT */ /* returns 1 if last reset was caused by the WDT */
return (tmp ? 1 : 0); return (tmp ? 1 : 0);
case WDIOC_SETOPTIONS:
if (get_user(tmp, p))
return -EINVAL;
if (tmp == WDIOS_ENABLECARD) {
booke_wdt_ping();
break;
} else
return -EINVAL;
return 0;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
booke_wdt_ping(); booke_wdt_ping();
return 0; return 0;
...@@ -110,15 +119,6 @@ static long booke_wdt_ioctl(struct file *file, ...@@ -110,15 +119,6 @@ static long booke_wdt_ioctl(struct file *file,
return 0; return 0;
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(booke_wdt_period, p); return put_user(booke_wdt_period, p);
case WDIOC_SETOPTIONS:
if (get_user(tmp, p))
return -EINVAL;
if (tmp == WDIOS_ENABLECARD) {
booke_wdt_ping();
break;
} else
return -EINVAL;
return 0;
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -160,8 +160,9 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -160,8 +160,9 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
}; };
switch (cmd) { switch (cmd) {
case WDIOC_KEEPALIVE: case WDIOC_GETSUPPORT:
cpu5wdt_reset(); if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
value = inb(port + CPU5WDT_STATUS_REG); value = inb(port + CPU5WDT_STATUS_REG);
...@@ -169,10 +170,6 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -169,10 +170,6 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
return put_user(value, p); return put_user(value, p);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(value, p)) if (get_user(value, p))
return -EFAULT; return -EFAULT;
...@@ -181,6 +178,9 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -181,6 +178,9 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
if (value & WDIOS_DISABLECARD) if (value & WDIOS_DISABLECARD)
cpu5wdt_stop(); cpu5wdt_stop();
break; break;
case WDIOC_KEEPALIVE:
cpu5wdt_reset();
break;
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -159,14 +159,14 @@ static long davinci_wdt_ioctl(struct file *file, ...@@ -159,14 +159,14 @@ static long davinci_wdt_ioctl(struct file *file,
ret = put_user(0, (int *)arg); ret = put_user(0, (int *)arg);
break; break;
case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg);
break;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_service(); wdt_service();
ret = 0; ret = 0;
break; break;
case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg);
break;
} }
return ret; return ret;
} }
......
...@@ -155,15 +155,15 @@ static long ep93xx_wdt_ioctl(struct file *file, ...@@ -155,15 +155,15 @@ static long ep93xx_wdt_ioctl(struct file *file,
ret = put_user(boot_status, (int __user *)arg); ret = put_user(boot_status, (int __user *)arg);
break; break;
case WDIOC_GETTIMEOUT:
/* actually, it is 0.250 seconds.... */
ret = put_user(1, (int __user *)arg);
break;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_keepalive(); wdt_keepalive();
ret = 0; ret = 0;
break; break;
case WDIOC_GETTIMEOUT:
/* actually, it is 0.250 seconds.... */
ret = put_user(1, (int __user *)arg);
break;
} }
return ret; return ret;
} }
......
...@@ -249,9 +249,6 @@ static long eurwdt_ioctl(struct file *file, ...@@ -249,9 +249,6 @@ static long eurwdt_ioctl(struct file *file,
int options, retval = -EINVAL; int options, retval = -EINVAL;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
...@@ -259,6 +256,22 @@ static long eurwdt_ioctl(struct file *file, ...@@ -259,6 +256,22 @@ static long eurwdt_ioctl(struct file *file,
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_SETOPTIONS:
if (get_user(options, p))
return -EFAULT;
spin_lock(&eurwdt_lock);
if (options & WDIOS_DISABLECARD) {
eurwdt_disable_timer();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
eurwdt_activate_timer();
eurwdt_ping();
retval = 0;
}
spin_unlock(&eurwdt_lock);
return retval;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
spin_lock(&eurwdt_lock); spin_lock(&eurwdt_lock);
eurwdt_ping(); eurwdt_ping();
...@@ -282,21 +295,8 @@ static long eurwdt_ioctl(struct file *file, ...@@ -282,21 +295,8 @@ static long eurwdt_ioctl(struct file *file,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(eurwdt_timeout, p); return put_user(eurwdt_timeout, p);
case WDIOC_SETOPTIONS: default:
if (get_user(options, p)) return -ENOTTY;
return -EFAULT;
spin_lock(&eurwdt_lock);
if (options & WDIOS_DISABLECARD) {
eurwdt_disable_timer();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
eurwdt_activate_timer();
eurwdt_ping();
retval = 0;
}
spin_unlock(&eurwdt_lock);
return retval;
} }
} }
......
...@@ -159,22 +159,6 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -159,22 +159,6 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
geodewdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(interval, p))
return -EFAULT;
if (geodewdt_set_heartbeat(interval))
return -EINVAL;
/* Fall through */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, ret = -EINVAL; int options, ret = -EINVAL;
...@@ -194,6 +178,20 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -194,6 +178,20 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
return ret; return ret;
} }
case WDIOC_KEEPALIVE:
geodewdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(interval, p))
return -EFAULT;
if (geodewdt_set_heartbeat(interval))
return -EINVAL;
/* Fall through */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -280,10 +280,6 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -280,10 +280,6 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(triggered, p); return put_user(triggered, p);
case WDIOC_KEEPALIVE:
esb_timer_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
if (get_user(new_options, p)) if (get_user(new_options, p))
...@@ -301,6 +297,10 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -301,6 +297,10 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
esb_timer_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
if (get_user(new_heartbeat, p)) if (get_user(new_heartbeat, p))
......
...@@ -532,10 +532,6 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -532,10 +532,6 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
iTCO_wdt_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
if (get_user(new_options, p)) if (get_user(new_options, p))
...@@ -552,6 +548,10 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -552,6 +548,10 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd,
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
iTCO_wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
if (get_user(new_heartbeat, p)) if (get_user(new_heartbeat, p))
......
...@@ -213,21 +213,6 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -213,21 +213,6 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
ibwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_margin, p))
return -EFAULT;
if (ibwdt_set_heartbeat(new_margin))
return -EINVAL;
ibwdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(wd_times[wd_margin], p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
...@@ -245,6 +230,21 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -245,6 +230,21 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
ibwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_margin, p))
return -EFAULT;
if (ibwdt_set_heartbeat(new_margin))
return -EINVAL;
ibwdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(wd_times[wd_margin], p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -287,16 +287,6 @@ static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -287,16 +287,6 @@ static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
asr_toggle();
return 0;
/*
* The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
* and WDIOC_GETTIMEOUT always returns 256.
*/
case WDIOC_GETTIMEOUT:
heartbeat = 256;
return put_user(heartbeat, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -313,6 +303,16 @@ static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -313,6 +303,16 @@ static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
asr_toggle();
return 0;
/*
* The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
* and WDIOC_GETTIMEOUT always returns 256.
*/
case WDIOC_GETTIMEOUT:
heartbeat = 256;
return put_user(heartbeat, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -128,11 +128,6 @@ static long indydog_ioctl(struct file *file, unsigned int cmd, ...@@ -128,11 +128,6 @@ static long indydog_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, (int *)arg);
case WDIOC_KEEPALIVE:
indydog_ping();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_TIMEOUT, (int *)arg);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
if (get_user(options, (int *)arg)) if (get_user(options, (int *)arg))
...@@ -147,6 +142,11 @@ static long indydog_ioctl(struct file *file, unsigned int cmd, ...@@ -147,6 +142,11 @@ static long indydog_ioctl(struct file *file, unsigned int cmd,
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
indydog_ping();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_TIMEOUT, (int *)arg);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -153,15 +153,6 @@ static long iop_wdt_ioctl(struct file *file, ...@@ -153,15 +153,6 @@ static long iop_wdt_ioctl(struct file *file,
ret = put_user(boot_status, argp); ret = put_user(boot_status, argp);
break; break;
case WDIOC_GETTIMEOUT:
ret = put_user(iop_watchdog_timeout(), argp);
break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(options, (int *)arg)) if (get_user(options, (int *)arg))
return -EFAULT; return -EFAULT;
...@@ -181,6 +172,15 @@ static long iop_wdt_ioctl(struct file *file, ...@@ -181,6 +172,15 @@ static long iop_wdt_ioctl(struct file *file,
ret = 0; ret = 0;
} }
break; break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
case WDIOC_GETTIMEOUT:
ret = put_user(iop_watchdog_timeout(), argp);
break;
} }
return ret; return ret;
} }
......
...@@ -244,8 +244,6 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -244,8 +244,6 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
int value; int value;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident))) if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT; return -EFAULT;
...@@ -284,6 +282,8 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -284,6 +282,8 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
if (put_user(margin, p)) if (put_user(margin, p))
return -EFAULT; return -EFAULT;
return 0; return 0;
default:
return -ENOTTY;
} }
} }
......
...@@ -126,6 +126,11 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -126,6 +126,11 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
ret = put_user(0, (int *)arg); ret = put_user(0, (int *)arg);
break; break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
ret = get_user(time, (int *)arg); ret = get_user(time, (int *)arg);
if (ret) if (ret)
...@@ -143,11 +148,6 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -143,11 +148,6 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg); ret = put_user(heartbeat, (int *)arg);
break; break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
} }
return ret; return ret;
......
...@@ -117,6 +117,11 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -117,6 +117,11 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
ret = put_user(boot_status, (int *)arg); ret = put_user(boot_status, (int *)arg);
break; break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
ret = get_user(time, (int *)arg); ret = get_user(time, (int *)arg);
if (ret) if (ret)
...@@ -134,11 +139,6 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -134,11 +139,6 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg); ret = put_user(heartbeat, (int *)arg);
break; break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
} }
return ret; return ret;
} }
......
...@@ -161,23 +161,9 @@ static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -161,23 +161,9 @@ static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd,
int new_value; int new_value;
switch (cmd) { switch (cmd) {
case WDIOC_KEEPALIVE:
ks8695_wdt_reload(); /* pat the watchdog */
return 0;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ks8695_wdt_info, return copy_to_user(argp, &ks8695_wdt_info,
sizeof(ks8695_wdt_info)) ? -EFAULT : 0; sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_value, p))
return -EFAULT;
if (ks8695_wdt_settimeout(new_value))
return -EINVAL;
/* Enable new time value */
ks8695_wdt_start();
/* Return current value */
return put_user(wdt_time, p);
case WDIOC_GETTIMEOUT:
return put_user(wdt_time, p);
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
...@@ -189,6 +175,20 @@ static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -189,6 +175,20 @@ static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd,
if (new_value & WDIOS_ENABLECARD) if (new_value & WDIOS_ENABLECARD)
ks8695_wdt_start(); ks8695_wdt_start();
return 0; return 0;
case WDIOC_KEEPALIVE:
ks8695_wdt_reload(); /* pat the watchdog */
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_value, p))
return -EFAULT;
if (ks8695_wdt_settimeout(new_value))
return -EINVAL;
/* Enable new time value */
ks8695_wdt_start();
/* Return current value */
return put_user(wdt_time, p);
case WDIOC_GETTIMEOUT:
return put_user(wdt_time, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -208,6 +208,10 @@ static long mixcomwd_ioctl(struct file *file, ...@@ -208,6 +208,10 @@ static long mixcomwd_ioctl(struct file *file,
}; };
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
status = mixcomwd_opened; status = mixcomwd_opened;
if (!nowayout) if (!nowayout)
...@@ -215,10 +219,6 @@ static long mixcomwd_ioctl(struct file *file, ...@@ -215,10 +219,6 @@ static long mixcomwd_ioctl(struct file *file,
return put_user(status, p); return put_user(status, p);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
mixcomwd_ping(); mixcomwd_ping();
break; break;
......
...@@ -243,6 +243,12 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -243,6 +243,12 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
ret = 0; ret = 0;
break; break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
uarg.i = 0;
ret = 0;
break;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
ret = -EINVAL; ret = -EINVAL;
if (uarg.i & WDIOS_DISABLECARD) { if (uarg.i & WDIOS_DISABLECARD) {
...@@ -255,12 +261,6 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -255,12 +261,6 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
} }
break; break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
uarg.i = 0;
ret = 0;
break;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
mpcore_wdt_keepalive(wdt); mpcore_wdt_keepalive(wdt);
ret = 0; ret = 0;
......
...@@ -148,17 +148,14 @@ static long mtx1_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -148,17 +148,14 @@ static long mtx1_wdt_ioctl(struct file *file, unsigned int cmd,
}; };
switch (cmd) { switch (cmd) {
case WDIOC_KEEPALIVE: case WDIOC_GETSUPPORT:
mtx1_wdt_reset(); if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
put_user(0, p); put_user(0, p);
break; break;
case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(value, p)) if (get_user(value, p))
return -EFAULT; return -EFAULT;
...@@ -169,6 +166,9 @@ static long mtx1_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -169,6 +166,9 @@ static long mtx1_wdt_ioctl(struct file *file, unsigned int cmd,
else else
return -EINVAL; return -EINVAL;
return 0; return 0;
case WDIOC_KEEPALIVE:
mtx1_wdt_reset();
break;
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -197,8 +197,6 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -197,8 +197,6 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
}; };
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info __user *)arg, &ident, return copy_to_user((struct watchdog_info __user *)arg, &ident,
sizeof(ident)); sizeof(ident));
...@@ -231,6 +229,8 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -231,6 +229,8 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timer_margin, (int __user *)arg); return put_user(timer_margin, (int __user *)arg);
default:
return -ENOTTY;
} }
} }
......
...@@ -426,6 +426,21 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, ...@@ -426,6 +426,21 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd,
return put_user(pc87413_status(), uarg.i); return put_user(pc87413_status(), uarg.i);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, uarg.i); return put_user(0, uarg.i);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, uarg.i))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
pc87413_disable();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
pc87413_enable();
retval = 0;
}
return retval;
}
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
pc87413_refresh(); pc87413_refresh();
#ifdef DEBUG #ifdef DEBUG
...@@ -445,21 +460,6 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, ...@@ -445,21 +460,6 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
new_timeout = timeout * 60; new_timeout = timeout * 60;
return put_user(new_timeout, uarg.i); return put_user(new_timeout, uarg.i);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, uarg.i))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
pc87413_disable();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
pc87413_enable();
retval = 0;
}
return retval;
}
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -612,9 +612,6 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -612,9 +612,6 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}; };
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident))) if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT; return -EFAULT;
...@@ -669,6 +666,9 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -669,6 +666,9 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, argp); return put_user(heartbeat, argp);
default:
return -ENOTTY;
} }
return 0; return 0;
......
...@@ -494,10 +494,6 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, ...@@ -494,10 +494,6 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
return put_user(temperature, p); return put_user(temperature, p);
} }
case WDIOC_KEEPALIVE:
pcipcwd_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -525,6 +521,10 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, ...@@ -525,6 +521,10 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
pcipcwd_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
int new_heartbeat; int new_heartbeat;
......
...@@ -400,10 +400,6 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, ...@@ -400,10 +400,6 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
return put_user(temperature, p); return put_user(temperature, p);
} }
case WDIOC_KEEPALIVE:
usb_pcwd_keepalive(usb_pcwd_device);
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -424,6 +420,10 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, ...@@ -424,6 +420,10 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
usb_pcwd_keepalive(usb_pcwd_device);
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
int new_heartbeat; int new_heartbeat;
......
...@@ -194,6 +194,11 @@ static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file, ...@@ -194,6 +194,11 @@ static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
ret = put_user(boot_status, (int *)arg); ret = put_user(boot_status, (int *)arg);
break; break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
ret = get_user(time, (int *)arg); ret = get_user(time, (int *)arg);
if (ret) if (ret)
...@@ -211,11 +216,6 @@ static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file, ...@@ -211,11 +216,6 @@ static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg); ret = put_user(heartbeat, (int *)arg);
break; break;
case WDIOC_KEEPALIVE:
wdt_enable();
ret = 0;
break;
} }
return ret; return ret;
} }
......
...@@ -305,8 +305,6 @@ static long s3c2410wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -305,8 +305,6 @@ static long s3c2410wdt_ioctl(struct file *file, unsigned int cmd,
int new_margin; int new_margin;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &s3c2410_wdt_ident, return copy_to_user(argp, &s3c2410_wdt_ident,
sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0; sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0;
...@@ -325,6 +323,8 @@ static long s3c2410wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -325,6 +323,8 @@ static long s3c2410wdt_ioctl(struct file *file, unsigned int cmd,
return put_user(tmr_margin, p); return put_user(tmr_margin, p);
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(tmr_margin, p); return put_user(tmr_margin, p);
default:
return -ENOTTY;
} }
} }
......
...@@ -107,6 +107,11 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd, ...@@ -107,6 +107,11 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
ret = put_user(boot_status, p); ret = put_user(boot_status, p);
break; break;
case WDIOC_KEEPALIVE:
OSMR3 = OSCR + pre_margin;
ret = 0;
break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
ret = get_user(time, p); ret = get_user(time, p);
if (ret) if (ret)
...@@ -124,11 +129,6 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd, ...@@ -124,11 +129,6 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
ret = put_user(pre_margin / OSCR_FREQ, p); ret = put_user(pre_margin / OSCR_FREQ, p);
break; break;
case WDIOC_KEEPALIVE:
OSMR3 = OSCR + pre_margin;
ret = 0;
break;
} }
return ret; return ret;
} }
......
...@@ -182,6 +182,11 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd, ...@@ -182,6 +182,11 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
ret = put_user(0, p); ret = put_user(0, p);
break; break;
case WDIOC_KEEPALIVE:
sbwdog_pet(user_dog);
ret = 0;
break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
ret = get_user(time, p); ret = get_user(time, p);
if (ret) if (ret)
...@@ -203,11 +208,6 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd, ...@@ -203,11 +208,6 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
*/ */
ret = put_user(__raw_readq(user_dog - 8) / 1000000, p); ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
break; break;
case WDIOC_KEEPALIVE:
sbwdog_pet(user_dog);
ret = 0;
break;
} }
return ret; return ret;
} }
......
...@@ -237,16 +237,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -237,16 +237,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}; };
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident))? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident))? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -262,6 +257,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -262,6 +257,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
int new_timeout; int new_timeout;
...@@ -277,6 +275,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -277,6 +275,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, p); return put_user(timeout, p);
default:
return -ENOTTY;
} }
} }
......
...@@ -177,39 +177,41 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -177,39 +177,41 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int __user *)arg); return put_user(0, (int __user *)arg);
case WDIOC_KEEPALIVE: case WDIOC_SETOPTIONS:
wdt_keepalive(); {
return 0; int options;
case WDIOC_SETOPTIONS:{ int retval = -EINVAL;
int options;
int retval = -EINVAL;
if (get_user(options, (int __user *)arg)) if (get_user(options, (int __user *)arg))
return -EFAULT; return -EFAULT;
if (options & WDIOS_DISABLECARD) { if (options & WDIOS_DISABLECARD) {
wdt_disable(); wdt_disable();
retval = 0; retval = 0;
} }
if (options & WDIOS_ENABLECARD) {
wdt_enable();
retval = 0;
}
return retval; if (options & WDIOS_ENABLECARD) {
wdt_enable();
retval = 0;
} }
case WDIOC_SETTIMEOUT:{
int new_timeout;
if (get_user(new_timeout, (int __user *)arg)) return retval;
return -EFAULT; }
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT:
{
int new_timeout;
if (wdt_set_timeout(new_timeout)) if (get_user(new_timeout, (int __user *)arg))
return -EINVAL; return -EFAULT;
/* Fall through */ if (wdt_set_timeout(new_timeout))
} return -EINVAL;
/* Fall through */
}
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int __user *)arg); return put_user(timeout, (int __user *)arg);
default: default:
......
...@@ -120,11 +120,6 @@ static long epx_c3_ioctl(struct file *file, unsigned int cmd, ...@@ -120,11 +120,6 @@ static long epx_c3_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, argp); return put_user(0, argp);
case WDIOC_KEEPALIVE:
epx_c3_pet();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_TIMEOUT, argp);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(options, argp)) if (get_user(options, argp))
return -EFAULT; return -EFAULT;
...@@ -140,6 +135,11 @@ static long epx_c3_ioctl(struct file *file, unsigned int cmd, ...@@ -140,6 +135,11 @@ static long epx_c3_ioctl(struct file *file, unsigned int cmd,
} }
return retval; return retval;
case WDIOC_KEEPALIVE:
epx_c3_pet();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_TIMEOUT, argp);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -207,24 +207,6 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -207,24 +207,6 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
sc1200wdt_write_data(WDTO, timeout);
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
/* the API states this is given in secs */
new_timeout /= 60;
if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
return -EINVAL;
timeout = new_timeout;
sc1200wdt_write_data(WDTO, timeout);
/* fall through and return the new timeout */
case WDIOC_GETTIMEOUT:
return put_user(timeout * 60, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
...@@ -244,6 +226,24 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -244,6 +226,24 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
sc1200wdt_write_data(WDTO, timeout);
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
/* the API states this is given in secs */
new_timeout /= 60;
if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
return -EINVAL;
timeout = new_timeout;
sc1200wdt_write_data(WDTO, timeout);
/* fall through and return the new timeout */
case WDIOC_GETTIMEOUT:
return put_user(timeout * 60, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -291,16 +291,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -291,16 +291,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}; };
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -320,6 +315,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -320,6 +315,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
int new_timeout; int new_timeout;
...@@ -335,6 +333,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -335,6 +333,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, p); return put_user(timeout, p);
default:
return -ENOTTY;
} }
} }
......
...@@ -168,8 +168,6 @@ static long scx200_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -168,8 +168,6 @@ static long scx200_wdt_ioctl(struct file *file, unsigned int cmd,
int new_margin; int new_margin;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident))) if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT; return -EFAULT;
...@@ -194,6 +192,8 @@ static long scx200_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -194,6 +192,8 @@ static long scx200_wdt_ioctl(struct file *file, unsigned int cmd,
if (put_user(margin, p)) if (put_user(margin, p))
return -EFAULT; return -EFAULT;
return 0; return 0;
default:
return -ENOTTY;
} }
} }
......
...@@ -351,20 +351,6 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -351,20 +351,6 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, (int *)arg);
case WDIOC_KEEPALIVE:
sh_wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_heartbeat, (int *)arg))
return -EFAULT;
if (sh_wdt_set_heartbeat(new_heartbeat))
return -EINVAL;
sh_wdt_keepalive();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(options, (int *)arg)) if (get_user(options, (int *)arg))
return -EFAULT; return -EFAULT;
...@@ -380,6 +366,20 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -380,6 +366,20 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd,
} }
return retval; return retval;
case WDIOC_KEEPALIVE:
sh_wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_heartbeat, (int *)arg))
return -EFAULT;
if (sh_wdt_set_heartbeat(new_heartbeat))
return -EINVAL;
sh_wdt_keepalive();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -451,6 +451,23 @@ static long wb_smsc_wdt_ioctl(struct file *file, ...@@ -451,6 +451,23 @@ static long wb_smsc_wdt_ioctl(struct file *file,
return put_user(wb_smsc_wdt_status(), uarg.i); return put_user(wb_smsc_wdt_status(), uarg.i);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, uarg.i); return put_user(0, uarg.i);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, uarg.i))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
wb_smsc_wdt_disable();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
wb_smsc_wdt_enable();
retval = 0;
}
return retval;
}
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wb_smsc_wdt_reset_timer(); wb_smsc_wdt_reset_timer();
return 0; return 0;
...@@ -470,23 +487,6 @@ static long wb_smsc_wdt_ioctl(struct file *file, ...@@ -470,23 +487,6 @@ static long wb_smsc_wdt_ioctl(struct file *file,
if (unit == UNIT_MINUTE) if (unit == UNIT_MINUTE)
new_timeout *= 60; new_timeout *= 60;
return put_user(new_timeout, uarg.i); return put_user(new_timeout, uarg.i);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, uarg.i))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
wb_smsc_wdt_disable();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
wb_smsc_wdt_enable();
retval = 0;
}
return retval;
}
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -206,8 +206,6 @@ static long softdog_ioctl(struct file *file, unsigned int cmd, ...@@ -206,8 +206,6 @@ static long softdog_ioctl(struct file *file, unsigned int cmd,
.identity = "Software Watchdog", .identity = "Software Watchdog",
}; };
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
...@@ -225,6 +223,8 @@ static long softdog_ioctl(struct file *file, unsigned int cmd, ...@@ -225,6 +223,8 @@ static long softdog_ioctl(struct file *file, unsigned int cmd,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(soft_margin, p); return put_user(soft_margin, p);
default:
return -ENOTTY;
} }
} }
......
...@@ -142,8 +142,6 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -142,8 +142,6 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd,
}; };
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
...@@ -163,6 +161,8 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -163,6 +161,8 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, p); return put_user(timeout, p);
default:
return -ENOTTY;
} }
} }
......
...@@ -211,18 +211,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -211,18 +211,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (wdt_set_heartbeat(new_timeout))
return -EINVAL;
wdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
...@@ -239,6 +227,18 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -239,6 +227,18 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
wdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (wdt_set_heartbeat(new_timeout))
return -EINVAL;
wdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -251,21 +251,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -251,21 +251,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (wdt_set_heartbeat(new_timeout))
return -EINVAL;
wdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
...@@ -286,6 +271,21 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -286,6 +271,21 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
wdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (wdt_set_heartbeat(new_timeout))
return -EINVAL;
wdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -254,16 +254,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -254,16 +254,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}; };
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
...@@ -283,6 +278,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -283,6 +278,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
int new_timeout; int new_timeout;
...@@ -300,6 +298,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -300,6 +298,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, p); return put_user(timeout, p);
default:
return -ENOTTY;
} }
} }
......
...@@ -390,9 +390,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -390,9 +390,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
uarg.i = (int __user *)arg; uarg.i = (int __user *)arg;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(uarg.ident, &ident, return copy_to_user(uarg.ident, &ident,
sizeof(ident)) ? -EFAULT : 0; sizeof(ident)) ? -EFAULT : 0;
...@@ -404,10 +401,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -404,10 +401,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, uarg.i); return put_user(0, uarg.i);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(new_options, uarg.i)) if (get_user(new_options, uarg.i))
return -EFAULT; return -EFAULT;
...@@ -424,6 +417,10 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -424,6 +417,10 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return retval; return retval;
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, uarg.i)) if (get_user(new_timeout, uarg.i))
return -EFAULT; return -EFAULT;
...@@ -437,6 +434,9 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -437,6 +434,9 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, uarg.i); return put_user(timeout, uarg.i);
default:
return -ENOTTY;
} }
} }
......
...@@ -145,22 +145,6 @@ static long wafwdt_ioctl(struct file *file, unsigned int cmd, ...@@ -145,22 +145,6 @@ static long wafwdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, p); return put_user(0, p);
case WDIOC_KEEPALIVE:
wafwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if ((new_timeout < 1) || (new_timeout > 255))
return -EINVAL;
timeout = new_timeout;
wafwdt_stop();
wafwdt_start();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
...@@ -181,6 +165,22 @@ static long wafwdt_ioctl(struct file *file, unsigned int cmd, ...@@ -181,6 +165,22 @@ static long wafwdt_ioctl(struct file *file, unsigned int cmd,
return retval; return retval;
} }
case WDIOC_KEEPALIVE:
wafwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if ((new_timeout < 1) || (new_timeout > 255))
return -EINVAL;
timeout = new_timeout;
wafwdt_stop();
wafwdt_start();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -373,8 +373,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -373,8 +373,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
#endif /* CONFIG_WDT_501 */ #endif /* CONFIG_WDT_501 */
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
...@@ -394,6 +392,8 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -394,6 +392,8 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, p); return put_user(heartbeat, p);
default:
return -ENOTTY;
} }
} }
......
...@@ -365,9 +365,6 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd, ...@@ -365,9 +365,6 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
uarg.i = (int __user *)arg; uarg.i = (int __user *)arg;
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(uarg.ident, &ident, return copy_to_user(uarg.ident, &ident,
sizeof(ident)) ? -EFAULT : 0; sizeof(ident)) ? -EFAULT : 0;
...@@ -379,10 +376,6 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd, ...@@ -379,10 +376,6 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, uarg.i); return put_user(0, uarg.i);
case WDIOC_KEEPALIVE:
wdt977_keepalive();
return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(new_options, uarg.i)) if (get_user(new_options, uarg.i))
return -EFAULT; return -EFAULT;
...@@ -399,6 +392,10 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd, ...@@ -399,6 +392,10 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
return retval; return retval;
case WDIOC_KEEPALIVE:
wdt977_keepalive();
return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, uarg.i)) if (get_user(new_timeout, uarg.i))
return -EFAULT; return -EFAULT;
...@@ -412,6 +409,9 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd, ...@@ -412,6 +409,9 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, uarg.i); return put_user(timeout, uarg.i);
default:
return -ENOTTY;
} }
} }
......
...@@ -428,8 +428,6 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd, ...@@ -428,8 +428,6 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd,
#endif /* CONFIG_WDT_501_PCI */ #endif /* CONFIG_WDT_501_PCI */
switch (cmd) { switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
...@@ -449,7 +447,9 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd, ...@@ -449,7 +447,9 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, p); return put_user(heartbeat, p);
} default:
return -ENOTTY;
}
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册