patch-2.1.101 linux/drivers/macintosh/via-pmu.c

Next file: linux/drivers/net/8390.c
Previous file: linux/drivers/macintosh/via-cuda.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.100/linux/drivers/macintosh/via-pmu.c linux/drivers/macintosh/via-pmu.c
@@ -23,6 +23,7 @@
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
+#include <asm/init.h>
 
 static volatile unsigned char *via;
 
@@ -79,6 +80,7 @@
 static int pmu_adb_flags;
 static int adb_dev_map = 0;
 static struct adb_request bright_req_1, bright_req_2;
+static struct device_node *vias;
 
 static int init_pmu(void);
 static int pmu_queue_request(struct adb_request *req);
@@ -138,11 +140,11 @@
 /*f8*/	{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
 };
 
+__openfirmware
+
 void
-via_pmu_init()
+find_via_pmu()
 {
-	struct device_node *vias;
-
 	vias = find_devices("via-pmu");
 	if (vias == 0)
 		return;
@@ -174,8 +176,20 @@
 	pmu_state = idle;
 
 	if (!init_pmu())
+		via = NULL;
+
+	adb_hardware = ADB_VIAPMU;
+}
+
+void
+via_pmu_init(void)
+{
+	if (vias == NULL)
 		return;
 
+	bright_req_1.complete = 1;
+	bright_req_2.complete = 1;
+
 	if (request_irq(vias->intrs[0].line, via_pmu_interrupt, 0, "VIA-PMU",
 			(void *)0)) {
 		printk(KERN_ERR "VIA-PMU: can't get irq %d\n",
@@ -187,12 +201,8 @@
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
 
 	/* Set function pointers */
-	adb_hardware = ADB_VIAPMU;
 	adb_send_request = pmu_adb_send_request;
 	adb_autopoll = pmu_adb_autopoll;
-
-	bright_req_1.complete = 1;
-	bright_req_2.complete = 1;
 }
 
 static int

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov