diff options
author | hauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-01-01 21:44:37 +0000 |
---|---|---|
committer | hauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-01-01 21:44:37 +0000 |
commit | 11c396f331348df1d0fc4878cb9a7013124819ed (patch) | |
tree | dea2b4dd9dbdbe2f1772e2549c22525d7c694cbf /target/linux/amazon/files/drivers/char | |
parent | 97e651b8465540b067405e212e9b073537d552d3 (diff) |
mazon: use platform_device for most drivers and fix some printk's
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18989 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/amazon/files/drivers/char')
-rw-r--r-- | target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c b/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c index e06203d5b..6e1eb799a 100644 --- a/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c +++ b/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c @@ -36,6 +36,7 @@ #include <linux/ioctl.h> #include <asm/uaccess.h> #include <asm/system.h> +#include <linux/platform_device.h> #include <asm/amazon/amazon.h> #include <asm/amazon/amazon_wdt.h> @@ -206,7 +207,7 @@ static struct file_operations wdt_fops = { release: wdt_release, }; -int __init amazon_wdt_init_module(void) +static int __init amazon_wdt_probe(struct platform_device *dev) { int result = result = register_chrdev(0, "watchdog", &wdt_fops); @@ -226,7 +227,7 @@ int __init amazon_wdt_init_module(void) return 0; } -void amazon_wdt_cleanup_module(void) +static int amazon_wdt_remove(struct platform_device *dev) { unregister_chrdev(0, "watchdog"); #ifdef AMAZON_WDT_DEBUG @@ -234,13 +235,35 @@ void amazon_wdt_cleanup_module(void) remove_proc_entry("amazon_wdt", NULL); #endif printk(KERN_INFO DRV_NAME "unregistered\n"); - return; + return 0; +} + +static struct platform_driver amazon_wdt_driver = { + .probe = amazon_wdt_probe, + .remove = amazon_wdt_remove, + .driver = { + .name = "amazon_wdt", + .owner = THIS_MODULE, + }, +}; + +static int __init amazon_wdt_init(void) +{ + int ret = platform_driver_register(&amazon_wdt_driver); + if (ret) + printk(KERN_WARNING "amazon_wdt: error registering platfom driver!\n"); + return ret; } +static void __exit amazon_wdt_exit(void) +{ + platform_driver_unregister(&amazon_wdt_driver); +} + +module_init(amazon_wdt_init); +module_exit(amazon_wdt_exit); + MODULE_LICENSE ("GPL"); MODULE_AUTHOR("Infineon / John Crispin <blogic@openwrt.org>"); MODULE_DESCRIPTION("AMAZON WDT driver"); -module_init(amazon_wdt_init_module); -module_exit(amazon_wdt_cleanup_module); - |