aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-03-04 20:48:43 +0000
committerFlorian Fainelli <florian@openwrt.org>2010-03-04 20:48:43 +0000
commitda72558c327b1b39a7a17b7d96aed1f401c2fc53 (patch)
tree3de22d6e526dd62870980dba1454e56c180fe6cf
parent7c966b8a3271a9312292094671dfcb7c08ec61c7 (diff)
downloadupstream-da72558c327b1b39a7a17b7d96aed1f401c2fc53.tar.gz
upstream-da72558c327b1b39a7a17b7d96aed1f401c2fc53.tar.bz2
upstream-da72558c327b1b39a7a17b7d96aed1f401c2fc53.zip
fix watchdog driver unregistering, patch by Bernhard Loos
SVN-Revision: 19979
-rw-r--r--target/linux/rdc/files-2.6.30/drivers/watchdog/rdc321x_wdt.c15
1 files changed, 12 insertions, 3 deletions
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 <linux/watchdog.h>
#include <linux/uaccess.h>
#include <linux/pci.h>
+#include <linux/delay.h>
#include <asm/rdc321x_defs.h>
@@ -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;
}