[PATCH 08/31] swim: Don't start motor until medium is present
From: Finn Thain
Date: Thu Jul 16 2026 - 06:19:23 EST
The spindle motor should not be running when a disk is to be inserted.
Don't start the motor while the drive is empty.
Fixes: 8852ecd97488 ("m68k: mac - Add SWIM floppy support")
Signed-off-by: Finn Thain <fthain@xxxxxxxxxxxxxx>
---
drivers/block/swim.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index c49e584cd663..03a89916d4ed 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -630,8 +630,7 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)
fs->ref_count++;
swim_drive(base, fs->location);
- swim_motor(base, ON);
- swim_action(base, SETMFM);
+
if (fs->ejected)
setup_medium(fs);
if (!fs->disk_in) {
@@ -639,6 +638,9 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)
goto out;
}
+ swim_motor(base, ON);
+ swim_action(base, SETMFM);
+
set_capacity(fs->disk, fs->total_secs);
if (mode & BLK_OPEN_NDELAY)
--
2.52.0