linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/8] Notifier chain update
@ 2006-01-18 16:38 Alan Stern
  0 siblings, 0 replies; only message in thread
From: Alan Stern @ 2006-01-18 16:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Chandra Seetharaman, Keith Owens, Kernel development list

Notifier chain re-implementation (as637): dcdbas re-registers itself
from within the callout. This is incorrect in two respects:

	1. Callouts should not register/unregister.
	2. It re-registers while the block is still in the list,
	   which would corrupt the list.

This patch fixes the problem by registering the callout to be the last
one to be called when the event happens.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>

---

Index: l2616/drivers/firmware/dcdbas.c
===================================================================
--- l2616.orig/drivers/firmware/dcdbas.c
+++ l2616/drivers/firmware/dcdbas.c
@@ -483,26 +483,15 @@ static void dcdbas_host_control(void)
 static int dcdbas_reboot_notify(struct notifier_block *nb, unsigned long code,
 				void *unused)
 {
-	static unsigned int notify_cnt = 0;
-
 	switch (code) {
 	case SYS_DOWN:
 	case SYS_HALT:
 	case SYS_POWER_OFF:
 		if (host_control_on_shutdown) {
 			/* firmware is going to perform host control action */
-			if (++notify_cnt == 2) {
-				printk(KERN_WARNING
-				       "Please wait for shutdown "
-				       "action to complete...\n");
-				dcdbas_host_control();
-			}
-			/*
-			 * register again and initiate the host control
-			 * action on the second notification to allow
-			 * everyone that registered to be notified
-			 */
-			register_reboot_notifier(nb);
+			printk(KERN_WARNING "Please wait for shutdown "
+			       "action to complete...\n");
+			dcdbas_host_control();
 		}
 		break;
 	}
@@ -513,7 +502,7 @@ static int dcdbas_reboot_notify(struct n
 static struct notifier_block dcdbas_reboot_nb = {
 	.notifier_call = dcdbas_reboot_notify,
 	.next = NULL,
-	.priority = 0
+	.priority = INT_MIN
 };
 
 static DCDBAS_BIN_ATTR_RW(smi_data);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-18 16:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-18 16:38 [PATCH 6/8] Notifier chain update Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).