wdrtas.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  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 <asm/rtas.h>
  37. #include <asm/uaccess.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 = 0;
  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
  76. wdrtas_set_interval(int interval)
  77. {
  78. long result;
  79. static int print_msg = 10;
  80. /* rtas uses minutes */
  81. interval = (interval + 59) / 60;
  82. result = rtas_call(wdrtas_token_set_indicator, 3, 1, NULL,
  83. WDRTAS_SURVEILLANCE_IND, 0, interval);
  84. if ( (result < 0) && (print_msg) ) {
  85. printk(KERN_ERR "wdrtas: setting the watchdog to %i "
  86. "timeout failed: %li\n", interval, result);
  87. print_msg--;
  88. }
  89. return result;
  90. }
  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
  102. wdrtas_get_interval(int fallback_value)
  103. {
  104. long result;
  105. char value[4];
  106. result = rtas_call(wdrtas_token_get_sp, 3, 1, NULL,
  107. WDRTAS_SP_SPI, (void *)__pa(&value), 4);
  108. if ( (value[0] != 0) || (value[1] != 2) || (value[3] != 0) ||
  109. (result < 0) ) {
  110. printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog "
  111. "timeout (%li). Continuing\n", result);
  112. return fallback_value;
  113. }
  114. /* rtas uses minutes */
  115. return ((int)value[2]) * 60;
  116. }
  117. /**
  118. * wdrtas_timer_start - starts watchdog
  119. *
  120. * wdrtas_timer_start starts the watchdog by calling the RTAS function
  121. * set-interval (surveillance)
  122. */
  123. static void
  124. wdrtas_timer_start(void)
  125. {
  126. wdrtas_set_interval(wdrtas_interval);
  127. }
  128. /**
  129. * wdrtas_timer_stop - stops watchdog
  130. *
  131. * wdrtas_timer_stop stops the watchdog timer by calling the RTAS function
  132. * set-interval (surveillance)
  133. */
  134. static void
  135. wdrtas_timer_stop(void)
  136. {
  137. wdrtas_set_interval(0);
  138. }
  139. /**
  140. * wdrtas_log_scanned_event - logs an event we received during keepalive
  141. *
  142. * wdrtas_log_scanned_event prints a message to the log buffer dumping
  143. * the results of the last event-scan call
  144. */
  145. static void
  146. 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
  171. wdrtas_timer_keepalive(void)
  172. {
  173. long result;
  174. do {
  175. result = rtas_call(wdrtas_token_event_scan, 4, 1, NULL,
  176. RTAS_EVENT_SCAN_ALL_EVENTS, 0,
  177. (void *)__pa(wdrtas_logbuffer),
  178. WDRTAS_LOGBUFFER_LEN);
  179. if (result < 0)
  180. printk(KERN_ERR "wdrtas: event-scan failed: %li\n",
  181. result);
  182. if (result == 0)
  183. wdrtas_log_scanned_event();
  184. } while (result == 0);
  185. }
  186. /**
  187. * wdrtas_get_temperature - returns current temperature
  188. *
  189. * returns temperature or <0 on failures
  190. *
  191. * wdrtas_get_temperature returns the current temperature in Fahrenheit. It
  192. * uses the RTAS call get-sensor-state, token 3 to do so
  193. */
  194. static int
  195. wdrtas_get_temperature(void)
  196. {
  197. long result;
  198. int temperature = 0;
  199. result = rtas_call(wdrtas_token_get_sensor_state, 2, 2,
  200. (void *)__pa(&temperature),
  201. WDRTAS_THERMAL_SENSOR, 0);
  202. if (result < 0)
  203. printk(KERN_WARNING "wdrtas: reading the thermal sensor "
  204. "faild: %li\n", result);
  205. else
  206. temperature = ((temperature * 9) / 5) + 32; /* fahrenheit */
  207. return temperature;
  208. }
  209. /**
  210. * wdrtas_get_status - returns the status of the watchdog
  211. *
  212. * returns a bitmask of defines WDIOF_... as defined in
  213. * include/linux/watchdog.h
  214. */
  215. static int
  216. wdrtas_get_status(void)
  217. {
  218. return 0; /* TODO */
  219. }
  220. /**
  221. * wdrtas_get_boot_status - returns the reason for the last boot
  222. *
  223. * returns a bitmask of defines WDIOF_... as defined in
  224. * include/linux/watchdog.h, indicating why the watchdog rebooted the system
  225. */
  226. static int
  227. wdrtas_get_boot_status(void)
  228. {
  229. return 0; /* TODO */
  230. }
  231. /*** watchdog API and operations stuff */
  232. /* wdrtas_write - called when watchdog device is written to
  233. * @file: file structure
  234. * @buf: user buffer with data
  235. * @len: amount to data written
  236. * @ppos: position in file
  237. *
  238. * returns the number of successfully processed characters, which is always
  239. * the number of bytes passed to this function
  240. *
  241. * wdrtas_write processes all the data given to it and looks for the magic
  242. * character 'V'. This character allows the watchdog device to be closed
  243. * properly.
  244. */
  245. static ssize_t
  246. wdrtas_write(struct file *file, const char __user *buf,
  247. size_t len, loff_t *ppos)
  248. {
  249. int i;
  250. char c;
  251. if (!len)
  252. goto out;
  253. if (!wdrtas_nowayout) {
  254. wdrtas_expect_close = 0;
  255. /* look for 'V' */
  256. for (i = 0; i < len; i++) {
  257. if (get_user(c, buf + i))
  258. return -EFAULT;
  259. /* allow to close device */
  260. if (c == 'V')
  261. wdrtas_expect_close = WDRTAS_MAGIC_CHAR;
  262. }
  263. }
  264. wdrtas_timer_keepalive();
  265. out:
  266. return len;
  267. }
  268. /**
  269. * wdrtas_ioctl - ioctl function for the watchdog device
  270. * @inode: inode structure
  271. * @file: file structure
  272. * @cmd: command for ioctl
  273. * @arg: argument pointer
  274. *
  275. * returns 0 on success, <0 on failure
  276. *
  277. * wdrtas_ioctl implements the watchdog API ioctls
  278. */
  279. static int
  280. wdrtas_ioctl(struct inode *inode, struct file *file,
  281. unsigned int cmd, unsigned long arg)
  282. {
  283. int __user *argp = (void __user *)arg;
  284. int i;
  285. static struct watchdog_info wdinfo = {
  286. .options = WDRTAS_SUPPORTED_MASK,
  287. .firmware_version = 0,
  288. .identity = "wdrtas"
  289. };
  290. switch (cmd) {
  291. case WDIOC_GETSUPPORT:
  292. if (copy_to_user(argp, &wdinfo, sizeof(wdinfo)))
  293. return -EFAULT;
  294. return 0;
  295. case WDIOC_GETSTATUS:
  296. i = wdrtas_get_status();
  297. return put_user(i, argp);
  298. case WDIOC_GETBOOTSTATUS:
  299. i = wdrtas_get_boot_status();
  300. return put_user(i, argp);
  301. case WDIOC_GETTEMP:
  302. if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE)
  303. return -EOPNOTSUPP;
  304. i = wdrtas_get_temperature();
  305. return put_user(i, argp);
  306. case WDIOC_SETOPTIONS:
  307. if (get_user(i, argp))
  308. return -EFAULT;
  309. if (i & WDIOS_DISABLECARD)
  310. wdrtas_timer_stop();
  311. if (i & WDIOS_ENABLECARD) {
  312. wdrtas_timer_keepalive();
  313. wdrtas_timer_start();
  314. }
  315. if (i & WDIOS_TEMPPANIC) {
  316. /* not implemented. Done by H8 */
  317. }
  318. return 0;
  319. case WDIOC_KEEPALIVE:
  320. wdrtas_timer_keepalive();
  321. return 0;
  322. case WDIOC_SETTIMEOUT:
  323. if (get_user(i, argp))
  324. return -EFAULT;
  325. if (wdrtas_set_interval(i))
  326. return -EINVAL;
  327. wdrtas_timer_keepalive();
  328. if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE)
  329. wdrtas_interval = i;
  330. else
  331. wdrtas_interval = wdrtas_get_interval(i);
  332. /* fallthrough */
  333. case WDIOC_GETTIMEOUT:
  334. return put_user(wdrtas_interval, argp);
  335. default:
  336. return -ENOTTY;
  337. }
  338. }
  339. /**
  340. * wdrtas_open - open function of watchdog device
  341. * @inode: inode structure
  342. * @file: file structure
  343. *
  344. * returns 0 on success, -EBUSY if the file has been opened already, <0 on
  345. * other failures
  346. *
  347. * function called when watchdog device is opened
  348. */
  349. static int
  350. wdrtas_open(struct inode *inode, struct file *file)
  351. {
  352. /* only open once */
  353. if (atomic_inc_return(&wdrtas_miscdev_open) > 1) {
  354. atomic_dec(&wdrtas_miscdev_open);
  355. return -EBUSY;
  356. }
  357. wdrtas_timer_start();
  358. wdrtas_timer_keepalive();
  359. return nonseekable_open(inode, file);
  360. }
  361. /**
  362. * wdrtas_close - close function of watchdog device
  363. * @inode: inode structure
  364. * @file: file structure
  365. *
  366. * returns 0 on success
  367. *
  368. * close function. Always succeeds
  369. */
  370. static int
  371. wdrtas_close(struct inode *inode, struct file *file)
  372. {
  373. /* only stop watchdog, if this was announced using 'V' before */
  374. if (wdrtas_expect_close == WDRTAS_MAGIC_CHAR)
  375. wdrtas_timer_stop();
  376. else {
  377. printk(KERN_WARNING "wdrtas: got unexpected close. Watchdog "
  378. "not stopped.\n");
  379. wdrtas_timer_keepalive();
  380. }
  381. wdrtas_expect_close = 0;
  382. atomic_dec(&wdrtas_miscdev_open);
  383. return 0;
  384. }
  385. /**
  386. * wdrtas_temp_read - gives back the temperature in fahrenheit
  387. * @file: file structure
  388. * @buf: user buffer
  389. * @count: number of bytes to be read
  390. * @ppos: position in file
  391. *
  392. * returns always 1 or -EFAULT in case of user space copy failures, <0 on
  393. * other failures
  394. *
  395. * wdrtas_temp_read gives the temperature to the users by copying this
  396. * value as one byte into the user space buffer. The unit is Fahrenheit...
  397. */
  398. static ssize_t
  399. wdrtas_temp_read(struct file *file, char __user *buf,
  400. size_t count, loff_t *ppos)
  401. {
  402. int temperature = 0;
  403. temperature = wdrtas_get_temperature();
  404. if (temperature < 0)
  405. return temperature;
  406. if (copy_to_user(buf, &temperature, 1))
  407. return -EFAULT;
  408. return 1;
  409. }
  410. /**
  411. * wdrtas_temp_open - open function of temperature device
  412. * @inode: inode structure
  413. * @file: file structure
  414. *
  415. * returns 0 on success, <0 on failure
  416. *
  417. * function called when temperature device is opened
  418. */
  419. static int
  420. wdrtas_temp_open(struct inode *inode, struct file *file)
  421. {
  422. return nonseekable_open(inode, file);
  423. }
  424. /**
  425. * wdrtas_temp_close - close function of temperature device
  426. * @inode: inode structure
  427. * @file: file structure
  428. *
  429. * returns 0 on success
  430. *
  431. * close function. Always succeeds
  432. */
  433. static int
  434. wdrtas_temp_close(struct inode *inode, struct file *file)
  435. {
  436. return 0;
  437. }
  438. /**
  439. * wdrtas_reboot - reboot notifier function
  440. * @nb: notifier block structure
  441. * @code: reboot code
  442. * @ptr: unused
  443. *
  444. * returns NOTIFY_DONE
  445. *
  446. * wdrtas_reboot stops the watchdog in case of a reboot
  447. */
  448. static int
  449. wdrtas_reboot(struct notifier_block *this, unsigned long code, void *ptr)
  450. {
  451. if ( (code==SYS_DOWN) || (code==SYS_HALT) )
  452. wdrtas_timer_stop();
  453. return NOTIFY_DONE;
  454. }
  455. /*** initialization stuff */
  456. static const struct file_operations wdrtas_fops = {
  457. .owner = THIS_MODULE,
  458. .llseek = no_llseek,
  459. .write = wdrtas_write,
  460. .ioctl = wdrtas_ioctl,
  461. .open = wdrtas_open,
  462. .release = wdrtas_close,
  463. };
  464. static struct miscdevice wdrtas_miscdev = {
  465. .minor = WATCHDOG_MINOR,
  466. .name = "watchdog",
  467. .fops = &wdrtas_fops,
  468. };
  469. static const struct file_operations wdrtas_temp_fops = {
  470. .owner = THIS_MODULE,
  471. .llseek = no_llseek,
  472. .read = wdrtas_temp_read,
  473. .open = wdrtas_temp_open,
  474. .release = wdrtas_temp_close,
  475. };
  476. static struct miscdevice wdrtas_tempdev = {
  477. .minor = TEMP_MINOR,
  478. .name = "temperature",
  479. .fops = &wdrtas_temp_fops,
  480. };
  481. static struct notifier_block wdrtas_notifier = {
  482. .notifier_call = wdrtas_reboot,
  483. };
  484. /**
  485. * wdrtas_get_tokens - reads in RTAS tokens
  486. *
  487. * returns 0 on succes, <0 on failure
  488. *
  489. * wdrtas_get_tokens reads in the tokens for the RTAS calls used in
  490. * this watchdog driver. It tolerates, if "get-sensor-state" and
  491. * "ibm,get-system-parameter" are not available.
  492. */
  493. static int
  494. wdrtas_get_tokens(void)
  495. {
  496. wdrtas_token_get_sensor_state = rtas_token("get-sensor-state");
  497. if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE) {
  498. printk(KERN_WARNING "wdrtas: couldn't get token for "
  499. "get-sensor-state. Trying to continue without "
  500. "temperature support.\n");
  501. }
  502. wdrtas_token_get_sp = rtas_token("ibm,get-system-parameter");
  503. if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE) {
  504. printk(KERN_WARNING "wdrtas: couldn't get token for "
  505. "ibm,get-system-parameter. Trying to continue with "
  506. "a default timeout value of %i seconds.\n",
  507. WDRTAS_DEFAULT_INTERVAL);
  508. }
  509. wdrtas_token_set_indicator = rtas_token("set-indicator");
  510. if (wdrtas_token_set_indicator == RTAS_UNKNOWN_SERVICE) {
  511. printk(KERN_ERR "wdrtas: couldn't get token for "
  512. "set-indicator. Terminating watchdog code.\n");
  513. return -EIO;
  514. }
  515. wdrtas_token_event_scan = rtas_token("event-scan");
  516. if (wdrtas_token_event_scan == RTAS_UNKNOWN_SERVICE) {
  517. printk(KERN_ERR "wdrtas: couldn't get token for event-scan. "
  518. "Terminating watchdog code.\n");
  519. return -EIO;
  520. }
  521. return 0;
  522. }
  523. /**
  524. * wdrtas_unregister_devs - unregisters the misc dev handlers
  525. *
  526. * wdrtas_register_devs unregisters the watchdog and temperature watchdog
  527. * misc devs
  528. */
  529. static void
  530. wdrtas_unregister_devs(void)
  531. {
  532. misc_deregister(&wdrtas_miscdev);
  533. if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE)
  534. misc_deregister(&wdrtas_tempdev);
  535. }
  536. /**
  537. * wdrtas_register_devs - registers the misc dev handlers
  538. *
  539. * returns 0 on succes, <0 on failure
  540. *
  541. * wdrtas_register_devs registers the watchdog and temperature watchdog
  542. * misc devs
  543. */
  544. static int
  545. wdrtas_register_devs(void)
  546. {
  547. int result;
  548. result = misc_register(&wdrtas_miscdev);
  549. if (result) {
  550. printk(KERN_ERR "wdrtas: couldn't register watchdog misc "
  551. "device. Terminating watchdog code.\n");
  552. return result;
  553. }
  554. if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE) {
  555. result = misc_register(&wdrtas_tempdev);
  556. if (result) {
  557. printk(KERN_WARNING "wdrtas: couldn't register "
  558. "watchdog temperature misc device. Continuing "
  559. "without temperature support.\n");
  560. wdrtas_token_get_sensor_state = RTAS_UNKNOWN_SERVICE;
  561. }
  562. }
  563. return 0;
  564. }
  565. /**
  566. * wdrtas_init - init function of the watchdog driver
  567. *
  568. * returns 0 on succes, <0 on failure
  569. *
  570. * registers the file handlers and the reboot notifier
  571. */
  572. static int __init
  573. wdrtas_init(void)
  574. {
  575. if (wdrtas_get_tokens())
  576. return -ENODEV;
  577. if (wdrtas_register_devs())
  578. return -ENODEV;
  579. if (register_reboot_notifier(&wdrtas_notifier)) {
  580. printk(KERN_ERR "wdrtas: could not register reboot notifier. "
  581. "Terminating watchdog code.\n");
  582. wdrtas_unregister_devs();
  583. return -ENODEV;
  584. }
  585. if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE)
  586. wdrtas_interval = WDRTAS_DEFAULT_INTERVAL;
  587. else
  588. wdrtas_interval = wdrtas_get_interval(WDRTAS_DEFAULT_INTERVAL);
  589. return 0;
  590. }
  591. /**
  592. * wdrtas_exit - exit function of the watchdog driver
  593. *
  594. * unregisters the file handlers and the reboot notifier
  595. */
  596. static void __exit
  597. wdrtas_exit(void)
  598. {
  599. if (!wdrtas_nowayout)
  600. wdrtas_timer_stop();
  601. wdrtas_unregister_devs();
  602. unregister_reboot_notifier(&wdrtas_notifier);
  603. }
  604. module_init(wdrtas_init);
  605. module_exit(wdrtas_exit);