* [PATCH] s3c2410 watchdog - replace reboot notifier
@ 2005-03-12 11:29 Ben Dooks
0 siblings, 0 replies; only message in thread
From: Ben Dooks @ 2005-03-12 11:29 UTC (permalink / raw)
To: wim, linux-kernel; +Cc: dimitry.andric
[-- Attachment #1: Type: text/plain, Size: 2682 bytes --]
Patch from Dimitry Andric <dimitry.andric@tomtom.com>
Change to using platfrom driver's .shutdown method instead
of an reboot notifier
Signed-off-by: Dimitry Andric <dimitry.andric@tomtom.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
diff -urN -X ../dontdiff linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c
--- linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:11:08.000000000 +0000
+++ linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:23:18.000000000 +0000
@@ -27,6 +27,7 @@
* Fixed tmr_count / wdt_count confusion
* Added configurable debug
* 25-Jan-2005 DA Added suspend/resume support
+ * Replaced reboot notifier with .shutdown method
*/
#include <linux/module.h>
@@ -37,8 +38,6 @@
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/fs.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/interrupt.h>
@@ -323,20 +322,6 @@
}
}
-/*
- * Notifier for system down
- */
-
-static int s3c2410wdt_notify_sys(struct notifier_block *this, unsigned long code,
- void *unused)
-{
- if(code==SYS_DOWN || code==SYS_HALT) {
- /* Turn the WDT off */
- s3c2410wdt_stop();
- }
- return NOTIFY_DONE;
-}
-
/* kernel interface */
static struct file_operations s3c2410wdt_fops = {
@@ -354,10 +339,6 @@
.fops = &s3c2410wdt_fops,
};
-static struct notifier_block s3c2410wdt_notifier = {
- .notifier_call = s3c2410wdt_notify_sys,
-};
-
/* interrupt handler code */
static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
@@ -438,18 +419,10 @@
}
}
- ret = register_reboot_notifier(&s3c2410wdt_notifier);
- if (ret) {
- printk (KERN_ERR PFX "cannot register reboot notifier (%d)\n",
- ret);
- return ret;
- }
-
ret = misc_register(&s3c2410wdt_miscdev);
if (ret) {
printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n",
WATCHDOG_MINOR, ret);
- unregister_reboot_notifier(&s3c2410wdt_notifier);
return ret;
}
@@ -485,6 +458,11 @@
return 0;
}
+static void s3c2410wdt_shutdown(struct device *dev)
+{
+ s3c2410wdt_stop();
+}
+
#ifdef CONFIG_PM
static unsigned long wtcon_save;
@@ -531,6 +509,7 @@
.bus = &platform_bus_type,
.probe = s3c2410wdt_probe,
.remove = s3c2410wdt_remove,
+ .shutdown = s3c2410wdt_shutdown,
.suspend = s3c2410wdt_suspend,
.resume = s3c2410wdt_resume,
};
@@ -547,7 +526,6 @@
static void __exit watchdog_exit(void)
{
driver_unregister(&s3c2410wdt_driver);
- unregister_reboot_notifier(&s3c2410wdt_notifier);
}
module_init(watchdog_init);
[-- Attachment #2: s3c2410-wdt-shutdown.patch --]
[-- Type: text/plain, Size: 2439 bytes --]
diff -urN -X ../dontdiff linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c
--- linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:11:08.000000000 +0000
+++ linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:23:18.000000000 +0000
@@ -27,6 +27,7 @@
* Fixed tmr_count / wdt_count confusion
* Added configurable debug
* 25-Jan-2005 DA Added suspend/resume support
+ * Replaced reboot notifier with .shutdown method
*/
#include <linux/module.h>
@@ -37,8 +38,6 @@
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/fs.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/interrupt.h>
@@ -323,20 +322,6 @@
}
}
-/*
- * Notifier for system down
- */
-
-static int s3c2410wdt_notify_sys(struct notifier_block *this, unsigned long code,
- void *unused)
-{
- if(code==SYS_DOWN || code==SYS_HALT) {
- /* Turn the WDT off */
- s3c2410wdt_stop();
- }
- return NOTIFY_DONE;
-}
-
/* kernel interface */
static struct file_operations s3c2410wdt_fops = {
@@ -354,10 +339,6 @@
.fops = &s3c2410wdt_fops,
};
-static struct notifier_block s3c2410wdt_notifier = {
- .notifier_call = s3c2410wdt_notify_sys,
-};
-
/* interrupt handler code */
static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
@@ -438,18 +419,10 @@
}
}
- ret = register_reboot_notifier(&s3c2410wdt_notifier);
- if (ret) {
- printk (KERN_ERR PFX "cannot register reboot notifier (%d)\n",
- ret);
- return ret;
- }
-
ret = misc_register(&s3c2410wdt_miscdev);
if (ret) {
printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n",
WATCHDOG_MINOR, ret);
- unregister_reboot_notifier(&s3c2410wdt_notifier);
return ret;
}
@@ -485,6 +458,11 @@
return 0;
}
+static void s3c2410wdt_shutdown(struct device *dev)
+{
+ s3c2410wdt_stop();
+}
+
#ifdef CONFIG_PM
static unsigned long wtcon_save;
@@ -531,6 +509,7 @@
.bus = &platform_bus_type,
.probe = s3c2410wdt_probe,
.remove = s3c2410wdt_remove,
+ .shutdown = s3c2410wdt_shutdown,
.suspend = s3c2410wdt_suspend,
.resume = s3c2410wdt_resume,
};
@@ -547,7 +526,6 @@
static void __exit watchdog_exit(void)
{
driver_unregister(&s3c2410wdt_driver);
- unregister_reboot_notifier(&s3c2410wdt_notifier);
}
module_init(watchdog_init);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-12 11:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-12 11:29 [PATCH] s3c2410 watchdog - replace reboot notifier Ben Dooks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®