diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2010-01-01 21:44:37 +0000 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2010-01-01 21:44:37 +0000 |
commit | 023c474951a4948ddd4ad1b1e9f9f0b7bce06c5c (patch) | |
tree | e414dc5bc7cd2f352a45cf0158e5dfcecf2d8b22 /target/linux/amazon/files/drivers/char | |
parent | 953ff0cf43e7ec2f99479dd7e7a5d076e31f9c28 (diff) | |
download | mtk-20170518-023c474951a4948ddd4ad1b1e9f9f0b7bce06c5c.zip mtk-20170518-023c474951a4948ddd4ad1b1e9f9f0b7bce06c5c.tar.gz mtk-20170518-023c474951a4948ddd4ad1b1e9f9f0b7bce06c5c.tar.bz2 |
mazon: use platform_device for most drivers and fix some printk's
SVN-Revision: 18989
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 e06203d..6e1eb79 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); - |