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

Next file: linux/drivers/macintosh/via-pmu.c
Previous file: linux/drivers/macintosh/valkyrie.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.100/linux/drivers/macintosh/via-cuda.c linux/drivers/macintosh/via-cuda.c
@@ -20,6 +20,7 @@
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
+#include <asm/init.h>
 
 static volatile unsigned char *via;
 
@@ -72,6 +73,7 @@
 static unsigned char *reply_ptr;
 static int reading_reply;
 static int data_index;
+static struct device_node *vias;
 
 static int init_via(void);
 static void cuda_start(void);
@@ -80,11 +82,11 @@
 static int cuda_adb_send_request(struct adb_request *req, int sync);
 static int cuda_adb_autopoll(int on);
 
+__openfirmware
+
 void
-via_cuda_init()
+find_via_cuda()
 {
-    struct device_node *vias;
-
     vias = find_devices("via-cuda");
     if (vias == 0)
 	return;
@@ -111,12 +113,21 @@
     }
     via = (volatile unsigned char *) ioremap(vias->addrs->address, 0x2000);
 
+    cuda_state = idle;
+
     if (!init_via()) {
 	printk(KERN_ERR "init_via failed\n");
-	return;
+	via = NULL;
     }
 
-    cuda_state = idle;
+    adb_hardware = ADB_VIACUDA;
+}
+
+void
+via_cuda_init(void)
+{
+    if (via == NULL)
+	return;
 
     if (request_irq(vias->intrs[0].line, via_interrupt, 0, "VIA", (void *)0)) {
 	printk(KERN_ERR "VIA: can't get irq %d\n", vias->intrs[0].line);
@@ -128,7 +139,6 @@
     via[IER] = IER_SET|SR_INT; eieio();	/* enable interrupt from SR */
 
     /* Set function pointers */
-    adb_hardware = ADB_VIACUDA;
     adb_send_request = cuda_adb_send_request;
     adb_autopoll = cuda_adb_autopoll;
 }

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