wdrtas.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. /*
  2. * FIXME: add wdrtas_get_status and wdrtas_get_boot_status as soon as
  3. * RTAS calls are available
  4. */
  5. /*
  6. * RTAS watchdog driver
  7. *
  8. * (C) Copyright IBM Corp. 2005
  9. * device driver to exploit watchdog RTAS functions
  10. *
  11. * Authors : Utz Bacher <utz.bacher@de.ibm.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2, or (at your option)
  16. * any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26. */
  27. #include <linux/fs.h>
  28. #include <linux/init.h>
  29. #include <linux/kernel.h>
  30. #include <linux/miscdevice.h>
  31. #include <linux/module.h>
  32. #include <linux/notifier.h>
  33. #include <linux/reboot.h>
  34. #include <linux/types.h>
  35. #include <linux/watchdog.h>
  36. #include <linux/uaccess.h>
  37. #include <asm/rtas.h>
  38. #define WDRTAS_MAGIC_CHAR 42
  39. #define WDRTAS_SUPPORTED_MASK (WDIOF_SETTIMEOUT | \
  40. WDIOF_MAGICCLOSE)
  41. MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>");
  42. MODULE_DESCRIPTION("RTAS watchdog driver");
  43. MODULE_LICENSE("GPL");
  44. MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
  45. MODULE_ALIAS_MISCDEV(TEMP_MINOR);
  46. #ifdef CONFIG_WATCHDOG_NOWAYOUT
  47. static int wdrtas_nowayout = 1;
  48. #else
  49. static int wdrtas_nowayout = 0;
  50. #endif
  51. static atomic_t wdrtas_miscdev_open = ATOMIC_INIT(0);
  52. static char wdrtas_expect_close;
  53. static int wdrtas_interval;
  54. #define WDRTAS_THERMAL_SENSOR 3
  55. static int wdrtas_token_get_sensor_state;
  56. #define WDRTAS_SURVEILLANCE_IND 9000
  57. static int wdrtas_token_set_indicator;
  58. #define WDRTAS_SP_SPI 28
  59. static int wdrtas_token_get_sp;
  60. static int wdrtas_token_event_scan;
  61. #define WDRTAS_DEFAULT_INTERVAL 300
  62. #define WDRTAS_LOGBUFFER_LEN 128
  63. static char wdrtas_logbuffer[WDRTAS_LOGBUFFER_LEN];
  64. /*** watchdog access functions */
  65. /**
  66. * wdrtas_set_interval - sets the watchdog interval
  67. * @interval: new interval
  68. *
  69. * returns 0 on success, <0 on failures
  70. *
  71. * wdrtas_set_interval sets the watchdog keepalive interval by calling the
  72. * RTAS function set-indicator (surveillance). The unit of interval is
  73. * seconds.
  74. */
  75. static int wdrtas_set_interval(int interval)
  76. {
  77. long result;
  78. static int print_msg = 10;
  79. /* rtas uses minutes */
  80. interval = (interval + 59) / 60;
  81. result = rtas_call(wdrtas_token_set_indicator, 3, 1, NULL,
  82. WDRTAS_SURVEILLANCE_IND, 0, interval);
  83. if (result < 0 && print_msg) {
  84. printk(KERN_ERR "wdrtas: setting the watchdog to %i "
  85. "timeout failed: %li\n", interval, result);
  86. print_msg--;
  87. }
  88. return result;
  89. }
  90. #define WDRTAS_SP_SPI_LEN 4
  91. /**
  92. * wdrtas_get_interval - returns the current watchdog interval
  93. * @fallback_value: value (in seconds) to use, if the RTAS call fails
  94. *
  95. * returns the interval
  96. *
  97. * wdrtas_get_interval returns the current watchdog keepalive interval
  98. * as reported by the RTAS function ibm,get-system-parameter. The unit
  99. * of the return value is seconds.
  100. */
  101. static int wdrtas_get_interval(int fallback_value)
  102. {
  103. long result;
  104. char value[WDRTAS_SP_SPI_LEN];
  105. spin_lock(&rtas_data_buf_lock);
  106. memset(rtas_data_buf, 0, WDRTAS_SP_SPI_LEN);
  107. result = rtas_call(wdrtas_token_get_sp, 3, 1, NULL,
  108. WDRTAS_SP_SPI, __pa(rtas_data_buf),
  109. WDRTAS_SP_SPI_LEN);
  110. memcpy(value, rtas_data_buf, WDRTAS_SP_SPI_LEN);
  111. spin_unlock(&rtas_data_buf_lock);
  112. if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) {
  113. printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog "
  114. "timeout (%li). Continuing\n", result);
  115. return fallback_value;
  116. }
  117. /* rtas uses minutes */
  118. return ((int)value[2]) * 60;
  119. }
  120. /**
  121. * wdrtas_timer_start - starts watchdog
  122. *
  123. * wdrtas_timer_start starts the watchdog by calling the RTAS function
  124. * set-interval (surveillance)
  125. */
  126. static void wdrtas_timer_start(void)
  127. {
  128. wdrtas_set_interval(wdrtas_interval);
  129. }
  130. /**
  131. * wdrtas_timer_stop - stops watchdog
  132. *
  133. * wdrtas_timer_stop stops the watchdog timer by calling the RTAS function
  134. * set-interval (surveillance)
  135. */
  136. static void wdrtas_timer_stop(void)
  137. {
  138. wdrtas_set_interval(0);
  139. }
  140. /**
  141. * wdrtas_log_scanned_event - logs an event we received during keepalive
  142. *
  143. * wdrtas_log_scanned_event prints a message to the log buffer dumping
  144. * the results of the last event-scan call
  145. */
  146. static void wdrtas_log_scanned_event(void)
  147. {
  148. int i;
  149. for (i = 0; i < WDRTAS_LOGBUFFER_LEN; i += 16)
  150. printk(KERN_INFO "wdrtas: dumping event (line %i/%i), data = "
  151. "%02x %02x %02x %02x %02x %02x %02x %02x "
  152. "%02x %02x %02x %02x %02x %02x %02x %02x\n",
  153. (i / 16) + 1, (WDRTAS_LOGBUFFER_LEN / 16),
  154. wdrtas_logbuffer[i + 0], wdrtas_logbuffer[i + 1],
  155. wdrtas_logbuffer[i + 2], wdrtas_logbuffer[i + 3],
  156. wdrtas_logbuffer[i + 4], wdrtas_logbuffer[i + 5],
  157. wdrtas_logbuffer[i + 6], wdrtas_logbuffer[i + 7],
  158. wdrtas_logbuffer[i + 8], wdrtas_logbuffer[i + 9],
  159. wdrtas_logbuffer[i + 10], wdrtas_logbuffer[i + 11],
  160. wdrtas_logbuffer[i + 12], wdrtas_logbuffer[i + 13],
  161. wdrtas_logbuffer[i + 14], wdrtas_logbuffer[i + 15]);
  162. }
  163. /**
  164. * wdrtas_timer_keepalive - resets watchdog timer to keep system alive
  165. *
  166. * wdrtas_timer_keepalive restarts the watchdog timer by calling the
  167. * RTAS function event-scan and repeats these calls as long as there are
  168. * events available. All events will be dumped.
  169. */
  170. static void wdrtas_timer_keepalive(void)
  171. {
  172. long result;
  173. do {
  174. result = rtas_call(wdrtas_token_event_scan, 4, 1, NULL,
  175. RTAS_EVENT_SCAN_ALL_EVENTS, 0,
  176. (void *)__pa(wdrtas_logbuffer),
  177. WDRTAS_LOGBUFFER_LEN);
  178. if (result < 0)
  179. printk(KERN_ERR "wdrtas: event-scan failed: %li\n",
  180. result);
  181. if (result == 0)
  182. wdrtas_log_scanned_event();
  183. } while (result == 0);
  184. }
  185. /**
  186. * wdrtas_get_temperature - returns current temperature
  187. *
  188. * returns temperature or <0 on failures
  189. *
  190. * wdrtas_get_temperature returns the current temperature in Fahrenheit. It
  191. * uses the RTAS call get-sensor-state, token 3 to do so
  192. */
  193. static int wdrtas_get_temperature(void)
  194. {
  195. long result;
  196. int temperature = 0;
  197. result = rtas_call(wdrtas_token_get_sensor_state, 2, 2,
  198. (void *)__pa(&temperature),
  199. WDRTAS_THERMAL_SENSOR, 0);
  200. if (result < 0)
  201. printk(KERN_WARNING "wdrtas: reading the thermal sensor "
  202. "faild: %li\n", result);
  203. else
  204. temperature = ((temperature * 9) / 5) + 32; /* fahrenheit */
  205. return temperature;
  206. }
  207. /**
  208. * wdrtas_get_status - returns the status of the watchdog
  209. *
  210. * returns a bitmask of defines WDIOF_... as defined in
  211. * include/linux/watchdog.h
  212. */
  213. static int wdrtas_get_status(void)
  214. {
  215. return 0; /* TODO */
  216. }
  217. /**
  218. * wdrtas_get_boot_status - returns the reason for the last boot
  219. *
  220. * returns a bitmask of defines WDIOF_... as defined in
  221. * include/linux/watchdog.h, indicating why the watchdog rebooted the system
  222. */
  223. static int wdrtas_get_boot_status(void)
  224. {
  225. return 0; /* TODO */
  226. }
  227. /*** watchdog API and operations stuff */
  228. /* wdrtas_write - called when watchdog device is written to
  229. * @file: file structure
  230. * @buf: user buffer with data
  231. * @len: amount to data written
  232. * @ppos: position in file
  233. *
  234. * returns the number of successfully processed characters, which is always
  235. * the number of bytes passed to this function
  236. *
  237. * wdrtas_write processes all the data given to it and looks for the magic
  238. * character 'V'. This character allows the watchdog device to be closed
  239. * properly.
  240. */
  241. static ssize_t wdrtas_write(struct file *file, const char __user *buf,
  242. size_t len, loff_t *ppos)
  243. {
  244. int i;
  245. char c;
  246. if (!len)
  247. goto out;
  248. if (!wdrtas_nowayout) {
  249. wdrtas_expect_close = 0;
  250. /* look for 'V' */
  251. for (i = 0; i < len; i++) {
  252. if (get_user(c, buf + i))
  253. return -EFAULT;
  254. /* allow to close device */
  255. if (c == 'V')
  256. wdrtas_expect_close = WDRTAS_MAGIC_CHAR;
  257. }
  258. }
  259. wdrtas_timer_keepalive();
  260. out:
  261. return len;
  262. }
  263. /**
  264. * wdrtas_ioctl - ioctl function for the watchdog device
  265. * @file: file structure
  266. * @cmd: command for ioctl
  267. * @arg: argument pointer
  268. *
  269. * returns 0 on success, <0 on failure
  270. *
  271. * wdrtas_ioctl implements the watchdog API ioctls
  272. */
  273. static long wdrtas_ioctl(struct file *file, unsigned int cmd,
  274. unsigned long arg)
  275. {
  276. int __user *argp = (void __user *)arg;
  277. int i;
  278. static struct watchdog_info wdinfo = {
  279. .options = WDRTAS_SUPPORTED_MASK,
  280. .firmware_version = 0,
  281. .identity = "wdrtas",
  282. };
  283. switch (cmd) {
  284. case WDIOC_GETSUPPORT:
  285. if (copy_to_user(argp, &wdinfo, sizeof(wdinfo)))
  286. return -EFAULT;
  287. return 0;
  288. case WDIOC_GETSTATUS:
  289. i = wdrtas_get_status();
  290. return put_user(i, argp);
  291. case WDIOC_GETBOOTSTATUS:
  292. i = wdrtas_get_boot_status();
  293. return put_user(i, argp);
  294. case WDIOC_GETTEMP:
  295. if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE)
  296. return -EOPNOTSUPP;
  297. i = wdrtas_get_temperature();
  298. return put_user(i, argp);
  299. case WDIOC_SETOPTIONS:
  300. if (get_user(i, argp))
  301. return -EFAULT;
  302. if (i & WDIOS_DISABLECARD)
  303. wdrtas_timer_stop();
  304. if (i & WDIOS_ENABLECARD) {
  305. wdrtas_timer_keepalive();
  306. wdrtas_timer_start();
  307. }
  308. /* not implemented. Done by H8
  309. if (i & WDIOS_TEMPPANIC) {
  310. } */
  311. return 0;
  312. case WDIOC_KEEPALIVE:
  313. wdrtas_timer_keepalive();
  314. return 0;
  315. case WDIOC_SETTIMEOUT:
  316. if (get_user(i, argp))
  317. return -EFAULT;
  318. if (wdrtas_set_interval(i))
  319. return -EINVAL;
  320. wdrtas_timer_keepalive();
  321. if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE)
  322. wdrtas_interval = i;
  323. else
  324. wdrtas_interval = wdrtas_get_interval(i);
  325. /* fallthrough */
  326. case WDIOC_GETTIMEOUT:
  327. return put_user(wdrtas_interval, argp);
  328. default:
  329. return -ENOTTY;
  330. }
  331. }
  332. /**
  333. * wdrtas_open - open function of watchdog device
  334. * @inode: inode structure
  335. * @file: file structure
  336. *
  337. * returns 0 on success, -EBUSY if the file has been opened already, <0 on
  338. * other failures
  339. *
  340. * function called when watchdog device is opened
  341. */
  342. static int wdrtas_open(struct inode *inode, struct file *file)
  343. {
  344. /* only open once */
  345. if (atomic_inc_return(&wdrtas_miscdev_open) > 1) {
  346. atomic_dec(&wdrtas_miscdev_open);
  347. return -EBUSY;
  348. }
  349. wdrtas_timer_start();
  350. wdrtas_timer_keepalive();
  351. return nonseekable_open(inode, file);
  352. }
  353. /**
  354. * wdrtas_close - close function of watchdog device
  355. * @inode: inode structure
  356. * @file: file structure
  357. *
  358. * returns 0 on success
  359. *
  360. * close function. Always succeeds
  361. */
  362. static int wdrtas_close(struct inode *inode, struct file *file)
  363. {
  364. /* only stop watchdog, if this was announced using 'V' before */
  365. if (wdrtas_expect_close == WDRTAS_MAGIC_CHAR)
  366. wdrtas_timer_stop();
  367. else {
  368. printk(KERN_WARNING "wdrtas: got unexpected close. Watchdog "
  369. "not stopped.\n");
  370. wdrtas_timer_keepalive();
  371. }
  372. wdrtas_expect_close = 0;
  373. atomic_dec(&wdrtas_miscdev_open);
  374. return 0;
  375. }
  376. /**
  377. * wdrtas_temp_read - gives back the temperature in fahrenheit
  378. * @file: file structure
  379. * @buf: user buffer
  380. * @count: number of bytes to be read
  381. * @ppos: position in file
  382. *
  383. * returns always 1 or -EFAULT in case of user space copy failures, <0 on
  384. * other failures
  385. *
  386. * wdrtas_temp_read gives the temperature to the users by copying this
  387. * value as one byte into the user space buffer. The unit is Fahrenheit...
  388. */
  389. static ssize_t wdrtas_temp_read(struct file *file, char __user *buf,
  390. size_t count, loff_t *ppos)
  391. {
  392. int temperature = 0;
  393. temperature = wdrtas_get_temperature();
  394. if (temperature < 0)
  395. return temperature;
  396. if (copy_to_user(buf, &temperature, 1))
  397. return -EFAULT;
  398. return 1;
  399. }
  400. /**
  401. * wdrtas_temp_open - open function of temperature device
  402. * @inode: inode structure
  403. * @file: file structure
  404. *
  405. * returns 0 on success, <0 on failure
  406. *
  407. * function called when temperature device is opened
  408. */
  409. static int wdrtas_temp_open(struct inode *inode, struct file *file)
  410. {
  411. return nonseekable_open(inode, file);
  412. }
  413. /**
  414. * wdrtas_temp_close - close function of temperature device
  415. * @inode: inode structure
  416. * @file: file structure
  417. *
  418. * returns 0 on success
  419. *
  420. * close function. Always succeeds
  421. */
  422. static int wdrtas_temp_close(struct inode *inode, struct file *file)
  423. {
  424. return 0;
  425. }
  426. /**
  427. * wdrtas_reboot - reboot notifier function
  428. * @nb: notifier block structure
  429. * @code: reboot code
  430. * @ptr: unused
  431. *
  432. * returns NOTIFY_DONE
  433. *
  434. * wdrtas_reboot stops the watchdog in case of a reboot
  435. */
  436. static int wdrtas_reboot(struct notifier_block *this,
  437. unsigned long code, void *ptr)
  438. {
  439. if (code == SYS_DOWN || code == SYS_HALT)
  440. wdrtas_timer_stop();
  441. return NOTIFY_DONE;
  442. }
  443. /*** initialization stuff */
  444. static const struct file_operations wdrtas_fops = {
  445. .owner = THIS_MODULE,
  446. .llseek = no_llseek,
  447. .write = wdrtas_write,
  448. .unlocked_ioctl = wdrtas_ioctl,
  449. .open = wdrtas_open,
  450. .release = wdrtas_close,
  451. };
  452. static struct miscdevice wdrtas_miscdev = {
  453. .minor = WATCHDOG_MINOR,
  454. .name = "watchdog",
  455. .fops = &wdrtas_fops,
  456. };
  457. static const struct file_operations wdrtas_temp_fops = {
  458. .owner = THIS_MODULE,
  459. .llseek = no_llseek,
  460. .read = wdrtas_temp_read,
  461. .open = wdrtas_temp_open,
  462. .release = wdrtas_temp_close,
  463. };
  464. static struct miscdevice wdrtas_tempdev = {
  465. .minor = TEMP_MINOR,
  466. .name = "temperature",
  467. .fops = &wdrtas_temp_fops,
  468. };
  469. static struct notifier_block wdrtas_notifier = {
  470. .notifier_call = wdrtas_reboot,
  471. };
  472. /**
  473. * wdrtas_get_tokens - reads in RTAS tokens
  474. *
  475. * returns 0 on succes, <0 on failure
  476. *
  477. * wdrtas_get_tokens reads in the tokens for the RTAS calls used in
  478. * this watchdog driver. It tolerates, if "get-sensor-state" and
  479. * "ibm,get-system-parameter" are not available.
  480. */
  481. static int wdrtas_get_tokens(void)
  482. {
  483. wdrtas_token_get_sensor_state = rtas_token("get-sensor-state");
  484. if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE) {
  485. printk(KERN_WARNING "wdrtas: couldn't get token for "
  486. "get-sensor-state. Trying to continue without "
  487. "temperature support.\n");
  488. }
  489. wdrtas_token_get_sp = rtas_token("ibm,get-system-parameter");
  490. if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE) {
  491. printk(KERN_WARNING "wdrtas: couldn't get token for "
  492. "ibm,get-system-parameter. Trying to continue with "
  493. "a default timeout value of %i seconds.\n",
  494. WDRTAS_DEFAULT_INTERVAL);
  495. }
  496. wdrtas_token_set_indicator = rtas_token("set-indicator");
  497. if (wdrtas_token_set_indicator == RTAS_UNKNOWN_SERVICE) {
  498. printk(KERN_ERR "wdrtas: couldn't get token for "
  499. "set-indicator. Terminating watchdog code.\n");
  500. return -EIO;
  501. }
  502. wdrtas_token_event_scan = rtas_token("event-scan");
  503. if (wdrtas_token_event_scan == RTAS_UNKNOWN_SERVICE) {
  504. printk(KERN_ERR "wdrtas: couldn't get token for event-scan. "
  505. "Terminating watchdog code.\n");
  506. return -EIO;
  507. }
  508. return 0;
  509. }
  510. /**
  511. * wdrtas_unregister_devs - unregisters the misc dev handlers
  512. *
  513. * wdrtas_register_devs unregisters the watchdog and temperature watchdog
  514. * misc devs
  515. */
  516. static void wdrtas_unregister_devs(void)
  517. {
  518. misc_deregister(&wdrtas_miscdev);
  519. if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE)
  520. misc_deregister(&wdrtas_tempdev);
  521. }
  522. /**
  523. * wdrtas_register_devs - registers the misc dev handlers
  524. *
  525. * returns 0 on succes, <0 on failure
  526. *
  527. * wdrtas_register_devs registers the watchdog and temperature watchdog
  528. * misc devs
  529. */
  530. static int wdrtas_register_devs(void)
  531. {
  532. int result;
  533. result = misc_register(&wdrtas_miscdev);
  534. if (result) {
  535. printk(KERN_ERR "wdrtas: couldn't register watchdog misc "
  536. "device. Terminating watchdog code.\n");
  537. return result;
  538. }
  539. if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE) {
  540. result = misc_register(&wdrtas_tempdev);
  541. if (result) {
  542. printk(KERN_WARNING "wdrtas: couldn't register "
  543. "watchdog temperature misc device. Continuing "
  544. "without temperature support.\n");
  545. wdrtas_token_get_sensor_state = RTAS_UNKNOWN_SERVICE;
  546. }
  547. }
  548. return 0;
  549. }
  550. /**
  551. * wdrtas_init - init function of the watchdog driver
  552. *
  553. * returns 0 on succes, <0 on failure
  554. *
  555. * registers the file handlers and the reboot notifier
  556. */
  557. static int __init wdrtas_init(void)
  558. {
  559. if (wdrtas_get_tokens())
  560. return -ENODEV;
  561. if (wdrtas_register_devs())
  562. return -ENODEV;
  563. if (register_reboot_notifier(&wdrtas_notifier)) {
  564. printk(KERN_ERR "wdrtas: could not register reboot notifier. "
  565. "Terminating watchdog code.\n");
  566. wdrtas_unregister_devs();
  567. return -ENODEV;
  568. }
  569. if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE)
  570. wdrtas_interval = WDRTAS_DEFAULT_INTERVAL;
  571. else
  572. wdrtas_interval = wdrtas_get_interval(WDRTAS_DEFAULT_INTERVAL);
  573. return 0;
  574. }
  575. /**
  576. * wdrtas_exit - exit function of the watchdog driver
  577. *
  578. * unregisters the file handlers and the reboot notifier
  579. */
  580. static void __exit wdrtas_exit(void)
  581. {
  582. if (!wdrtas_nowayout)
  583. wdrtas_timer_stop();
  584. wdrtas_unregister_devs();
  585. unregister_reboot_notifier(&wdrtas_notifier);
  586. }
  587. module_init(wdrtas_init);
  588. module_exit(wdrtas_exit);