2002-01-13 02:55:44

by Kevin P. Fleming

[permalink] [raw]
Subject: [CFT][PATCH] ide-floppy cleanups/media change detection (1/5)

(I am posting this to the list because my recent attempts to contact the
maintainer of this module have been unsuccessful...)

This message (and the next 4) contain five patches for the ide-floppy.c
module (against 2.4.18-pre3). The patches do the following:

1 - (cosmetic fix) make ide-floppy only emit its "ide-floppy 0.xx" banner
once per module load
2 - remove duplicate code for the Clik! drive
3 - modify ide-floppy functions to use kmalloc for a large structure instead
of the stack
4 - move common lock/unlock code into a function (instead of 4+ repetitions)
5 - implement media change detection

Patches 1-3 can stand alone, but patch 4 assumes patch 3 has been applied
(although it could be rediffed and work without patch 3). Patch 5 would
probably apply without patch 4, but with some fuzz.

Patch 1 follows:

diff -X dontdiff -urN linux/drivers/ide/ide-floppy.c
linux-1/drivers/ide/ide-floppy.c
--- linux/drivers/ide/ide-floppy.c Sat Jan 12 16:23:16 2002
+++ linux-1/drivers/ide/ide-floppy.c Sat Jan 12 16:33:08 2002
@@ -2087,8 +2087,12 @@
ide_drive_t *drive;
idefloppy_floppy_t *floppy;
int failed = 0;
+ static int first_init = 1;

- printk("ide-floppy driver " IDEFLOPPY_VERSION "\n");
+ if (first_init) {
+ printk ("ide-floppy driver " IDEFLOPPY_VERSION "\n");
+ first_init = 0;
+ }
MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, NULL,
failed++)) != NULL) {
if (!idefloppy_identify_device (drive, drive->id)) {