Return-Path: Received: from mnm [127.0.0.1] by localhost with POP3 (fetchmail-5.9.0) for akpm@localhost (single-drop); Thu, 01 Jan 2004 12:05:27 -0800 (PST) Received: from fire-1.osdl.org (air1.pdx.osdl.net [172.20.0.5]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i01K26M11732; Thu, 1 Jan 2004 12:02:06 -0800 Received: from amsfep14-int.chello.nl (amsfep14-int.chello.nl [213.46.243.22]) by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id i01K23N2012637; Thu, 1 Jan 2004 12:02:05 -0800 Received: from callisto.of.borg ([195.162.221.57]) by amsfep14-int.chello.nl (InterMail vM.6.00.05.02 201-2115-109-103-20031105) with ESMTP id <20040101200158.GZDY26052.amsfep14-int.chello.nl@callisto.of.borg>; Thu, 1 Jan 2004 21:01:58 +0100 Received: from callisto.of.borg (geert@localhost [127.0.0.1]) by callisto.of.borg (8.12.9/8.12.9/Debian-5) with ESMTP id i01K1vVR031777; Thu, 1 Jan 2004 21:01:57 +0100 Received: (from geert@localhost) by callisto.of.borg (8.12.9/8.12.9/Debian-5) id i01K1uWh031775; Thu, 1 Jan 2004 21:01:57 +0100 Date: Thu, 1 Jan 2004 21:01:57 +0100 Message-Id: <200401012001.i01K1uWh031775@callisto.of.borg> From: Geert Uytterhoeven To: Linus Torvalds , Andrew Morton Cc: Linux Kernel Development , Geert Uytterhoeven Subject: [PATCH 355] Mac ADB IOP fix X-MIMEDefang-Filter: osdl$Revision: 1.45 $ X-Scanned-By: MIMEDefang 2.36 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on mnm X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=2.0 tests=BAYES_00 autolearn=ham version=2.60 Mac ADB IOP: Fix improperly initialized request struct in the reset code, causing a bogus pointer (from Matthias Urlichs) --- linux-2.6.0/drivers/macintosh/adb-iop.c Thu Jan 2 12:54:27 2003 +++ linux-m68k-2.6.0/drivers/macintosh/adb-iop.c Mon Oct 20 21:45:56 2003 @@ -105,18 +105,19 @@ struct adb_iopmsg *amsg = (struct adb_iopmsg *) msg->message; struct adb_request *req; uint flags; +#ifdef DEBUG_ADB_IOP + int i; +#endif local_irq_save(flags); req = current_req; #ifdef DEBUG_ADB_IOP - printk("adb_iop_listen: rcvd packet, %d bytes: %02X %02X", + printk("adb_iop_listen %p: rcvd packet, %d bytes: %02X %02X", req, (uint) amsg->count + 2, (uint) amsg->flags, (uint) amsg->cmd); - i = 0; - while (i < amsg->count) { - printk(" %02X", (uint) amsg->data[i++]); - } + for (i = 0; i < amsg->count; i++) + printk(" %02X", (uint) amsg->data[i]); printk("\n"); #endif @@ -134,7 +135,7 @@ adb_iop_end_req(req, idle); } } else { - /* TODO: is it possible for more tha one chunk of data */ + /* TODO: is it possible for more than one chunk of data */ /* to arrive before the timeout? If so we need to */ /* use reply_ptr here like the other drivers do. */ if ((adb_iop_state == awaiting_reply) && @@ -163,6 +164,9 @@ unsigned long flags; struct adb_request *req; struct adb_iopmsg amsg; +#ifdef DEBUG_ADB_IOP + int i; +#endif /* get the packet to send */ req = current_req; @@ -171,7 +175,7 @@ local_irq_save(flags); #ifdef DEBUG_ADB_IOP - printk("adb_iop_start: sending packet, %d bytes:", req->nbytes); + printk("adb_iop_start %p: sending packet, %d bytes:", req, req->nbytes); for (i = 0 ; i < req->nbytes ; i++) printk(" %02X", (uint) req->data[i]); printk("\n"); @@ -267,13 +271,17 @@ int adb_iop_reset_bus(void) { - struct adb_request req; + struct adb_request req = { + .reply_expected = 0, + .nbytes = 2, + .data = { ADB_PACKET, 0 }, + }; - req.reply_expected = 0; - req.nbytes = 2; - req.data[0] = ADB_PACKET; - req.data[1] = 0; /* RESET */ adb_iop_write(&req); - while (!req.complete) adb_iop_poll(); + while (!req.complete) { + adb_iop_poll(); + schedule(); + } + return 0; } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org 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