Skip to content

Commit

Permalink
[PATCH] exit early in floppy_init when no floppy exists
Browse files Browse the repository at this point in the history
modprobe -v floppy on a Apple G5 writes incorrect stuff to dmesg:

Floppy drive(s): fd0 is 2.88M

The reason is that the legacy io check happens very late,
when part of the floppy stuff is already initialized.
check_legacy_ioport() returns either -ENODEV right away, or it walks
the device-tree looking for a floppy node.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Olaf Hering authored and Linus Torvalds committed Sep 1, 2006
1 parent a9aa141 commit ef16b51
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -4177,6 +4177,11 @@ static int __init floppy_init(void)
int i, unit, drive;
int err, dr;

#if defined(CONFIG_PPC_MERGE)
if (check_legacy_ioport(FDC1))
return -ENODEV;
#endif

raw_cmd = NULL;

for (dr = 0; dr < N_DRIVE; dr++) {
Expand Down Expand Up @@ -4234,13 +4239,6 @@ static int __init floppy_init(void)
}

use_virtual_dma = can_use_virtual_dma & 1;
#if defined(CONFIG_PPC_MERGE)
if (check_legacy_ioport(FDC1)) {
del_timer(&fd_timeout);
err = -ENODEV;
goto out_unreg_region;
}
#endif
fdc_state[0].address = FDC1;
if (fdc_state[0].address == -1) {
del_timer(&fd_timeout);
Expand Down

0 comments on commit ef16b51

Please sign in to comment.