aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/sbc7240_wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/sbc7240_wdt.c')
-rw-r--r--drivers/watchdog/sbc7240_wdt.c54
1 files changed, 28 insertions, 26 deletions
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: