From e4d03e7d306970a9dbac2257bfc7dc9f7e8cc45f Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 4 Mar 2010 20:48:43 +0000 Subject: [rdc] fix watchdog driver unregistering, patch by Bernhard Loos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19979 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/rdc/files-2.6.30/drivers/watchdog/rdc321x_wdt.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'target/linux/rdc/files-2.6.30/drivers') diff --git a/target/linux/rdc/files-2.6.30/drivers/watchdog/rdc321x_wdt.c b/target/linux/rdc/files-2.6.30/drivers/watchdog/rdc321x_wdt.c index 9e8b0372d2..3ced6c9a21 100644 --- a/target/linux/rdc/files-2.6.30/drivers/watchdog/rdc321x_wdt.c +++ b/target/linux/rdc/files-2.6.30/drivers/watchdog/rdc321x_wdt.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -123,8 +124,12 @@ static int rdc321x_wdt_open(struct inode *inode, struct file *file) static int rdc321x_wdt_release(struct inode *inode, struct file *file) { - if (rdc321x_wdt_dev.close_expected) - rdc321x_wdt_stop(); + int res; + if (rdc321x_wdt_dev.close_expected) { + res = rdc321x_wdt_stop(); + if (res) + return res; + } rdc321x_wdt_dev.inuse = false; @@ -181,7 +186,7 @@ static ssize_t rdc321x_wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { size_t i; - + if (!count) return -EIO; @@ -248,6 +253,10 @@ static int __devexit rdc321x_wdt_remove(struct platform_device *pdev) { if (rdc321x_wdt_dev.inuse) rdc321x_wdt_dev.inuse = 0; + + while (timer_pending(&rdc321x_wdt_dev.timer)) + msleep(100); + misc_deregister(&rdc321x_wdt_misc); return 0; } -- cgit v1.2.3