Skip to content

Commit aeb445b

Browse files
Finn Thaingeertu
authored andcommitted
m68k: mac: Don't send IOP message until channel is idle
In the following sequence of calls, iop_do_send() gets called when the "send" channel is not in the IOP_MSG_IDLE state: iop_ism_irq() iop_handle_send() (msg->handler)() iop_send_message() iop_do_send() Avoid this by testing the channel state before calling iop_do_send(). When sending, and iop_send_queue is empty, call iop_do_send() because the channel is idle. If iop_send_queue is not empty, iop_do_send() will get called later by iop_handle_send(). Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Finn Thain <[email protected]> Tested-by: Stan Johnson <[email protected]> Cc: Joshua Thompson <[email protected]> Link: https://lore.kernel.org/r/6d667c39e53865661fa5a48f16829d18ed8abe54.1590880333.git.fthain@telegraphics.com.au Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent be1a312 commit aeb445b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

arch/m68k/mac/iop.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ static void iop_handle_send(uint iop_num, uint chan)
415415
msg->status = IOP_MSGSTATUS_UNUSED;
416416
msg = msg->next;
417417
iop_send_queue[iop_num][chan] = msg;
418-
if (msg) iop_do_send(msg);
418+
if (msg && iop_readb(iop, IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE)
419+
iop_do_send(msg);
419420
}
420421

421422
/*
@@ -489,16 +490,12 @@ int iop_send_message(uint iop_num, uint chan, void *privdata,
489490

490491
if (!(q = iop_send_queue[iop_num][chan])) {
491492
iop_send_queue[iop_num][chan] = msg;
493+
iop_do_send(msg);
492494
} else {
493495
while (q->next) q = q->next;
494496
q->next = msg;
495497
}
496498

497-
if (iop_readb(iop_base[iop_num],
498-
IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) {
499-
iop_do_send(msg);
500-
}
501-
502499
return 0;
503500
}
504501

0 commit comments

Comments
 (0)