Skip to content

Commit 63e0ea8

Browse files
Finn Thaingregkh
authored andcommitted
m68k: mac: Don't send IOP message until channel is idle
[ Upstream commit aeb445b ] 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: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Stan Johnson <userm57@yahoo.com> Cc: Joshua Thompson <funaho@jurai.org> Link: https://lore.kernel.org/r/6d667c39e53865661fa5a48f16829d18ed8abe54.1590880333.git.fthain@telegraphics.com.au Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a9b01fd commit 63e0ea8

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

arch/m68k/mac/iop.c

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

422423
/*
@@ -490,16 +491,12 @@ int iop_send_message(uint iop_num, uint chan, void *privdata,
490491

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

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

0 commit comments

Comments
 (0)