wdrtas.c 17 KB

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