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

Laurent Vivier <[email protected]> Tue, 21 Jul 2026 08:10:13 +0200
Newsgroups org.kernel.vger.linux-m68k,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Le 16/07/2026 =C3=A0 12:02, Finn Thain a =C3=A9crit=C2=A0:
> 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.
>=20
> BTW, Inside Macintosh says, "Be sure [...] that CA0 and CA1 are set high
> before changing SEL." Hence the RELAX found in swim_select(). The SwimII=
I
> 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 it=
s
> control... In anycase, swim.c really does control SEL so there's no need
> for that here.
>=20
> Signed-off-by: Finn Thain <[email protected]>
> ---
>   drivers/block/swim.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
>=20

Reviewed-by: Laurent Vivier <[email protected]>

> 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 *b=
ase,
>   		swim_action(base, MOTOR_ON);
>  =20
>   		for (i =3D 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 *b=
ase,
>   		}
>   	} else if (action =3D=3D OFF) {
>   		swim_action(base, MOTOR_OFF);
> -		swim_select(base, RELAX);
> +		swim_write(base, phase, RELAX);
>   	}
>   }
>  =20
> @@ -355,13 +354,11 @@ static inline void swim_eject(struct swim __iomem =
*base)
>   	swim_action(base, EJECT);
>  =20
>   	for (i =3D 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);
>   }
>  =20
>   static inline void swim_head(struct swim __iomem *base, enum head head=
)
> @@ -385,7 +382,6 @@ static inline int swim_step(struct swim __iomem *bas=
e)
>   		set_current_state(TASK_INTERRUPTIBLE);
>   		schedule_timeout(1);
>  =20
> -		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);
>  =20
>   	for (try =3D 0; try < 100; try++) {
> -
> -		swim_select(base, RELAX);
>   		msleep(3);
>  =20
>   		if (swim_readbit(base, TRACK_ZERO))