aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/acquirewdt.c14
-rw-r--r--drivers/watchdog/advantechwdt.c26
-rw-r--r--drivers/watchdog/alim1535_wdt.c6
-rw-r--r--drivers/watchdog/alim7101_wdt.c6
-rw-r--r--drivers/watchdog/ar7_wdt.c4
-rw-r--r--drivers/watchdog/at32ap700x_wdt.c34
-rw-r--r--drivers/watchdog/at91rm9200_wdt.c28
-rw-r--r--drivers/watchdog/bfin_wdt.c28
-rw-r--r--drivers/watchdog/booke_wdt.c18
-rw-r--r--drivers/watchdog/cpu5wdt.c12
-rw-r--r--drivers/watchdog/davinci_wdt.c8
-rw-r--r--drivers/watchdog/ep93xx_wdt.c10
-rw-r--r--drivers/watchdog/eurotechwdt.c36
-rw-r--r--drivers/watchdog/geodewdt.c30
-rw-r--r--drivers/watchdog/i6300esb.c8
-rw-r--r--drivers/watchdog/iTCO_wdt.c8
-rw-r--r--drivers/watchdog/ib700wdt.c30
-rw-r--r--drivers/watchdog/ibmasr.c20
-rw-r--r--drivers/watchdog/indydog.c10
-rw-r--r--drivers/watchdog/iop_wdt.c18
-rw-r--r--drivers/watchdog/it8712f_wdt.c4
-rw-r--r--drivers/watchdog/ixp2000_wdt.c10
-rw-r--r--drivers/watchdog/ixp4xx_wdt.c10
-rw-r--r--drivers/watchdog/ks8695_wdt.c28
-rw-r--r--drivers/watchdog/mixcomwd.c8
-rw-r--r--drivers/watchdog/mpcore_wdt.c12
-rw-r--r--drivers/watchdog/mtx-1_wdt.c12
-rw-r--r--drivers/watchdog/omap_wdt.c4
-rw-r--r--drivers/watchdog/pc87413_wdt.c30
-rw-r--r--drivers/watchdog/pcwd.c6
-rw-r--r--drivers/watchdog/pcwd_pci.c8
-rw-r--r--drivers/watchdog/pcwd_usb.c8
-rw-r--r--drivers/watchdog/pnx4008_wdt.c10
-rw-r--r--drivers/watchdog/s3c2410_wdt.c4
-rw-r--r--drivers/watchdog/sa1100_wdt.c10
-rw-r--r--drivers/watchdog/sb_wdog.c10
-rw-r--r--drivers/watchdog/sbc60xxwdt.c10
-rw-r--r--drivers/watchdog/sbc7240_wdt.c54
-rw-r--r--drivers/watchdog/sbc_epx_c3.c10
-rw-r--r--drivers/watchdog/sc1200wdt.c36
-rw-r--r--drivers/watchdog/sc520_wdt.c10
-rw-r--r--drivers/watchdog/scx200_wdt.c4
-rw-r--r--drivers/watchdog/shwdt.c28
-rw-r--r--drivers/watchdog/smsc37b787_wdt.c34
-rw-r--r--drivers/watchdog/softdog.c4
-rw-r--r--drivers/watchdog/txx9wdt.c4
-rw-r--r--drivers/watchdog/w83627hf_wdt.c24
-rw-r--r--drivers/watchdog/w83697hf_wdt.c30
-rw-r--r--drivers/watchdog/w83877f_wdt.c10
-rw-r--r--drivers/watchdog/w83977f_wdt.c14
-rw-r--r--drivers/watchdog/wafer5823wdt.c32
-rw-r--r--drivers/watchdog/wdt.c4
-rw-r--r--drivers/watchdog/wdt977.c14
-rw-r--r--drivers/watchdog/wdt_pci.c6
54 files changed, 428 insertions, 428 deletions
diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c
index 340d1eeec16b..7a5c69421f12 100644
--- a/drivers/watchdog/acquirewdt.c
+++ b/drivers/watchdog/acquirewdt.c
@@ -164,13 +164,6 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
164 case WDIOC_GETBOOTSTATUS: 164 case WDIOC_GETBOOTSTATUS:
165 return put_user(0, p); 165 return put_user(0, p);
166 166
167 case WDIOC_KEEPALIVE:
168 acq_keepalive();
169 return 0;
170
171 case WDIOC_GETTIMEOUT:
172 return put_user(WATCHDOG_HEARTBEAT, p);
173
174 case WDIOC_SETOPTIONS: 167 case WDIOC_SETOPTIONS:
175 { 168 {
176 if (get_user(options, p)) 169 if (get_user(options, p))
@@ -185,6 +178,13 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
185 } 178 }
186 return retval; 179 return retval;
187 } 180 }
181 case WDIOC_KEEPALIVE:
182 acq_keepalive();
183 return 0;
184
185 case WDIOC_GETTIMEOUT:
186 return put_user(WATCHDOG_HEARTBEAT, p);
187
188 default: 188 default:
189 return -ENOTTY; 189 return -ENOTTY;
190 } 190 }
diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c
index e6bf8d2d3d30..bfec16600475 100644
--- a/drivers/watchdog/advantechwdt.c
+++ b/drivers/watchdog/advantechwdt.c
@@ -152,19 +152,6 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
152 case WDIOC_GETBOOTSTATUS: 152 case WDIOC_GETBOOTSTATUS:
153 return put_user(0, p); 153 return put_user(0, p);
154 154
155 case WDIOC_KEEPALIVE:
156 advwdt_ping();
157 break;
158
159 case WDIOC_SETTIMEOUT:
160 if (get_user(new_timeout, p))
161 return -EFAULT;
162 if (advwdt_set_heartbeat(new_timeout))
163 return -EINVAL;
164 advwdt_ping();
165 /* Fall */
166 case WDIOC_GETTIMEOUT:
167 return put_user(timeout, p);
168 case WDIOC_SETOPTIONS: 155 case WDIOC_SETOPTIONS:
169 { 156 {
170 int options, retval = -EINVAL; 157 int options, retval = -EINVAL;
@@ -181,6 +168,19 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
181 } 168 }
182 return retval; 169 return retval;
183 } 170 }
171 case WDIOC_KEEPALIVE:
172 advwdt_ping();
173 break;
174
175 case WDIOC_SETTIMEOUT:
176 if (get_user(new_timeout, p))
177 return -EFAULT;
178 if (advwdt_set_heartbeat(new_timeout))
179 return -EINVAL;
180 advwdt_ping();
181 /* Fall */
182 case WDIOC_GETTIMEOUT:
183 return put_user(timeout, p);
184 default: 184 default:
185 return -ENOTTY; 185 return -ENOTTY;
186 } 186 }
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c
index 80e323ddc4ba..dfa11d19043a 100644
--- a/drivers/watchdog/alim1535_wdt.c
+++ b/drivers/watchdog/alim1535_wdt.c
@@ -195,9 +195,6 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
195 case WDIOC_GETSTATUS: 195 case WDIOC_GETSTATUS:
196 case WDIOC_GETBOOTSTATUS: 196 case WDIOC_GETBOOTSTATUS:
197 return put_user(0, p); 197 return put_user(0, p);
198 case WDIOC_KEEPALIVE:
199 ali_keepalive();
200 return 0;
201 case WDIOC_SETOPTIONS: 198 case WDIOC_SETOPTIONS:
202 { 199 {
203 int new_options, retval = -EINVAL; 200 int new_options, retval = -EINVAL;
@@ -214,6 +211,9 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
214 } 211 }
215 return retval; 212 return retval;
216 } 213 }
214 case WDIOC_KEEPALIVE:
215 ali_keepalive();
216 return 0;
217 case WDIOC_SETTIMEOUT: 217 case WDIOC_SETTIMEOUT:
218 { 218 {
219 int new_timeout; 219 int new_timeout;
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 726e75d9db7a..049c9122e40d 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -251,9 +251,6 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
251 case WDIOC_GETSTATUS: 251 case WDIOC_GETSTATUS:
252 case WDIOC_GETBOOTSTATUS: 252 case WDIOC_GETBOOTSTATUS:
253 return put_user(0, p); 253 return put_user(0, p);
254 case WDIOC_KEEPALIVE:
255 wdt_keepalive();
256 return 0;
257 case WDIOC_SETOPTIONS: 254 case WDIOC_SETOPTIONS:
258 { 255 {
259 int new_options, retval = -EINVAL; 256 int new_options, retval = -EINVAL;
@@ -270,6 +267,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
270 } 267 }
271 return retval; 268 return retval;
272 } 269 }
270 case WDIOC_KEEPALIVE:
271 wdt_keepalive();
272 return 0;
273 case WDIOC_SETTIMEOUT: 273 case WDIOC_SETTIMEOUT:
274 { 274 {
275 int new_timeout; 275 int new_timeout;
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
index ef7b0d67095e..9a81a205ef74 100644
--- a/drivers/watchdog/ar7_wdt.c
+++ b/drivers/watchdog/ar7_wdt.c
@@ -251,8 +251,6 @@ static long ar7_wdt_ioctl(struct file *file,
251 int new_margin; 251 int new_margin;
252 252
253 switch (cmd) { 253 switch (cmd) {
254 default:
255 return -ENOTTY;
256 case WDIOC_GETSUPPORT: 254 case WDIOC_GETSUPPORT:
257 if (copy_to_user((struct watchdog_info *)arg, &ident, 255 if (copy_to_user((struct watchdog_info *)arg, &ident,
258 sizeof(ident))) 256 sizeof(ident)))
@@ -281,6 +279,8 @@ static long ar7_wdt_ioctl(struct file *file,
281 if (put_user(margin, (int *)arg)) 279 if (put_user(margin, (int *)arg))
282 return -EFAULT; 280 return -EFAULT;
283 return 0; 281 return 0;
282 default:
283 return -ENOTTY;
284 } 284 }
285} 285}
286 286
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c
index c5dc5e912fb2..4538b57f451a 100644
--- a/drivers/watchdog/at32ap700x_wdt.c
+++ b/drivers/watchdog/at32ap700x_wdt.c
@@ -221,27 +221,10 @@ static long at32_wdt_ioctl(struct file *file,
221 int __user *p = argp; 221 int __user *p = argp;
222 222
223 switch (cmd) { 223 switch (cmd) {
224 case WDIOC_KEEPALIVE:
225 at32_wdt_pat();
226 ret = 0;
227 break;
228 case WDIOC_GETSUPPORT: 224 case WDIOC_GETSUPPORT:
229 ret = copy_to_user(argp, &at32_wdt_info, 225 ret = copy_to_user(argp, &at32_wdt_info,
230 sizeof(at32_wdt_info)) ? -EFAULT : 0; 226 sizeof(at32_wdt_info)) ? -EFAULT : 0;
231 break; 227 break;
232 case WDIOC_SETTIMEOUT:
233 ret = get_user(time, p);
234 if (ret)
235 break;
236 ret = at32_wdt_settimeout(time);
237 if (ret)
238 break;
239 /* Enable new time value */
240 at32_wdt_start();
241 /* fall through */
242 case WDIOC_GETTIMEOUT:
243 ret = put_user(wdt->timeout, p);
244 break;
245 case WDIOC_GETSTATUS: 228 case WDIOC_GETSTATUS:
246 ret = put_user(0, p); 229 ret = put_user(0, p);
247 break; 230 break;
@@ -258,6 +241,23 @@ static long at32_wdt_ioctl(struct file *file,
258 at32_wdt_start(); 241 at32_wdt_start();
259 ret = 0; 242 ret = 0;
260 break; 243 break;
244 case WDIOC_KEEPALIVE:
245 at32_wdt_pat();
246 ret = 0;
247 break;
248 case WDIOC_SETTIMEOUT:
249 ret = get_user(time, p);
250 if (ret)
251 break;
252 ret = at32_wdt_settimeout(time);
253 if (ret)
254 break;
255 /* Enable new time value */
256 at32_wdt_start();
257 /* fall through */
258 case WDIOC_GETTIMEOUT:
259 ret = put_user(wdt->timeout, p);
260 break;
261 } 261 }
262 262
263 return ret; 263 return ret;
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
index bb79f649dc7e..2313f44144f8 100644
--- a/drivers/watchdog/at91rm9200_wdt.c
+++ b/drivers/watchdog/at91rm9200_wdt.c
@@ -137,23 +137,9 @@ static long at91_wdt_ioct(struct file *file,
137 int new_value; 137 int new_value;
138 138
139 switch (cmd) { 139 switch (cmd) {
140 case WDIOC_KEEPALIVE:
141 at91_wdt_reload(); /* pat the watchdog */
142 return 0;
143 case WDIOC_GETSUPPORT: 140 case WDIOC_GETSUPPORT:
144 return copy_to_user(argp, &at91_wdt_info, 141 return copy_to_user(argp, &at91_wdt_info,
145 sizeof(at91_wdt_info)) ? -EFAULT : 0; 142 sizeof(at91_wdt_info)) ? -EFAULT : 0;
146 case WDIOC_SETTIMEOUT:
147 if (get_user(new_value, p))
148 return -EFAULT;
149 if (at91_wdt_settimeout(new_value))
150 return -EINVAL;
151 /* Enable new time value */
152 at91_wdt_start();
153 /* Return current value */
154 return put_user(wdt_time, p);
155 case WDIOC_GETTIMEOUT:
156 return put_user(wdt_time, p);
157 case WDIOC_GETSTATUS: 143 case WDIOC_GETSTATUS:
158 case WDIOC_GETBOOTSTATUS: 144 case WDIOC_GETBOOTSTATUS:
159 return put_user(0, p); 145 return put_user(0, p);
@@ -165,6 +151,20 @@ static long at91_wdt_ioct(struct file *file,
165 if (new_value & WDIOS_ENABLECARD) 151 if (new_value & WDIOS_ENABLECARD)
166 at91_wdt_start(); 152 at91_wdt_start();
167 return 0; 153 return 0;
154 case WDIOC_KEEPALIVE:
155 at91_wdt_reload(); /* pat the watchdog */
156 return 0;
157 case WDIOC_SETTIMEOUT:
158 if (get_user(new_value, p))
159 return -EFAULT;
160 if (at91_wdt_settimeout(new_value))
161 return -EINVAL;
162 /* Enable new time value */
163 at91_wdt_start();
164 /* Return current value */
165 return put_user(wdt_time, p);
166 case WDIOC_GETTIMEOUT:
167 return put_user(wdt_time, p);
168 default: 168 default:
169 return -ENOTTY; 169 return -ENOTTY;
170 } 170 }
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 8f6e871b3fe3..31b42253054e 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -265,20 +265,6 @@ static long bfin_wdt_ioctl(struct file *file,
265 case WDIOC_GETSTATUS: 265 case WDIOC_GETSTATUS:
266 case WDIOC_GETBOOTSTATUS: 266 case WDIOC_GETBOOTSTATUS:
267 return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p); 267 return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
268 case WDIOC_KEEPALIVE:
269 bfin_wdt_keepalive();
270 return 0;
271 case WDIOC_SETTIMEOUT: {
272 int new_timeout;
273
274 if (get_user(new_timeout, p))
275 return -EFAULT;
276 if (bfin_wdt_set_timeout(new_timeout))
277 return -EINVAL;
278 }
279 /* Fall */
280 case WDIOC_GETTIMEOUT:
281 return put_user(timeout, p);
282 case WDIOC_SETOPTIONS: { 268 case WDIOC_SETOPTIONS: {
283 unsigned long flags; 269 unsigned long flags;
284 int options, ret = -EINVAL; 270 int options, ret = -EINVAL;
@@ -298,6 +284,20 @@ static long bfin_wdt_ioctl(struct file *file,
298 spin_unlock_irqrestore(&bfin_wdt_spinlock, flags); 284 spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
299 return ret; 285 return ret;
300 } 286 }
287 case WDIOC_KEEPALIVE:
288 bfin_wdt_keepalive();
289 return 0;
290 case WDIOC_SETTIMEOUT: {
291 int new_timeout;
292
293 if (get_user(new_timeout, p))
294 return -EFAULT;
295 if (bfin_wdt_set_timeout(new_timeout))
296 return -EINVAL;
297 }
298 /* Fall */
299 case WDIOC_GETTIMEOUT:
300 return put_user(timeout, p);
301 default: 301 default:
302 return -ENOTTY; 302 return -ENOTTY;
303 } 303 }
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 06b7a17a60e7..c3b78a76f173 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -99,6 +99,15 @@ static long booke_wdt_ioctl(struct file *file,
99 tmp = mfspr(SPRN_TSR) & TSR_WRS(3); 99 tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
100 /* returns 1 if last reset was caused by the WDT */ 100 /* returns 1 if last reset was caused by the WDT */
101 return (tmp ? 1 : 0); 101 return (tmp ? 1 : 0);
102 case WDIOC_SETOPTIONS:
103 if (get_user(tmp, p))
104 return -EINVAL;
105 if (tmp == WDIOS_ENABLECARD) {
106 booke_wdt_ping();
107 break;
108 } else
109 return -EINVAL;
110 return 0;
102 case WDIOC_KEEPALIVE: 111 case WDIOC_KEEPALIVE:
103 booke_wdt_ping(); 112 booke_wdt_ping();
104 return 0; 113 return 0;
@@ -110,15 +119,6 @@ static long booke_wdt_ioctl(struct file *file,
110 return 0; 119 return 0;
111 case WDIOC_GETTIMEOUT: 120 case WDIOC_GETTIMEOUT:
112 return put_user(booke_wdt_period, p); 121 return put_user(booke_wdt_period, p);
113 case WDIOC_SETOPTIONS:
114 if (get_user(tmp, p))
115 return -EINVAL;
116 if (tmp == WDIOS_ENABLECARD) {
117 booke_wdt_ping();
118 break;
119 } else
120 return -EINVAL;
121 return 0;
122 default: 122 default:
123 return -ENOTTY; 123 return -ENOTTY;
124 } 124 }
diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c
index ec324e5e1c99..71f6d7eec9a8 100644
--- a/drivers/watchdog/cpu5wdt.c
+++ b/drivers/watchdog/cpu5wdt.c
@@ -160,8 +160,9 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
160 }; 160 };
161 161
162 switch (cmd) { 162 switch (cmd) {
163 case WDIOC_KEEPALIVE: 163 case WDIOC_GETSUPPORT:
164 cpu5wdt_reset(); 164 if (copy_to_user(argp, &ident, sizeof(ident)))
165 return -EFAULT;
165 break; 166 break;
166 case WDIOC_GETSTATUS: 167 case WDIOC_GETSTATUS:
167 value = inb(port + CPU5WDT_STATUS_REG); 168 value = inb(port + CPU5WDT_STATUS_REG);
@@ -169,10 +170,6 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
169 return put_user(value, p); 170 return put_user(value, p);
170 case WDIOC_GETBOOTSTATUS: 171 case WDIOC_GETBOOTSTATUS:
171 return put_user(0, p); 172 return put_user(0, p);
172 case WDIOC_GETSUPPORT:
173 if (copy_to_user(argp, &ident, sizeof(ident)))
174 return -EFAULT;
175 break;
176 case WDIOC_SETOPTIONS: 173 case WDIOC_SETOPTIONS:
177 if (get_user(value, p)) 174 if (get_user(value, p))
178 return -EFAULT; 175 return -EFAULT;
@@ -181,6 +178,9 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
181 if (value & WDIOS_DISABLECARD) 178 if (value & WDIOS_DISABLECARD)
182 cpu5wdt_stop(); 179 cpu5wdt_stop();
183 break; 180 break;
181 case WDIOC_KEEPALIVE:
182 cpu5wdt_reset();
183 break;
184 default: 184 default:
185 return -ENOTTY; 185 return -ENOTTY;
186 } 186 }
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 926b59c41186..802aeba347a0 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -159,14 +159,14 @@ static long davinci_wdt_ioctl(struct file *file,
159 ret = put_user(0, (int *)arg); 159 ret = put_user(0, (int *)arg);
160 break; 160 break;
161 161
162 case WDIOC_GETTIMEOUT:
163 ret = put_user(heartbeat, (int *)arg);
164 break;
165
166 case WDIOC_KEEPALIVE: 162 case WDIOC_KEEPALIVE:
167 wdt_service(); 163 wdt_service();
168 ret = 0; 164 ret = 0;
169 break; 165 break;
166
167 case WDIOC_GETTIMEOUT:
168 ret = put_user(heartbeat, (int *)arg);
169 break;
170 } 170 }
171 return ret; 171 return ret;
172} 172}
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c
index cdcdd11173a7..07b74a768922 100644
--- a/drivers/watchdog/ep93xx_wdt.c
+++ b/drivers/watchdog/ep93xx_wdt.c
@@ -155,15 +155,15 @@ static long ep93xx_wdt_ioctl(struct file *file,
155 ret = put_user(boot_status, (int __user *)arg); 155 ret = put_user(boot_status, (int __user *)arg);
156 break; 156 break;
157 157
158 case WDIOC_GETTIMEOUT:
159 /* actually, it is 0.250 seconds.... */
160 ret = put_user(1, (int __user *)arg);
161 break;
162
163 case WDIOC_KEEPALIVE: 158 case WDIOC_KEEPALIVE:
164 wdt_keepalive(); 159 wdt_keepalive();
165 ret = 0; 160 ret = 0;
166 break; 161 break;
162
163 case WDIOC_GETTIMEOUT:
164 /* actually, it is 0.250 seconds.... */
165 ret = put_user(1, (int __user *)arg);
166 break;
167 } 167 }
168 return ret; 168 return ret;
169} 169}
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c
index b94e6ef4c7a7..96250118fd7c 100644
--- a/drivers/watchdog/eurotechwdt.c
+++ b/drivers/watchdog/eurotechwdt.c
@@ -249,9 +249,6 @@ static long eurwdt_ioctl(struct file *file,
249 int options, retval = -EINVAL; 249 int options, retval = -EINVAL;
250 250
251 switch (cmd) { 251 switch (cmd) {
252 default:
253 return -ENOTTY;
254
255 case WDIOC_GETSUPPORT: 252 case WDIOC_GETSUPPORT:
256 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; 253 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
257 254
@@ -259,6 +256,22 @@ static long eurwdt_ioctl(struct file *file,
259 case WDIOC_GETBOOTSTATUS: 256 case WDIOC_GETBOOTSTATUS:
260 return put_user(0, p); 257 return put_user(0, p);
261 258
259 case WDIOC_SETOPTIONS:
260 if (get_user(options, p))
261 return -EFAULT;
262 spin_lock(&eurwdt_lock);
263 if (options & WDIOS_DISABLECARD) {
264 eurwdt_disable_timer();
265 retval = 0;
266 }
267 if (options & WDIOS_ENABLECARD) {
268 eurwdt_activate_timer();
269 eurwdt_ping();
270 retval = 0;
271 }
272 spin_unlock(&eurwdt_lock);
273 return retval;
274
262 case WDIOC_KEEPALIVE: 275 case WDIOC_KEEPALIVE:
263 spin_lock(&eurwdt_lock); 276 spin_lock(&eurwdt_lock);
264 eurwdt_ping(); 277 eurwdt_ping();
@@ -282,21 +295,8 @@ static long eurwdt_ioctl(struct file *file,
282 case WDIOC_GETTIMEOUT: 295 case WDIOC_GETTIMEOUT:
283 return put_user(eurwdt_timeout, p); 296 return put_user(eurwdt_timeout, p);
284 297
285 case WDIOC_SETOPTIONS: 298 default:
286 if (get_user(options, p)) 299 return -ENOTTY;
287 return -EFAULT;
288 spin_lock(&eurwdt_lock);
289 if (options & WDIOS_DISABLECARD) {
290 eurwdt_disable_timer();
291 retval = 0;
292 }
293 if (options & WDIOS_ENABLECARD) {
294 eurwdt_activate_timer();
295 eurwdt_ping();
296 retval = 0;
297 }
298 spin_unlock(&eurwdt_lock);
299 return retval;
300 } 300 }
301} 301}
302 302
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c
index 74c00698801d..04b861cfdf0c 100644
--- a/drivers/watchdog/geodewdt.c
+++ b/drivers/watchdog/geodewdt.c
@@ -159,22 +159,6 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
159 case WDIOC_GETBOOTSTATUS: 159 case WDIOC_GETBOOTSTATUS:
160 return put_user(0, p); 160 return put_user(0, p);
161 161
162 case WDIOC_KEEPALIVE:
163 geodewdt_ping();
164 return 0;
165
166 case WDIOC_SETTIMEOUT:
167 if (get_user(interval, p))
168 return -EFAULT;
169
170 if (geodewdt_set_heartbeat(interval))
171 return -EINVAL;
172
173/* Fall through */
174
175 case WDIOC_GETTIMEOUT:
176 return put_user(timeout, p);
177
178 case WDIOC_SETOPTIONS: 162 case WDIOC_SETOPTIONS:
179 { 163 {
180 int options, ret = -EINVAL; 164 int options, ret = -EINVAL;
@@ -194,6 +178,20 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
194 178
195 return ret; 179 return ret;
196 } 180 }
181 case WDIOC_KEEPALIVE:
182 geodewdt_ping();
183 return 0;
184
185 case WDIOC_SETTIMEOUT:
186 if (get_user(interval, p))
187 return -EFAULT;
188
189 if (geodewdt_set_heartbeat(interval))
190 return -EINVAL;
191 /* Fall through */
192 case WDIOC_GETTIMEOUT:
193 return put_user(timeout, p);
194
197 default: 195 default:
198 return -ENOTTY; 196 return -ENOTTY;
199 } 197 }
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
index 01a283f7a271..c768cb718904 100644
--- a/drivers/watchdog/i6300esb.c
+++ b/drivers/watchdog/i6300esb.c
@@ -280,10 +280,6 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
280 case WDIOC_GETBOOTSTATUS: 280 case WDIOC_GETBOOTSTATUS:
281 return put_user(triggered, p); 281 return put_user(triggered, p);
282 282
283 case WDIOC_KEEPALIVE:
284 esb_timer_keepalive();
285 return 0;
286
287 case WDIOC_SETOPTIONS: 283 case WDIOC_SETOPTIONS:
288 { 284 {
289 if (get_user(new_options, p)) 285 if (get_user(new_options, p))
@@ -301,6 +297,10 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
301 } 297 }
302 return retval; 298 return retval;
303 } 299 }
300 case WDIOC_KEEPALIVE:
301 esb_timer_keepalive();
302 return 0;
303
304 case WDIOC_SETTIMEOUT: 304 case WDIOC_SETTIMEOUT:
305 { 305 {
306 if (get_user(new_heartbeat, p)) 306 if (get_user(new_heartbeat, p))
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index c9ca8f691d81..b18766436638 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -532,10 +532,6 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd,
532 case WDIOC_GETBOOTSTATUS: 532 case WDIOC_GETBOOTSTATUS:
533 return put_user(0, p); 533 return put_user(0, p);
534 534
535 case WDIOC_KEEPALIVE:
536 iTCO_wdt_keepalive();
537 return 0;
538
539 case WDIOC_SETOPTIONS: 535 case WDIOC_SETOPTIONS:
540 { 536 {
541 if (get_user(new_options, p)) 537 if (get_user(new_options, p))
@@ -552,6 +548,10 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd,
552 } 548 }
553 return retval; 549 return retval;
554 } 550 }
551 case WDIOC_KEEPALIVE:
552 iTCO_wdt_keepalive();
553 return 0;
554
555 case WDIOC_SETTIMEOUT: 555 case WDIOC_SETTIMEOUT:
556 { 556 {
557 if (get_user(new_heartbeat, p)) 557 if (get_user(new_heartbeat, p))
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index 9eb9537c370e..6aa914e5caf5 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -213,21 +213,6 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
213 case WDIOC_GETBOOTSTATUS: 213 case WDIOC_GETBOOTSTATUS:
214 return put_user(0, p); 214 return put_user(0, p);
215 215
216 case WDIOC_KEEPALIVE:
217 ibwdt_ping();
218 break;
219
220 case WDIOC_SETTIMEOUT:
221 if (get_user(new_margin, p))
222 return -EFAULT;
223 if (ibwdt_set_heartbeat(new_margin))
224 return -EINVAL;
225 ibwdt_ping();
226 /* Fall */
227
228 case WDIOC_GETTIMEOUT:
229 return put_user(wd_times[wd_margin], p);
230
231 case WDIOC_SETOPTIONS: 216 case WDIOC_SETOPTIONS:
232 { 217 {
233 int options, retval = -EINVAL; 218 int options, retval = -EINVAL;
@@ -245,6 +230,21 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
245 } 230 }
246 return retval; 231 return retval;
247 } 232 }
233 case WDIOC_KEEPALIVE:
234 ibwdt_ping();
235 break;
236
237 case WDIOC_SETTIMEOUT:
238 if (get_user(new_margin, p))
239 return -EFAULT;
240 if (ibwdt_set_heartbeat(new_margin))
241 return -EINVAL;
242 ibwdt_ping();
243 /* Fall */
244
245 case WDIOC_GETTIMEOUT:
246 return put_user(wd_times[wd_margin], p);
247
248 default: 248 default:
249 return -ENOTTY; 249 return -ENOTTY;
250 } 250 }
diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c
index 6824bf80b37e..0b549f3ff915 100644
--- a/drivers/watchdog/ibmasr.c
+++ b/drivers/watchdog/ibmasr.c
@@ -287,16 +287,6 @@ static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
287 case WDIOC_GETSTATUS: 287 case WDIOC_GETSTATUS:
288 case WDIOC_GETBOOTSTATUS: 288 case WDIOC_GETBOOTSTATUS:
289 return put_user(0, p); 289 return put_user(0, p);
290 case WDIOC_KEEPALIVE:
291 asr_toggle();
292 return 0;
293 /*
294 * The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
295 * and WDIOC_GETTIMEOUT always returns 256.
296 */
297 case WDIOC_GETTIMEOUT:
298 heartbeat = 256;
299 return put_user(heartbeat, p);
300 case WDIOC_SETOPTIONS: 290 case WDIOC_SETOPTIONS:
301 { 291 {
302 int new_options, retval = -EINVAL; 292 int new_options, retval = -EINVAL;
@@ -313,6 +303,16 @@ static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
313 } 303 }
314 return retval; 304 return retval;
315 } 305 }
306 case WDIOC_KEEPALIVE:
307 asr_toggle();
308 return 0;
309 /*
310 * The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
311 * and WDIOC_GETTIMEOUT always returns 256.
312 */
313 case WDIOC_GETTIMEOUT:
314 heartbeat = 256;
315 return put_user(heartbeat, p);
316 default: 316 default:
317 return -ENOTTY; 317 return -ENOTTY;
318 } 318 }
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c
index 0bffea37404e..73c9e7992feb 100644
--- a/drivers/watchdog/indydog.c
+++ b/drivers/watchdog/indydog.c
@@ -128,11 +128,6 @@ static long indydog_ioctl(struct file *file, unsigned int cmd,
128 case WDIOC_GETSTATUS: 128 case WDIOC_GETSTATUS:
129 case WDIOC_GETBOOTSTATUS: 129 case WDIOC_GETBOOTSTATUS:
130 return put_user(0, (int *)arg); 130 return put_user(0, (int *)arg);
131 case WDIOC_KEEPALIVE:
132 indydog_ping();
133 return 0;
134 case WDIOC_GETTIMEOUT:
135 return put_user(WATCHDOG_TIMEOUT, (int *)arg);
136 case WDIOC_SETOPTIONS: 131 case WDIOC_SETOPTIONS:
137 { 132 {
138 if (get_user(options, (int *)arg)) 133 if (get_user(options, (int *)arg))
@@ -147,6 +142,11 @@ static long indydog_ioctl(struct file *file, unsigned int cmd,
147 } 142 }
148 return retval; 143 return retval;
149 } 144 }
145 case WDIOC_KEEPALIVE:
146 indydog_ping();
147 return 0;
148 case WDIOC_GETTIMEOUT:
149 return put_user(WATCHDOG_TIMEOUT, (int *)arg);
150 default: 150 default:
151 return -ENOTTY; 151 return -ENOTTY;
152 } 152 }
diff --git a/drivers/watchdog/iop_wdt.c b/drivers/watchdog/iop_wdt.c
index e54c888d2afe..e0d0a90ea10c 100644
--- a/drivers/watchdog/iop_wdt.c
+++ b/drivers/watchdog/iop_wdt.c
@@ -153,15 +153,6 @@ static long iop_wdt_ioctl(struct file *file,
153 ret = put_user(boot_status, argp); 153 ret = put_user(boot_status, argp);
154 break; 154 break;
155 155
156 case WDIOC_GETTIMEOUT:
157 ret = put_user(iop_watchdog_timeout(), argp);
158 break;
159
160 case WDIOC_KEEPALIVE:
161 wdt_enable();
162 ret = 0;
163 break;
164
165 case WDIOC_SETOPTIONS: 156 case WDIOC_SETOPTIONS:
166 if (get_user(options, (int *)arg)) 157 if (get_user(options, (int *)arg))
167 return -EFAULT; 158 return -EFAULT;
@@ -181,6 +172,15 @@ static long iop_wdt_ioctl(struct file *file,
181 ret = 0; 172 ret = 0;
182 } 173 }
183 break; 174 break;
175
176 case WDIOC_KEEPALIVE:
177 wdt_enable();
178 ret = 0;
179 break;
180
181 case WDIOC_GETTIMEOUT:
182 ret = put_user(iop_watchdog_timeout(), argp);
183 break;
184 } 184 }
185 return ret; 185 return ret;
186} 186}
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c
index 51bfd5721833..c1db74f6e310 100644
--- a/drivers/watchdog/it8712f_wdt.c
+++ b/drivers/watchdog/it8712f_wdt.c
@@ -244,8 +244,6 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
244 int value; 244 int value;
245 245
246 switch (cmd) { 246 switch (cmd) {
247 default:
248 return -ENOTTY;
249 case WDIOC_GETSUPPORT: 247 case WDIOC_GETSUPPORT:
250 if (copy_to_user(argp, &ident, sizeof(ident))) 248 if (copy_to_user(argp, &ident, sizeof(ident)))
251 return -EFAULT; 249 return -EFAULT;
@@ -284,6 +282,8 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
284 if (put_user(margin, p)) 282 if (put_user(margin, p))
285 return -EFAULT; 283 return -EFAULT;
286 return 0; 284 return 0;
285 default:
286 return -ENOTTY;
287 } 287 }
288} 288}
289 289
diff --git a/drivers/watchdog/ixp2000_wdt.c b/drivers/watchdog/ixp2000_wdt.c
index 943ceffbd683..a77f69d52877 100644
--- a/drivers/watchdog/ixp2000_wdt.c
+++ b/drivers/watchdog/ixp2000_wdt.c
@@ -126,6 +126,11 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
126 ret = put_user(0, (int *)arg); 126 ret = put_user(0, (int *)arg);
127 break; 127 break;
128 128
129 case WDIOC_KEEPALIVE:
130 wdt_enable();
131 ret = 0;
132 break;
133
129 case WDIOC_SETTIMEOUT: 134 case WDIOC_SETTIMEOUT:
130 ret = get_user(time, (int *)arg); 135 ret = get_user(time, (int *)arg);
131 if (ret) 136 if (ret)
@@ -143,11 +148,6 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
143 case WDIOC_GETTIMEOUT: 148 case WDIOC_GETTIMEOUT:
144 ret = put_user(heartbeat, (int *)arg); 149 ret = put_user(heartbeat, (int *)arg);
145 break; 150 break;
146
147 case WDIOC_KEEPALIVE:
148 wdt_enable();
149 ret = 0;
150 break;
151 } 151 }
152 152
153 return ret; 153 return ret;
diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c
index 1bafd7b58ca5..b94713e4773d 100644
--- a/drivers/watchdog/ixp4xx_wdt.c
+++ b/drivers/watchdog/ixp4xx_wdt.c
@@ -117,6 +117,11 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
117 ret = put_user(boot_status, (int *)arg); 117 ret = put_user(boot_status, (int *)arg);
118 break; 118 break;
119 119
120 case WDIOC_KEEPALIVE:
121 wdt_enable();
122 ret = 0;
123 break;
124
120 case WDIOC_SETTIMEOUT: 125 case WDIOC_SETTIMEOUT:
121 ret = get_user(time, (int *)arg); 126 ret = get_user(time, (int *)arg);
122 if (ret) 127 if (ret)
@@ -134,11 +139,6 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
134 case WDIOC_GETTIMEOUT: 139 case WDIOC_GETTIMEOUT:
135 ret = put_user(heartbeat, (int *)arg); 140 ret = put_user(heartbeat, (int *)arg);
136 break; 141 break;
137
138 case WDIOC_KEEPALIVE:
139 wdt_enable();
140 ret = 0;
141 break;
142 } 142 }
143 return ret; 143 return ret;
144} 144}
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
index 6d052b80aa20..f8566d5c62fe 100644
--- a/drivers/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -161,23 +161,9 @@ static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd,
161 int new_value; 161 int new_value;
162 162
163 switch (cmd) { 163 switch (cmd) {
164 case WDIOC_KEEPALIVE:
165 ks8695_wdt_reload(); /* pat the watchdog */
166 return 0;
167 case WDIOC_GETSUPPORT: 164 case WDIOC_GETSUPPORT:
168 return copy_to_user(argp, &ks8695_wdt_info, 165 return copy_to_user(argp, &ks8695_wdt_info,
169 sizeof(ks8695_wdt_info)) ? -EFAULT : 0; 166 sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
170 case WDIOC_SETTIMEOUT:
171 if (get_user(new_value, p))
172 return -EFAULT;
173 if (ks8695_wdt_settimeout(new_value))
174 return -EINVAL;
175 /* Enable new time value */
176 ks8695_wdt_start();
177 /* Return current value */
178 return put_user(wdt_time, p);
179 case WDIOC_GETTIMEOUT:
180 return put_user(wdt_time, p);
181 case WDIOC_GETSTATUS: 167 case WDIOC_GETSTATUS:
182 case WDIOC_GETBOOTSTATUS: 168 case WDIOC_GETBOOTSTATUS:
183 return put_user(0, p); 169 return put_user(0, p);
@@ -189,6 +175,20 @@ static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd,
189 if (new_value & WDIOS_ENABLECARD) 175 if (new_value & WDIOS_ENABLECARD)
190 ks8695_wdt_start(); 176 ks8695_wdt_start();
191 return 0; 177 return 0;
178 case WDIOC_KEEPALIVE:
179 ks8695_wdt_reload(); /* pat the watchdog */
180 return 0;
181 case WDIOC_SETTIMEOUT:
182 if (get_user(new_value, p))
183 return -EFAULT;
184 if (ks8695_wdt_settimeout(new_value))
185 return -EINVAL;
186 /* Enable new time value */
187 ks8695_wdt_start();
188 /* Return current value */
189 return put_user(wdt_time, p);
190 case WDIOC_GETTIMEOUT:
191 return put_user(wdt_time, p);
192 default: 192 default:
193 return -ENOTTY; 193 return -ENOTTY;
194 } 194 }
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
index 2248a8187590..407b025cb104 100644
--- a/drivers/watchdog/mixcomwd.c
+++ b/drivers/watchdog/mixcomwd.c
@@ -208,6 +208,10 @@ static long mixcomwd_ioctl(struct file *file,
208 }; 208 };
209 209
210 switch (cmd) { 210 switch (cmd) {
211 case WDIOC_GETSUPPORT:
212 if (copy_to_user(argp, &ident, sizeof(ident)))
213 return -EFAULT;
214 break;
211 case WDIOC_GETSTATUS: 215 case WDIOC_GETSTATUS:
212 status = mixcomwd_opened; 216 status = mixcomwd_opened;
213 if (!nowayout) 217 if (!nowayout)
@@ -215,10 +219,6 @@ static long mixcomwd_ioctl(struct file *file,
215 return put_user(status, p); 219 return put_user(status, p);
216 case WDIOC_GETBOOTSTATUS: 220 case WDIOC_GETBOOTSTATUS:
217 return put_user(0, p); 221 return put_user(0, p);
218 case WDIOC_GETSUPPORT:
219 if (copy_to_user(argp, &ident, sizeof(ident)))
220 return -EFAULT;
221 break;
222 case WDIOC_KEEPALIVE: 222 case WDIOC_KEEPALIVE:
223 mixcomwd_ping(); 223 mixcomwd_ping();
224 break; 224 break;
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 5e58f8b73d00..3c4f95599c65 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -243,6 +243,12 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
243 ret = 0; 243 ret = 0;
244 break; 244 break;
245 245
246 case WDIOC_GETSTATUS:
247 case WDIOC_GETBOOTSTATUS:
248 uarg.i = 0;
249 ret = 0;
250 break;
251
246 case WDIOC_SETOPTIONS: 252 case WDIOC_SETOPTIONS:
247 ret = -EINVAL; 253 ret = -EINVAL;
248 if (uarg.i & WDIOS_DISABLECARD) { 254 if (uarg.i & WDIOS_DISABLECARD) {
@@ -255,12 +261,6 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
255 } 261 }
256 break; 262 break;
257 263
258 case WDIOC_GETSTATUS:
259 case WDIOC_GETBOOTSTATUS:
260 uarg.i = 0;
261 ret = 0;
262 break;
263
264 case WDIOC_KEEPALIVE: 264 case WDIOC_KEEPALIVE:
265 mpcore_wdt_keepalive(wdt); 265 mpcore_wdt_keepalive(wdt);
266 ret = 0; 266 ret = 0;
diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
index e0b8cdfa5e70..f820b82da7c3 100644
--- a/drivers/watchdog/mtx-1_wdt.c
+++ b/drivers/watchdog/mtx-1_wdt.c
@@ -148,17 +148,14 @@ static long mtx1_wdt_ioctl(struct file *file, unsigned int cmd,
148 }; 148 };
149 149
150 switch (cmd) { 150 switch (cmd) {
151 case WDIOC_KEEPALIVE: 151 case WDIOC_GETSUPPORT:
152 mtx1_wdt_reset(); 152 if (copy_to_user(argp, &ident, sizeof(ident)))
153 return -EFAULT;
153 break; 154 break;
154 case WDIOC_GETSTATUS: 155 case WDIOC_GETSTATUS:
155 case WDIOC_GETBOOTSTATUS: 156 case WDIOC_GETBOOTSTATUS:
156 put_user(0, p); 157 put_user(0, p);
157 break; 158 break;
158 case WDIOC_GETSUPPORT:
159 if (copy_to_user(argp, &ident, sizeof(ident)))
160 return -EFAULT;
161 break;
162 case WDIOC_SETOPTIONS: 159 case WDIOC_SETOPTIONS:
163 if (get_user(value, p)) 160 if (get_user(value, p))
164 return -EFAULT; 161 return -EFAULT;
@@ -169,6 +166,9 @@ static long mtx1_wdt_ioctl(struct file *file, unsigned int cmd,
169 else 166 else
170 return -EINVAL; 167 return -EINVAL;
171 return 0; 168 return 0;
169 case WDIOC_KEEPALIVE:
170 mtx1_wdt_reset();
171 break;
172 default: 172 default:
173 return -ENOTTY; 173 return -ENOTTY;
174 } 174 }
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 5aae071cc045..7beb21ce1de9 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -197,8 +197,6 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
197 }; 197 };
198 198
199 switch (cmd) { 199 switch (cmd) {
200 default:
201 return -ENOTTY;
202 case WDIOC_GETSUPPORT: 200 case WDIOC_GETSUPPORT:
203 return copy_to_user((struct watchdog_info __user *)arg, &ident, 201 return copy_to_user((struct watchdog_info __user *)arg, &ident,
204 sizeof(ident)); 202 sizeof(ident));
@@ -231,6 +229,8 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
231 /* Fall */ 229 /* Fall */
232 case WDIOC_GETTIMEOUT: 230 case WDIOC_GETTIMEOUT:
233 return put_user(timer_margin, (int __user *)arg); 231 return put_user(timer_margin, (int __user *)arg);
232 default:
233 return -ENOTTY;
234 } 234 }
235} 235}
236 236
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c
index 326f2d2ded3b..5fc7f1349950 100644
--- a/drivers/watchdog/pc87413_wdt.c
+++ b/drivers/watchdog/pc87413_wdt.c
@@ -426,6 +426,21 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd,
426 return put_user(pc87413_status(), uarg.i); 426 return put_user(pc87413_status(), uarg.i);
427 case WDIOC_GETBOOTSTATUS: 427 case WDIOC_GETBOOTSTATUS:
428 return put_user(0, uarg.i); 428 return put_user(0, uarg.i);
429 case WDIOC_SETOPTIONS:
430 {
431 int options, retval = -EINVAL;
432 if (get_user(options, uarg.i))
433 return -EFAULT;
434 if (options & WDIOS_DISABLECARD) {
435 pc87413_disable();
436 retval = 0;
437 }
438 if (options & WDIOS_ENABLECARD) {
439 pc87413_enable();
440 retval = 0;
441 }
442 return retval;
443 }
429 case WDIOC_KEEPALIVE: 444 case WDIOC_KEEPALIVE:
430 pc87413_refresh(); 445 pc87413_refresh();
431#ifdef DEBUG 446#ifdef DEBUG
@@ -445,21 +460,6 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd,
445 case WDIOC_GETTIMEOUT: 460 case WDIOC_GETTIMEOUT:
446 new_timeout = timeout * 60; 461 new_timeout = timeout * 60;
447 return put_user(new_timeout, uarg.i); 462 return put_user(new_timeout, uarg.i);
448 case WDIOC_SETOPTIONS:
449 {
450 int options, retval = -EINVAL;
451 if (get_user(options, uarg.i))
452 return -EFAULT;
453 if (options & WDIOS_DISABLECARD) {
454 pc87413_disable();
455 retval = 0;
456 }
457 if (options & WDIOS_ENABLECARD) {
458 pc87413_enable();
459 retval = 0;
460 }
461 return retval;
462 }
463 default: 463 default:
464 return -ENOTTY; 464 return -ENOTTY;
465 } 465 }
diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c
index e1259adf09f9..134386a88852 100644
--- a/drivers/watchdog/pcwd.c
+++ b/drivers/watchdog/pcwd.c
@@ -612,9 +612,6 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
612 }; 612 };
613 613
614 switch (cmd) { 614 switch (cmd) {
615 default:
616 return -ENOTTY;
617
618 case WDIOC_GETSUPPORT: 615 case WDIOC_GETSUPPORT:
619 if (copy_to_user(argp, &ident, sizeof(ident))) 616 if (copy_to_user(argp, &ident, sizeof(ident)))
620 return -EFAULT; 617 return -EFAULT;
@@ -669,6 +666,9 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
669 666
670 case WDIOC_GETTIMEOUT: 667 case WDIOC_GETTIMEOUT:
671 return put_user(heartbeat, argp); 668 return put_user(heartbeat, argp);
669
670 default:
671 return -ENOTTY;
672 } 672 }
673 673
674 return 0; 674 return 0;
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c
index 7f500ee4ee8a..2617129a7ccc 100644
--- a/drivers/watchdog/pcwd_pci.c
+++ b/drivers/watchdog/pcwd_pci.c
@@ -494,10 +494,6 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
494 return put_user(temperature, p); 494 return put_user(temperature, p);
495 } 495 }
496 496
497 case WDIOC_KEEPALIVE:
498 pcipcwd_keepalive();
499 return 0;
500
501 case WDIOC_SETOPTIONS: 497 case WDIOC_SETOPTIONS:
502 { 498 {
503 int new_options, retval = -EINVAL; 499 int new_options, retval = -EINVAL;
@@ -525,6 +521,10 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
525 return retval; 521 return retval;
526 } 522 }
527 523
524 case WDIOC_KEEPALIVE:
525 pcipcwd_keepalive();
526 return 0;
527
528 case WDIOC_SETTIMEOUT: 528 case WDIOC_SETTIMEOUT:
529 { 529 {
530 int new_heartbeat; 530 int new_heartbeat;
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 8194435052c8..8c582bc0588e 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -400,10 +400,6 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
400 return put_user(temperature, p); 400 return put_user(temperature, p);
401 } 401 }
402 402
403 case WDIOC_KEEPALIVE:
404 usb_pcwd_keepalive(usb_pcwd_device);
405 return 0;
406
407 case WDIOC_SETOPTIONS: 403 case WDIOC_SETOPTIONS:
408 { 404 {
409 int new_options, retval = -EINVAL; 405 int new_options, retval = -EINVAL;
@@ -424,6 +420,10 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
424 return retval; 420 return retval;
425 } 421 }
426 422
423 case WDIOC_KEEPALIVE:
424 usb_pcwd_keepalive(usb_pcwd_device);
425 return 0;
426
427 case WDIOC_SETTIMEOUT: 427 case WDIOC_SETTIMEOUT:
428 { 428 {
429 int new_heartbeat; 429 int new_heartbeat;
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 56dee3bfd4aa..6eadf5ebb9b3 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -194,6 +194,11 @@ static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
194 ret = put_user(boot_status, (int *)arg); 194 ret = put_user(boot_status, (int *)arg);
195 break; 195 break;
196 196
197 case WDIOC_KEEPALIVE:
198 wdt_enable();
199 ret = 0;
200 break;
201
197 case WDIOC_SETTIMEOUT: 202 case WDIOC_SETTIMEOUT:
198 ret = get_user(time, (int *)arg); 203 ret = get_user(time, (int *)arg);
199 if (ret) 204 if (ret)
@@ -211,11 +216,6 @@ static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
211 case WDIOC_GETTIMEOUT: 216 case WDIOC_GETTIMEOUT:
212 ret = put_user(heartbeat, (int *)arg); 217 ret = put_user(heartbeat, (int *)arg);
213 break; 218 break;
214
215 case WDIOC_KEEPALIVE:
216 wdt_enable();
217 ret = 0;
218 break;
219 } 219 }
220 return ret; 220 return ret;
221} 221}
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 97b4a2e8eb09..44bf5e4282e1 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -305,8 +305,6 @@ static long s3c2410wdt_ioctl(struct file *file, unsigned int cmd,
305 int new_margin; 305 int new_margin;
306 306
307 switch (cmd) { 307 switch (cmd) {
308 default:
309 return -ENOTTY;
310 case WDIOC_GETSUPPORT: 308 case WDIOC_GETSUPPORT:
311 return copy_to_user(argp, &s3c2410_wdt_ident, 309 return copy_to_user(argp, &s3c2410_wdt_ident,
312 sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0; 310 sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0;
@@ -325,6 +323,8 @@ static long s3c2410wdt_ioctl(struct file *file, unsigned int cmd,
325 return put_user(tmr_margin, p); 323 return put_user(tmr_margin, p);
326 case WDIOC_GETTIMEOUT: 324 case WDIOC_GETTIMEOUT:
327 return put_user(tmr_margin, p); 325 return put_user(tmr_margin, p);
326 default:
327 return -ENOTTY;
328 } 328 }
329} 329}
330 330
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index 869d538c02f9..27d6898a7c98 100644
--- a/drivers/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -107,6 +107,11 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
107 ret = put_user(boot_status, p); 107 ret = put_user(boot_status, p);
108 break; 108 break;
109 109
110 case WDIOC_KEEPALIVE:
111 OSMR3 = OSCR + pre_margin;
112 ret = 0;
113 break;
114
110 case WDIOC_SETTIMEOUT: 115 case WDIOC_SETTIMEOUT:
111 ret = get_user(time, p); 116 ret = get_user(time, p);
112 if (ret) 117 if (ret)
@@ -124,11 +129,6 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
124 case WDIOC_GETTIMEOUT: 129 case WDIOC_GETTIMEOUT:
125 ret = put_user(pre_margin / OSCR_FREQ, p); 130 ret = put_user(pre_margin / OSCR_FREQ, p);
126 break; 131 break;
127
128 case WDIOC_KEEPALIVE:
129 OSMR3 = OSCR + pre_margin;
130 ret = 0;
131 break;
132 } 132 }
133 return ret; 133 return ret;
134} 134}
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index c8b544ce77fb..528097651f7f 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -182,6 +182,11 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
182 ret = put_user(0, p); 182 ret = put_user(0, p);
183 break; 183 break;
184 184
185 case WDIOC_KEEPALIVE:
186 sbwdog_pet(user_dog);
187 ret = 0;
188 break;
189
185 case WDIOC_SETTIMEOUT: 190 case WDIOC_SETTIMEOUT:
186 ret = get_user(time, p); 191 ret = get_user(time, p);
187 if (ret) 192 if (ret)
@@ -203,11 +208,6 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
203 */ 208 */
204 ret = put_user(__raw_readq(user_dog - 8) / 1000000, p); 209 ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
205 break; 210 break;
206
207 case WDIOC_KEEPALIVE:
208 sbwdog_pet(user_dog);
209 ret = 0;
210 break;
211 } 211 }
212 return ret; 212 return ret;
213} 213}
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index e284a5d4fb1b..e801cd46c647 100644
--- a/drivers/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
@@ -237,16 +237,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
237 }; 237 };
238 238
239 switch (cmd) { 239 switch (cmd) {
240 default:
241 return -ENOTTY;
242 case WDIOC_GETSUPPORT: 240 case WDIOC_GETSUPPORT:
243 return copy_to_user(argp, &ident, sizeof(ident))? -EFAULT : 0; 241 return copy_to_user(argp, &ident, sizeof(ident))? -EFAULT : 0;
244 case WDIOC_GETSTATUS: 242 case WDIOC_GETSTATUS:
245 case WDIOC_GETBOOTSTATUS: 243 case WDIOC_GETBOOTSTATUS:
246 return put_user(0, p); 244 return put_user(0, p);
247 case WDIOC_KEEPALIVE:
248 wdt_keepalive();
249 return 0;
250 case WDIOC_SETOPTIONS: 245 case WDIOC_SETOPTIONS:
251 { 246 {
252 int new_options, retval = -EINVAL; 247 int new_options, retval = -EINVAL;
@@ -262,6 +257,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
262 } 257 }
263 return retval; 258 return retval;
264 } 259 }
260 case WDIOC_KEEPALIVE:
261 wdt_keepalive();
262 return 0;
265 case WDIOC_SETTIMEOUT: 263 case WDIOC_SETTIMEOUT:
266 { 264 {
267 int new_timeout; 265 int new_timeout;
@@ -277,6 +275,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
277 } 275 }
278 case WDIOC_GETTIMEOUT: 276 case WDIOC_GETTIMEOUT:
279 return put_user(timeout, p); 277 return put_user(timeout, p);
278 default:
279 return -ENOTTY;
280 } 280 }
281} 281}
282 282
diff --git a/drivers/watchdog/sbc7240_wdt.c b/drivers/watchdog/sbc7240_wdt.c
index abccbe265249..67ddeb1c830a 100644
--- a/drivers/watchdog/sbc7240_wdt.c
+++ b/drivers/watchdog/sbc7240_wdt.c
@@ -177,39 +177,41 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
177 case WDIOC_GETSTATUS: 177 case WDIOC_GETSTATUS:
178 case WDIOC_GETBOOTSTATUS: 178 case WDIOC_GETBOOTSTATUS:
179 return put_user(0, (int __user *)arg); 179 return put_user(0, (int __user *)arg);
180 case WDIOC_KEEPALIVE: 180 case WDIOC_SETOPTIONS:
181 wdt_keepalive(); 181 {
182 return 0; 182 int options;
183 case WDIOC_SETOPTIONS:{ 183 int retval = -EINVAL;
184 int options;
185 int retval = -EINVAL;
186 184
187 if (get_user(options, (int __user *)arg)) 185 if (get_user(options, (int __user *)arg))
188 return -EFAULT; 186 return -EFAULT;
189 187
190 if (options & WDIOS_DISABLECARD) { 188 if (options & WDIOS_DISABLECARD) {
191 wdt_disable(); 189 wdt_disable();
192 retval = 0; 190 retval = 0;
193 } 191 }
194
195 if (options & WDIOS_ENABLECARD) {
196 wdt_enable();
197 retval = 0;
198 }
199 192
200 return retval; 193 if (options & WDIOS_ENABLECARD) {
194 wdt_enable();
195 retval = 0;
201 } 196 }
202 case WDIOC_SETTIMEOUT:{
203 int new_timeout;
204 197
205 if (get_user(new_timeout, (int __user *)arg)) 198 return retval;
206 return -EFAULT; 199 }
200 case WDIOC_KEEPALIVE:
201 wdt_keepalive();
202 return 0;
203 case WDIOC_SETTIMEOUT:
204 {
205 int new_timeout;
207 206
208 if (wdt_set_timeout(new_timeout)) 207 if (get_user(new_timeout, (int __user *)arg))
209 return -EINVAL; 208 return -EFAULT;
210 209
211 /* Fall through */ 210 if (wdt_set_timeout(new_timeout))
212 } 211 return -EINVAL;
212
213 /* Fall through */
214 }
213 case WDIOC_GETTIMEOUT: 215 case WDIOC_GETTIMEOUT:
214 return put_user(timeout, (int __user *)arg); 216 return put_user(timeout, (int __user *)arg);
215 default: 217 default:
diff --git a/drivers/watchdog/sbc_epx_c3.c b/drivers/watchdog/sbc_epx_c3.c
index 70ff9cbc8e9b..e5e470ca7759 100644
--- a/drivers/watchdog/sbc_epx_c3.c
+++ b/drivers/watchdog/sbc_epx_c3.c
@@ -120,11 +120,6 @@ static long epx_c3_ioctl(struct file *file, unsigned int cmd,
120 case WDIOC_GETSTATUS: 120 case WDIOC_GETSTATUS:
121 case WDIOC_GETBOOTSTATUS: 121 case WDIOC_GETBOOTSTATUS:
122 return put_user(0, argp); 122 return put_user(0, argp);
123 case WDIOC_KEEPALIVE:
124 epx_c3_pet();
125 return 0;
126 case WDIOC_GETTIMEOUT:
127 return put_user(WATCHDOG_TIMEOUT, argp);
128 case WDIOC_SETOPTIONS: 123 case WDIOC_SETOPTIONS:
129 if (get_user(options, argp)) 124 if (get_user(options, argp))
130 return -EFAULT; 125 return -EFAULT;
@@ -140,6 +135,11 @@ static long epx_c3_ioctl(struct file *file, unsigned int cmd,
140 } 135 }
141 136
142 return retval; 137 return retval;
138 case WDIOC_KEEPALIVE:
139 epx_c3_pet();
140 return 0;
141 case WDIOC_GETTIMEOUT:
142 return put_user(WATCHDOG_TIMEOUT, argp);
143 default: 143 default:
144 return -ENOTTY; 144 return -ENOTTY;
145 } 145 }
diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c
index 03e67fa4d689..f3bdc8227cc4 100644
--- a/drivers/watchdog/sc1200wdt.c
+++ b/drivers/watchdog/sc1200wdt.c
@@ -207,24 +207,6 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
207 case WDIOC_GETBOOTSTATUS: 207 case WDIOC_GETBOOTSTATUS:
208 return put_user(0, p); 208 return put_user(0, p);
209 209
210 case WDIOC_KEEPALIVE:
211 sc1200wdt_write_data(WDTO, timeout);
212 return 0;
213
214 case WDIOC_SETTIMEOUT:
215 if (get_user(new_timeout, p))
216 return -EFAULT;
217 /* the API states this is given in secs */
218 new_timeout /= 60;
219 if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
220 return -EINVAL;
221 timeout = new_timeout;
222 sc1200wdt_write_data(WDTO, timeout);
223 /* fall through and return the new timeout */
224
225 case WDIOC_GETTIMEOUT:
226 return put_user(timeout * 60, p);
227
228 case WDIOC_SETOPTIONS: 210 case WDIOC_SETOPTIONS:
229 { 211 {
230 int options, retval = -EINVAL; 212 int options, retval = -EINVAL;
@@ -244,6 +226,24 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
244 226
245 return retval; 227 return retval;
246 } 228 }
229 case WDIOC_KEEPALIVE:
230 sc1200wdt_write_data(WDTO, timeout);
231 return 0;
232
233 case WDIOC_SETTIMEOUT:
234 if (get_user(new_timeout, p))
235 return -EFAULT;
236 /* the API states this is given in secs */
237 new_timeout /= 60;
238 if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
239 return -EINVAL;
240 timeout = new_timeout;
241 sc1200wdt_write_data(WDTO, timeout);
242 /* fall through and return the new timeout */
243
244 case WDIOC_GETTIMEOUT:
245 return put_user(timeout * 60, p);
246
247 default: 247 default:
248 return -ENOTTY; 248 return -ENOTTY;
249 } 249 }
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index 1d5ba15dec63..a2b6c1067ec5 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -291,16 +291,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
291 }; 291 };
292 292
293 switch (cmd) { 293 switch (cmd) {
294 default:
295 return -ENOTTY;
296 case WDIOC_GETSUPPORT: 294 case WDIOC_GETSUPPORT:
297 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; 295 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
298 case WDIOC_GETSTATUS: 296 case WDIOC_GETSTATUS:
299 case WDIOC_GETBOOTSTATUS: 297 case WDIOC_GETBOOTSTATUS:
300 return put_user(0, p); 298 return put_user(0, p);
301 case WDIOC_KEEPALIVE:
302 wdt_keepalive();
303 return 0;
304 case WDIOC_SETOPTIONS: 299 case WDIOC_SETOPTIONS:
305 { 300 {
306 int new_options, retval = -EINVAL; 301 int new_options, retval = -EINVAL;
@@ -320,6 +315,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
320 315
321 return retval; 316 return retval;
322 } 317 }
318 case WDIOC_KEEPALIVE:
319 wdt_keepalive();
320 return 0;
323 case WDIOC_SETTIMEOUT: 321 case WDIOC_SETTIMEOUT:
324 { 322 {
325 int new_timeout; 323 int new_timeout;
@@ -335,6 +333,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
335 } 333 }
336 case WDIOC_GETTIMEOUT: 334 case WDIOC_GETTIMEOUT:
337 return put_user(timeout, p); 335 return put_user(timeout, p);
336 default:
337 return -ENOTTY;
338 } 338 }
339} 339}
340 340
diff --git a/drivers/watchdog/scx200_wdt.c b/drivers/watchdog/scx200_wdt.c
index 7c1de94704f3..fd5c09446bce 100644
--- a/drivers/watchdog/scx200_wdt.c
+++ b/drivers/watchdog/scx200_wdt.c
@@ -168,8 +168,6 @@ static long scx200_wdt_ioctl(struct file *file, unsigned int cmd,
168 int new_margin; 168 int new_margin;
169 169
170 switch (cmd) { 170 switch (cmd) {
171 default:
172 return -ENOTTY;
173 case WDIOC_GETSUPPORT: 171 case WDIOC_GETSUPPORT:
174 if (copy_to_user(argp, &ident, sizeof(ident))) 172 if (copy_to_user(argp, &ident, sizeof(ident)))
175 return -EFAULT; 173 return -EFAULT;
@@ -194,6 +192,8 @@ static long scx200_wdt_ioctl(struct file *file, unsigned int cmd,
194 if (put_user(margin, p)) 192 if (put_user(margin, p))
195 return -EFAULT; 193 return -EFAULT;
196 return 0; 194 return 0;
195 default:
196 return -ENOTTY;
197 } 197 }
198} 198}
199 199
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
index 60f0036aaca6..824125adf90a 100644
--- a/drivers/watchdog/shwdt.c
+++ b/drivers/watchdog/shwdt.c
@@ -351,20 +351,6 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd,
351 case WDIOC_GETSTATUS: 351 case WDIOC_GETSTATUS:
352 case WDIOC_GETBOOTSTATUS: 352 case WDIOC_GETBOOTSTATUS:
353 return put_user(0, (int *)arg); 353 return put_user(0, (int *)arg);
354 case WDIOC_KEEPALIVE:
355 sh_wdt_keepalive();
356 return 0;
357 case WDIOC_SETTIMEOUT:
358 if (get_user(new_heartbeat, (int *)arg))
359 return -EFAULT;
360
361 if (sh_wdt_set_heartbeat(new_heartbeat))
362 return -EINVAL;
363
364 sh_wdt_keepalive();
365 /* Fall */
366 case WDIOC_GETTIMEOUT:
367 return put_user(heartbeat, (int *)arg);
368 case WDIOC_SETOPTIONS: 354 case WDIOC_SETOPTIONS:
369 if (get_user(options, (int *)arg)) 355 if (get_user(options, (int *)arg))
370 return -EFAULT; 356 return -EFAULT;
@@ -380,6 +366,20 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd,
380 } 366 }
381 367
382 return retval; 368 return retval;
369 case WDIOC_KEEPALIVE:
370 sh_wdt_keepalive();
371 return 0;
372 case WDIOC_SETTIMEOUT:
373 if (get_user(new_heartbeat, (int *)arg))
374 return -EFAULT;
375
376 if (sh_wdt_set_heartbeat(new_heartbeat))
377 return -EINVAL;
378
379 sh_wdt_keepalive();
380 /* Fall */
381 case WDIOC_GETTIMEOUT:
382 return put_user(heartbeat, (int *)arg);
383 default: 383 default:
384 return -ENOTTY; 384 return -ENOTTY;
385 } 385 }
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index b7c6394b7d70..239383da6d87 100644
--- a/drivers/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
@@ -451,6 +451,23 @@ static long wb_smsc_wdt_ioctl(struct file *file,
451 return put_user(wb_smsc_wdt_status(), uarg.i); 451 return put_user(wb_smsc_wdt_status(), uarg.i);
452 case WDIOC_GETBOOTSTATUS: 452 case WDIOC_GETBOOTSTATUS:
453 return put_user(0, uarg.i); 453 return put_user(0, uarg.i);
454 case WDIOC_SETOPTIONS:
455 {
456 int options, retval = -EINVAL;
457
458 if (get_user(options, uarg.i))
459 return -EFAULT;
460
461 if (options & WDIOS_DISABLECARD) {
462 wb_smsc_wdt_disable();
463 retval = 0;
464 }
465 if (options & WDIOS_ENABLECARD) {
466 wb_smsc_wdt_enable();
467 retval = 0;
468 }
469 return retval;
470 }
454 case WDIOC_KEEPALIVE: 471 case WDIOC_KEEPALIVE:
455 wb_smsc_wdt_reset_timer(); 472 wb_smsc_wdt_reset_timer();
456 return 0; 473 return 0;
@@ -470,23 +487,6 @@ static long wb_smsc_wdt_ioctl(struct file *file,
470 if (unit == UNIT_MINUTE) 487 if (unit == UNIT_MINUTE)
471 new_timeout *= 60; 488 new_timeout *= 60;
472 return put_user(new_timeout, uarg.i); 489 return put_user(new_timeout, uarg.i);
473 case WDIOC_SETOPTIONS:
474 {
475 int options, retval = -EINVAL;
476
477 if (get_user(options, uarg.i))
478 return -EFAULT;
479
480 if (options & WDIOS_DISABLECARD) {
481 wb_smsc_wdt_disable();
482 retval = 0;
483 }
484 if (options & WDIOS_ENABLECARD) {
485 wb_smsc_wdt_enable();
486 retval = 0;
487 }
488 return retval;
489 }
490 default: 490 default:
491 return -ENOTTY; 491 return -ENOTTY;
492 } 492 }
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index bb3c75eed9df..c650464c5c63 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -206,8 +206,6 @@ static long softdog_ioctl(struct file *file, unsigned int cmd,
206 .identity = "Software Watchdog", 206 .identity = "Software Watchdog",
207 }; 207 };
208 switch (cmd) { 208 switch (cmd) {
209 default:
210 return -ENOTTY;
211 case WDIOC_GETSUPPORT: 209 case WDIOC_GETSUPPORT:
212 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; 210 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
213 case WDIOC_GETSTATUS: 211 case WDIOC_GETSTATUS:
@@ -225,6 +223,8 @@ static long softdog_ioctl(struct file *file, unsigned int cmd,
225 /* Fall */ 223 /* Fall */
226 case WDIOC_GETTIMEOUT: 224 case WDIOC_GETTIMEOUT:
227 return put_user(soft_margin, p); 225 return put_user(soft_margin, p);
226 default:
227 return -ENOTTY;
228 } 228 }
229} 229}
230 230
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c
index b729cc447df3..8382f9a9534b 100644
--- a/drivers/watchdog/txx9wdt.c
+++ b/drivers/watchdog/txx9wdt.c
@@ -142,8 +142,6 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd,
142 }; 142 };
143 143
144 switch (cmd) { 144 switch (cmd) {
145 default:
146 return -ENOTTY;
147 case WDIOC_GETSUPPORT: 145 case WDIOC_GETSUPPORT:
148 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; 146 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
149 case WDIOC_GETSTATUS: 147 case WDIOC_GETSTATUS:
@@ -163,6 +161,8 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd,
163 /* Fall */ 161 /* Fall */
164 case WDIOC_GETTIMEOUT: 162 case WDIOC_GETTIMEOUT:
165 return put_user(timeout, p); 163 return put_user(timeout, p);
164 default:
165 return -ENOTTY;
166 } 166 }
167} 167}
168 168
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index 70c843f4201a..59507f609996 100644
--- a/drivers/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
@@ -211,18 +211,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
211 case WDIOC_GETSTATUS: 211 case WDIOC_GETSTATUS:
212 case WDIOC_GETBOOTSTATUS: 212 case WDIOC_GETBOOTSTATUS:
213 return put_user(0, p); 213 return put_user(0, p);
214 case WDIOC_KEEPALIVE:
215 wdt_ping();
216 break;
217 case WDIOC_SETTIMEOUT:
218 if (get_user(new_timeout, p))
219 return -EFAULT;
220 if (wdt_set_heartbeat(new_timeout))
221 return -EINVAL;
222 wdt_ping();
223 /* Fall */
224 case WDIOC_GETTIMEOUT:
225 return put_user(timeout, p);
226 case WDIOC_SETOPTIONS: 214 case WDIOC_SETOPTIONS:
227 { 215 {
228 int options, retval = -EINVAL; 216 int options, retval = -EINVAL;
@@ -239,6 +227,18 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
239 } 227 }
240 return retval; 228 return retval;
241 } 229 }
230 case WDIOC_KEEPALIVE:
231 wdt_ping();
232 break;
233 case WDIOC_SETTIMEOUT:
234 if (get_user(new_timeout, p))
235 return -EFAULT;
236 if (wdt_set_heartbeat(new_timeout))
237 return -EINVAL;
238 wdt_ping();
239 /* Fall */
240 case WDIOC_GETTIMEOUT:
241 return put_user(timeout, p);
242 default: 242 default:
243 return -ENOTTY; 243 return -ENOTTY;
244 } 244 }
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 06ddd38675bd..12bd6618ed5e 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -251,21 +251,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
251 case WDIOC_GETBOOTSTATUS: 251 case WDIOC_GETBOOTSTATUS:
252 return put_user(0, p); 252 return put_user(0, p);
253 253
254 case WDIOC_KEEPALIVE:
255 wdt_ping();
256 break;
257
258 case WDIOC_SETTIMEOUT:
259 if (get_user(new_timeout, p))
260 return -EFAULT;
261 if (wdt_set_heartbeat(new_timeout))
262 return -EINVAL;
263 wdt_ping();
264 /* Fall */
265
266 case WDIOC_GETTIMEOUT:
267 return put_user(timeout, p);
268
269 case WDIOC_SETOPTIONS: 254 case WDIOC_SETOPTIONS:
270 { 255 {
271 int options, retval = -EINVAL; 256 int options, retval = -EINVAL;
@@ -286,6 +271,21 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
286 return retval; 271 return retval;
287 } 272 }
288 273
274 case WDIOC_KEEPALIVE:
275 wdt_ping();
276 break;
277
278 case WDIOC_SETTIMEOUT:
279 if (get_user(new_timeout, p))
280 return -EFAULT;
281 if (wdt_set_heartbeat(new_timeout))
282 return -EINVAL;
283 wdt_ping();
284 /* Fall */
285
286 case WDIOC_GETTIMEOUT:
287 return put_user(timeout, p);
288
289 default: 289 default:
290 return -ENOTTY; 290 return -ENOTTY;
291 } 291 }
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index 75b546d7d8c2..24587d2060c4 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -254,16 +254,11 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
254 }; 254 };
255 255
256 switch (cmd) { 256 switch (cmd) {
257 default:
258 return -ENOTTY;
259 case WDIOC_GETSUPPORT: 257 case WDIOC_GETSUPPORT:
260 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; 258 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
261 case WDIOC_GETSTATUS: 259 case WDIOC_GETSTATUS:
262 case WDIOC_GETBOOTSTATUS: 260 case WDIOC_GETBOOTSTATUS:
263 return put_user(0, p); 261 return put_user(0, p);
264 case WDIOC_KEEPALIVE:
265 wdt_keepalive();
266 return 0;
267 case WDIOC_SETOPTIONS: 262 case WDIOC_SETOPTIONS:
268 { 263 {
269 int new_options, retval = -EINVAL; 264 int new_options, retval = -EINVAL;
@@ -283,6 +278,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
283 278
284 return retval; 279 return retval;
285 } 280 }
281 case WDIOC_KEEPALIVE:
282 wdt_keepalive();
283 return 0;
286 case WDIOC_SETTIMEOUT: 284 case WDIOC_SETTIMEOUT:
287 { 285 {
288 int new_timeout; 286 int new_timeout;
@@ -300,6 +298,8 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
300 } 298 }
301 case WDIOC_GETTIMEOUT: 299 case WDIOC_GETTIMEOUT:
302 return put_user(timeout, p); 300 return put_user(timeout, p);
301 default:
302 return -ENOTTY;
303 } 303 }
304} 304}
305 305
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c
index 6860a13f5bb9..2525da5080ca 100644
--- a/drivers/watchdog/w83977f_wdt.c
+++ b/drivers/watchdog/w83977f_wdt.c
@@ -390,9 +390,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
390 uarg.i = (int __user *)arg; 390 uarg.i = (int __user *)arg;
391 391
392 switch (cmd) { 392 switch (cmd) {
393 default:
394 return -ENOTTY;
395
396 case WDIOC_GETSUPPORT: 393 case WDIOC_GETSUPPORT:
397 return copy_to_user(uarg.ident, &ident, 394 return copy_to_user(uarg.ident, &ident,
398 sizeof(ident)) ? -EFAULT : 0; 395 sizeof(ident)) ? -EFAULT : 0;
@@ -404,10 +401,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
404 case WDIOC_GETBOOTSTATUS: 401 case WDIOC_GETBOOTSTATUS:
405 return put_user(0, uarg.i); 402 return put_user(0, uarg.i);
406 403
407 case WDIOC_KEEPALIVE:
408 wdt_keepalive();
409 return 0;
410
411 case WDIOC_SETOPTIONS: 404 case WDIOC_SETOPTIONS:
412 if (get_user(new_options, uarg.i)) 405 if (get_user(new_options, uarg.i))
413 return -EFAULT; 406 return -EFAULT;
@@ -424,6 +417,10 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
424 417
425 return retval; 418 return retval;
426 419
420 case WDIOC_KEEPALIVE:
421 wdt_keepalive();
422 return 0;
423
427 case WDIOC_SETTIMEOUT: 424 case WDIOC_SETTIMEOUT:
428 if (get_user(new_timeout, uarg.i)) 425 if (get_user(new_timeout, uarg.i))
429 return -EFAULT; 426 return -EFAULT;
@@ -437,6 +434,9 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
437 case WDIOC_GETTIMEOUT: 434 case WDIOC_GETTIMEOUT:
438 return put_user(timeout, uarg.i); 435 return put_user(timeout, uarg.i);
439 436
437 default:
438 return -ENOTTY;
439
440 } 440 }
441} 441}
442 442
diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c
index 886cbbcf3eed..44e81f7d4322 100644
--- a/drivers/watchdog/wafer5823wdt.c
+++ b/drivers/watchdog/wafer5823wdt.c
@@ -145,22 +145,6 @@ static long wafwdt_ioctl(struct file *file, unsigned int cmd,
145 case WDIOC_GETBOOTSTATUS: 145 case WDIOC_GETBOOTSTATUS:
146 return put_user(0, p); 146 return put_user(0, p);
147 147
148 case WDIOC_KEEPALIVE:
149 wafwdt_ping();
150 break;
151
152 case WDIOC_SETTIMEOUT:
153 if (get_user(new_timeout, p))
154 return -EFAULT;
155 if ((new_timeout < 1) || (new_timeout > 255))
156 return -EINVAL;
157 timeout = new_timeout;
158 wafwdt_stop();
159 wafwdt_start();
160 /* Fall */
161 case WDIOC_GETTIMEOUT:
162 return put_user(timeout, p);
163
164 case WDIOC_SETOPTIONS: 148 case WDIOC_SETOPTIONS:
165 { 149 {
166 int options, retval = -EINVAL; 150 int options, retval = -EINVAL;
@@ -181,6 +165,22 @@ static long wafwdt_ioctl(struct file *file, unsigned int cmd,
181 return retval; 165 return retval;
182 } 166 }
183 167
168 case WDIOC_KEEPALIVE:
169 wafwdt_ping();
170 break;
171
172 case WDIOC_SETTIMEOUT:
173 if (get_user(new_timeout, p))
174 return -EFAULT;
175 if ((new_timeout < 1) || (new_timeout > 255))
176 return -EINVAL;
177 timeout = new_timeout;
178 wafwdt_stop();
179 wafwdt_start();
180 /* Fall */
181 case WDIOC_GETTIMEOUT:
182 return put_user(timeout, p);
183
184 default: 184 default:
185 return -ENOTTY; 185 return -ENOTTY;
186 } 186 }
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
index 53a6b18bcb9a..deeebb2b13ea 100644
--- a/drivers/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
@@ -373,8 +373,6 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
373#endif /* CONFIG_WDT_501 */ 373#endif /* CONFIG_WDT_501 */
374 374
375 switch (cmd) { 375 switch (cmd) {
376 default:
377 return -ENOTTY;
378 case WDIOC_GETSUPPORT: 376 case WDIOC_GETSUPPORT:
379 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; 377 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
380 case WDIOC_GETSTATUS: 378 case WDIOC_GETSTATUS:
@@ -394,6 +392,8 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
394 /* Fall */ 392 /* Fall */
395 case WDIOC_GETTIMEOUT: 393 case WDIOC_GETTIMEOUT:
396 return put_user(heartbeat, p); 394 return put_user(heartbeat, p);
395 default:
396 return -ENOTTY;
397 } 397 }
398} 398}
399 399
diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c
index bdc28e522f03..60e28d49ff52 100644
--- a/drivers/watchdog/wdt977.c
+++ b/drivers/watchdog/wdt977.c
@@ -365,9 +365,6 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
365 uarg.i = (int __user *)arg; 365 uarg.i = (int __user *)arg;
366 366
367 switch (cmd) { 367 switch (cmd) {
368 default:
369 return -ENOTTY;
370
371 case WDIOC_GETSUPPORT: 368 case WDIOC_GETSUPPORT:
372 return copy_to_user(uarg.ident, &ident, 369 return copy_to_user(uarg.ident, &ident,
373 sizeof(ident)) ? -EFAULT : 0; 370 sizeof(ident)) ? -EFAULT : 0;
@@ -379,10 +376,6 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
379 case WDIOC_GETBOOTSTATUS: 376 case WDIOC_GETBOOTSTATUS:
380 return put_user(0, uarg.i); 377 return put_user(0, uarg.i);
381 378
382 case WDIOC_KEEPALIVE:
383 wdt977_keepalive();
384 return 0;
385
386 case WDIOC_SETOPTIONS: 379 case WDIOC_SETOPTIONS:
387 if (get_user(new_options, uarg.i)) 380 if (get_user(new_options, uarg.i))
388 return -EFAULT; 381 return -EFAULT;
@@ -399,6 +392,10 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
399 392
400 return retval; 393 return retval;
401 394
395 case WDIOC_KEEPALIVE:
396 wdt977_keepalive();
397 return 0;
398
402 case WDIOC_SETTIMEOUT: 399 case WDIOC_SETTIMEOUT:
403 if (get_user(new_timeout, uarg.i)) 400 if (get_user(new_timeout, uarg.i))
404 return -EFAULT; 401 return -EFAULT;
@@ -412,6 +409,9 @@ static long wdt977_ioctl(struct file *file, unsigned int cmd,
412 case WDIOC_GETTIMEOUT: 409 case WDIOC_GETTIMEOUT:
413 return put_user(timeout, uarg.i); 410 return put_user(timeout, uarg.i);
414 411
412 default:
413 return -ENOTTY;
414
415 } 415 }
416} 416}
417 417
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c
index 5d922fd6eafc..fb8fc0144852 100644
--- a/drivers/watchdog/wdt_pci.c
+++ b/drivers/watchdog/wdt_pci.c
@@ -428,8 +428,6 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd,
428#endif /* CONFIG_WDT_501_PCI */ 428#endif /* CONFIG_WDT_501_PCI */
429 429
430 switch (cmd) { 430 switch (cmd) {
431 default:
432 return -ENOTTY;
433 case WDIOC_GETSUPPORT: 431 case WDIOC_GETSUPPORT:
434 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; 432 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
435 case WDIOC_GETSTATUS: 433 case WDIOC_GETSTATUS:
@@ -449,7 +447,9 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd,
449 /* Fall */ 447 /* Fall */
450 case WDIOC_GETTIMEOUT: 448 case WDIOC_GETTIMEOUT:
451 return put_user(heartbeat, p); 449 return put_user(heartbeat, p);
452 } 450 default:
451 return -ENOTTY;
452 }
453} 453}
454 454
455/** 455/**