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

Next file: linux-2.4.22/drivers/macintosh/mediabay.c
Previous file: linux-2.4.22/drivers/macintosh/apm_emu.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/macintosh/macio-adb.c linux-2.4.22/drivers/macintosh/macio-adb.c
@@ -218,7 +218,6 @@
 				out_8(&adb->ctrl.r, DTB + CRE);
 			} else {
 				out_8(&adb->ctrl.r, DTB);
-				req->complete = 1;
 				current_req = req->next;
 				complete = 1;
 				if (current_req)
@@ -238,7 +237,6 @@
 				for (i = 0; i < req->reply_len; ++i)
 					req->reply[i] = in_8(&adb->data[i].r);
 			}
-			req->complete = 1;
 			current_req = req->next;
 			complete = 1;
 			if (current_req)
@@ -255,8 +253,16 @@
 		out_8(&adb->intr.r, 0);
 	}
 	spin_unlock(&macio_lock);
-	if (complete && req && req->done)
-		(*req->done)(req);
+	if (complete && req) {
+	    void (*done)(struct adb_request *) = req->done;
+	    mb();
+	    req->complete = 1;
+	    /* Here, we assume that if the request has a done member, the
+    	     * struct request will survive to setting req->complete to 1
+	     */
+	    if (done)
+		(*done)(req);
+	}
 	if (ibuf_len)
 		adb_input(ibuf, ibuf_len, regs, autopoll);
 }

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