[PATCH 18/31] swim: Remove redundant RELAX actions

From: Finn Thain

Date: Thu Jul 16 2026 - 06:21:58 EST


Wherever we have a swim_select() or swim_readbit() call there is an
implicit RELAX. That means the caller doesn't have to do it. Remove the
redundant code.

BTW, Inside Macintosh says, "Be sure [...] that CA0 and CA1 are set high
before changing SEL." Hence the RELAX found in swim_select(). The SwimIII
driver in mkLinux also has that. But the swim3.c driver in Linux is odd:
it scatters RELAX actions around as though SEL was not actually under its
control... In anycase, swim.c really does control SEL so there's no need
for that here.

Signed-off-by: Finn Thain <fthain@xxxxxxxxxxxxxx>
---
drivers/block/swim.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 6f93ebaaffb7..b4bf96a788db 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -336,7 +336,6 @@ static inline void swim_motor(struct swim __iomem *base,
swim_action(base, MOTOR_ON);

for (i = 0; i < 2*HZ; i++) {
- swim_select(base, RELAX);
if (swim_readbit(base, MOTOR_ON))
break;
set_current_state(TASK_INTERRUPTIBLE);
@@ -344,7 +343,7 @@ static inline void swim_motor(struct swim __iomem *base,
}
} else if (action == OFF) {
swim_action(base, MOTOR_OFF);
- swim_select(base, RELAX);
+ swim_write(base, phase, RELAX);
}
}

@@ -355,13 +354,11 @@ static inline void swim_eject(struct swim __iomem *base)
swim_action(base, EJECT);

for (i = 0; i < 2*HZ; i++) {
- swim_select(base, RELAX);
if (!swim_readbit(base, DISK_IN))
break;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
}
- swim_select(base, RELAX);
}

static inline void swim_head(struct swim __iomem *base, enum head head)
@@ -385,7 +382,6 @@ static inline int swim_step(struct swim __iomem *base)
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);

- swim_select(base, RELAX);
if (!swim_readbit(base, STEP))
return 0;
}
@@ -399,8 +395,6 @@ static inline int swim_track00(struct swim __iomem *base)
swim_action(base, SEEK_NEGATIVE);

for (try = 0; try < 100; try++) {
-
- swim_select(base, RELAX);
msleep(3);

if (swim_readbit(base, TRACK_ZERO))
--
2.52.0