Skip to contentSkip to conversation

Mac/m68k patches?

DISCUSSION Geert Uytterhoeven 1 participant 1 message Dec 12, 2000 1 message not in the archive Linux for power macintosh

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 8 lines
(quoted diff) +7 -1
-	req->nbytes = nbytes+1;
+	if (flags & ADBREQ_RAW) {
+		i = 0;
+		len = nbytes;
+	} else {
+		req->data[0] = ADB_PACKET;
+		i = 1;
+		len = nbytes+1;
Quoted 8 lines
Quoted 5 lines
(quoted diff) +2 -0
+	}
+	req->nbytes = len;
	req->done = done;
	req->reply_expected = flags & ADBREQ_REPLY;
	req->data[0] = ADB_PACKET;

Just cosmetic: you are setting req->data[0] twice to ADB_PACKET when not using the ADBREQ_RAW...

Thanks! With some more work, I could get rid of the additional len and 7 lines as well.

drivers/macintosh/adb.c +6 -4
@@ -61,7 +61,7 @@
 #ifdef CONFIG_ADB_IOP
 	&adb_iop_driver,
 #endif
-#ifdef CONFIG_ADB_PMU
+#if defined(CONFIG_ADB_PMU) || defined(CONFIG_ADB_PMU68K)
 	&via_pmu_driver,
 #endif
 #ifdef CONFIG_ADB_MACIO
@@ -347,13 +347,15 @@
 		req = &sreq;
 		flags |= ADBREQ_SYNC;
 	}
-	req->nbytes = nbytes+1;
+	i = (flags & ADBREQ_RAW) ? 0 : 1;
+	req->nbytes = nbytes+i;
 	req->done = done;
 	req->reply_expected = flags & ADBREQ_REPLY;
 	req->data[0] = ADB_PACKET;
 	va_start(list, nbytes);
-	for (i = 0; i < nbytes; ++i)
-		req->data[i+1] = va_arg(list, int);
+	while (i < req->nbytes) {
+		req->data[i++] = va_arg(list, int);
+	}
 	va_end(list);
 
 	if (flags & ADBREQ_NOSEND)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/