diff options
Diffstat (limited to 'drivers/watchdog/sc1200wdt.c')
-rw-r--r-- | drivers/watchdog/sc1200wdt.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c index 621ebad56d86..23da3ccd832a 100644 --- a/drivers/watchdog/sc1200wdt.c +++ b/drivers/watchdog/sc1200wdt.c | |||
@@ -196,7 +196,6 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd, | |||
196 | }; | 196 | }; |
197 | 197 | ||
198 | switch (cmd) { | 198 | switch (cmd) { |
199 | |||
200 | case WDIOC_GETSUPPORT: | 199 | case WDIOC_GETSUPPORT: |
201 | if (copy_to_user(argp, &ident, sizeof ident)) | 200 | if (copy_to_user(argp, &ident, sizeof ident)) |
202 | return -EFAULT; | 201 | return -EFAULT; |
@@ -208,24 +207,6 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd, | |||
208 | case WDIOC_GETBOOTSTATUS: | 207 | case WDIOC_GETBOOTSTATUS: |
209 | return put_user(0, p); | 208 | return put_user(0, p); |
210 | 209 | ||
211 | case WDIOC_KEEPALIVE: | ||
212 | sc1200wdt_write_data(WDTO, timeout); | ||
213 | return 0; | ||
214 | |||
215 | case WDIOC_SETTIMEOUT: | ||
216 | if (get_user(new_timeout, p)) | ||
217 | return -EFAULT; | ||
218 | /* the API states this is given in secs */ | ||
219 | new_timeout /= 60; | ||
220 | if (new_timeout < 0 || new_timeout > MAX_TIMEOUT) | ||
221 | return -EINVAL; | ||
222 | timeout = new_timeout; | ||
223 | sc1200wdt_write_data(WDTO, timeout); | ||
224 | /* fall through and return the new timeout */ | ||
225 | |||
226 | case WDIOC_GETTIMEOUT: | ||
227 | return put_user(timeout * 60, p); | ||
228 | |||
229 | case WDIOC_SETOPTIONS: | 210 | case WDIOC_SETOPTIONS: |
230 | { | 211 | { |
231 | int options, retval = -EINVAL; | 212 | int options, retval = -EINVAL; |
@@ -245,6 +226,24 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd, | |||
245 | 226 | ||
246 | return retval; | 227 | return retval; |
247 | } | 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 | |||
248 | default: | 247 | default: |
249 | return -ENOTTY; | 248 | return -ENOTTY; |
250 | } | 249 | } |
@@ -280,7 +279,7 @@ static ssize_t sc1200wdt_write(struct file *file, const char __user *data, | |||
280 | for (i = 0; i != len; i++) { | 279 | for (i = 0; i != len; i++) { |
281 | char c; | 280 | char c; |
282 | 281 | ||
283 | if (get_user(c, data+i)) | 282 | if (get_user(c, data + i)) |
284 | return -EFAULT; | 283 | return -EFAULT; |
285 | if (c == 'V') | 284 | if (c == 'V') |
286 | expect_close = 42; | 285 | expect_close = 42; |