Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Acquire Single Board Computer Watchdog Timer driver |
| 3 | * |
Wim Van Sebroeck | 143a2e5 | 2009-03-18 08:35:09 +0000 | [diff] [blame] | 4 | * Based on wdt.c. Original copyright messages: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
Alan Cox | 29fa058 | 2008-10-27 15:17:56 +0000 | [diff] [blame] | 6 | * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>, |
| 7 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation; either version |
| 12 | * 2 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide |
| 15 | * warranty for any of this software. This material is provided |
| 16 | * "AS-IS" and at no charge. |
| 17 | * |
Alan Cox | 29fa058 | 2008-10-27 15:17:56 +0000 | [diff] [blame] | 18 | * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | * |
Wim Van Sebroeck | 143a2e5 | 2009-03-18 08:35:09 +0000 | [diff] [blame] | 20 | * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> |
| 21 | * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT |
| 22 | * Can't add timeout - driver doesn't allow changing value |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | */ |
| 24 | |
| 25 | /* |
| 26 | * Theory of Operation: |
| 27 | * The Watch-Dog Timer is provided to ensure that standalone |
| 28 | * Systems can always recover from catastrophic conditions that |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 29 | * caused the CPU to crash. This condition may have occurred by |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | * external EMI or a software bug. When the CPU stops working |
| 31 | * correctly, hardware on the board will either perform a hardware |
| 32 | * reset (cold boot) or a non-maskable interrupt (NMI) to bring the |
| 33 | * system back to a known state. |
| 34 | * |
| 35 | * The Watch-Dog Timer is controlled by two I/O Ports. |
| 36 | * 443 hex - Read - Enable or refresh the Watch-Dog Timer |
| 37 | * 043 hex - Read - Disable the Watch-Dog Timer |
| 38 | * |
| 39 | * To enable the Watch-Dog Timer, a read from I/O port 443h must |
| 40 | * be performed. This will enable and activate the countdown timer |
| 41 | * which will eventually time out and either reset the CPU or cause |
| 42 | * an NMI depending on the setting of a jumper. To ensure that this |
| 43 | * reset condition does not occur, the Watch-Dog Timer must be |
| 44 | * periodically refreshed by reading the same I/O port 443h. |
| 45 | * The Watch-Dog Timer is disabled by reading I/O port 043h. |
| 46 | * |
| 47 | * The Watch-Dog Timer Time-Out Period is set via jumpers. |
| 48 | * It can be 1, 2, 10, 20, 110 or 220 seconds. |
| 49 | */ |
| 50 | |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 51 | /* |
| 52 | * Includes, defines, variables, module parameters, ... |
| 53 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 55 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 56 | |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 57 | /* Includes */ |
| 58 | #include <linux/module.h> /* For module specific items */ |
| 59 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
| 60 | #include <linux/types.h> /* For standard types (like size_t) */ |
| 61 | #include <linux/errno.h> /* For the -ENODEV/... values */ |
| 62 | #include <linux/kernel.h> /* For printk/panic/... */ |
Jean Delvare | 487722c | 2013-10-21 17:38:49 +0200 | [diff] [blame] | 63 | #include <linux/miscdevice.h> /* For struct miscdevice */ |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 64 | #include <linux/watchdog.h> /* For the watchdog specific items */ |
| 65 | #include <linux/fs.h> /* For file operations */ |
| 66 | #include <linux/ioport.h> /* For io-port access */ |
Wim Van Sebroeck | ad5fe32 | 2007-01-10 23:36:13 +0100 | [diff] [blame] | 67 | #include <linux/platform_device.h> /* For platform_driver framework */ |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 68 | #include <linux/init.h> /* For __init/__exit/... */ |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 69 | #include <linux/uaccess.h> /* For copy_to_user/put_user/... */ |
| 70 | #include <linux/io.h> /* For inb/outb/... */ |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 71 | |
| 72 | /* Module information */ |
| 73 | #define DRV_NAME "acquirewdt" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | #define WATCHDOG_NAME "Acquire WDT" |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 75 | /* There is no way to see what the correct time-out period is */ |
| 76 | #define WATCHDOG_HEARTBEAT 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 78 | /* internal variables */ |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 79 | /* the watchdog platform device */ |
| 80 | static struct platform_device *acq_platform_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | static unsigned long acq_is_open; |
| 82 | static char expect_close; |
| 83 | |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 84 | /* module parameters */ |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 85 | /* You must set this - there is no sane way to probe for this board. */ |
| 86 | static int wdt_stop = 0x43; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | module_param(wdt_stop, int, 0); |
| 88 | MODULE_PARM_DESC(wdt_stop, "Acquire WDT 'stop' io port (default 0x43)"); |
| 89 | |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 90 | /* You must set this - there is no sane way to probe for this board. */ |
| 91 | static int wdt_start = 0x443; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | module_param(wdt_start, int, 0); |
| 93 | MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)"); |
| 94 | |
Wim Van Sebroeck | 86a1e18 | 2012-03-05 16:51:11 +0100 | [diff] [blame] | 95 | static bool nowayout = WATCHDOG_NOWAYOUT; |
| 96 | module_param(nowayout, bool, 0); |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 97 | MODULE_PARM_DESC(nowayout, |
| 98 | "Watchdog cannot be stopped once started (default=" |
| 99 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
| 101 | /* |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 102 | * Watchdog Operations |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | */ |
| 104 | |
| 105 | static void acq_keepalive(void) |
| 106 | { |
| 107 | /* Write a watchdog value */ |
| 108 | inb_p(wdt_start); |
| 109 | } |
| 110 | |
| 111 | static void acq_stop(void) |
| 112 | { |
| 113 | /* Turn the card off */ |
| 114 | inb_p(wdt_stop); |
| 115 | } |
| 116 | |
| 117 | /* |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 118 | * /dev/watchdog handling |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | */ |
| 120 | |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 121 | static ssize_t acq_write(struct file *file, const char __user *buf, |
| 122 | size_t count, loff_t *ppos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | { |
| 124 | /* See if we got the magic character 'V' and reload the timer */ |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 125 | if (count) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | if (!nowayout) { |
| 127 | size_t i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | /* note: just in case someone wrote the magic character |
Wim Van Sebroeck | 7944d3a | 2008-08-06 20:19:41 +0000 | [diff] [blame] | 129 | five months ago... */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | expect_close = 0; |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 131 | /* scan to see whether or not we got the |
| 132 | magic character */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | for (i = 0; i != count; i++) { |
| 134 | char c; |
| 135 | if (get_user(c, buf + i)) |
| 136 | return -EFAULT; |
| 137 | if (c == 'V') |
| 138 | expect_close = 42; |
| 139 | } |
| 140 | } |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 141 | /* Well, anyhow someone wrote to us, we should |
| 142 | return that favour */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | acq_keepalive(); |
| 144 | } |
| 145 | return count; |
| 146 | } |
| 147 | |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 148 | static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | { |
| 150 | int options, retval = -EINVAL; |
| 151 | void __user *argp = (void __user *)arg; |
| 152 | int __user *p = argp; |
Wim Van Sebroeck | 42747d7 | 2009-12-26 18:55:22 +0000 | [diff] [blame] | 153 | static const struct watchdog_info ident = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
| 155 | .firmware_version = 1, |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 156 | .identity = WATCHDOG_NAME, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | }; |
| 158 | |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 159 | switch (cmd) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | case WDIOC_GETSUPPORT: |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 161 | return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
| 163 | case WDIOC_GETSTATUS: |
| 164 | case WDIOC_GETBOOTSTATUS: |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 165 | return put_user(0, p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | case WDIOC_SETOPTIONS: |
| 168 | { |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 169 | if (get_user(options, p)) |
| 170 | return -EFAULT; |
| 171 | if (options & WDIOS_DISABLECARD) { |
| 172 | acq_stop(); |
| 173 | retval = 0; |
| 174 | } |
| 175 | if (options & WDIOS_ENABLECARD) { |
| 176 | acq_keepalive(); |
| 177 | retval = 0; |
| 178 | } |
| 179 | return retval; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | } |
Wim Van Sebroeck | 0c06090 | 2008-07-18 11:41:17 +0000 | [diff] [blame] | 181 | case WDIOC_KEEPALIVE: |
| 182 | acq_keepalive(); |
| 183 | return 0; |
| 184 | |
| 185 | case WDIOC_GETTIMEOUT: |
| 186 | return put_user(WATCHDOG_HEARTBEAT, p); |
| 187 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | default: |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 189 | return -ENOTTY; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | } |
| 191 | } |
| 192 | |
| 193 | static int acq_open(struct inode *inode, struct file *file) |
| 194 | { |
| 195 | if (test_and_set_bit(0, &acq_is_open)) |
| 196 | return -EBUSY; |
| 197 | |
| 198 | if (nowayout) |
| 199 | __module_get(THIS_MODULE); |
| 200 | |
| 201 | /* Activate */ |
| 202 | acq_keepalive(); |
| 203 | return nonseekable_open(inode, file); |
| 204 | } |
| 205 | |
| 206 | static int acq_close(struct inode *inode, struct file *file) |
| 207 | { |
| 208 | if (expect_close == 42) { |
| 209 | acq_stop(); |
| 210 | } else { |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 211 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | acq_keepalive(); |
| 213 | } |
| 214 | clear_bit(0, &acq_is_open); |
| 215 | expect_close = 0; |
| 216 | return 0; |
| 217 | } |
| 218 | |
| 219 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | * Kernel Interfaces |
| 221 | */ |
| 222 | |
Arjan van de Ven | 62322d2 | 2006-07-03 00:24:21 -0700 | [diff] [blame] | 223 | static const struct file_operations acq_fops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | .owner = THIS_MODULE, |
| 225 | .llseek = no_llseek, |
| 226 | .write = acq_write, |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 227 | .unlocked_ioctl = acq_ioctl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | .open = acq_open, |
| 229 | .release = acq_close, |
| 230 | }; |
| 231 | |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 232 | static struct miscdevice acq_miscdev = { |
| 233 | .minor = WATCHDOG_MINOR, |
| 234 | .name = "watchdog", |
| 235 | .fops = &acq_fops, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | }; |
| 237 | |
| 238 | /* |
Wim Van Sebroeck | 76c11f0 | 2007-01-10 23:23:44 +0100 | [diff] [blame] | 239 | * Init & exit routines |
| 240 | */ |
| 241 | |
Jean Delvare | b0e0b4b | 2014-03-14 13:04:37 +0100 | [diff] [blame] | 242 | static int __init acq_probe(struct platform_device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | { |
| 244 | int ret; |
| 245 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | if (wdt_stop != wdt_start) { |
| 247 | if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) { |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 248 | pr_err("I/O address 0x%04x already in use\n", wdt_stop); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | ret = -EIO; |
| 250 | goto out; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | if (!request_region(wdt_start, 1, WATCHDOG_NAME)) { |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 255 | pr_err("I/O address 0x%04x already in use\n", wdt_start); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | ret = -EIO; |
| 257 | goto unreg_stop; |
| 258 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | ret = misc_register(&acq_miscdev); |
| 260 | if (ret != 0) { |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 261 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
| 262 | WATCHDOG_MINOR, ret); |
Wim Van Sebroeck | 98c08e9 | 2007-01-10 23:38:56 +0100 | [diff] [blame] | 263 | goto unreg_regions; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | } |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 265 | pr_info("initialized. (nowayout=%d)\n", nowayout); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | |
| 267 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | unreg_regions: |
| 269 | release_region(wdt_start, 1); |
| 270 | unreg_stop: |
| 271 | if (wdt_stop != wdt_start) |
| 272 | release_region(wdt_stop, 1); |
| 273 | out: |
| 274 | return ret; |
| 275 | } |
| 276 | |
Bill Pemberton | 4b12b89 | 2012-11-19 13:26:24 -0500 | [diff] [blame] | 277 | static int acq_remove(struct platform_device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | { |
| 279 | misc_deregister(&acq_miscdev); |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 280 | release_region(wdt_start, 1); |
| 281 | if (wdt_stop != wdt_start) |
| 282 | release_region(wdt_stop, 1); |
Wim Van Sebroeck | ad5fe32 | 2007-01-10 23:36:13 +0100 | [diff] [blame] | 283 | |
| 284 | return 0; |
| 285 | } |
| 286 | |
Wim Van Sebroeck | 98c08e9 | 2007-01-10 23:38:56 +0100 | [diff] [blame] | 287 | static void acq_shutdown(struct platform_device *dev) |
| 288 | { |
| 289 | /* Turn the WDT off if we have a soft shutdown */ |
| 290 | acq_stop(); |
| 291 | } |
| 292 | |
Wim Van Sebroeck | ad5fe32 | 2007-01-10 23:36:13 +0100 | [diff] [blame] | 293 | static struct platform_driver acquirewdt_driver = { |
Bill Pemberton | 8226871 | 2012-11-19 13:21:12 -0500 | [diff] [blame] | 294 | .remove = acq_remove, |
Wim Van Sebroeck | 98c08e9 | 2007-01-10 23:38:56 +0100 | [diff] [blame] | 295 | .shutdown = acq_shutdown, |
Wim Van Sebroeck | ad5fe32 | 2007-01-10 23:36:13 +0100 | [diff] [blame] | 296 | .driver = { |
| 297 | .owner = THIS_MODULE, |
| 298 | .name = DRV_NAME, |
| 299 | }, |
| 300 | }; |
| 301 | |
| 302 | static int __init acq_init(void) |
| 303 | { |
| 304 | int err; |
| 305 | |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 306 | pr_info("WDT driver for Acquire single board computer initialising\n"); |
Wim Van Sebroeck | ad5fe32 | 2007-01-10 23:36:13 +0100 | [diff] [blame] | 307 | |
Alan Cox | 94da1e2 | 2008-05-19 14:04:46 +0100 | [diff] [blame] | 308 | acq_platform_device = platform_device_register_simple(DRV_NAME, |
| 309 | -1, NULL, 0); |
Jean Delvare | b0e0b4b | 2014-03-14 13:04:37 +0100 | [diff] [blame] | 310 | if (IS_ERR(acq_platform_device)) |
| 311 | return PTR_ERR(acq_platform_device); |
| 312 | |
| 313 | err = platform_driver_probe(&acquirewdt_driver, acq_probe); |
| 314 | if (err) |
| 315 | goto unreg_platform_device; |
Wim Van Sebroeck | ad5fe32 | 2007-01-10 23:36:13 +0100 | [diff] [blame] | 316 | return 0; |
| 317 | |
Jean Delvare | b0e0b4b | 2014-03-14 13:04:37 +0100 | [diff] [blame] | 318 | unreg_platform_device: |
| 319 | platform_device_unregister(acq_platform_device); |
Wim Van Sebroeck | ad5fe32 | 2007-01-10 23:36:13 +0100 | [diff] [blame] | 320 | return err; |
| 321 | } |
| 322 | |
| 323 | static void __exit acq_exit(void) |
| 324 | { |
| 325 | platform_device_unregister(acq_platform_device); |
| 326 | platform_driver_unregister(&acquirewdt_driver); |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 327 | pr_info("Watchdog Module Unloaded\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | module_init(acq_init); |
| 331 | module_exit(acq_exit); |
| 332 | |
| 333 | MODULE_AUTHOR("David Woodhouse"); |
| 334 | MODULE_DESCRIPTION("Acquire Inc. Single Board Computer Watchdog Timer driver"); |
| 335 | MODULE_LICENSE("GPL"); |