aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2007-01-27 16:39:46 -0500
committerWim Van Sebroeck <wim@iguana.be>2007-01-27 16:39:46 -0500
commit745ac1ea6e06125cc1326adbec34d756b25678c6 (patch)
treeae4f65de9ca556f983752a42d3322bdf30741e0e /drivers/char
parente42162a46d948769c8b45d25ee81827bc7dac435 (diff)
[WATCHDOG] ib700wdt.c - convert to platform_device
Convert the ib700wdt watchdog into a platform_device Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/watchdog/ib700wdt.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
index be61e4755891..b74e15159c02 100644
--- a/drivers/char/watchdog/ib700wdt.c
+++ b/drivers/char/watchdog/ib700wdt.c
@@ -42,16 +42,20 @@
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/spinlock.h> 43#include <linux/spinlock.h>
44#include <linux/moduleparam.h> 44#include <linux/moduleparam.h>
45#include <linux/platform_device.h>
45 46
46#include <asm/io.h> 47#include <asm/io.h>
47#include <asm/uaccess.h> 48#include <asm/uaccess.h>
48#include <asm/system.h> 49#include <asm/system.h>
49 50
51static struct platform_device *ibwdt_platform_device;
50static unsigned long ibwdt_is_open; 52static unsigned long ibwdt_is_open;
51static spinlock_t ibwdt_lock; 53static spinlock_t ibwdt_lock;
52static char expect_close; 54static char expect_close;
53 55
54#define PFX "ib700wdt: " 56/* Module information */
57#define DRV_NAME "ib700wdt"
58#define PFX DRV_NAME ": "
55 59
56/* 60/*
57 * 61 *
@@ -326,12 +330,10 @@ static struct notifier_block ibwdt_notifier = {
326 * Init & exit routines 330 * Init & exit routines
327 */ 331 */
328 332
329static int __init ibwdt_init(void) 333static int __devinit ibwdt_probe(struct platform_device *dev)
330{ 334{
331 int res; 335 int res;
332 336
333 printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n");
334
335 spin_lock_init(&ibwdt_lock); 337 spin_lock_init(&ibwdt_lock);
336 338
337#if WDT_START != WDT_STOP 339#if WDT_START != WDT_STOP
@@ -373,8 +375,7 @@ out_nostopreg:
373 return res; 375 return res;
374} 376}
375 377
376static void __exit 378static int __devexit ibwdt_remove(struct platform_device *dev)
377ibwdt_exit(void)
378{ 379{
379 misc_deregister(&ibwdt_miscdev); 380 misc_deregister(&ibwdt_miscdev);
380 unregister_reboot_notifier(&ibwdt_notifier); 381 unregister_reboot_notifier(&ibwdt_notifier);
@@ -382,6 +383,46 @@ ibwdt_exit(void)
382#if WDT_START != WDT_STOP 383#if WDT_START != WDT_STOP
383 release_region(WDT_STOP,1); 384 release_region(WDT_STOP,1);
384#endif 385#endif
386 return 0;
387}
388
389static struct platform_driver ibwdt_driver = {
390 .probe = ibwdt_probe,
391 .remove = __devexit_p(ibwdt_remove),
392 .driver = {
393 .owner = THIS_MODULE,
394 .name = DRV_NAME,
395 },
396};
397
398static int __init ibwdt_init(void)
399{
400 int err;
401
402 printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n");
403
404 err = platform_driver_register(&ibwdt_driver);
405 if (err)
406 return err;
407
408 ibwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
409 if (IS_ERR(ibwdt_platform_device)) {
410 err = PTR_ERR(ibwdt_platform_device);
411 goto unreg_platform_driver;
412 }
413
414 return 0;
415
416unreg_platform_driver:
417 platform_driver_unregister(&ibwdt_driver);
418 return err;
419}
420
421static void __exit ibwdt_exit(void)
422{
423 platform_device_unregister(ibwdt_platform_device);
424 platform_driver_unregister(&ibwdt_driver);
425 printk(KERN_INFO PFX "Watchdog Module Unloaded.\n");
385} 426}
386 427
387module_init(ibwdt_init); 428module_init(ibwdt_init);