patch-2.4.0-test4 linux/drivers/macintosh/via-pmu.c

Next file: linux/drivers/mtd/Config.in
Previous file: linux/drivers/macintosh/adb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test3/linux/drivers/macintosh/via-pmu.c linux/drivers/macintosh/via-pmu.c
@@ -31,6 +31,7 @@
 #include <linux/adb.h>
 #include <linux/pmu.h>
 #include <linux/cuda.h>
+#include <linux/smp_lock.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/io.h>
@@ -1031,12 +1032,12 @@
 pmu_register_sleep_notifier(struct pmu_sleep_notifier *n)
 {
 	struct list_head *list;
-	struct pmu_sleep_notifier *current;
+	struct pmu_sleep_notifier *notifier;
 
 	for (list = sleep_notifiers.next; list != &sleep_notifiers;
 	     list = list->next) {
-		current = list_entry(list, struct pmu_sleep_notifier, list);
-		if (n->priority > current->priority)
+		notifier = list_entry(list, struct pmu_sleep_notifier, list);
+		if (n->priority > notifier->priority)
 			break;
 	}
 	__list_add(&n->list, list->prev, list);
@@ -1059,18 +1060,18 @@
 {
 	int ret = PBOOK_SLEEP_OK;
 	struct list_head *list;
-	struct pmu_sleep_notifier *current;
+	struct pmu_sleep_notifier *notifier;
 
 	for (list = sleep_notifiers.prev; list != &sleep_notifiers;
 	     list = list->prev) {
-		current = list_entry(list, struct pmu_sleep_notifier, list);
-		ret = current->notifier_call(current, when);
+		notifier = list_entry(list, struct pmu_sleep_notifier, list);
+		ret = notifier->notifier_call(notifier, when);
 		if (ret != PBOOK_SLEEP_OK) {
 			printk(KERN_DEBUG "sleep %d rejected by %p (%p)\n",
-			       when, current, current->notifier_call);
+			       when, notifier, notifier->notifier_call);
 			for (; list != &sleep_notifiers; list = list->next) {
-				current = list_entry(list, struct pmu_sleep_notifier, list);
-				current->notifier_call(current, fallback);
+				notifier = list_entry(list, struct pmu_sleep_notifier, list);
+				notifier->notifier_call(notifier, fallback);
 			}
 			return ret;
 		}
@@ -1084,12 +1085,12 @@
 {
 	int ret = PBOOK_SLEEP_OK;
 	struct list_head *list;
-	struct pmu_sleep_notifier *current;
+	struct pmu_sleep_notifier *notifier;
 
 	for (list = sleep_notifiers.next; list != &sleep_notifiers;
 	     list = list->next) {
-		current = list_entry(list, struct pmu_sleep_notifier, list);
-		current->notifier_call(current, PBOOK_WAKE);
+		notifier = list_entry(list, struct pmu_sleep_notifier, list);
+		notifier->notifier_call(notifier, PBOOK_WAKE);
 	}
 	return ret;
 }
@@ -1539,6 +1540,7 @@
 	struct pmu_private *pp = file->private_data;
 	unsigned long flags;
 
+	lock_kernel();
 	if (pp != 0) {
 		file->private_data = 0;
 		spin_lock_irqsave(&all_pvt_lock, flags);
@@ -1546,6 +1548,7 @@
 		spin_unlock_irqrestore(&all_pvt_lock, flags);
 		kfree(pp);
 	}
+	unlock_kernel();
 	return 0;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)