watchdog: s3c2410_wdt - Fix removing of platform device
authorWim Van Sebroeck <wim@iguana.be>
Fri, 21 May 2010 08:11:42 +0000 (08:11 +0000)
committerWim Van Sebroeck <wim@iguana.be>
Sun, 8 Aug 2010 18:20:09 +0000 (18:20 +0000)
When removing the watchdog platform device, we need to
disable the access to userspace first. It makes no sense
to remove the drivers clock, irq's, ... and then disable
userspace access.
the order of removal has also been changed so that it
is the reverse of probing (this way the clock is also
disabled sooner).

Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/s3c2410_wdt.c

index 300932580ded93e26e38f3dfaa1c0583d0b89976..ae53662c29bce78ce4a674155e7ee24577818950 100644 (file)
@@ -532,21 +532,22 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
 
 static int __devexit s3c2410wdt_remove(struct platform_device *dev)
 {
-       s3c2410wdt_cpufreq_deregister();
-
-       release_resource(wdt_mem);
-       kfree(wdt_mem);
-       wdt_mem = NULL;
+       misc_deregister(&s3c2410wdt_miscdev);
 
-       free_irq(wdt_irq->start, dev);
-       wdt_irq = NULL;
+       s3c2410wdt_cpufreq_deregister();
 
        clk_disable(wdt_clock);
        clk_put(wdt_clock);
        wdt_clock = NULL;
 
+       free_irq(wdt_irq->start, dev);
+       wdt_irq = NULL;
+
        iounmap(wdt_base);
-       misc_deregister(&s3c2410wdt_miscdev);
+
+       release_resource(wdt_mem);
+       kfree(wdt_mem);
+       wdt_mem = NULL;
        return 0;
 }