mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Dooks <ben@fluff.org.uk>
To: wim@iguana.be, linux-kernel@vger.kernel.org
Cc: dimitry.andric@tomtom.com
Subject: [PATCH] s3c2410 watchdog - replace reboot notifier
Date: Sat, 12 Mar 2005 11:29:11 +0000	[thread overview]
Message-ID: <20050312112911.GA24366@home.fluff.org> (raw)

[-- 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);

                 reply	other threads:[~2005-03-12 11:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050312112911.GA24366@home.fluff.org \
    --to=ben@fluff.org.uk \
    --cc=dimitry.andric@tomtom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®