aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/watchdog/acquirewdt.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c
index a968f84c353e..687b809d49cb 100644
--- a/drivers/char/watchdog/acquirewdt.c
+++ b/drivers/char/watchdog/acquirewdt.c
@@ -64,6 +64,7 @@
64#include <linux/ioport.h> /* For io-port access */ 64#include <linux/ioport.h> /* For io-port access */
65#include <linux/notifier.h> /* For reboot notifier */ 65#include <linux/notifier.h> /* For reboot notifier */
66#include <linux/reboot.h> /* For reboot notifier */ 66#include <linux/reboot.h> /* For reboot notifier */
67#include <linux/platform_device.h> /* For platform_driver framework */
67#include <linux/init.h> /* For __init/__exit/... */ 68#include <linux/init.h> /* For __init/__exit/... */
68 69
69#include <asm/uaccess.h> /* For copy_to_user/put_user/... */ 70#include <asm/uaccess.h> /* For copy_to_user/put_user/... */
@@ -76,6 +77,7 @@
76#define WATCHDOG_HEARTBEAT 0 /* There is no way to see what the correct time-out period is */ 77#define WATCHDOG_HEARTBEAT 0 /* There is no way to see what the correct time-out period is */
77 78
78/* internal variables */ 79/* internal variables */
80static struct platform_device *acq_platform_device; /* the watchdog platform device */
79static unsigned long acq_is_open; 81static unsigned long acq_is_open;
80static char expect_close; 82static char expect_close;
81 83
@@ -265,12 +267,10 @@ static struct notifier_block acq_notifier = {
265 * Init & exit routines 267 * Init & exit routines
266 */ 268 */
267 269
268static int __init acq_init(void) 270static int __devinit acq_probe(struct platform_device *dev)
269{ 271{
270 int ret; 272 int ret;
271 273
272 printk(KERN_INFO "WDT driver for Acquire single board computer initialising.\n");
273
274 if (wdt_stop != wdt_start) { 274 if (wdt_stop != wdt_start) {
275 if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) { 275 if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
276 printk (KERN_ERR PFX "I/O address 0x%04x already in use\n", 276 printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
@@ -317,13 +317,54 @@ out:
317 return ret; 317 return ret;
318} 318}
319 319
320static void __exit acq_exit(void) 320static int __devexit acq_remove(struct platform_device *dev)
321{ 321{
322 misc_deregister(&acq_miscdev); 322 misc_deregister(&acq_miscdev);
323 unregister_reboot_notifier(&acq_notifier); 323 unregister_reboot_notifier(&acq_notifier);
324 release_region(wdt_start,1); 324 release_region(wdt_start,1);
325 if(wdt_stop != wdt_start) 325 if(wdt_stop != wdt_start)
326 release_region(wdt_stop,1); 326 release_region(wdt_stop,1);
327
328 return 0;
329}
330
331static struct platform_driver acquirewdt_driver = {
332 .probe = acq_probe,
333 .remove = __devexit_p(acq_remove),
334 .driver = {
335 .owner = THIS_MODULE,
336 .name = DRV_NAME,
337 },
338};
339
340static int __init acq_init(void)
341{
342 int err;
343
344 printk(KERN_INFO "WDT driver for Acquire single board computer initialising.\n");
345
346 err = platform_driver_register(&acquirewdt_driver);
347 if (err)
348 return err;
349
350 acq_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
351 if (IS_ERR(acq_platform_device)) {
352 err = PTR_ERR(acq_platform_device);
353 goto unreg_platform_driver;
354 }
355
356 return 0;
357
358unreg_platform_driver:
359 platform_driver_unregister(&acquirewdt_driver);
360 return err;
361}
362
363static void __exit acq_exit(void)
364{
365 platform_device_unregister(acq_platform_device);
366 platform_driver_unregister(&acquirewdt_driver);
367 printk(KERN_INFO PFX "Watchdog Module Unloaded.\n");
327} 368}
328 369
329module_init(acq_init); 370module_init(acq_init);