2020-05-30 23:26:26

by Finn Thain

[permalink] [raw]
Subject: [PATCH 0/8] Mac ADB IOP driver fixes

The adb-iop driver was never finished. Some deficiencies have become
apparent over the years. For example,

- Mouse and/or keyboard may stop working if used together

- SRQ autopoll list cannot be changed

- Some bugs were found by inspection

This patch series contains fixes for the known bugs in the driver, plus
a few clean-ups.


Finn Thain (8):
macintosh/adb-iop: Remove dead and redundant code
macintosh/adb-iop: Correct comment text
macintosh/adb-iop: Adopt bus reset algorithm from via-macii driver
macintosh/adb-iop: Access current_req and adb_iop_state when inside
lock
macintosh/adb-iop: Resolve static checker warnings
macintosh/adb-iop: Implement idle -> sending state transition
macintosh/adb-iop: Implement sending -> idle state transition
macintosh/adb-iop: Implement SRQ autopolling

arch/m68k/include/asm/adb_iop.h | 1 +
drivers/macintosh/adb-iop.c | 186 +++++++++++++++-----------------
2 files changed, 86 insertions(+), 101 deletions(-)

--
2.26.2


2020-05-30 23:29:04

by Finn Thain

[permalink] [raw]
Subject: [PATCH 4/8] macintosh/adb-iop: Access current_req and adb_iop_state when inside lock

Drop the redundant local_irq_save/restore() from adb_iop_start() because
the caller has to do it anyway. This is the pattern used in via-macii.

Cc: Joshua Thompson <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/macintosh/adb-iop.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c
index c3089dacf2e2..7ecc41bc7358 100644
--- a/drivers/macintosh/adb-iop.c
+++ b/drivers/macintosh/adb-iop.c
@@ -137,7 +137,6 @@ static void adb_iop_listen(struct iop_msg *msg)

static void adb_iop_start(void)
{
- unsigned long flags;
struct adb_request *req;
struct adb_iopmsg amsg;

@@ -146,8 +145,6 @@ static void adb_iop_start(void)
if (!req)
return;

- local_irq_save(flags);
-
/* The IOP takes MacII-style packets, so strip the initial
* ADB_PACKET byte.
*/
@@ -161,7 +158,6 @@ static void adb_iop_start(void)

req->sent = 1;
adb_iop_state = sending;
- local_irq_restore(flags);

/* Now send it. The IOP manager will call adb_iop_complete
* when the message has been sent.
@@ -208,13 +204,13 @@ static int adb_iop_write(struct adb_request *req)
return -EINVAL;
}

- local_irq_save(flags);
-
req->next = NULL;
req->sent = 0;
req->complete = 0;
req->reply_len = 0;

+ local_irq_save(flags);
+
if (current_req != 0) {
last_req->next = req;
last_req = req;
@@ -223,10 +219,11 @@ static int adb_iop_write(struct adb_request *req)
last_req = req;
}

- local_irq_restore(flags);
-
if (adb_iop_state == idle)
adb_iop_start();
+
+ local_irq_restore(flags);
+
return 0;
}

--
2.26.2

2020-07-27 07:28:08

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 0/8] Mac ADB IOP driver fixes

On Sun, 31 May 2020 09:17:03 +1000, Finn Thain wrote:
> The adb-iop driver was never finished. Some deficiencies have become
> apparent over the years. For example,
>
> - Mouse and/or keyboard may stop working if used together
>
> - SRQ autopoll list cannot be changed
>
> [...]

Applied to powerpc/next.

[1/8] macintosh/adb-iop: Remove dead and redundant code
https://git.kernel.org/powerpc/c/8384c82ab0860cd7db2ce4ec403e574f4ee54b6e
[2/8] macintosh/adb-iop: Correct comment text
https://git.kernel.org/powerpc/c/ff785e179faf4bb06a2f73b8dcde6dabb66a83d2
[3/8] macintosh/adb-iop: Adopt bus reset algorithm from via-macii driver
https://git.kernel.org/powerpc/c/303511edb859b1fbf48b3c1d1d53b33a6ebd2a2b
[4/8] macintosh/adb-iop: Access current_req and adb_iop_state when inside lock
https://git.kernel.org/powerpc/c/aac840eca8fec02d594560647130d4e4447e10d9
[5/8] macintosh/adb-iop: Resolve static checker warnings
https://git.kernel.org/powerpc/c/56b732edda96b1942fff974fd298ea2a2c543b94
[6/8] macintosh/adb-iop: Implement idle -> sending state transition
https://git.kernel.org/powerpc/c/32226e81704398317e1cc5a82d24c0ef3cc25e5e
[7/8] macintosh/adb-iop: Implement sending -> idle state transition
https://git.kernel.org/powerpc/c/e2954e5f727fad126258e83259b513988973c166
[8/8] macintosh/adb-iop: Implement SRQ autopolling
https://git.kernel.org/powerpc/c/c66da95a39ec2bb95544c3def974d96e8c178f57

cheers