patch-2.2.8 linux/drivers/macintosh/macio-adb.c

Next file: linux/drivers/macintosh/macserial.c
Previous file: linux/drivers/macintosh/mac_keyb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.7/linux/drivers/macintosh/macio-adb.c linux/drivers/macintosh/macio-adb.c
@@ -63,9 +63,17 @@
 static int macio_adb_send_request(struct adb_request *req, int sync);
 static int macio_adb_autopoll(int devs);
 static void macio_adb_poll(void);
-static int macio_reset_bus(void);
+static int macio_adb_reset_bus(void);
 static void completed(void);
 
+static struct adb_controller	macio_controller = {
+	ADB_MACIO,
+	macio_adb_send_request,
+	macio_adb_autopoll,
+	macio_adb_reset_bus,
+	macio_adb_poll
+};
+
 __openfirmware
 
 void macio_adb_init(void)
@@ -106,10 +114,12 @@
 	out_8(&adb->autopoll.r, APE);
 	out_8(&adb->intr_enb.r, DFB | TAG);
 
-	adb_hardware = ADB_MACIO;
-	adb_send_request = macio_adb_send_request;
-	adb_autopoll = macio_adb_autopoll;
-	adb_reset_bus = macio_reset_bus;
+	adb_controller = &macio_controller;
+//	adb_hardware = ADB_MACIO;
+
+//	adb_send_request = macio_adb_send_request;
+//	adb_autopoll = macio_adb_autopoll;
+//	adb_reset_bus = macio_reset_bus;
 }
 
 static int macio_adb_autopoll(int devs)
@@ -120,7 +130,7 @@
 	return 0;
 }
 
-static int macio_reset_bus(void)
+static int macio_adb_reset_bus(void)
 {
 	int timeout = 1000000;
 
@@ -138,7 +148,15 @@
 static int macio_adb_send_request(struct adb_request *req, int sync)
 {
 	unsigned long mflags;
-
+	int i;
+	
+	if (req->data[0] != ADB_PACKET)
+		return -EINVAL;
+	
+	for (i = 0; i < req->nbytes - 1; ++i)
+		req->data[i] = req->data[i+1];
+	--req->nbytes;
+	
 	req->next = 0;
 	req->sent = 0;
 	req->complete = 0;

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