From: "Randy.Dunlap" <rddunlap@osdl.org>


---

 25-akpm/drivers/block/floppy.c | 1712 ++++++++++++++++++++---------------------
 1 files changed, 857 insertions(+), 855 deletions(-)

diff -puN drivers/block/floppy.c~floppy_format_265 drivers/block/floppy.c
--- 25/drivers/block/floppy.c~floppy_format_265	2004-04-08 21:31:07.726497344 -0700
+++ 25-akpm/drivers/block/floppy.c	2004-04-08 21:31:07.749493848 -0700
@@ -102,7 +102,7 @@
  * interrupt and dma channel to asm/floppy.h. Cleaned up some formatting &
  * use of '0' for NULL.
  */
- 
+
 /*
  * 1998/06/07 -- Alan Cox -- Merged the 2.0.34 fixes for resource allocation
  * failures.
@@ -145,10 +145,10 @@
 #define REALLY_SLOW_IO
 
 #define DEBUGT 2
-#define DCL_DEBUG /* debug disk change line */
+#define DCL_DEBUG		/* debug disk change line */
 
 /* do print messages for unexpected interrupts */
-static int print_unex=1;
+static int print_unex = 1;
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -163,7 +163,6 @@ static int print_unex=1;
  * 1998/1/21 -- Richard Gooch <rgooch@atnf.csiro.au> -- devfs support
  */
 
-
 #include <linux/fd.h>
 #include <linux/hdreg.h>
 
@@ -174,13 +173,13 @@ static int print_unex=1;
 #include <linux/string.h>
 #include <linux/fcntl.h>
 #include <linux/delay.h>
-#include <linux/mc146818rtc.h> /* CMOS defines */
+#include <linux/mc146818rtc.h>	/* CMOS defines */
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/device.h>
-#include <linux/buffer_head.h>		/* for invalidate_buffers() */
+#include <linux/buffer_head.h>	/* for invalidate_buffers() */
 
 /*
  * PS/2 floppies have much slower step rates than regular floppies.
@@ -195,9 +194,9 @@ static int slow_floppy;
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
-static int FLOPPY_IRQ=6;
-static int FLOPPY_DMA=2;
-static int can_use_virtual_dma=2;
+static int FLOPPY_IRQ = 6;
+static int FLOPPY_DMA = 2;
+static int can_use_virtual_dma = 2;
 /* =======
  * can use virtual DMA:
  * 0 = use of virtual DMA disallowed by config
@@ -221,10 +220,10 @@ static int use_virtual_dma;
 static spinlock_t floppy_lock = SPIN_LOCK_UNLOCKED;
 static struct completion device_release;
 
-static unsigned short virtual_dma_port=0x3f0;
-irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs);
+static unsigned short virtual_dma_port = 0x3f0;
+irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 static int set_dor(int fdc, char mask, char data);
-static void register_devfs_entries (int drive) __init;
+static void register_devfs_entries(int drive) __init;
 
 #define K_64	0x10000		/* 64KB */
 
@@ -249,7 +248,7 @@ static int irqdma_allocated;
 
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
-#include <linux/cdrom.h> /* for the compatibility eject ioctl */
+#include <linux/cdrom.h>	/* for the compatibility eject ioctl */
 #include <linux/completion.h>
 
 static struct request *current_req;
@@ -274,11 +273,12 @@ static inline void fallback_on_nodma_all
 {
 #ifdef FLOPPY_CAN_FALLBACK_ON_NODMA
 	if (*addr)
-		return; /* we have the memory */
+		return;		/* we have the memory */
 	if (can_use_virtual_dma != 2)
-		return; /* no fallback allowed */
-	printk("DMA memory shortage. Temporarily falling back on virtual DMA\n");
-	*addr = (char *) nodma_mem_alloc(l);
+		return;		/* no fallback allowed */
+	printk
+	    ("DMA memory shortage. Temporarily falling back on virtual DMA\n");
+	*addr = (char *)nodma_mem_alloc(l);
 #else
 	return;
 #endif
@@ -287,12 +287,12 @@ static inline void fallback_on_nodma_all
 /* End dma memory related stuff */
 
 static unsigned long fake_change;
-static int initialising=1;
+static int initialising = 1;
 
 #define ITYPE(x) (((x)>>2) & 0x1f)
 #define TOMINOR(x) ((x & 3) | ((x & 4) << 5))
-#define UNIT(x) ((x) & 0x03)		/* drive on fdc */
-#define FDC(x) (((x) & 0x04) >> 2)  /* fdc of drive */
+#define UNIT(x) ((x) & 0x03)	/* drive on fdc */
+#define FDC(x) (((x) & 0x04) >> 2)	/* fdc of drive */
 #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2))
 				/* reverse mapping from unit and fdc to drive */
 #define DP (&drive_params[current_drive])
@@ -342,19 +342,18 @@ static int initialising=1;
  * current disk size is unknown.
  * [Now it is rather a minimum]
  */
-#define MAX_DISK_SIZE 4 /* 3984*/
-
+#define MAX_DISK_SIZE 4		/* 3984 */
 
 /*
  * globals used by 'result()'
  */
 #define MAX_REPLIES 16
 static unsigned char reply_buffer[MAX_REPLIES];
-static int inr; /* size of reply buffer, when called from interrupt */
+static int inr;			/* size of reply buffer, when called from interrupt */
 #define ST0 (reply_buffer[0])
 #define ST1 (reply_buffer[1])
 #define ST2 (reply_buffer[2])
-#define ST3 (reply_buffer[0]) /* result of GETSTATUS */
+#define ST3 (reply_buffer[0])	/* result of GETSTATUS */
 #define R_TRACK (reply_buffer[3])
 #define R_HEAD (reply_buffer[4])
 #define R_SECTOR (reply_buffer[5])
@@ -367,8 +366,8 @@ static int inr; /* size of reply buffer,
  */
 static struct {
 	struct floppy_drive_params params;
-	const char *name; /* name printed while booting */
-} default_drive_params[]= {
+	const char *name;	/* name printed while booting */
+} default_drive_params[] = {
 /* NOTE: the time values in jiffies should be in msec!
  CMOS drive type
   |     Maximum data rate supported by drive type
@@ -541,14 +540,14 @@ static char *floppy_track_buffer;
 static int max_buffer_sectors;
 
 static int *errors;
-typedef void (*done_f)(int);
+typedef void (*done_f) (int);
 static struct cont_t {
-	void (*interrupt)(void); /* this is called after the interrupt of the
-				  * main command */
-	void (*redo)(void); /* this is called to retry the operation */
-	void (*error)(void); /* this is called to tally an error */
-	done_f done; /* this is called to say if the operation has 
-		      * succeeded/failed */
+	void (*interrupt) (void);	/* this is called after the interrupt of the
+					 * main command */
+	void (*redo) (void);	/* this is called to retry the operation */
+	void (*error) (void);	/* this is called to tally an error */
+	done_f done;		/* this is called to say if the operation has
+				 * succeeded/failed */
 } *cont;
 
 static void floppy_ready(void);
@@ -589,12 +588,12 @@ static int buffer_max = -1;
 
 /* fdc related variables, should end up in a struct */
 static struct floppy_fdc_state fdc_state[N_FDC];
-static int fdc; /* current fdc */
+static int fdc;			/* current fdc */
 
 static struct floppy_struct *_floppy = floppy_type;
 static unsigned char current_drive;
 static long current_count_sectors;
-static unsigned char fsector_t; /* sector in track */
+static unsigned char fsector_t;	/* sector in track */
 static unsigned char in_sector_offset;	/* offset within physical sector,
 					 * expressed in units of 512 bytes */
 
@@ -624,11 +623,11 @@ static inline void debugt(const char *me
 {
 #ifdef DEBUGT
 	if (DP->flags & DEBUGT)
-		printk("%s dtime=%lu\n", message, jiffies-debugtimer);
+		printk("%s dtime=%lu\n", message, jiffies - debugtimer);
 #endif
 }
 
-typedef void (*timeout_fn)(unsigned long);
+typedef void (*timeout_fn) (unsigned long);
 static struct timer_list fd_timeout = TIMER_INITIALIZER(floppy_shutdown, 0, 0);
 
 static const char *timeout_message;
@@ -639,18 +638,18 @@ static void is_alive(const char *message
 	/* this routine checks whether the floppy driver is "alive" */
 	if (test_bit(0, &fdc_busy) && command_status < 2
 	    && !timer_pending(&fd_timeout)) {
-		DPRINT("timeout handler died: %s\n",message);
+		DPRINT("timeout handler died: %s\n", message);
 	}
 }
 #endif
 
-static void (*do_floppy)(void) = NULL;
+static void (*do_floppy) (void) = NULL;
 
 #ifdef FLOPPY_SANITY_CHECK
 
 #define OLOGSIZE 20
 
-static void (*lasthandler)(void);
+static void (*lasthandler) (void);
 static unsigned long interruptjiffies;
 static unsigned long resultjiffies;
 static int resultsize;
@@ -674,12 +673,12 @@ static void __reschedule_timeout(int dri
 		drive = current_drive;
 	del_timer(&fd_timeout);
 	if (drive < 0 || drive > N_DRIVE) {
-		fd_timeout.expires = jiffies + 20UL*HZ;
-		drive=0;
+		fd_timeout.expires = jiffies + 20UL * HZ;
+		drive = 0;
 	} else
 		fd_timeout.expires = jiffies + UDP->timeout;
 	add_timer(&fd_timeout);
-	if (UDP->flags & FD_DEBUG){
+	if (UDP->flags & FD_DEBUG) {
 		DPRINT("reschedule timeout ");
 		printk(message, marg);
 		printk("\n");
@@ -700,7 +699,6 @@ static void reschedule_timeout(int drive
 
 #define SUPBOUND(a,b) (a)=min_t(int, a, b)
 
-
 /*
  * Bottom half floppy driver.
  * ==========================
@@ -736,32 +734,31 @@ static void reschedule_timeout(int drive
 
 static int disk_change(int drive)
 {
-	int fdc=FDC(drive);
+	int fdc = FDC(drive);
 #ifdef FLOPPY_SANITY_CHECK
 	if (jiffies - UDRS->select_date < UDP->select_delay)
 		DPRINT("WARNING disk change called early\n");
 	if (!(FDCS->dor & (0x10 << UNIT(drive))) ||
-	    (FDCS->dor & 3) != UNIT(drive) ||
-	    fdc != FDC(drive)){
+	    (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) {
 		DPRINT("probing disk change on unselected drive\n");
-		DPRINT("drive=%d fdc=%d dor=%x\n",drive, FDC(drive),
-			(unsigned int)FDCS->dor);
+		DPRINT("drive=%d fdc=%d dor=%x\n", drive, FDC(drive),
+		       (unsigned int)FDCS->dor);
 	}
 #endif
 
 #ifdef DCL_DEBUG
-	if (UDP->flags & FD_DEBUG){
-		DPRINT("checking disk change line for drive %d\n",drive);
+	if (UDP->flags & FD_DEBUG) {
+		DPRINT("checking disk change line for drive %d\n", drive);
 		DPRINT("jiffies=%lu\n", jiffies);
-		DPRINT("disk change line=%x\n",fd_inb(FD_DIR)&0x80);
-		DPRINT("flags=%lx\n",UDRS->flags);
+		DPRINT("disk change line=%x\n", fd_inb(FD_DIR) & 0x80);
+		DPRINT("flags=%lx\n", UDRS->flags);
 	}
 #endif
 	if (UDP->flags & FD_BROKEN_DCL)
 		return UTESTF(FD_DISK_CHANGED);
-	if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80){
-		USETF(FD_VERIFY); /* verify write protection */
-		if (UDRS->maxblock){
+	if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80) {
+		USETF(FD_VERIFY);	/* verify write protection */
+		if (UDRS->maxblock) {
 			/* mark it changed */
 			USETF(FD_DISK_CHANGED);
 		}
@@ -776,10 +773,10 @@ static int disk_change(int drive)
 			floppy_sizes[TOMINOR(drive)] = MAX_DISK_SIZE << 1;
 		}
 
-		/*USETF(FD_DISK_NEWCHANGE);*/
+		/*USETF(FD_DISK_NEWCHANGE); */
 		return 1;
 	} else {
-		UDRS->last_checked=jiffies;
+		UDRS->last_checked = jiffies;
 		UCLEARF(FD_DISK_NEWCHANGE);
 	}
 	return 0;
@@ -787,24 +784,24 @@ static int disk_change(int drive)
 
 static inline int is_selected(int dor, int unit)
 {
-	return ((dor  & (0x10 << unit)) && (dor &3) == unit);
+	return ((dor & (0x10 << unit)) && (dor & 3) == unit);
 }
 
 static int set_dor(int fdc, char mask, char data)
 {
-	register unsigned char drive, unit, newdor,olddor;
+	register unsigned char drive, unit, newdor, olddor;
 
 	if (FDCS->address == -1)
 		return -1;
 
 	olddor = FDCS->dor;
-	newdor =  (olddor & mask) | data;
-	if (newdor != olddor){
+	newdor = (olddor & mask) | data;
+	if (newdor != olddor) {
 		unit = olddor & 0x3;
-		if (is_selected(olddor, unit) && !is_selected(newdor,unit)){
-			drive = REVDRIVE(fdc,unit);
+		if (is_selected(olddor, unit) && !is_selected(newdor, unit)) {
+			drive = REVDRIVE(fdc, unit);
 #ifdef DCL_DEBUG
-			if (UDP->flags & FD_DEBUG){
+			if (UDP->flags & FD_DEBUG) {
 				DPRINT("calling disk change from set_dor\n");
 			}
 #endif
@@ -814,15 +811,15 @@ static int set_dor(int fdc, char mask, c
 		fd_outb(newdor, FD_DOR);
 
 		unit = newdor & 0x3;
-		if (!is_selected(olddor, unit) && is_selected(newdor,unit)){
-			drive = REVDRIVE(fdc,unit);
+		if (!is_selected(olddor, unit) && is_selected(newdor, unit)) {
+			drive = REVDRIVE(fdc, unit);
 			UDRS->select_date = jiffies;
 		}
 	}
 	/*
-	 *	We should propagate failures to grab the resources back
-	 *	nicely from here. Actually we ought to rewrite the fd
-	 *	driver some day too.
+	 *      We should propagate failures to grab the resources back
+	 *      nicely from here. Actually we ought to rewrite the fd
+	 *      driver some day too.
 	 */
 	if (newdor & FLOPPY_MOTOR_MASK)
 		floppy_grab_irq_and_dma();
@@ -835,7 +832,7 @@ static void twaddle(void)
 {
 	if (DP->select_delay)
 		return;
-	fd_outb(FDCS->dor & ~(0x10<<UNIT(current_drive)), FD_DOR);
+	fd_outb(FDCS->dor & ~(0x10 << UNIT(current_drive)), FD_DOR);
 	fd_outb(FDCS->dor, FD_DOR);
 	DRS->select_date = jiffies;
 }
@@ -851,15 +848,14 @@ static void reset_fdc_info(int mode)
 	FDCS->perp_mode = 1;
 	FDCS->rawcmd = 0;
 	for (drive = 0; drive < N_DRIVE; drive++)
-		if (FDC(drive) == fdc &&
-		    (mode || UDRS->track != NEED_1_RECAL))
+		if (FDC(drive) == fdc && (mode || UDRS->track != NEED_1_RECAL))
 			UDRS->track = NEED_2_RECAL;
 }
 
 /* selects the fdc and drive, and enables the fdc's input/dma. */
 static void set_fdc(int drive)
 {
-	if (drive >= 0 && drive < N_DRIVE){
+	if (drive >= 0 && drive < N_DRIVE) {
 		fdc = FDC(drive);
 		current_drive = drive;
 	}
@@ -867,9 +863,9 @@ static void set_fdc(int drive)
 		printk("bad fdc value\n");
 		return;
 	}
-	set_dor(fdc,~0,8);
+	set_dor(fdc, ~0, 8);
 #if N_FDC > 1
-	set_dor(1-fdc, ~8, 0);
+	set_dor(1 - fdc, ~8, 0);
 #endif
 	if (FDCS->rawcmd == 2)
 		reset_fdc_info(1);
@@ -880,11 +876,13 @@ static void set_fdc(int drive)
 /* locks the driver */
 static int _lock_fdc(int drive, int interruptible, int line)
 {
-	if (!usage_count){
-		printk(KERN_ERR "Trying to lock fdc while usage count=0 at line %d\n", line);
+	if (!usage_count) {
+		printk(KERN_ERR
+		       "Trying to lock fdc while usage count=0 at line %d\n",
+		       line);
 		return -1;
 	}
-	if(floppy_grab_irq_and_dma()==-1)
+	if (floppy_grab_irq_and_dma() == -1)
 		return -EBUSY;
 
 	if (test_and_set_bit(0, &fdc_busy)) {
@@ -920,7 +918,6 @@ static int _lock_fdc(int drive, int inte
 #define LOCK_FDC(drive,interruptible) \
 if (lock_fdc(drive,interruptible)) return -EINTR;
 
-
 /* unlocks the driver */
 static inline void unlock_fdc(void)
 {
@@ -932,7 +929,7 @@ static inline void unlock_fdc(void)
 
 	if (do_floppy)
 		DPRINT("device interrupt still active at FDC release: %p!\n",
-			do_floppy);
+		       do_floppy);
 	command_status = FD_COMMAND_NONE;
 	spin_lock_irqsave(&floppy_lock, flags);
 	del_timer(&fd_timeout);
@@ -957,22 +954,23 @@ static void motor_off_callback(unsigned 
 static void floppy_off(unsigned int drive)
 {
 	unsigned long volatile delta;
-	register int fdc=FDC(drive);
+	register int fdc = FDC(drive);
 
 	if (!(FDCS->dor & (0x10 << UNIT(drive))))
 		return;
 
-	del_timer(motor_off_timer+drive);
+	del_timer(motor_off_timer + drive);
 
 	/* make spindle stop in a position which minimizes spinup time
 	 * next time */
-	if (UDP->rps){
+	if (UDP->rps) {
 		delta = jiffies - UDRS->first_read_date + HZ -
-			UDP->spindown_offset;
+		    UDP->spindown_offset;
 		delta = ((delta * UDP->rps) % HZ) / UDP->rps;
-		motor_off_timer[drive].expires = jiffies + UDP->spindown - delta;
+		motor_off_timer[drive].expires =
+		    jiffies + UDP->spindown - delta;
 	}
-	add_timer(motor_off_timer+drive);
+	add_timer(motor_off_timer + drive);
 }
 
 /*
@@ -988,10 +986,10 @@ static void scandrives(void)
 		return;
 
 	saved_drive = current_drive;
-	for (i=0; i < N_DRIVE; i++){
+	for (i = 0; i < N_DRIVE; i++) {
 		drive = (saved_drive + i + 1) % N_DRIVE;
 		if (UDRS->fd_ref == 0 || UDP->select_delay != 0)
-			continue; /* skip closed drives */
+			continue;	/* skip closed drives */
 		set_fdc(drive);
 		if (!(set_dor(fdc, ~3, UNIT(drive) | (0x10 << UNIT(drive))) &
 		      (0x10 << UNIT(drive))))
@@ -1022,7 +1020,7 @@ static void cancel_activity(void)
 
 	spin_lock_irqsave(&floppy_lock, flags);
 	do_floppy = NULL;
-	PREPARE_WORK(&floppy_work, (void*)empty, NULL);
+	PREPARE_WORK(&floppy_work, (void *)empty, NULL);
 	del_timer(&fd_timer);
 	spin_unlock_irqrestore(&floppy_lock, flags);
 }
@@ -1032,12 +1030,12 @@ static void cancel_activity(void)
 static void fd_watchdog(void)
 {
 #ifdef DCL_DEBUG
-	if (DP->flags & FD_DEBUG){
+	if (DP->flags & FD_DEBUG) {
 		DPRINT("calling disk change from watchdog\n");
 	}
 #endif
 
-	if (disk_change(current_drive)){
+	if (disk_change(current_drive)) {
 		DPRINT("disk removed during i/o\n");
 		cancel_activity();
 		cont->done(0);
@@ -1059,14 +1057,14 @@ static void main_command_interrupt(void)
 /* waits for a delay (spinup or select) to pass */
 static int fd_wait_for_completion(unsigned long delay, timeout_fn function)
 {
-	if (FDCS->reset){
-		reset_fdc(); /* do the reset during sleep to win time
-			      * if we don't need to sleep, it's a good
-			      * occasion anyways */
+	if (FDCS->reset) {
+		reset_fdc();	/* do the reset during sleep to win time
+				 * if we don't need to sleep, it's a good
+				 * occasion anyways */
 		return 1;
 	}
 
-	if ((signed) (jiffies - delay) < 0){
+	if ((signed)(jiffies - delay) < 0) {
 		del_timer(&fd_timer);
 		fd_timer.function = function;
 		fd_timer.expires = delay;
@@ -1084,7 +1082,7 @@ static void floppy_disable_hlt(void)
 
 	spin_lock_irqsave(&floppy_hlt_lock, flags);
 	if (!hlt_disabled) {
-		hlt_disabled=1;
+		hlt_disabled = 1;
 #ifdef HAVE_DISABLE_HLT
 		disable_hlt();
 #endif
@@ -1097,8 +1095,8 @@ static void floppy_enable_hlt(void)
 	unsigned long flags;
 
 	spin_lock_irqsave(&floppy_hlt_lock, flags);
-	if (hlt_disabled){
-		hlt_disabled=0;
+	if (hlt_disabled) {
+		hlt_disabled = 0;
 #ifdef HAVE_DISABLE_HLT
 		enable_hlt();
 #endif
@@ -1106,47 +1104,45 @@ static void floppy_enable_hlt(void)
 	spin_unlock_irqrestore(&floppy_hlt_lock, flags);
 }
 
-
 static void setup_DMA(void)
 {
 	unsigned long f;
 
 #ifdef FLOPPY_SANITY_CHECK
-	if (raw_cmd->length == 0){
+	if (raw_cmd->length == 0) {
 		int i;
 
 		printk("zero dma transfer size:");
-		for (i=0; i < raw_cmd->cmd_count; i++)
+		for (i = 0; i < raw_cmd->cmd_count; i++)
 			printk("%x,", raw_cmd->cmd[i]);
 		printk("\n");
 		cont->done(0);
 		FDCS->reset = 1;
 		return;
 	}
-	if (((unsigned long) raw_cmd->kernel_data) % 512){
+	if (((unsigned long)raw_cmd->kernel_data) % 512) {
 		printk("non aligned address: %p\n", raw_cmd->kernel_data);
 		cont->done(0);
-		FDCS->reset=1;
+		FDCS->reset = 1;
 		return;
 	}
 #endif
-	f=claim_dma_lock();
+	f = claim_dma_lock();
 	fd_disable_dma();
 #ifdef fd_dma_setup
-	if (fd_dma_setup(raw_cmd->kernel_data, raw_cmd->length, 
-			(raw_cmd->flags & FD_RAW_READ)?
-			DMA_MODE_READ : DMA_MODE_WRITE,
-			FDCS->address) < 0) {
+	if (fd_dma_setup(raw_cmd->kernel_data, raw_cmd->length,
+			 (raw_cmd->flags & FD_RAW_READ) ?
+			 DMA_MODE_READ : DMA_MODE_WRITE, FDCS->address) < 0) {
 		release_dma_lock(f);
 		cont->done(0);
-		FDCS->reset=1;
+		FDCS->reset = 1;
 		return;
 	}
 	release_dma_lock(f);
-#else	
+#else
 	fd_clear_dma_ff();
 	fd_cacheflush(raw_cmd->kernel_data, raw_cmd->length);
-	fd_set_dma_mode((raw_cmd->flags & FD_RAW_READ)?
+	fd_set_dma_mode((raw_cmd->flags & FD_RAW_READ) ?
 			DMA_MODE_READ : DMA_MODE_WRITE);
 	fd_set_dma_addr(raw_cmd->kernel_data);
 	fd_set_dma_count(raw_cmd->length);
@@ -1166,13 +1162,12 @@ static int wait_til_ready(void)
 	if (FDCS->reset)
 		return -1;
 	for (counter = 0; counter < 10000; counter++) {
-		status = fd_inb(FD_STATUS);		
+		status = fd_inb(FD_STATUS);
 		if (status & STATUS_READY)
 			return status;
 	}
 	if (!initialising) {
-		DPRINT("Getstatus times out (%x) on fdc %d\n",
-			status, fdc);
+		DPRINT("Getstatus times out (%x) on fdc %d\n", status, fdc);
 		show_floppy();
 	}
 	FDCS->reset = 1;
@@ -1186,8 +1181,8 @@ static int output_byte(char byte)
 
 	if ((status = wait_til_ready()) < 0)
 		return -1;
-	if ((status & (STATUS_READY|STATUS_DIR|STATUS_DMA)) == STATUS_READY){
-		fd_outb(byte,FD_DATA);
+	if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) {
+		fd_outb(byte, FD_DATA);
 #ifdef FLOPPY_SANITY_CHECK
 		output_log[output_log_pos].data = byte;
 		output_log[output_log_pos].status = status;
@@ -1204,32 +1199,34 @@ static int output_byte(char byte)
 	}
 	return -1;
 }
+
 #define LAST_OUT(x) if (output_byte(x)<0){ reset_fdc();return;}
 
 /* gets the response from the fdc */
 static int result(void)
 {
-	int i, status=0;
+	int i, status = 0;
 
-	for(i=0; i < MAX_REPLIES; i++) {
+	for (i = 0; i < MAX_REPLIES; i++) {
 		if ((status = wait_til_ready()) < 0)
 			break;
-		status &= STATUS_DIR|STATUS_READY|STATUS_BUSY|STATUS_DMA;
-		if ((status & ~STATUS_BUSY) == STATUS_READY){
+		status &= STATUS_DIR | STATUS_READY | STATUS_BUSY | STATUS_DMA;
+		if ((status & ~STATUS_BUSY) == STATUS_READY) {
 #ifdef FLOPPY_SANITY_CHECK
 			resultjiffies = jiffies;
 			resultsize = i;
 #endif
 			return i;
 		}
-		if (status == (STATUS_DIR|STATUS_READY|STATUS_BUSY))
+		if (status == (STATUS_DIR | STATUS_READY | STATUS_BUSY))
 			reply_buffer[i] = fd_inb(FD_DATA);
 		else
 			break;
 	}
 	if (!initialising) {
-		DPRINT("get result error. Fdc=%d Last status=%x Read bytes=%d\n",
-		       fdc, status, i);
+		DPRINT
+		    ("get result error. Fdc=%d Last status=%x Read bytes=%d\n",
+		     fdc, status, i);
 		show_floppy();
 	}
 	FDCS->reset = 1;
@@ -1243,7 +1240,7 @@ static int need_more_output(void)
 	int status;
 	if ((status = wait_til_ready()) < 0)
 		return -1;
-	if ((status & (STATUS_READY|STATUS_DIR|STATUS_DMA)) == STATUS_READY)
+	if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY)
 		return MORE_OUTPUT;
 	return result();
 }
@@ -1255,21 +1252,21 @@ static inline void perpendicular_mode(vo
 {
 	unsigned char perp_mode;
 
-	if (raw_cmd->rate & 0x40){
-		switch(raw_cmd->rate & 3){
-			case 0:
-				perp_mode=2;
-				break;
-			case 3:
-				perp_mode=3;
-				break;
-			default:
-				DPRINT("Invalid data rate for perpendicular mode!\n");
-				cont->done(0);
-				FDCS->reset = 1; /* convenient way to return to
-						  * redo without to much hassle (deep
-						  * stack et al. */
-				return;
+	if (raw_cmd->rate & 0x40) {
+		switch (raw_cmd->rate & 3) {
+		case 0:
+			perp_mode = 2;
+			break;
+		case 3:
+			perp_mode = 3;
+			break;
+		default:
+			DPRINT("Invalid data rate for perpendicular mode!\n");
+			cont->done(0);
+			FDCS->reset = 1;	/* convenient way to return to
+						 * redo without to much hassle (deep
+						 * stack et al. */
+			return;
 		}
 	} else
 		perp_mode = 0;
@@ -1283,7 +1280,7 @@ static inline void perpendicular_mode(vo
 	} else if (perp_mode) {
 		DPRINT("perpendicular mode not supported by this FDC.\n");
 	}
-} /* perpendicular_mode */
+}				/* perpendicular_mode */
 
 static int fifo_depth = 0xa;
 static int no_fifo;
@@ -1296,10 +1293,10 @@ static int fdc_configure(void)
 		return 0;
 	output_byte(0);
 	output_byte(0x10 | (no_fifo & 0x20) | (fifo_depth & 0xf));
-	output_byte(0);	/* pre-compensation from track 
-			   0 upwards */
+	output_byte(0);		/* pre-compensation from track
+				   0 upwards */
 	return 1;
-}	
+}
 
 #define NOMINAL_DTR 500
 
@@ -1334,51 +1331,51 @@ static void fdc_specify(void)
 	if (FDCS->need_configure && FDCS->version >= FDC_82072A) {
 		fdc_configure();
 		FDCS->need_configure = 0;
-		/*DPRINT("FIFO enabled\n");*/
+		/*DPRINT("FIFO enabled\n"); */
 	}
 
 	switch (raw_cmd->rate & 0x03) {
-		case 3:
-			dtr = 1000;
-			break;
-		case 1:
-			dtr = 300;
-			if (FDCS->version >= FDC_82078) {
-				/* chose the default rate table, not the one
-				 * where 1 = 2 Mbps */
-				output_byte(FD_DRIVESPEC);
-				if (need_more_output() == MORE_OUTPUT) {
-					output_byte(UNIT(current_drive));
-					output_byte(0xc0);
-				}
+	case 3:
+		dtr = 1000;
+		break;
+	case 1:
+		dtr = 300;
+		if (FDCS->version >= FDC_82078) {
+			/* chose the default rate table, not the one
+			 * where 1 = 2 Mbps */
+			output_byte(FD_DRIVESPEC);
+			if (need_more_output() == MORE_OUTPUT) {
+				output_byte(UNIT(current_drive));
+				output_byte(0xc0);
 			}
-			break;
-		case 2:
-			dtr = 250;
-			break;
+		}
+		break;
+	case 2:
+		dtr = 250;
+		break;
 	}
 
 	if (FDCS->version >= FDC_82072) {
 		scale_dtr = dtr;
-		hlt_max_code = 0x00; /* 0==256msec*dtr0/dtr (not linear!) */
-		hut_max_code = 0x0; /* 0==256msec*dtr0/dtr (not linear!) */
+		hlt_max_code = 0x00;	/* 0==256msec*dtr0/dtr (not linear!) */
+		hut_max_code = 0x0;	/* 0==256msec*dtr0/dtr (not linear!) */
 	}
 
 	/* Convert step rate from microseconds to milliseconds and 4 bits */
-	srt = 16 - (DP->srt*scale_dtr/1000 + NOMINAL_DTR - 1)/NOMINAL_DTR;
-	if( slow_floppy ) {
+	srt = 16 - (DP->srt * scale_dtr / 1000 + NOMINAL_DTR - 1) / NOMINAL_DTR;
+	if (slow_floppy) {
 		srt = srt / 4;
 	}
 	SUPBOUND(srt, 0xf);
 	INFBOUND(srt, 0);
 
-	hlt = (DP->hlt*scale_dtr/2 + NOMINAL_DTR - 1)/NOMINAL_DTR;
+	hlt = (DP->hlt * scale_dtr / 2 + NOMINAL_DTR - 1) / NOMINAL_DTR;
 	if (hlt < 0x01)
 		hlt = 0x01;
 	else if (hlt > 0x7f)
 		hlt = hlt_max_code;
 
-	hut = (DP->hut*scale_dtr/16 + NOMINAL_DTR - 1)/NOMINAL_DTR;
+	hut = (DP->hut * scale_dtr / 16 + NOMINAL_DTR - 1) / NOMINAL_DTR;
 	if (hut < 0x1)
 		hut = 0x1;
 	else if (hut > 0xf)
@@ -1394,7 +1391,7 @@ static void fdc_specify(void)
 		output_byte(FDCS->spec1 = spec1);
 		output_byte(FDCS->spec2 = spec2);
 	}
-} /* fdc_specify */
+}				/* fdc_specify */
 
 /* Set the FDC's data transfer rate on behalf of the specified drive.
  * NOTE: with 82072/82077 FDCs, changing the data rate requires a reissue
@@ -1415,16 +1412,15 @@ static int fdc_dtr(void)
 	 * Pause 5 msec to avoid trouble. (Needs to be 2 jiffies)
 	 */
 	FDCS->dtr = raw_cmd->rate & 3;
-	return(fd_wait_for_completion(jiffies+2UL*HZ/100,
-				   (timeout_fn) floppy_ready));
-} /* fdc_dtr */
+	return (fd_wait_for_completion(jiffies + 2UL * HZ / 100,
+				       (timeout_fn) floppy_ready));
+}				/* fdc_dtr */
 
 static void tell_sector(void)
 {
 	printk(": track %d, head %d, sector %d, size %d",
 	       R_TRACK, R_HEAD, R_SECTOR, R_SIZECODE);
-} /* tell_sector */
-
+}				/* tell_sector */
 
 /*
  * OK, this error interpreting routine is called after a
@@ -1437,7 +1433,7 @@ static int interpret_errors(void)
 {
 	char bad;
 
-	if (inr!=7) {
+	if (inr != 7) {
 		DPRINT("-- FDC reply error");
 		FDCS->reset = 1;
 		return 1;
@@ -1445,62 +1441,65 @@ static int interpret_errors(void)
 
 	/* check IC to find cause of interrupt */
 	switch (ST0 & ST0_INTR) {
-		case 0x40:	/* error occurred during command execution */
-			if (ST1 & ST1_EOC)
-				return 0; /* occurs with pseudo-DMA */
-			bad = 1;
-			if (ST1 & ST1_WP) {
-				DPRINT("Drive is write protected\n");
-				CLEARF(FD_DISK_WRITABLE);
-				cont->done(0);
-				bad = 2;
-			} else if (ST1 & ST1_ND) {
-				SETF(FD_NEED_TWADDLE);
-			} else if (ST1 & ST1_OR) {
-				if (DP->flags & FTD_MSG)
-					DPRINT("Over/Underrun - retrying\n");
-				bad = 0;
-			}else if (*errors >= DP->max_errors.reporting){
-				DPRINT("");
-				if (ST0 & ST0_ECE) {
-					printk("Recalibrate failed!");
-				} else if (ST2 & ST2_CRC) {
-					printk("data CRC error");
-					tell_sector();
-				} else if (ST1 & ST1_CRC) {
-					printk("CRC error");
-					tell_sector();
-				} else if ((ST1 & (ST1_MAM|ST1_ND)) || (ST2 & ST2_MAM)) {
-					if (!probing) {
-						printk("sector not found");
-						tell_sector();
-					} else
-						printk("probe failed...");
-				} else if (ST2 & ST2_WC) {	/* seek error */
-					printk("wrong cylinder");
-				} else if (ST2 & ST2_BC) {	/* cylinder marked as bad */
-					printk("bad cylinder");
-				} else {
-					printk("unknown error. ST[0..2] are: 0x%x 0x%x 0x%x", ST0, ST1, ST2);
+	case 0x40:		/* error occurred during command execution */
+		if (ST1 & ST1_EOC)
+			return 0;	/* occurs with pseudo-DMA */
+		bad = 1;
+		if (ST1 & ST1_WP) {
+			DPRINT("Drive is write protected\n");
+			CLEARF(FD_DISK_WRITABLE);
+			cont->done(0);
+			bad = 2;
+		} else if (ST1 & ST1_ND) {
+			SETF(FD_NEED_TWADDLE);
+		} else if (ST1 & ST1_OR) {
+			if (DP->flags & FTD_MSG)
+				DPRINT("Over/Underrun - retrying\n");
+			bad = 0;
+		} else if (*errors >= DP->max_errors.reporting) {
+			DPRINT("");
+			if (ST0 & ST0_ECE) {
+				printk("Recalibrate failed!");
+			} else if (ST2 & ST2_CRC) {
+				printk("data CRC error");
+				tell_sector();
+			} else if (ST1 & ST1_CRC) {
+				printk("CRC error");
+				tell_sector();
+			} else if ((ST1 & (ST1_MAM | ST1_ND))
+				   || (ST2 & ST2_MAM)) {
+				if (!probing) {
+					printk("sector not found");
 					tell_sector();
-				}
-				printk("\n");
-
+				} else
+					printk("probe failed...");
+			} else if (ST2 & ST2_WC) {	/* seek error */
+				printk("wrong cylinder");
+			} else if (ST2 & ST2_BC) {	/* cylinder marked as bad */
+				printk("bad cylinder");
+			} else {
+				printk
+				    ("unknown error. ST[0..2] are: 0x%x 0x%x 0x%x",
+				     ST0, ST1, ST2);
+				tell_sector();
 			}
-			if (ST2 & ST2_WC || ST2 & ST2_BC)
-				/* wrong cylinder => recal */
-				DRS->track = NEED_2_RECAL;
-			return bad;
-		case 0x80: /* invalid command given */
-			DPRINT("Invalid FDC command given!\n");
-			cont->done(0);
-			return 2;
-		case 0xc0:
-			DPRINT("Abnormal termination caused by polling\n");
-			cont->error();
-			return 2;
-		default: /* (0) Normal command termination */
-			return 0;
+			printk("\n");
+
+		}
+		if (ST2 & ST2_WC || ST2 & ST2_BC)
+			/* wrong cylinder => recal */
+			DRS->track = NEED_2_RECAL;
+		return bad;
+	case 0x80:		/* invalid command given */
+		DPRINT("Invalid FDC command given!\n");
+		cont->done(0);
+		return 2;
+	case 0xc0:
+		DPRINT("Abnormal termination caused by polling\n");
+		cont->error();
+		return 2;
+	default:		/* (0) Normal command termination */
+		return 0;
 	}
 }
 
@@ -1511,7 +1510,7 @@ static int interpret_errors(void)
  */
 static void setup_rw_floppy(void)
 {
-	int i,r, flags,dflags;
+	int i, r, flags, dflags;
 	unsigned long ready_date;
 	timeout_fn function;
 
@@ -1519,20 +1518,20 @@ static void setup_rw_floppy(void)
 	if (flags & (FD_RAW_READ | FD_RAW_WRITE))
 		flags |= FD_RAW_INTR;
 
-	if ((flags & FD_RAW_SPIN) && !(flags & FD_RAW_NO_MOTOR)){
+	if ((flags & FD_RAW_SPIN) && !(flags & FD_RAW_NO_MOTOR)) {
 		ready_date = DRS->spinup_date + DP->spinup;
 		/* If spinup will take a long time, rerun scandrives
 		 * again just before spinup completion. Beware that
 		 * after scandrives, we must again wait for selection.
 		 */
-		if ((signed) (ready_date - jiffies) > DP->select_delay){
+		if ((signed)(ready_date - jiffies) > DP->select_delay) {
 			ready_date -= DP->select_delay;
 			function = (timeout_fn) floppy_start;
 		} else
 			function = (timeout_fn) setup_rw_floppy;
 
 		/* wait until the floppy is spinning fast enough */
-		if (fd_wait_for_completion(ready_date,function))
+		if (fd_wait_for_completion(ready_date, function))
 			return;
 	}
 	dflags = DRS->flags;
@@ -1543,20 +1542,20 @@ static void setup_rw_floppy(void)
 	if (flags & FD_RAW_INTR)
 		do_floppy = main_command_interrupt;
 
-	r=0;
-	for (i=0; i< raw_cmd->cmd_count; i++)
-		r|=output_byte(raw_cmd->cmd[i]);
+	r = 0;
+	for (i = 0; i < raw_cmd->cmd_count; i++)
+		r |= output_byte(raw_cmd->cmd[i]);
 
 #ifdef DEBUGT
 	debugt("rw_command: ");
 #endif
-	if (r){
+	if (r) {
 		cont->error();
 		reset_fdc();
 		return;
 	}
 
-	if (!(flags & FD_RAW_INTR)){
+	if (!(flags & FD_RAW_INTR)) {
 		inr = result();
 		cont->interrupt();
 	} else if (flags & FD_RAW_NEED_DISK)
@@ -1581,14 +1580,15 @@ static void seek_interrupt(void)
 		cont->redo();
 		return;
 	}
-	if (DRS->track >= 0 && DRS->track != ST1 && !blind_seek){
+	if (DRS->track >= 0 && DRS->track != ST1 && !blind_seek) {
 #ifdef DCL_DEBUG
-		if (DP->flags & FD_DEBUG){
-			DPRINT("clearing NEWCHANGE flag because of effective seek\n");
+		if (DP->flags & FD_DEBUG) {
+			DPRINT
+			    ("clearing NEWCHANGE flag because of effective seek\n");
 			DPRINT("jiffies=%lu\n", jiffies);
 		}
 #endif
-		CLEARF(FD_DISK_NEWCHANGE); /* effective seek */
+		CLEARF(FD_DISK_NEWCHANGE);	/* effective seek */
 		DRS->select_date = jiffies;
 	}
 	DRS->track = ST1;
@@ -1601,19 +1601,19 @@ static void check_wp(void)
 		/* check write protection */
 		output_byte(FD_GETSTATUS);
 		output_byte(UNIT(current_drive));
-		if (result() != 1){
+		if (result() != 1) {
 			FDCS->reset = 1;
 			return;
 		}
 		CLEARF(FD_VERIFY);
 		CLEARF(FD_NEED_TWADDLE);
 #ifdef DCL_DEBUG
-		if (DP->flags & FD_DEBUG){
+		if (DP->flags & FD_DEBUG) {
 			DPRINT("checking whether disk is write protected\n");
-			DPRINT("wp=%x\n",ST3 & 0x40);
+			DPRINT("wp=%x\n", ST3 & 0x40);
 		}
 #endif
-		if (!(ST3  & 0x40))
+		if (!(ST3 & 0x40))
 			SETF(FD_DISK_WRITABLE);
 		else
 			CLEARF(FD_DISK_WRITABLE);
@@ -1624,17 +1624,16 @@ static void seek_floppy(void)
 {
 	int track;
 
-	blind_seek=0;
+	blind_seek = 0;
 
 #ifdef DCL_DEBUG
-	if (DP->flags & FD_DEBUG){
+	if (DP->flags & FD_DEBUG) {
 		DPRINT("calling disk change from seek\n");
 	}
 #endif
 
 	if (!TESTF(FD_DISK_NEWCHANGE) &&
-	    disk_change(current_drive) &&
-	    (raw_cmd->flags & FD_RAW_NEED_DISK)){
+	    disk_change(current_drive) && (raw_cmd->flags & FD_RAW_NEED_DISK)) {
 		/* the media changed flag should be cleared after the seek.
 		 * If it isn't, this means that there is really no disk in
 		 * the drive.
@@ -1644,7 +1643,7 @@ static void seek_floppy(void)
 		cont->redo();
 		return;
 	}
-	if (DRS->track <= NEED_1_RECAL){
+	if (DRS->track <= NEED_1_RECAL) {
 		recalibrate_floppy();
 		return;
 	} else if (TESTF(FD_DISK_NEWCHANGE) &&
@@ -1655,7 +1654,7 @@ static void seek_floppy(void)
 		if (raw_cmd->track)
 			track = raw_cmd->track - 1;
 		else {
-			if (DP->flags & FD_SILENT_DCL_CLEAR){
+			if (DP->flags & FD_SILENT_DCL_CLEAR) {
 				set_dor(fdc, ~(0x10 << UNIT(current_drive)), 0);
 				blind_seek = 1;
 				raw_cmd->flags |= FD_RAW_NEED_SEEK;
@@ -1687,52 +1686,53 @@ static void recal_interrupt(void)
 #ifdef DEBUGT
 	debugt("recal interrupt:");
 #endif
-	if (inr !=2)
+	if (inr != 2)
 		FDCS->reset = 1;
 	else if (ST0 & ST0_ECE) {
-	       	switch(DRS->track){
-			case NEED_1_RECAL:
+		switch (DRS->track) {
+		case NEED_1_RECAL:
 #ifdef DEBUGT
-				debugt("recal interrupt need 1 recal:");
+			debugt("recal interrupt need 1 recal:");
 #endif
-				/* after a second recalibrate, we still haven't
-				 * reached track 0. Probably no drive. Raise an
-				 * error, as failing immediately might upset
-				 * computers possessed by the Devil :-) */
-				cont->error();
-				cont->redo();
-				return;
-			case NEED_2_RECAL:
+			/* after a second recalibrate, we still haven't
+			 * reached track 0. Probably no drive. Raise an
+			 * error, as failing immediately might upset
+			 * computers possessed by the Devil :-) */
+			cont->error();
+			cont->redo();
+			return;
+		case NEED_2_RECAL:
 #ifdef DEBUGT
-				debugt("recal interrupt need 2 recal:");
+			debugt("recal interrupt need 2 recal:");
 #endif
-				/* If we already did a recalibrate,
-				 * and we are not at track 0, this
-				 * means we have moved. (The only way
-				 * not to move at recalibration is to
-				 * be already at track 0.) Clear the
-				 * new change flag */
+			/* If we already did a recalibrate,
+			 * and we are not at track 0, this
+			 * means we have moved. (The only way
+			 * not to move at recalibration is to
+			 * be already at track 0.) Clear the
+			 * new change flag */
 #ifdef DCL_DEBUG
-				if (DP->flags & FD_DEBUG){
-					DPRINT("clearing NEWCHANGE flag because of second recalibrate\n");
-				}
+			if (DP->flags & FD_DEBUG) {
+				DPRINT
+				    ("clearing NEWCHANGE flag because of second recalibrate\n");
+			}
 #endif
 
-				CLEARF(FD_DISK_NEWCHANGE);
-				DRS->select_date = jiffies;
-				/* fall through */
-			default:
+			CLEARF(FD_DISK_NEWCHANGE);
+			DRS->select_date = jiffies;
+			/* fall through */
+		default:
 #ifdef DEBUGT
-				debugt("recal interrupt default:");
+			debugt("recal interrupt default:");
 #endif
-				/* Recalibrate moves the head by at
-				 * most 80 steps. If after one
-				 * recalibrate we don't have reached
-				 * track 0, this might mean that we
-				 * started beyond track 80.  Try
-				 * again.  */
-				DRS->track = NEED_1_RECAL;
-				break;
+			/* Recalibrate moves the head by at
+			 * most 80 steps. If after one
+			 * recalibrate we don't have reached
+			 * track 0, this might mean that we
+			 * started beyond track 80.  Try
+			 * again.  */
+			DRS->track = NEED_1_RECAL;
+			break;
 		}
 	} else
 		DRS->track = ST1;
@@ -1745,31 +1745,31 @@ static void print_result(char *message, 
 
 	DPRINT("%s ", message);
 	if (inr >= 0)
-		for (i=0; i<inr; i++)
+		for (i = 0; i < inr; i++)
 			printk("repl[%d]=%x ", i, reply_buffer[i]);
 	printk("\n");
 }
 
 /* interrupt handler. Note that this can be called externally on the Sparc */
-irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-	void (*handler)(void) = do_floppy;
+	void (*handler) (void) = do_floppy;
 	int do_print;
 	unsigned long f;
 
 	lasthandler = handler;
 	interruptjiffies = jiffies;
 
-	f=claim_dma_lock();
+	f = claim_dma_lock();
 	fd_disable_dma();
 	release_dma_lock(f);
 
 	floppy_enable_hlt();
 	do_floppy = NULL;
-	if (fdc >= N_FDC || FDCS->address == -1){
+	if (fdc >= N_FDC || FDCS->address == -1) {
 		/* we don't even know which FDC is the culprit */
 		printk("DOR0=%x\n", fdc_state[0].dor);
-		printk("floppy interrupt on bizarre fdc %d\n",fdc);
+		printk("floppy interrupt on bizarre fdc %d\n", fdc);
 		printk("handler=%p\n", handler);
 		is_alive("bizarre fdc");
 		return IRQ_NONE;
@@ -1790,7 +1790,7 @@ irqreturn_t floppy_interrupt(int irq, vo
 	inr = result();
 	if (do_print)
 		print_result("unexpected interrupt", inr);
-	if (inr == 0){
+	if (inr == 0) {
 		int max_sensei = 4;
 		do {
 			output_byte(FD_SENSEI);
@@ -1798,7 +1798,8 @@ irqreturn_t floppy_interrupt(int irq, vo
 			if (do_print)
 				print_result("sensei", inr);
 			max_sensei--;
-		} while ((ST0 & 0x83) != UNIT(current_drive) && inr == 2 && max_sensei);
+		} while ((ST0 & 0x83) != UNIT(current_drive) && inr == 2
+			 && max_sensei);
 	}
 	if (handler)
 		schedule_bh(handler);
@@ -1831,7 +1832,7 @@ static void reset_interrupt(void)
 	result();		/* get the status ready for set_fdc */
 	if (FDCS->reset) {
 		printk("reset set in interrupt, calling %p\n", cont->error);
-		cont->error(); /* a reset just after a reset. BAD! */
+		cont->error();	/* a reset just after a reset. BAD! */
 	}
 	cont->redo();
 }
@@ -1851,12 +1852,12 @@ static void reset_fdc(void)
 	/* Pseudo-DMA may intercept 'reset finished' interrupt.  */
 	/* Irrelevant for systems with true DMA (i386).          */
 
-	flags=claim_dma_lock();
+	flags = claim_dma_lock();
 	fd_disable_dma();
 	release_dma_lock(flags);
 
 	if (FDCS->version >= FDC_82072A)
-		fd_outb(0x80 | (FDCS->dtr &3), FD_STATUS);
+		fd_outb(0x80 | (FDCS->dtr & 3), FD_STATUS);
 	else {
 		fd_outb(FDCS->dor & ~0x04, FD_DOR);
 		udelay(FD_RESET_DELAY);
@@ -1872,20 +1873,20 @@ static void show_floppy(void)
 	printk("floppy driver state\n");
 	printk("-------------------\n");
 	printk("now=%lu last interrupt=%lu diff=%lu last called handler=%p\n",
-	       jiffies, interruptjiffies, jiffies-interruptjiffies, lasthandler);
-
+	       jiffies, interruptjiffies, jiffies - interruptjiffies,
+	       lasthandler);
 
 #ifdef FLOPPY_SANITY_CHECK
 	printk("timeout_message=%s\n", timeout_message);
 	printk("last output bytes:\n");
-	for (i=0; i < OLOGSIZE; i++)
+	for (i = 0; i < OLOGSIZE; i++)
 		printk("%2x %2x %lu\n",
-		       output_log[(i+output_log_pos) % OLOGSIZE].data,
-		       output_log[(i+output_log_pos) % OLOGSIZE].status,
-		       output_log[(i+output_log_pos) % OLOGSIZE].jiffies);
+		       output_log[(i + output_log_pos) % OLOGSIZE].data,
+		       output_log[(i + output_log_pos) % OLOGSIZE].status,
+		       output_log[(i + output_log_pos) % OLOGSIZE].jiffies);
 	printk("last result at %lu\n", resultjiffies);
 	printk("last redo_fd_request at %lu\n", lastredo);
-	for (i=0; i<resultsize; i++){
+	for (i = 0; i < resultsize; i++) {
 		printk("%2x ", reply_buffer[i]);
 	}
 	printk("\n");
@@ -1899,10 +1900,10 @@ static void show_floppy(void)
 		printk("floppy_work.func=%p\n", floppy_work.func);
 	if (timer_pending(&fd_timer))
 		printk("fd_timer.function=%p\n", fd_timer.function);
-	if (timer_pending(&fd_timeout)){
-		printk("timer_function=%p\n",fd_timeout.function);
-		printk("expires=%lu\n",fd_timeout.expires-jiffies);
-		printk("now=%lu\n",jiffies);
+	if (timer_pending(&fd_timeout)) {
+		printk("timer_function=%p\n", fd_timeout.function);
+		printk("expires=%lu\n", fd_timeout.expires - jiffies);
+		printk("now=%lu\n", jiffies);
 	}
 	printk("cont=%p\n", cont);
 	printk("current_req=%p\n", current_req);
@@ -1913,42 +1914,43 @@ static void show_floppy(void)
 static void floppy_shutdown(unsigned long data)
 {
 	unsigned long flags;
-	
+
 	if (!initialising)
 		show_floppy();
 	cancel_activity();
 
 	floppy_enable_hlt();
-	
-	flags=claim_dma_lock();
+
+	flags = claim_dma_lock();
 	fd_disable_dma();
 	release_dma_lock(flags);
-	
+
 	/* avoid dma going to a random drive after shutdown */
 
 	if (!initialising)
 		DPRINT("floppy timeout called\n");
 	FDCS->reset = 1;
-	if (cont){
+	if (cont) {
 		cont->done(0);
-		cont->redo(); /* this will recall reset when needed */
+		cont->redo();	/* this will recall reset when needed */
 	} else {
 		printk("no cont in shutdown!\n");
 		process_fd_request();
 	}
 	is_alive("floppy shutdown");
 }
+
 /*typedef void (*timeout_fn)(unsigned long);*/
 
 /* start motor, check media-changed condition and write protection */
-static int start_motor(void (*function)(void) )
+static int start_motor(void (*function) (void))
 {
 	int mask, data;
 
 	mask = 0xfc;
 	data = UNIT(current_drive);
-	if (!(raw_cmd->flags & FD_RAW_NO_MOTOR)){
-		if (!(FDCS->dor & (0x10 << UNIT(current_drive)))){
+	if (!(raw_cmd->flags & FD_RAW_NO_MOTOR)) {
+		if (!(FDCS->dor & (0x10 << UNIT(current_drive)))) {
 			set_debugt();
 			/* no read since this drive is running */
 			DRS->first_read_date = 0;
@@ -1956,53 +1958,50 @@ static int start_motor(void (*function)(
 			DRS->spinup_date = jiffies;
 			data |= (0x10 << UNIT(current_drive));
 		}
-	} else
-		if (FDCS->dor & (0x10 << UNIT(current_drive)))
-			mask &= ~(0x10 << UNIT(current_drive));
+	} else if (FDCS->dor & (0x10 << UNIT(current_drive)))
+		mask &= ~(0x10 << UNIT(current_drive));
 
 	/* starts motor and selects floppy */
 	del_timer(motor_off_timer + current_drive);
 	set_dor(fdc, mask, data);
 
 	/* wait_for_completion also schedules reset if needed. */
-	return(fd_wait_for_completion(DRS->select_date+DP->select_delay,
-				   (timeout_fn) function));
+	return (fd_wait_for_completion(DRS->select_date + DP->select_delay,
+				       (timeout_fn) function));
 }
 
 static void floppy_ready(void)
 {
 	CHECK_RESET;
-	if (start_motor(floppy_ready)) return;
-	if (fdc_dtr()) return;
+	if (start_motor(floppy_ready))
+		return;
+	if (fdc_dtr())
+		return;
 
 #ifdef DCL_DEBUG
-	if (DP->flags & FD_DEBUG){
+	if (DP->flags & FD_DEBUG) {
 		DPRINT("calling disk change from floppy_ready\n");
 	}
 #endif
 	if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) &&
-	   disk_change(current_drive) &&
-	   !DP->select_delay)
-		twaddle(); /* this clears the dcl on certain drive/controller
-			    * combinations */
+	    disk_change(current_drive) && !DP->select_delay)
+		twaddle();	/* this clears the dcl on certain drive/controller
+				 * combinations */
 
 #ifdef fd_chose_dma_mode
-	if ((raw_cmd->flags & FD_RAW_READ) || 
-	    (raw_cmd->flags & FD_RAW_WRITE))
-	{
+	if ((raw_cmd->flags & FD_RAW_READ) || (raw_cmd->flags & FD_RAW_WRITE)) {
 		unsigned long flags = claim_dma_lock();
-		fd_chose_dma_mode(raw_cmd->kernel_data,
-				  raw_cmd->length);
+		fd_chose_dma_mode(raw_cmd->kernel_data, raw_cmd->length);
 		release_dma_lock(flags);
 	}
 #endif
 
-	if (raw_cmd->flags & (FD_RAW_NEED_SEEK | FD_RAW_NEED_DISK)){
+	if (raw_cmd->flags & (FD_RAW_NEED_SEEK | FD_RAW_NEED_DISK)) {
 		perpendicular_mode();
-		fdc_specify(); /* must be done here because of hut, hlt ... */
+		fdc_specify();	/* must be done here because of hut, hlt ... */
 		seek_floppy();
 	} else {
-		if ((raw_cmd->flags & FD_RAW_READ) || 
+		if ((raw_cmd->flags & FD_RAW_READ) ||
 		    (raw_cmd->flags & FD_RAW_WRITE))
 			fdc_specify();
 		setup_rw_floppy();
@@ -2015,7 +2014,7 @@ static void floppy_start(void)
 
 	scandrives();
 #ifdef DCL_DEBUG
-	if (DP->flags & FD_DEBUG){
+	if (DP->flags & FD_DEBUG) {
 		DPRINT("setting NEWCHANGE in floppy_start\n");
 	}
 #endif
@@ -2046,21 +2045,20 @@ static void do_wakeup(void)
 }
 
 static struct cont_t wakeup_cont = {
-	.interrupt = empty,
-	.redo = do_wakeup,
-	.error = empty,
-	.done = (done_f) empty
+	.interrupt	= empty,
+	.redo		= do_wakeup,
+	.error		= empty,
+	.done		= (done_f) empty
 };
 
-
 static struct cont_t intr_cont = {
-	.interrupt = empty,
-	.redo = process_fd_request,
-	.error = empty,
-	.done = (done_f) empty
+	.interrupt	= empty,
+	.redo		= process_fd_request,
+	.error		= empty,
+	.done		= (done_f) empty
 };
 
-static int wait_til_done(void (*handler)(void), int interruptible)
+static int wait_til_done(void (*handler) (void), int interruptible)
 {
 	int ret;
 
@@ -2071,8 +2069,8 @@ static int wait_til_done(void (*handler)
 
 		add_wait_queue(&command_done, &wait);
 		for (;;) {
-			set_current_state(interruptible?
-					  TASK_INTERRUPTIBLE:
+			set_current_state(interruptible ?
+					  TASK_INTERRUPTIBLE :
 					  TASK_UNINTERRUPTIBLE);
 
 			if (command_status >= 2 || !NO_SIGNAL)
@@ -2087,7 +2085,7 @@ static int wait_til_done(void (*handler)
 		remove_wait_queue(&command_done, &wait);
 	}
 
-	if (command_status < 2){
+	if (command_status < 2) {
 		cancel_activity();
 		cont = &intr_cont;
 		reset_fdc();
@@ -2097,9 +2095,9 @@ static int wait_til_done(void (*handler)
 	if (FDCS->reset)
 		command_status = FD_COMMAND_ERROR;
 	if (command_status == FD_COMMAND_OKAY)
-		ret=0;
+		ret = 0;
 	else
-		ret=-EIO;
+		ret = -EIO;
 	command_status = FD_COMMAND_NONE;
 	return ret;
 }
@@ -2126,7 +2124,6 @@ static void success_and_wakeup(void)
 	cont->redo();
 }
 
-
 /*
  * formatting and rw support.
  * ==========================
@@ -2137,13 +2134,12 @@ static int next_valid_format(void)
 	int probed_format;
 
 	probed_format = DRS->probed_format;
-	while(1){
-		if (probed_format >= 8 ||
-		     !DP->autodetect[probed_format]){
+	while (1) {
+		if (probed_format >= 8 || !DP->autodetect[probed_format]) {
 			DRS->probed_format = 0;
 			return 1;
 		}
-		if (floppy_type[DP->autodetect[probed_format]].sect){
+		if (floppy_type[DP->autodetect[probed_format]].sect) {
 			DRS->probed_format = probed_format;
 			return 0;
 		}
@@ -2155,7 +2151,7 @@ static void bad_flp_intr(void)
 {
 	int err_count;
 
-	if (probing){
+	if (probing) {
 		DRS->probed_format++;
 		if (!next_valid_format())
 			return;
@@ -2176,7 +2172,7 @@ static void set_floppy(int drive)
 	if (type)
 		_floppy = floppy_type + type;
 	else
-		_floppy = current_type[ drive ];
+		_floppy = current_type[drive];
 }
 
 /*
@@ -2185,13 +2181,13 @@ static void set_floppy(int drive)
  */
 static void format_interrupt(void)
 {
-	switch (interpret_errors()){
-		case 1:
-			cont->error();
-		case 2:
-			break;
-		case 0:
-			cont->done(1);
+	switch (interpret_errors()) {
+	case 1:
+		cont->error();
+	case 2:
+		break;
+	case 0:
+		cont->done(1);
 	}
 	cont->redo();
 }
@@ -2202,20 +2198,20 @@ static void format_interrupt(void)
 static void setup_format_params(int track)
 {
 	struct fparm {
-		unsigned char track,head,sect,size;
+		unsigned char track, head, sect, size;
 	} *here = (struct fparm *)floppy_track_buffer;
-	int il,n;
-	int count,head_shift,track_shift;
+	int il, n;
+	int count, head_shift, track_shift;
 
 	raw_cmd = &default_raw_cmd;
 	raw_cmd->track = track;
 
 	raw_cmd->flags = FD_RAW_WRITE | FD_RAW_INTR | FD_RAW_SPIN |
-		FD_RAW_NEED_DISK | FD_RAW_NEED_SEEK;
+	    FD_RAW_NEED_DISK | FD_RAW_NEED_SEEK;
 	raw_cmd->rate = _floppy->rate & 0x43;
 	raw_cmd->cmd_count = NR_F;
-	COMMAND = FM_MODE(_floppy,FD_FORMAT);
-	DR_SELECT = UNIT(current_drive) + PH_HEAD(_floppy,format_req.head);
+	COMMAND = FM_MODE(_floppy, FD_FORMAT);
+	DR_SELECT = UNIT(current_drive) + PH_HEAD(_floppy, format_req.head);
 	F_SIZECODE = FD_SIZECODE(_floppy);
 	F_SECT_PER_TRACK = _floppy->sect << 2 >> F_SIZECODE;
 	F_GAP = _floppy->fmt_gap;
@@ -2225,14 +2221,14 @@ static void setup_format_params(int trac
 	raw_cmd->length = 4 * F_SECT_PER_TRACK;
 
 	/* allow for about 30ms for data transport per track */
-	head_shift  = (F_SECT_PER_TRACK + 5) / 6;
+	head_shift = (F_SECT_PER_TRACK + 5) / 6;
 
 	/* a ``cylinder'' is two tracks plus a little stepping time */
 	track_shift = 2 * head_shift + 3;
 
 	/* position of logical sector 1 on this track */
 	n = (track_shift * format_req.track + head_shift * format_req.head)
-		% F_SECT_PER_TRACK;
+	    % F_SECT_PER_TRACK;
 
 	/* determine interleave */
 	il = 1;
@@ -2249,18 +2245,19 @@ static void setup_format_params(int trac
 	/* place logical sectors */
 	for (count = 1; count <= F_SECT_PER_TRACK; ++count) {
 		here[n].sect = count;
-		n = (n+il) % F_SECT_PER_TRACK;
-		if (here[n].sect) { /* sector busy, find next free sector */
+		n = (n + il) % F_SECT_PER_TRACK;
+		if (here[n].sect) {	/* sector busy, find next free sector */
 			++n;
-			if (n>= F_SECT_PER_TRACK) {
-				n-=F_SECT_PER_TRACK;
-				while (here[n].sect) ++n;
+			if (n >= F_SECT_PER_TRACK) {
+				n -= F_SECT_PER_TRACK;
+				while (here[n].sect)
+					++n;
 			}
 		}
 	}
-	if(_floppy->stretch & FD_ZEROBASED) {
-	    for(count = 0; count < F_SECT_PER_TRACK; count++)
-		here[count].sect--;
+	if (_floppy->stretch & FD_ZEROBASED) {
+		for (count = 0; count < F_SECT_PER_TRACK; count++)
+			here[count].sect--;
 	}
 }
 
@@ -2275,23 +2272,23 @@ static void redo_format(void)
 }
 
 static struct cont_t format_cont = {
-	.interrupt = format_interrupt,
-	.redo = redo_format,
-	.error = bad_flp_intr,
-	.done = generic_done
+	.interrupt	= format_interrupt,
+	.redo		= redo_format,
+	.error		= bad_flp_intr,
+	.done		= generic_done
 };
 
 static int do_format(int drive, struct format_descr *tmp_format_req)
 {
 	int ret;
 
-	LOCK_FDC(drive,1);
+	LOCK_FDC(drive, 1);
 	set_floppy(drive);
 	if (!_floppy ||
 	    _floppy->track > DP->tracks ||
 	    tmp_format_req->track >= _floppy->track ||
 	    tmp_format_req->head >= _floppy->head ||
-	    (_floppy->sect << 2) % (1 <<  FD_SIZECODE(_floppy)) ||
+	    (_floppy->sect << 2) % (1 << FD_SIZECODE(_floppy)) ||
 	    !_floppy->fmt_gap) {
 		process_fd_request();
 		return -EINVAL;
@@ -2328,7 +2325,6 @@ static void floppy_end_request(struct re
 	current_req = NULL;
 }
 
-
 /* new request_done. Can handle physical sectors which are smaller than a
  * logical buffer */
 static void request_done(int uptodate)
@@ -2346,7 +2342,7 @@ static void request_done(int uptodate)
 		return;
 	}
 
-	if (uptodate){
+	if (uptodate) {
 		/* maintain values for invalidation on geometry
 		 * change */
 		block = current_count_sectors + req->sector;
@@ -2381,11 +2377,11 @@ static void rw_interrupt(void)
 	int nr_sectors, ssize, eoc, heads;
 
 	if (R_HEAD >= 2) {
-	    /* some Toshiba floppy controllers occasionnally seem to
-	     * return bogus interrupts after read/write operations, which
-	     * can be recognized by a bad head number (>= 2) */
-	     return;
-	}  
+		/* some Toshiba floppy controllers occasionnally seem to
+		 * return bogus interrupts after read/write operations, which
+		 * can be recognized by a bad head number (>= 2) */
+		return;
+	}
 
 	if (!DRS->first_read_date)
 		DRS->first_read_date = jiffies;
@@ -2403,15 +2399,15 @@ static void rw_interrupt(void)
 	else
 		heads = 1;
 
-	nr_sectors = (((R_TRACK-TRACK) * heads +
-				   R_HEAD-HEAD) * SECT_PER_TRACK +
-				   R_SECTOR-SECTOR + eoc) << SIZECODE >> 2;
+	nr_sectors = (((R_TRACK - TRACK) * heads +
+		       R_HEAD - HEAD) * SECT_PER_TRACK +
+		      R_SECTOR - SECTOR + eoc) << SIZECODE >> 2;
 
 #ifdef FLOPPY_SANITY_CHECK
-	if (nr_sectors / ssize > 
-		(in_sector_offset + current_count_sectors + ssize - 1) / ssize) {
+	if (nr_sectors / ssize >
+	    (in_sector_offset + current_count_sectors + ssize - 1) / ssize) {
 		DPRINT("long rw: %x instead of %lx\n",
-			nr_sectors, current_count_sectors);
+		       nr_sectors, current_count_sectors);
 		printk("rs=%d s=%d\n", R_SECTOR, SECTOR);
 		printk("rh=%d h=%d\n", R_HEAD, HEAD);
 		printk("rt=%d t=%d\n", R_TRACK, TRACK);
@@ -2423,44 +2419,44 @@ static void rw_interrupt(void)
 #endif
 
 	nr_sectors -= in_sector_offset;
-	INFBOUND(nr_sectors,0);
+	INFBOUND(nr_sectors, 0);
 	SUPBOUND(current_count_sectors, nr_sectors);
 
-	switch (interpret_errors()){
-		case 2:
+	switch (interpret_errors()) {
+	case 2:
+		cont->redo();
+		return;
+	case 1:
+		if (!current_count_sectors) {
+			cont->error();
 			cont->redo();
 			return;
-		case 1:
-			if (!current_count_sectors){
-				cont->error();
-				cont->redo();
-				return;
-			}
-			break;
-		case 0:
-			if (!current_count_sectors){
-				cont->redo();
-				return;
-			}
-			current_type[current_drive] = _floppy;
-			floppy_sizes[TOMINOR(current_drive) ]= _floppy->size;
-			break;
+		}
+		break;
+	case 0:
+		if (!current_count_sectors) {
+			cont->redo();
+			return;
+		}
+		current_type[current_drive] = _floppy;
+		floppy_sizes[TOMINOR(current_drive)] = _floppy->size;
+		break;
 	}
 
 	if (probing) {
 		if (DP->flags & FTD_MSG)
 			DPRINT("Auto-detected floppy type %s in fd%d\n",
-				_floppy->name,current_drive);
+			       _floppy->name, current_drive);
 		current_type[current_drive] = _floppy;
 		floppy_sizes[TOMINOR(current_drive)] = _floppy->size;
 		probing = 0;
 	}
 
-	if (CT(COMMAND) != FD_READ || 
-	     raw_cmd->kernel_data == current_req->buffer){
+	if (CT(COMMAND) != FD_READ ||
+	    raw_cmd->kernel_data == current_req->buffer) {
 		/* transfer directly from buffer */
 		cont->done(1);
-	} else if (CT(COMMAND) == FD_READ){
+	} else if (CT(COMMAND) == FD_READ) {
 		buffer_track = raw_cmd->track;
 		buffer_drive = current_drive;
 		INFBOUND(buffer_max, nr_sectors + fsector_t);
@@ -2481,7 +2477,8 @@ static int buffer_chain_size(void)
 
 	rq_for_each_bio(bio, current_req) {
 		bio_for_each_segment(bv, bio, i) {
-			if (page_address(bv->bv_page) + bv->bv_offset != base + size)
+			if (page_address(bv->bv_page) + bv->bv_offset !=
+			    base + size)
 				break;
 
 			size += bv->bv_len;
@@ -2500,7 +2497,7 @@ static int transfer_size(int ssize, int 
 	max_sector -= (max_sector % _floppy->sect) % ssize;
 
 	/* transfer size, beginning not aligned */
-	current_count_sectors = max_sector - fsector_t ;
+	current_count_sectors = max_sector - fsector_t;
 
 	return max_sector;
 }
@@ -2510,7 +2507,7 @@ static int transfer_size(int ssize, int 
  */
 static void copy_buffer(int ssize, int max_sector, int max_sector_2)
 {
-	int remaining; /* number of transferred 512-byte sectors */
+	int remaining;		/* number of transferred 512-byte sectors */
 	struct bio_vec *bv;
 	struct bio *bio;
 	char *buffer, *dma_buffer;
@@ -2523,16 +2520,17 @@ static void copy_buffer(int ssize, int m
 	if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE &&
 	    buffer_max > fsector_t + current_req->nr_sectors)
 		current_count_sectors = min_t(int, buffer_max - fsector_t,
-						current_req->nr_sectors);
+					      current_req->nr_sectors);
 
 	remaining = current_count_sectors << 9;
 #ifdef FLOPPY_SANITY_CHECK
-	if ((remaining >> 9) > current_req->nr_sectors  &&
-	    CT(COMMAND) == FD_WRITE){
+	if ((remaining >> 9) > current_req->nr_sectors &&
+	    CT(COMMAND) == FD_WRITE) {
 		DPRINT("in copy buffer\n");
 		printk("current_count_sectors=%ld\n", current_count_sectors);
 		printk("remaining=%d\n", remaining >> 9);
-		printk("current_req->nr_sectors=%ld\n",current_req->nr_sectors);
+		printk("current_req->nr_sectors=%ld\n",
+		       current_req->nr_sectors);
 		printk("current_req->current_nr_sectors=%u\n",
 		       current_req->current_nr_sectors);
 		printk("max_sector=%d\n", max_sector);
@@ -2556,23 +2554,24 @@ static void copy_buffer(int ssize, int m
 
 			buffer = page_address(bv->bv_page) + bv->bv_offset;
 #ifdef FLOPPY_SANITY_CHECK
-		if (dma_buffer + size >
-		    floppy_track_buffer + (max_buffer_sectors << 10) ||
-		    dma_buffer < floppy_track_buffer){
-			DPRINT("buffer overrun in copy buffer %d\n",
-				(int) ((floppy_track_buffer - dma_buffer) >>9));
-			printk("fsector_t=%d buffer_min=%d\n",
-			       fsector_t, buffer_min);
-			printk("current_count_sectors=%ld\n",
-			       current_count_sectors);
-			if (CT(COMMAND) == FD_READ)
-				printk("read\n");
-			if (CT(COMMAND) == FD_WRITE)
-				printk("write\n");
-			break;
-		}
-		if (((unsigned long)buffer) % 512)
-			DPRINT("%p buffer not aligned\n", buffer);
+			if (dma_buffer + size >
+			    floppy_track_buffer + (max_buffer_sectors << 10) ||
+			    dma_buffer < floppy_track_buffer) {
+				DPRINT("buffer overrun in copy buffer %d\n",
+				       (int)((floppy_track_buffer -
+					      dma_buffer) >> 9));
+				printk("fsector_t=%d buffer_min=%d\n",
+				       fsector_t, buffer_min);
+				printk("current_count_sectors=%ld\n",
+				       current_count_sectors);
+				if (CT(COMMAND) == FD_READ)
+					printk("read\n");
+				if (CT(COMMAND) == FD_WRITE)
+					printk("write\n");
+				break;
+			}
+			if (((unsigned long)buffer) % 512)
+				DPRINT("%p buffer not aligned\n", buffer);
 #endif
 			if (CT(COMMAND) == FD_READ)
 				memcpy(buffer, dma_buffer, size);
@@ -2584,21 +2583,21 @@ static void copy_buffer(int ssize, int m
 		}
 	}
 #ifdef FLOPPY_SANITY_CHECK
-	if (remaining){
+	if (remaining) {
 		if (remaining > 0)
 			max_sector -= remaining >> 9;
-		DPRINT("weirdness: remaining %d\n", remaining>>9);
+		DPRINT("weirdness: remaining %d\n", remaining >> 9);
 	}
 #endif
 }
 
 #if 0
-static inline int check_dma_crossing(char *start, 
+static inline int check_dma_crossing(char *start,
 				     unsigned long length, char *message)
 {
 	if (CROSS_64KB(start, length)) {
-		printk("DMA xfer crosses 64KB boundary in %s %p-%p\n", 
-		       message, start, start+length);
+		printk("DMA xfer crosses 64KB boundary in %s %p-%p\n",
+		       message, start, start + length);
 		return 1;
 	} else
 		return 0;
@@ -2616,20 +2615,20 @@ static void virtualdmabug_workaround(voi
 {
 	int hard_sectors, end_sector;
 
-	if(CT(COMMAND) == FD_WRITE) {
-		COMMAND &= ~0x80; /* switch off multiple track mode */
+	if (CT(COMMAND) == FD_WRITE) {
+		COMMAND &= ~0x80;	/* switch off multiple track mode */
 
 		hard_sectors = raw_cmd->length >> (7 + SIZECODE);
 		end_sector = SECTOR + hard_sectors - 1;
 #ifdef FLOPPY_SANITY_CHECK
-		if(end_sector > SECT_PER_TRACK) {
+		if (end_sector > SECT_PER_TRACK) {
 			printk("too many sectors %d > %d\n",
 			       end_sector, SECT_PER_TRACK);
 			return;
 		}
 #endif
-		SECT_PER_TRACK = end_sector; /* make sure SECT_PER_TRACK points
-					      * to end of transfer */
+		SECT_PER_TRACK = end_sector;	/* make sure SECT_PER_TRACK points
+						 * to end of transfer */
 	}
 }
 
@@ -2648,7 +2647,7 @@ static int make_raw_rw_request(void)
 	int aligned_sector_t;
 	int max_sector, max_size, tracksize, ssize;
 
-	if(max_buffer_sectors == 0) {
+	if (max_buffer_sectors == 0) {
 		printk("VFS: Block I/O scheduled on unopened device\n");
 		return 0;
 	}
@@ -2657,14 +2656,14 @@ static int make_raw_rw_request(void)
 
 	raw_cmd = &default_raw_cmd;
 	raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_DISK | FD_RAW_NEED_DISK |
-		FD_RAW_NEED_SEEK;
+	    FD_RAW_NEED_SEEK;
 	raw_cmd->cmd_count = NR_RW;
 	if (rq_data_dir(current_req) == READ) {
 		raw_cmd->flags |= FD_RAW_READ;
-		COMMAND = FM_MODE(_floppy,FD_READ);
-	} else if (rq_data_dir(current_req) == WRITE){
+		COMMAND = FM_MODE(_floppy, FD_READ);
+	} else if (rq_data_dir(current_req) == WRITE) {
 		raw_cmd->flags |= FD_RAW_WRITE;
-		COMMAND = FM_MODE(_floppy,FD_WRITE);
+		COMMAND = FM_MODE(_floppy, FD_WRITE);
 	} else {
 		DPRINT("make_raw_rw_request: unknown command\n");
 		return 0;
@@ -2684,25 +2683,23 @@ static int make_raw_rw_request(void)
 	HEAD = fsector_t / _floppy->sect;
 
 	if (((_floppy->stretch & (FD_SWAPSIDES | FD_ZEROBASED)) ||
-	     TESTF(FD_NEED_TWADDLE)) &&
-	    fsector_t < _floppy->sect)
+	     TESTF(FD_NEED_TWADDLE)) && fsector_t < _floppy->sect)
 		max_sector = _floppy->sect;
 
 	/* 2M disks have phantom sectors on the first track */
-	if ((_floppy->rate & FD_2M) && (!TRACK) && (!HEAD)){
+	if ((_floppy->rate & FD_2M) && (!TRACK) && (!HEAD)) {
 		max_sector = 2 * _floppy->sect / 3;
-		if (fsector_t >= max_sector){
-			current_count_sectors = min_t(int, _floppy->sect - fsector_t,
-							current_req->nr_sectors);
+		if (fsector_t >= max_sector) {
+			current_count_sectors =
+			    min_t(int, _floppy->sect - fsector_t,
+				  current_req->nr_sectors);
 			return 1;
 		}
 		SIZECODE = 2;
 	} else
 		SIZECODE = FD_SIZECODE(_floppy);
 	raw_cmd->rate = _floppy->rate & 0x43;
-	if ((_floppy->rate & FD_2M) &&
-	    (TRACK || HEAD) &&
-	    raw_cmd->rate == 2)
+	if ((_floppy->rate & FD_2M) && (TRACK || HEAD) && raw_cmd->rate == 2)
 		raw_cmd->rate = 1;
 
 	if (SIZECODE)
@@ -2710,7 +2707,7 @@ static int make_raw_rw_request(void)
 	else
 		SIZECODE2 = 0x80;
 	raw_cmd->track = TRACK << STRETCH(_floppy);
-	DR_SELECT = UNIT(current_drive) + PH_HEAD(_floppy,HEAD);
+	DR_SELECT = UNIT(current_drive) + PH_HEAD(_floppy, HEAD);
 	GAP = _floppy->gap;
 	CODE2SIZE;
 	SECT_PER_TRACK = _floppy->sect << 2 >> SIZECODE;
@@ -2721,18 +2718,19 @@ static int make_raw_rw_request(void)
 	 * of size ssize.
 	 */
 	tracksize = _floppy->sect - _floppy->sect % ssize;
-	if (tracksize < _floppy->sect){
-		SECT_PER_TRACK ++;
+	if (tracksize < _floppy->sect) {
+		SECT_PER_TRACK++;
 		if (tracksize <= fsector_t % _floppy->sect)
 			SECTOR--;
 
 		/* if we are beyond tracksize, fill up using smaller sectors */
-		while (tracksize <= fsector_t % _floppy->sect){
-			while(tracksize + ssize > _floppy->sect){
+		while (tracksize <= fsector_t % _floppy->sect) {
+			while (tracksize + ssize > _floppy->sect) {
 				SIZECODE--;
 				ssize >>= 1;
 			}
-			SECTOR++; SECT_PER_TRACK ++;
+			SECTOR++;
+			SECT_PER_TRACK++;
 			tracksize += ssize;
 		}
 		max_sector = HEAD * _floppy->sect + tracksize;
@@ -2746,7 +2744,7 @@ static int make_raw_rw_request(void)
 	in_sector_offset = (fsector_t % _floppy->sect) % ssize;
 	aligned_sector_t = fsector_t - in_sector_offset;
 	max_size = current_req->nr_sectors;
-	if ((raw_cmd->track == buffer_track) && 
+	if ((raw_cmd->track == buffer_track) &&
 	    (current_drive == buffer_drive) &&
 	    (fsector_t >= buffer_min) && (fsector_t < buffer_max)) {
 		/* data already in track buffer */
@@ -2754,8 +2752,8 @@ static int make_raw_rw_request(void)
 			copy_buffer(1, max_sector, buffer_max);
 			return 1;
 		}
-	} else if (in_sector_offset || current_req->nr_sectors < ssize){
-		if (CT(COMMAND) == FD_WRITE){
+	} else if (in_sector_offset || current_req->nr_sectors < ssize) {
+		if (CT(COMMAND) == FD_WRITE) {
 			if (fsector_t + current_req->nr_sectors > ssize &&
 			    fsector_t + current_req->nr_sectors < ssize + ssize)
 				max_size = ssize + ssize;
@@ -2764,28 +2762,32 @@ static int make_raw_rw_request(void)
 		}
 		raw_cmd->flags &= ~FD_RAW_WRITE;
 		raw_cmd->flags |= FD_RAW_READ;
-		COMMAND = FM_MODE(_floppy,FD_READ);
+		COMMAND = FM_MODE(_floppy, FD_READ);
 	} else if ((unsigned long)current_req->buffer < MAX_DMA_ADDRESS) {
 		unsigned long dma_limit;
 		int direct, indirect;
 
-		indirect= transfer_size(ssize,max_sector,max_buffer_sectors*2) -
-			fsector_t;
+		indirect =
+		    transfer_size(ssize, max_sector,
+				  max_buffer_sectors * 2) - fsector_t;
 
 		/*
 		 * Do NOT use minimum() here---MAX_DMA_ADDRESS is 64 bits wide
 		 * on a 64 bit machine!
 		 */
 		max_size = buffer_chain_size();
-		dma_limit = (MAX_DMA_ADDRESS - ((unsigned long) current_req->buffer)) >> 9;
-		if ((unsigned long) max_size > dma_limit) {
+		dma_limit =
+		    (MAX_DMA_ADDRESS -
+		     ((unsigned long)current_req->buffer)) >> 9;
+		if ((unsigned long)max_size > dma_limit) {
 			max_size = dma_limit;
 		}
 		/* 64 kb boundaries */
 		if (CROSS_64KB(current_req->buffer, max_size << 9))
-			max_size = (K_64 - 
-				    ((unsigned long)current_req->buffer) % K_64)>>9;
-		direct = transfer_size(ssize,max_sector,max_size) - fsector_t;
+			max_size = (K_64 -
+				    ((unsigned long)current_req->buffer) %
+				    K_64) >> 9;
+		direct = transfer_size(ssize, max_sector, max_size) - fsector_t;
 		/*
 		 * We try to read tracks, but if we get too many errors, we
 		 * go back to reading just one sector at a time.
@@ -2796,16 +2798,18 @@ static int make_raw_rw_request(void)
 		if (!direct ||
 		    (indirect * 2 > direct * 3 &&
 		     *errors < DP->max_errors.read_track &&
-		     /*!TESTF(FD_NEED_TWADDLE) &&*/
-		     ((!probing || (DP->read_track&(1<<DRS->probed_format)))))){
+		     /*!TESTF(FD_NEED_TWADDLE) && */
+		     ((!probing
+		       || (DP->read_track & (1 << DRS->probed_format)))))) {
 			max_size = current_req->nr_sectors;
 		} else {
 			raw_cmd->kernel_data = current_req->buffer;
 			raw_cmd->length = current_count_sectors << 9;
-			if (raw_cmd->length == 0){
-				DPRINT("zero dma transfer attempted from make_raw_request\n");
+			if (raw_cmd->length == 0) {
+				DPRINT
+				    ("zero dma transfer attempted from make_raw_request\n");
 				DPRINT("indirect=%d direct=%d fsector_t=%d",
-					indirect, direct, fsector_t);
+				       indirect, direct, fsector_t);
 				return 0;
 			}
 /*			check_dma_crossing(raw_cmd->kernel_data, 
@@ -2818,26 +2822,27 @@ static int make_raw_rw_request(void)
 	}
 
 	if (CT(COMMAND) == FD_READ)
-		max_size = max_sector; /* unbounded */
+		max_size = max_sector;	/* unbounded */
 
 	/* claim buffer track if needed */
-	if (buffer_track != raw_cmd->track ||  /* bad track */
-	    buffer_drive !=current_drive || /* bad drive */
+	if (buffer_track != raw_cmd->track ||	/* bad track */
+	    buffer_drive != current_drive ||	/* bad drive */
 	    fsector_t > buffer_max ||
 	    fsector_t < buffer_min ||
 	    ((CT(COMMAND) == FD_READ ||
-	      (!in_sector_offset && current_req->nr_sectors >= ssize))&&
+	      (!in_sector_offset && current_req->nr_sectors >= ssize)) &&
 	     max_sector > 2 * max_buffer_sectors + buffer_min &&
 	     max_size + fsector_t > 2 * max_buffer_sectors + buffer_min)
-	    /* not enough space */){
+	    /* not enough space */
+	    ) {
 		buffer_track = -1;
 		buffer_drive = current_drive;
 		buffer_max = buffer_min = aligned_sector_t;
 	}
-	raw_cmd->kernel_data = floppy_track_buffer + 
-		((aligned_sector_t-buffer_min)<<9);
+	raw_cmd->kernel_data = floppy_track_buffer +
+	    ((aligned_sector_t - buffer_min) << 9);
 
-	if (CT(COMMAND) == FD_WRITE){
+	if (CT(COMMAND) == FD_WRITE) {
 		/* copy write buffer to track buffer.
 		 * if we get here, we know that the write
 		 * is either aligned or the data already in the buffer
@@ -2848,31 +2853,33 @@ static int make_raw_rw_request(void)
 #endif
 		buffer_track = raw_cmd->track;
 		buffer_drive = current_drive;
-		copy_buffer(ssize, max_sector, 2*max_buffer_sectors+buffer_min);
+		copy_buffer(ssize, max_sector,
+			    2 * max_buffer_sectors + buffer_min);
 	} else
 		transfer_size(ssize, max_sector,
-			      2*max_buffer_sectors+buffer_min-aligned_sector_t);
+			      2 * max_buffer_sectors + buffer_min -
+			      aligned_sector_t);
 
 	/* round up current_count_sectors to get dma xfer size */
-	raw_cmd->length = in_sector_offset+current_count_sectors;
-	raw_cmd->length = ((raw_cmd->length -1)|(ssize-1))+1;
+	raw_cmd->length = in_sector_offset + current_count_sectors;
+	raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1;
 	raw_cmd->length <<= 9;
 #ifdef FLOPPY_SANITY_CHECK
 	/*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length, 
-	  "end of make_raw_request");*/
+	   "end of make_raw_request"); */
 	if ((raw_cmd->length < current_count_sectors << 9) ||
 	    (raw_cmd->kernel_data != current_req->buffer &&
 	     CT(COMMAND) == FD_WRITE &&
 	     (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max ||
 	      aligned_sector_t < buffer_min)) ||
 	    raw_cmd->length % (128 << SIZECODE) ||
-	    raw_cmd->length <= 0 || current_count_sectors <= 0){
+	    raw_cmd->length <= 0 || current_count_sectors <= 0) {
 		DPRINT("fractionary current count b=%lx s=%lx\n",
-			raw_cmd->length, current_count_sectors);
+		       raw_cmd->length, current_count_sectors);
 		if (raw_cmd->kernel_data != current_req->buffer)
 			printk("addr=%d, length=%ld\n",
-			       (int) ((raw_cmd->kernel_data - 
-				       floppy_track_buffer) >> 9),
+			       (int)((raw_cmd->kernel_data -
+				      floppy_track_buffer) >> 9),
 			       current_count_sectors);
 		printk("st=%d ast=%d mse=%d msi=%d\n",
 		       fsector_t, aligned_sector_t, max_sector, max_size);
@@ -2886,16 +2893,15 @@ static int make_raw_rw_request(void)
 		return 0;
 	}
 
-	if (raw_cmd->kernel_data != current_req->buffer){
+	if (raw_cmd->kernel_data != current_req->buffer) {
 		if (raw_cmd->kernel_data < floppy_track_buffer ||
 		    current_count_sectors < 0 ||
 		    raw_cmd->length < 0 ||
 		    raw_cmd->kernel_data + raw_cmd->length >
-		    floppy_track_buffer + (max_buffer_sectors  << 10)){
+		    floppy_track_buffer + (max_buffer_sectors << 10)) {
 			DPRINT("buffer overrun in schedule dma\n");
 			printk("fsector_t=%d buffer_min=%d current_count=%ld\n",
-			       fsector_t, buffer_min,
-			       raw_cmd->length >> 9);
+			       fsector_t, buffer_min, raw_cmd->length >> 9);
 			printk("current_count_sectors=%ld\n",
 			       current_count_sectors);
 			if (CT(COMMAND) == FD_READ)
@@ -2905,15 +2911,15 @@ static int make_raw_rw_request(void)
 			return 0;
 		}
 	} else if (raw_cmd->length > current_req->nr_sectors << 9 ||
-		   current_count_sectors > current_req->nr_sectors){
+		   current_count_sectors > current_req->nr_sectors) {
 		DPRINT("buffer overrun in direct transfer\n");
 		return 0;
-	} else if (raw_cmd->length < current_count_sectors << 9){
+	} else if (raw_cmd->length < current_count_sectors << 9) {
 		DPRINT("more sectors than bytes\n");
 		printk("bytes=%ld\n", raw_cmd->length >> 9);
 		printk("sectors=%ld\n", current_count_sectors);
 	}
-	if (raw_cmd->length == 0){
+	if (raw_cmd->length == 0) {
 		DPRINT("zero dma transfer attempted from make_raw_request\n");
 		return 0;
 	}
@@ -2952,31 +2958,33 @@ static void redo_fd_request(void)
 		reschedule_timeout(current_reqD, "redo fd request", 0);
 
 		set_floppy(drive);
-		raw_cmd = & default_raw_cmd;
+		raw_cmd = &default_raw_cmd;
 		raw_cmd->flags = 0;
-		if (start_motor(redo_fd_request)) return;
+		if (start_motor(redo_fd_request))
+			return;
 		disk_change(current_drive);
 		if (test_bit(current_drive, &fake_change) ||
-		   TESTF(FD_DISK_CHANGED)){
+		    TESTF(FD_DISK_CHANGED)) {
 			DPRINT("disk absent or changed during operation\n");
 			REPEAT;
 		}
-		if (!_floppy) { /* Autodetection */
-			if (!probing){
+		if (!_floppy) {	/* Autodetection */
+			if (!probing) {
 				DRS->probed_format = 0;
-				if (next_valid_format()){
+				if (next_valid_format()) {
 					DPRINT("no autodetectable formats\n");
 					_floppy = NULL;
 					REPEAT;
 				}
 			}
 			probing = 1;
-			_floppy = floppy_type+DP->autodetect[DRS->probed_format];
+			_floppy =
+			    floppy_type + DP->autodetect[DRS->probed_format];
 		} else
 			probing = 0;
-		errors = & (current_req->errors);
+		errors = &(current_req->errors);
 		tmp = make_raw_rw_request();
-		if (tmp < 2){
+		if (tmp < 2) {
 			request_done(tmp);
 			continue;
 		}
@@ -2993,10 +3001,10 @@ static void redo_fd_request(void)
 }
 
 static struct cont_t rw_cont = {
-	.interrupt = rw_interrupt,
-	.redo = redo_fd_request,
-	.error = bad_flp_intr,
-	.done = request_done
+	.interrupt	= rw_interrupt,
+	.redo		= redo_fd_request,
+	.error		= bad_flp_intr,
+	.done		= request_done
 };
 
 static void process_fd_request(void)
@@ -3007,14 +3015,16 @@ static void process_fd_request(void)
 
 static void do_fd_request(request_queue_t * q)
 {
-	if(max_buffer_sectors == 0) {
+	if (max_buffer_sectors == 0) {
 		printk("VFS: do_fd_request called on non-open device\n");
 		return;
 	}
 
 	if (usage_count == 0) {
-		printk("warning: usage count=0, current_req=%p exiting\n", current_req);
-		printk("sect=%ld flags=%lx\n", (long)current_req->sector, current_req->flags);
+		printk("warning: usage count=0, current_req=%p exiting\n",
+		       current_req);
+		printk("sect=%ld flags=%lx\n", (long)current_req->sector,
+		       current_req->flags);
 		return;
 	}
 	if (test_bit(0, &fdc_busy)) {
@@ -3023,16 +3033,16 @@ static void do_fd_request(request_queue_
 		is_alive("do fd request, old request running");
 		return;
 	}
-	lock_fdc(MAXTIMEOUT,0);
+	lock_fdc(MAXTIMEOUT, 0);
 	process_fd_request();
 	is_alive("do fd request");
 }
 
 static struct cont_t poll_cont = {
-	.interrupt = success_and_wakeup,
-	.redo = floppy_ready,
-	.error = generic_failure,
-	.done = generic_done
+	.interrupt	= success_and_wakeup,
+	.redo		= floppy_ready,
+	.error		= generic_failure,
+	.done		= generic_done
 };
 
 static int poll_drive(int interruptible, int flag)
@@ -3040,12 +3050,12 @@ static int poll_drive(int interruptible,
 	int ret;
 	/* no auto-sense, just clear dcl */
 	raw_cmd = &default_raw_cmd;
-	raw_cmd->flags= flag;
-	raw_cmd->track=0;
-	raw_cmd->cmd_count=0;
+	raw_cmd->flags = flag;
+	raw_cmd->track = 0;
+	raw_cmd->cmd_count = 0;
 	cont = &poll_cont;
 #ifdef DCL_DEBUG
-	if (DP->flags & FD_DEBUG){
+	if (DP->flags & FD_DEBUG) {
 		DPRINT("setting NEWCHANGE in poll_drive\n");
 	}
 #endif
@@ -3065,21 +3075,21 @@ static void reset_intr(void)
 }
 
 static struct cont_t reset_cont = {
-	.interrupt = reset_intr,
-	.redo = success_and_wakeup,
-	.error = generic_failure,
-	.done = generic_done
+	.interrupt	= reset_intr,
+	.redo		= success_and_wakeup,
+	.error		= generic_failure,
+	.done		= generic_done
 };
 
 static int user_reset_fdc(int drive, int arg, int interruptible)
 {
 	int ret;
 
-	ret=0;
-	LOCK_FDC(drive,interruptible);
+	ret = 0;
+	LOCK_FDC(drive, interruptible);
 	if (arg == FD_RESET_ALWAYS)
-		FDCS->reset=1;
-	if (FDCS->reset){
+		FDCS->reset = 1;
+	if (FDCS->reset) {
 		cont = &reset_cont;
 		WAIT(reset_fdc);
 	}
@@ -3091,9 +3101,10 @@ static int user_reset_fdc(int drive, int
  * Misc Ioctl's and support
  * ========================
  */
-static inline int fd_copyout(void *param, const void *address, unsigned long size)
+static inline int fd_copyout(void *param, const void *address,
+			     unsigned long size)
 {
-	return copy_to_user(param,address, size) ? -EFAULT : 0;
+	return copy_to_user(param, address, size) ? -EFAULT : 0;
 }
 
 static inline int fd_copyin(void *param, void *address, unsigned long size)
@@ -3125,7 +3136,6 @@ static inline const char *drive_name(int
 		return "(null)";
 }
 
-
 /* raw commands */
 static void raw_cmd_done(int flag)
 {
@@ -3137,18 +3147,17 @@ static void raw_cmd_done(int flag)
 	} else {
 		raw_cmd->reply_count = inr;
 		if (raw_cmd->reply_count > MAX_REPLIES)
-			raw_cmd->reply_count=0;
-		for (i=0; i< raw_cmd->reply_count; i++)
+			raw_cmd->reply_count = 0;
+		for (i = 0; i < raw_cmd->reply_count; i++)
 			raw_cmd->reply[i] = reply_buffer[i];
 
-		if (raw_cmd->flags & (FD_RAW_READ | FD_RAW_WRITE))
-		{
+		if (raw_cmd->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
 			unsigned long flags;
-			flags=claim_dma_lock();
+			flags = claim_dma_lock();
 			raw_cmd->length = fd_get_dma_residue();
 			release_dma_lock(flags);
 		}
-		
+
 		if ((raw_cmd->flags & FD_RAW_SOFTFAILURE) &&
 		    (!raw_cmd->reply_count || (raw_cmd->reply[0] & 0xc0)))
 			raw_cmd->flags |= FD_RAW_FAILURE;
@@ -3161,10 +3170,10 @@ static void raw_cmd_done(int flag)
 			motor_off_callback(current_drive);
 
 		if (raw_cmd->next &&
-		   (!(raw_cmd->flags & FD_RAW_FAILURE) ||
-		    !(raw_cmd->flags & FD_RAW_STOP_IF_FAILURE)) &&
-		   ((raw_cmd->flags & FD_RAW_FAILURE) ||
-		    !(raw_cmd->flags &FD_RAW_STOP_IF_SUCCESS))) {
+		    (!(raw_cmd->flags & FD_RAW_FAILURE) ||
+		     !(raw_cmd->flags & FD_RAW_STOP_IF_FAILURE)) &&
+		    ((raw_cmd->flags & FD_RAW_FAILURE) ||
+		     !(raw_cmd->flags & FD_RAW_STOP_IF_SUCCESS))) {
 			raw_cmd = raw_cmd->next;
 			return;
 		}
@@ -3172,12 +3181,11 @@ static void raw_cmd_done(int flag)
 	generic_done(flag);
 }
 
-
 static struct cont_t raw_cmd_cont = {
-	.interrupt = success_and_wakeup,
-	.redo = floppy_start,
-	.error = generic_failure,
-	.done = raw_cmd_done
+	.interrupt	= success_and_wakeup,
+	.redo		= floppy_start,
+	.error		= generic_failure,
+	.done		= raw_cmd_done
 };
 
 static inline int raw_cmd_copyout(int cmd, char *param,
@@ -3185,29 +3193,28 @@ static inline int raw_cmd_copyout(int cm
 {
 	int ret;
 
-	while(ptr) {
+	while (ptr) {
 		COPYOUT(*ptr);
 		param += sizeof(struct floppy_raw_cmd);
-		if ((ptr->flags & FD_RAW_READ) && ptr->buffer_length){
-			if (ptr->length>=0 && ptr->length<=ptr->buffer_length)
-				ECALL(fd_copyout(ptr->data, 
-						 ptr->kernel_data, 
-						 ptr->buffer_length - 
-						 ptr->length));
+		if ((ptr->flags & FD_RAW_READ) && ptr->buffer_length) {
+			if (ptr->length >= 0
+			    && ptr->length <= ptr->buffer_length)
+				ECALL(fd_copyout
+				      (ptr->data, ptr->kernel_data,
+				       ptr->buffer_length - ptr->length));
 		}
 		ptr = ptr->next;
 	}
 	return 0;
 }
 
-
 static void raw_cmd_free(struct floppy_raw_cmd **ptr)
 {
-	struct floppy_raw_cmd *next,*this;
+	struct floppy_raw_cmd *next, *this;
 
 	this = *ptr;
 	*ptr = 0;
-	while(this) {
+	while (this) {
 		if (this->buffer_length) {
 			fd_dma_mem_free((unsigned long)this->kernel_data,
 					this->buffer_length);
@@ -3219,18 +3226,17 @@ static void raw_cmd_free(struct floppy_r
 	}
 }
 
-
 static inline int raw_cmd_copyin(int cmd, char *param,
 				 struct floppy_raw_cmd **rcmd)
 {
 	struct floppy_raw_cmd *ptr;
 	int ret;
 	int i;
-	
+
 	*rcmd = 0;
-	while(1) {
-		ptr = (struct floppy_raw_cmd *) 
-			kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER);
+	while (1) {
+		ptr = (struct floppy_raw_cmd *)
+		    kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER);
 		if (!ptr)
 			return -ENOMEM;
 		*rcmd = ptr;
@@ -3249,7 +3255,7 @@ static inline int raw_cmd_copyin(int cmd
 			 */
 			return -EINVAL;
 
-		for (i=0; i< 16; i++)
+		for (i = 0; i < 16; i++)
 			ptr->reply[i] = 0;
 		ptr->resultcode = 0;
 		ptr->kernel_data = 0;
@@ -3257,24 +3263,23 @@ static inline int raw_cmd_copyin(int cmd
 		if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
 			if (ptr->length <= 0)
 				return -EINVAL;
-			ptr->kernel_data =(char*)fd_dma_mem_alloc(ptr->length);
-			fallback_on_nodma_alloc(&ptr->kernel_data,
-						ptr->length);
+			ptr->kernel_data =
+			    (char *)fd_dma_mem_alloc(ptr->length);
+			fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length);
 			if (!ptr->kernel_data)
 				return -ENOMEM;
 			ptr->buffer_length = ptr->length;
 		}
 		if (ptr->flags & FD_RAW_WRITE)
-			ECALL(fd_copyin(ptr->data, ptr->kernel_data, 
+			ECALL(fd_copyin(ptr->data, ptr->kernel_data,
 					ptr->length));
-		rcmd = & (ptr->next);
+		rcmd = &(ptr->next);
 		if (!(ptr->flags & FD_RAW_MORE))
 			return 0;
 		ptr->rate &= 0x43;
 	}
 }
 
-
 static int raw_cmd_ioctl(int cmd, void *param)
 {
 	int drive, ret, ret2;
@@ -3282,15 +3287,15 @@ static int raw_cmd_ioctl(int cmd, void *
 
 	if (FDCS->rawcmd <= 1)
 		FDCS->rawcmd = 1;
-	for (drive= 0; drive < N_DRIVE; drive++){
+	for (drive = 0; drive < N_DRIVE; drive++) {
 		if (FDC(drive) != fdc)
 			continue;
-		if (drive == current_drive){
-			if (UDRS->fd_ref > 1){
+		if (drive == current_drive) {
+			if (UDRS->fd_ref > 1) {
 				FDCS->rawcmd = 2;
 				break;
 			}
-		} else if (UDRS->fd_ref){
+		} else if (UDRS->fd_ref) {
 			FDCS->rawcmd = 2;
 			break;
 		}
@@ -3307,9 +3312,9 @@ static int raw_cmd_ioctl(int cmd, void *
 
 	raw_cmd = my_raw_cmd;
 	cont = &raw_cmd_cont;
-	ret=wait_til_done(floppy_start,1);
+	ret = wait_til_done(floppy_start, 1);
 #ifdef DCL_DEBUG
-	if (DP->flags & FD_DEBUG){
+	if (DP->flags & FD_DEBUG) {
 		DPRINT("calling disk change from raw_cmd ioctl\n");
 	}
 #endif
@@ -3335,7 +3340,6 @@ static int invalidate_drive(struct block
 	return 0;
 }
 
-
 static inline void clear_write_error(int drive)
 {
 	CLEARSTRUCT(UDRWE);
@@ -3346,24 +3350,23 @@ static inline int set_geometry(unsigned 
 {
 	int cnt;
 
-	/* sanity checking for parameters.*/
+	/* sanity checking for parameters. */
 	if (g->sect <= 0 ||
 	    g->head <= 0 ||
-	    g->track <= 0 ||
-	    g->track > UDP->tracks>>STRETCH(g) ||
+	    g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||
 	    /* check if reserved bits are set */
-	    (g->stretch&~(FD_STRETCH|FD_SWAPSIDES|FD_ZEROBASED)) != 0)
+	    (g->stretch & ~(FD_STRETCH | FD_SWAPSIDES | FD_ZEROBASED)) != 0)
 		return -EINVAL;
-	if (type){
+	if (type) {
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
 		down(&open_lock);
-		LOCK_FDC(drive,1);
+		LOCK_FDC(drive, 1);
 		floppy_type[type] = *g;
-		floppy_type[type].name="user format";
+		floppy_type[type].name = "user format";
 		for (cnt = type << 2; cnt < (type << 2) + 4; cnt++)
-			floppy_sizes[cnt]= floppy_sizes[cnt+0x80]=
-				floppy_type[type].size+1;
+			floppy_sizes[cnt] = floppy_sizes[cnt + 0x80] =
+			    floppy_type[type].size + 1;
 		process_fd_request();
 		for (cnt = 0; cnt < N_DRIVE; cnt++) {
 			struct block_device *bdev = opened_bdev[cnt];
@@ -3374,7 +3377,7 @@ static inline int set_geometry(unsigned 
 		up(&open_lock);
 	} else {
 		int oldStretch;
-		LOCK_FDC(drive,1);
+		LOCK_FDC(drive, 1);
 		if (cmd != FDDEFPRM)
 			/* notice a disk change immediately, else
 			 * we lose our settings immediately*/
@@ -3406,7 +3409,7 @@ static inline int set_geometry(unsigned 
 }
 
 /* handle obsolete ioctl's */
-static int ioctl_table[]= {
+static int ioctl_table[] = {
 	FDCLRPRM,
 	FDSETPRM,
 	FDDEFPRM,
@@ -3438,8 +3441,8 @@ static inline int normalize_ioctl(int *c
 {
 	int i;
 
-	for (i=0; i < ARRAY_SIZE(ioctl_table); i++) {
-		if ((*cmd & 0xffff) == (ioctl_table[i] & 0xffff)){
+	for (i = 0; i < ARRAY_SIZE(ioctl_table); i++) {
+		if ((*cmd & 0xffff) == (ioctl_table[i] & 0xffff)) {
 			*size = _IOC_SIZE(*cmd);
 			*cmd = ioctl_table[i];
 			if (*size > _IOC_SIZE(*cmd)) {
@@ -3457,9 +3460,9 @@ static int get_floppy_geometry(int drive
 	if (type)
 		*g = &floppy_type[type];
 	else {
-		LOCK_FDC(drive,0);
-		CALL(poll_drive(0,0));
-		process_fd_request();		
+		LOCK_FDC(drive, 0);
+		CALL(poll_drive(0, 0));
+		process_fd_request();
 		*g = current_type[drive];
 	}
 	if (!*g)
@@ -3479,30 +3482,29 @@ static int fd_ioctl(struct inode *inode,
 	int ret;
 	int size;
 	union inparam {
-		struct floppy_struct g; /* geometry */
+		struct floppy_struct g;	/* geometry */
 		struct format_descr f;
 		struct floppy_max_errors max_errors;
 		struct floppy_drive_params dp;
-	} inparam; /* parameters coming from user space */
-	const char *outparam; /* parameters passed back to user space */
-
+	} inparam;		/* parameters coming from user space */
+	const char *outparam;	/* parameters passed back to user space */
 
 	/* convert compatibility eject ioctls into floppy eject ioctl.
 	 * We do this in order to provide a means to eject floppy disks before
 	 * installing the new fdutils package */
-	if (cmd == CDROMEJECT || /* CD-ROM eject */
-	    cmd == 0x6470 /* SunOS floppy eject */) {
+	if (cmd == CDROMEJECT ||	/* CD-ROM eject */
+	    cmd == 0x6470 /* SunOS floppy eject */ ) {
 		DPRINT("obsolete eject ioctl\n");
 		DPRINT("please use floppycontrol --eject\n");
 		cmd = FDEJECT;
 	}
 
 	/* generic block device ioctls */
-	switch(cmd) {
+	switch (cmd) {
 		/* the following have been inspired by the corresponding
 		 * code for other block devices. */
 		struct floppy_struct *g;
-		case HDIO_GETGEO:
+	case HDIO_GETGEO:
 		{
 			struct hd_geometry loc;
 			ECALL(get_floppy_geometry(drive, type, &g));
@@ -3528,36 +3530,36 @@ static int fd_ioctl(struct inode *inode,
 	/* copyin */
 	CLEARSTRUCT(&inparam);
 	if (_IOC_DIR(cmd) & _IOC_WRITE)
-		ECALL(fd_copyin((void *)param, &inparam, size))
+	    ECALL(fd_copyin((void *)param, &inparam, size))
 
-	switch (cmd) {
+		switch (cmd) {
 		case FDEJECT:
 			if (UDRS->fd_ref != 1)
 				/* somebody else has this drive open */
 				return -EBUSY;
-			LOCK_FDC(drive,1);
+			LOCK_FDC(drive, 1);
 
 			/* do the actual eject. Fails on
 			 * non-Sparc architectures */
-			ret=fd_eject(UNIT(drive));
+			ret = fd_eject(UNIT(drive));
 
 			USETF(FD_DISK_CHANGED);
 			USETF(FD_VERIFY);
 			process_fd_request();
-			return ret;			
+			return ret;
 		case FDCLRPRM:
-			LOCK_FDC(drive,1);
+			LOCK_FDC(drive, 1);
 			current_type[drive] = NULL;
 			floppy_sizes[drive] = MAX_DISK_SIZE << 1;
 			UDRS->keep_data = 0;
 			return invalidate_drive(inode->i_bdev);
 		case FDSETPRM:
 		case FDDEFPRM:
-			return set_geometry(cmd, & inparam.g,
+			return set_geometry(cmd, &inparam.g,
 					    drive, type, inode->i_bdev);
 		case FDGETPRM:
-			ECALL(get_floppy_geometry(drive, type, 
-						  (struct floppy_struct**)
+			ECALL(get_floppy_geometry(drive, type,
+						  (struct floppy_struct **)
 						  &outparam));
 			break;
 
@@ -3569,7 +3571,7 @@ static int fd_ioctl(struct inode *inode,
 			return 0;
 
 		case FDFMTBEG:
-			LOCK_FDC(drive,1);
+			LOCK_FDC(drive, 1);
 			CALL(poll_drive(1, FD_RAW_NEED_DISK));
 			ret = UDRS->flags;
 			process_fd_request();
@@ -3584,59 +3586,59 @@ static int fd_ioctl(struct inode *inode,
 			return do_format(drive, &inparam.f);
 		case FDFMTEND:
 		case FDFLUSH:
-			LOCK_FDC(drive,1);
+			LOCK_FDC(drive, 1);
 			return invalidate_drive(inode->i_bdev);
 
 		case FDSETEMSGTRESH:
 			UDP->max_errors.reporting =
-				(unsigned short) (param & 0x0f);
+			    (unsigned short)(param & 0x0f);
 			return 0;
-		OUT(FDGETMAXERRS, &UDP->max_errors);
-		IN(FDSETMAXERRS, &UDP->max_errors, max_errors);
+			OUT(FDGETMAXERRS, &UDP->max_errors);
+			IN(FDSETMAXERRS, &UDP->max_errors, max_errors);
 
 		case FDGETDRVTYP:
-			outparam = drive_name(type,drive);
-			SUPBOUND(size,strlen(outparam)+1);
+			outparam = drive_name(type, drive);
+			SUPBOUND(size, strlen(outparam) + 1);
 			break;
 
-		IN(FDSETDRVPRM, UDP, dp);
-		OUT(FDGETDRVPRM, UDP);
+			IN(FDSETDRVPRM, UDP, dp);
+			OUT(FDGETDRVPRM, UDP);
 
 		case FDPOLLDRVSTAT:
-			LOCK_FDC(drive,1);
+			LOCK_FDC(drive, 1);
 			CALL(poll_drive(1, FD_RAW_NEED_DISK));
 			process_fd_request();
 			/* fall through */
-	       	OUT(FDGETDRVSTAT, UDRS);
+			OUT(FDGETDRVSTAT, UDRS);
 
 		case FDRESET:
 			return user_reset_fdc(drive, (int)param, 1);
 
-		OUT(FDGETFDCSTAT,UFDCS);
+			OUT(FDGETFDCSTAT, UFDCS);
 
 		case FDWERRORCLR:
 			CLEARSTRUCT(UDRWE);
 			return 0;
-		OUT(FDWERRORGET,UDRWE);
+			OUT(FDWERRORGET, UDRWE);
 
 		case FDRAWCMD:
 			if (type)
 				return -EINVAL;
-			LOCK_FDC(drive,1);
+			LOCK_FDC(drive, 1);
 			set_floppy(drive);
-			CALL(i = raw_cmd_ioctl(cmd,(void *) param));
+			CALL(i = raw_cmd_ioctl(cmd, (void *)param));
 			process_fd_request();
 			return i;
 
 		case FDTWADDLE:
-			LOCK_FDC(drive,1);
+			LOCK_FDC(drive, 1);
 			twaddle();
 			process_fd_request();
 			return 0;
 
 		default:
 			return -EINVAL;
-	}
+		}
 
 	if (_IOC_DIR(cmd) & _IOC_READ)
 		return fd_copyout((void *)param, outparam, size);
@@ -3648,21 +3650,21 @@ static int fd_ioctl(struct inode *inode,
 
 static void __init config_types(void)
 {
-	int first=1;
+	int first = 1;
 	int drive;
 
 	/* read drive info out of physical CMOS */
-	drive=0;
+	drive = 0;
 	if (!UDP->cmos)
 		UDP->cmos = FLOPPY0_TYPE;
-	drive=1;
+	drive = 1;
 	if (!UDP->cmos && FLOPPY1_TYPE)
 		UDP->cmos = FLOPPY1_TYPE;
 
 	/* XXX */
 	/* additional physical CMOS drive detection should go here */
 
-	for (drive=0; drive < N_DRIVE; drive++){
+	for (drive = 0; drive < N_DRIVE; drive++) {
 		unsigned int type = UDP->cmos;
 		struct floppy_drive_params *params;
 		const char *name = NULL;
@@ -3673,8 +3675,7 @@ static void __init config_types(void)
 			if (type) {
 				name = default_drive_params[type].name;
 				allowed_drive_mask |= 1 << drive;
-			}
-			else
+			} else
 				allowed_drive_mask &= ~(1 << drive);
 		} else {
 			params = &default_drive_params[0].params;
@@ -3682,13 +3683,13 @@ static void __init config_types(void)
 			name = temparea;
 		}
 		if (name) {
-			const char * prepend = ",";
+			const char *prepend = ",";
 			if (first) {
 				prepend = KERN_INFO "Floppy drive(s):";
 				first = 0;
 			}
 			printk("%s fd%d is %s", prepend, drive, name);
-			register_devfs_entries (drive);
+			register_devfs_entries(drive);
 		}
 		*UDP = *params;
 	}
@@ -3696,13 +3697,13 @@ static void __init config_types(void)
 		printk("\n");
 }
 
-static int floppy_release(struct inode * inode, struct file * filp)
+static int floppy_release(struct inode *inode, struct file *filp)
 {
 	int drive = (long)inode->i_bdev->bd_disk->private_data;
 
 	down(&open_lock);
 	if (UDRS->fd_ref < 0)
-		UDRS->fd_ref=0;
+		UDRS->fd_ref = 0;
 	else if (!UDRS->fd_ref--) {
 		DPRINT("floppy_release with fd_ref == 0");
 		UDRS->fd_ref = 0;
@@ -3719,7 +3720,7 @@ static int floppy_release(struct inode *
  * /dev/PS0 etc), and disallows simultaneous access to the same
  * drive with different device numbers.
  */
-static int floppy_open(struct inode * inode, struct file * filp)
+static int floppy_open(struct inode *inode, struct file *filp)
 {
 	int drive = (long)inode->i_bdev->bd_disk->private_data;
 	int old_dev;
@@ -3727,19 +3728,18 @@ static int floppy_open(struct inode * in
 	int res = -EBUSY;
 	char *tmp;
 
-	filp->private_data = (void*) 0;
+	filp->private_data = (void *)0;
 	down(&open_lock);
 	old_dev = UDRS->fd_device;
 	if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev)
 		goto out2;
 
-	if (!UDRS->fd_ref && (UDP->flags & FD_BROKEN_DCL)){
+	if (!UDRS->fd_ref && (UDP->flags & FD_BROKEN_DCL)) {
 		USETF(FD_DISK_CHANGED);
 		USETF(FD_VERIFY);
 	}
 
-	if (UDRS->fd_ref == -1 ||
-	   (UDRS->fd_ref && (filp->f_flags & O_EXCL)))
+	if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL)))
 		goto out2;
 
 	if (floppy_grab_irq_and_dma())
@@ -3754,19 +3754,19 @@ static int floppy_open(struct inode * in
 
 	res = -ENXIO;
 
-	if (!floppy_track_buffer){
+	if (!floppy_track_buffer) {
 		/* if opening an ED drive, reserve a big buffer,
 		 * else reserve a small one */
 		if ((UDP->cmos == 6) || (UDP->cmos == 5))
-			try = 64; /* Only 48 actually useful */
+			try = 64;	/* Only 48 actually useful */
 		else
-			try = 32; /* Only 24 actually useful */
+			try = 32;	/* Only 24 actually useful */
 
-		tmp=(char *)fd_dma_mem_alloc(1024 * try);
+		tmp = (char *)fd_dma_mem_alloc(1024 * try);
 		if (!tmp && !floppy_track_buffer) {
-			try >>= 1; /* buffer only one side */
+			try >>= 1;	/* buffer only one side */
 			INFBOUND(try, 16);
-			tmp= (char *)fd_dma_mem_alloc(1024*try);
+			tmp = (char *)fd_dma_mem_alloc(1024 * try);
 		}
 		if (!tmp && !floppy_track_buffer) {
 			fallback_on_nodma_alloc(&tmp, 2048 * try);
@@ -3777,7 +3777,7 @@ static int floppy_open(struct inode * in
 		}
 		if (floppy_track_buffer) {
 			if (tmp)
-				fd_dma_mem_free((unsigned long)tmp,try*1024);
+				fd_dma_mem_free((unsigned long)tmp, try * 1024);
 		} else {
 			buffer_min = buffer_max = -1;
 			floppy_track_buffer = tmp;
@@ -3795,8 +3795,9 @@ static int floppy_open(struct inode * in
 	/* Allow ioctls if we have write-permissions even if read-only open.
 	 * Needed so that programs such as fdrawcmd still can work on write
 	 * protected disks */
-	if (filp->f_mode & 2 || permission(filp->f_dentry->d_inode,2,NULL) == 0)
-	    filp->private_data = (void*) 8;
+	if (filp->f_mode & 2
+	    || permission(filp->f_dentry->d_inode, 2, NULL) == 0)
+		filp->private_data = (void *)8;
 
 	if (UFDCS->rawcmd == 1)
 		UFDCS->rawcmd = 2;
@@ -3816,7 +3817,7 @@ static int floppy_open(struct inode * in
 	return 0;
 out:
 	if (UDRS->fd_ref < 0)
-		UDRS->fd_ref=0;
+		UDRS->fd_ref = 0;
 	else
 		UDRS->fd_ref--;
 	if (!UDRS->fd_ref)
@@ -3838,20 +3839,20 @@ static int check_floppy_change(struct ge
 		return 1;
 
 	if (UDP->checkfreq < (int)(jiffies - UDRS->last_checked)) {
-		if(floppy_grab_irq_and_dma()) {
+		if (floppy_grab_irq_and_dma()) {
 			return 1;
 		}
 
-		lock_fdc(drive,0);
-		poll_drive(0,0);
+		lock_fdc(drive, 0);
+		poll_drive(0, 0);
 		process_fd_request();
 		floppy_release_irq_and_dma();
 	}
 
 	if (UTESTF(FD_DISK_CHANGED) ||
-	   UTESTF(FD_VERIFY) ||
-	   test_bit(drive, &fake_change) ||
-	   (!ITYPE(UDRS->fd_device) && !current_type[drive]))
+	    UTESTF(FD_VERIFY) ||
+	    test_bit(drive, &fake_change) ||
+	    (!ITYPE(UDRS->fd_device) && !current_type[drive]))
 		return 1;
 	return 0;
 }
@@ -3862,12 +3863,13 @@ static int check_floppy_change(struct ge
  * a disk in the drive, and whether that disk is writable.
  */
 
-static int floppy_rb0_complete(struct bio *bio, unsigned int bytes_done, int err)
+static int floppy_rb0_complete(struct bio *bio, unsigned int bytes_done,
+			       int err)
 {
 	if (bio->bi_size)
 		return 1;
 
-	complete((struct completion*)bio->bi_private);
+	complete((struct completion *)bio->bi_private);
 	return 0;
 }
 
@@ -3919,23 +3921,21 @@ static int __floppy_read_block_0(struct 
  * geometry formats */
 static int floppy_revalidate(struct gendisk *disk)
 {
-	int drive=(long)disk->private_data;
+	int drive = (long)disk->private_data;
 #define NO_GEOM (!current_type[drive] && !ITYPE(UDRS->fd_device))
 	int cf;
 	int res = 0;
 
 	if (UTESTF(FD_DISK_CHANGED) ||
-	    UTESTF(FD_VERIFY) ||
-	    test_bit(drive, &fake_change) ||
-	    NO_GEOM){
-		if(usage_count == 0) {
+	    UTESTF(FD_VERIFY) || test_bit(drive, &fake_change) || NO_GEOM) {
+		if (usage_count == 0) {
 			printk("VFS: revalidate called on non-open device.\n");
 			return -EFAULT;
 		}
-		lock_fdc(drive,0);
+		lock_fdc(drive, 0);
 		cf = UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY);
-		if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)){
-			process_fd_request(); /*already done by another thread*/
+		if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) {
+			process_fd_request();	/*already done by another thread */
 			return 0;
 		}
 		UDRS->maxblock = 0;
@@ -3946,7 +3946,7 @@ static int floppy_revalidate(struct gend
 		UCLEARF(FD_DISK_CHANGED);
 		if (cf)
 			UDRS->generation++;
-		if (NO_GEOM){
+		if (NO_GEOM) {
 			/* auto-sensing */
 			res = __floppy_read_block_0(opened_bdev[drive]);
 		} else {
@@ -3965,22 +3965,24 @@ static struct block_device_operations fl
 	.release	= floppy_release,
 	.ioctl		= fd_ioctl,
 	.media_changed	= check_floppy_change,
-	.revalidate_disk= floppy_revalidate,
+	.revalidate_disk = floppy_revalidate,
 };
-static char *table[] =
-{"", "d360", "h1200", "u360", "u720", "h360", "h720",
-"u1440", "u2880", "CompaQ", "h1440", "u1680", "h410",
-"u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743",
-"h880", "u1040", "u1120", "h1600", "u1760", "u1920",
-"u3200", "u3520", "u3840", "u1840", "u800", "u1600",
-NULL
+static char *table[] = {
+	"", "d360", "h1200", "u360", "u720", "h360", "h720",
+	"u1440", "u2880", "CompaQ", "h1440", "u1680", "h410",
+	"u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743",
+	"h880", "u1040", "u1120", "h1600", "u1760", "u1920",
+	"u3200", "u3520", "u3840", "u1840", "u800", "u1600",
+	NULL
 };
-static int t360[] = {1,0}, t1200[] = {2,5,6,10,12,14,16,18,20,23,0},
-t3in[] = {8,9,26,27,28, 7,11,15,19,24,25,29,31, 3,4,13,17,21,22,30,0};
-static int *table_sup[] = 
-{NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in};
+static int t360[] = { 1, 0 },
+	t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 },
+	t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13,
+			17, 21, 22, 30, 0 };
+static int *table_sup[] =
+    { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in };
 
-static void __init register_devfs_entries (int drive)
+static void __init register_devfs_entries(int drive)
 {
 	int base_minor = (drive < 4) ? drive : (124 + drive);
 
@@ -3989,10 +3991,10 @@ static void __init register_devfs_entrie
 		do {
 			int minor = base_minor + (table_sup[UDP->cmos][i] << 2);
 
-			devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor), 
-					S_IFBLK|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP,
-					"floppy/%d%s",
-					drive, table[table_sup[UDP->cmos][i]]);
+			devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor),
+				      S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |
+				      S_IWGRP, "floppy/%d%s", drive,
+				      table[table_sup[UDP->cmos][i]]);
 		} while (table_sup[UDP->cmos][i++]);
 	}
 }
@@ -4013,19 +4015,20 @@ static char __init get_fdc_version(void)
 		return FDC_NONE;
 	if ((r = result()) <= 0x00)
 		return FDC_NONE;	/* No FDC present ??? */
-	if ((r==1) && (reply_buffer[0] == 0x80)){
-		printk(KERN_INFO "FDC %d is an 8272A\n",fdc);
+	if ((r == 1) && (reply_buffer[0] == 0x80)) {
+		printk(KERN_INFO "FDC %d is an 8272A\n", fdc);
 		return FDC_8272A;	/* 8272a/765 don't know DUMPREGS */
 	}
 	if (r != 10) {
-		printk("FDC %d init: DUMPREGS: unexpected return of %d bytes.\n",
-		       fdc, r);
+		printk
+		    ("FDC %d init: DUMPREGS: unexpected return of %d bytes.\n",
+		     fdc, r);
 		return FDC_UNKNOWN;
 	}
 
 	if (!fdc_configure()) {
-		printk(KERN_INFO "FDC %d is an 82072\n",fdc);
-		return FDC_82072;      	/* 82072 doesn't know CONFIGURE */
+		printk(KERN_INFO "FDC %d is an 82072\n", fdc);
+		return FDC_82072;	/* 82072 doesn't know CONFIGURE */
 	}
 
 	output_byte(FD_PERPENDICULAR);
@@ -4038,7 +4041,7 @@ static char __init get_fdc_version(void)
 
 	output_byte(FD_UNLOCK);
 	r = result();
-	if ((r == 1) && (reply_buffer[0] == 0x80)){
+	if ((r == 1) && (reply_buffer[0] == 0x80)) {
 		printk(KERN_INFO "FDC %d is a pre-1991 82077\n", fdc);
 		return FDC_82077_ORIG;	/* Pre-1991 82077, doesn't know 
 					 * LOCK/UNLOCK */
@@ -4056,37 +4059,39 @@ static char __init get_fdc_version(void)
 		return FDC_UNKNOWN;
 	}
 	if (reply_buffer[0] == 0x80) {
-		printk(KERN_INFO "FDC %d is a post-1991 82077\n",fdc);
+		printk(KERN_INFO "FDC %d is a post-1991 82077\n", fdc);
 		return FDC_82077;	/* Revised 82077AA passes all the tests */
 	}
 	switch (reply_buffer[0] >> 5) {
-		case 0x0:
-			/* Either a 82078-1 or a 82078SL running at 5Volt */
-			printk(KERN_INFO "FDC %d is an 82078.\n",fdc);
-			return FDC_82078;
-		case 0x1:
-			printk(KERN_INFO "FDC %d is a 44pin 82078\n",fdc);
-			return FDC_82078;
-		case 0x2:
-			printk(KERN_INFO "FDC %d is a S82078B\n", fdc);
-			return FDC_S82078B;
-		case 0x3:
-			printk(KERN_INFO "FDC %d is a National Semiconductor PC87306\n", fdc);
-			return FDC_87306;
-		default:
-			printk(KERN_INFO "FDC %d init: 82078 variant with unknown PARTID=%d.\n",
-			       fdc, reply_buffer[0] >> 5);
-			return FDC_82078_UNKN;
+	case 0x0:
+		/* Either a 82078-1 or a 82078SL running at 5Volt */
+		printk(KERN_INFO "FDC %d is an 82078.\n", fdc);
+		return FDC_82078;
+	case 0x1:
+		printk(KERN_INFO "FDC %d is a 44pin 82078\n", fdc);
+		return FDC_82078;
+	case 0x2:
+		printk(KERN_INFO "FDC %d is a S82078B\n", fdc);
+		return FDC_S82078B;
+	case 0x3:
+		printk(KERN_INFO "FDC %d is a National Semiconductor PC87306\n",
+		       fdc);
+		return FDC_87306;
+	default:
+		printk(KERN_INFO
+		       "FDC %d init: 82078 variant with unknown PARTID=%d.\n",
+		       fdc, reply_buffer[0] >> 5);
+		return FDC_82078_UNKN;
 	}
-} /* get_fdc_version */
+}				/* get_fdc_version */
 
 /* lilo configuration */
 
-static void __init floppy_set_flags(int *ints,int param, int param2)
+static void __init floppy_set_flags(int *ints, int param, int param2)
 {
 	int i;
 
-	for (i=0; i < ARRAY_SIZE(default_drive_params); i++){
+	for (i = 0; i < ARRAY_SIZE(default_drive_params); i++) {
 		if (param)
 			default_drive_params[i].params.flags |= param2;
 		else
@@ -4095,17 +4100,20 @@ static void __init floppy_set_flags(int 
 	DPRINT("%s flag 0x%x\n", param2 ? "Setting" : "Clearing", param);
 }
 
-static void __init daring(int *ints,int param, int param2)
+static void __init daring(int *ints, int param, int param2)
 {
 	int i;
 
-	for (i=0; i < ARRAY_SIZE(default_drive_params); i++){
-		if (param){
+	for (i = 0; i < ARRAY_SIZE(default_drive_params); i++) {
+		if (param) {
 			default_drive_params[i].params.select_delay = 0;
-			default_drive_params[i].params.flags |= FD_SILENT_DCL_CLEAR;
+			default_drive_params[i].params.flags |=
+			    FD_SILENT_DCL_CLEAR;
 		} else {
-			default_drive_params[i].params.select_delay = 2*HZ/100;
-			default_drive_params[i].params.flags &= ~FD_SILENT_DCL_CLEAR;
+			default_drive_params[i].params.select_delay =
+			    2 * HZ / 100;
+			default_drive_params[i].params.flags &=
+			    ~FD_SILENT_DCL_CLEAR;
 		}
 	}
 	DPRINT("Assuming %s floppy hardware\n", param ? "standard" : "broken");
@@ -4113,14 +4121,14 @@ static void __init daring(int *ints,int 
 
 static void __init set_cmos(int *ints, int dummy, int dummy2)
 {
-	int current_drive=0;
+	int current_drive = 0;
 
-	if (ints[0] != 2){
+	if (ints[0] != 2) {
 		DPRINT("wrong number of parameters for CMOS\n");
 		return;
 	}
 	current_drive = ints[1];
-	if (current_drive < 0 || current_drive >= 8){
+	if (current_drive < 0 || current_drive >= 8) {
 		DPRINT("bad drive for set_cmos\n");
 		return;
 	}
@@ -4134,43 +4142,37 @@ static void __init set_cmos(int *ints, i
 
 static struct param_table {
 	const char *name;
-	void (*fn)(int *ints, int param, int param2);
+	void (*fn) (int *ints, int param, int param2);
 	int *var;
 	int def_param;
 	int param2;
-} config_params[]={
-	{ "allowed_drive_mask", 0, &allowed_drive_mask, 0xff, 0}, /* obsolete */
-	{ "all_drives", 0, &allowed_drive_mask, 0xff, 0 }, /* obsolete */
-	{ "asus_pci", 0, &allowed_drive_mask, 0x33, 0},
-
-	{ "irq", 0, &FLOPPY_IRQ, 6, 0 },
-	{ "dma", 0, &FLOPPY_DMA, 2, 0 },
-
-	{ "daring", daring, 0, 1, 0},
+} config_params[] = {
+	{"allowed_drive_mask", 0, &allowed_drive_mask, 0xff, 0}, /* obsolete */
+	{"all_drives", 0, &allowed_drive_mask, 0xff, 0},	/* obsolete */
+	{"asus_pci", 0, &allowed_drive_mask, 0x33, 0},
+	{"irq", 0, &FLOPPY_IRQ, 6, 0},
+	{"dma", 0, &FLOPPY_DMA, 2, 0},
+	{"daring", daring, 0, 1, 0},
 #if N_FDC > 1
-	{ "two_fdc",  0, &FDC2, 0x370, 0 },
-	{ "one_fdc", 0, &FDC2, 0, 0 },
+	{"two_fdc", 0, &FDC2, 0x370, 0},
+	{"one_fdc", 0, &FDC2, 0, 0},
 #endif
-	{ "thinkpad", floppy_set_flags, 0, 1, FD_INVERTED_DCL },
-	{ "broken_dcl", floppy_set_flags, 0, 1, FD_BROKEN_DCL },
-	{ "messages", floppy_set_flags, 0, 1, FTD_MSG },
-	{ "silent_dcl_clear", floppy_set_flags, 0, 1, FD_SILENT_DCL_CLEAR },
-	{ "debug", floppy_set_flags, 0, 1, FD_DEBUG },
-
-	{ "nodma", 0, &can_use_virtual_dma, 1, 0 },
-	{ "omnibook", 0, &can_use_virtual_dma, 1, 0 },
-	{ "yesdma", 0, &can_use_virtual_dma, 0, 0 },
-
-	{ "fifo_depth", 0, &fifo_depth, 0xa, 0 },
-	{ "nofifo", 0, &no_fifo, 0x20, 0 },
-	{ "usefifo", 0, &no_fifo, 0, 0 },
-
-	{ "cmos", set_cmos, 0, 0, 0 },
-	{ "slow", 0, &slow_floppy, 1, 0 },
-
-	{ "unexpected_interrupts", 0, &print_unex, 1, 0 },
-	{ "no_unexpected_interrupts", 0, &print_unex, 0, 0 },
-	{ "L40SX", 0, &print_unex, 0, 0 }
+	{"thinkpad", floppy_set_flags, 0, 1, FD_INVERTED_DCL},
+	{"broken_dcl", floppy_set_flags, 0, 1, FD_BROKEN_DCL},
+	{"messages", floppy_set_flags, 0, 1, FTD_MSG},
+	{"silent_dcl_clear", floppy_set_flags, 0, 1, FD_SILENT_DCL_CLEAR},
+	{"debug", floppy_set_flags, 0, 1, FD_DEBUG},
+	{"nodma", 0, &can_use_virtual_dma, 1, 0},
+	{"omnibook", 0, &can_use_virtual_dma, 1, 0},
+	{"yesdma", 0, &can_use_virtual_dma, 0, 0},
+	{"fifo_depth", 0, &fifo_depth, 0xa, 0},
+	{"nofifo", 0, &no_fifo, 0x20, 0},
+	{"usefifo", 0, &no_fifo, 0, 0},
+	{"cmos", set_cmos, 0, 0, 0},
+	{"slow", 0, &slow_floppy, 1, 0},
+	{"unexpected_interrupts", 0, &print_unex, 1, 0},
+	{"no_unexpected_interrupts", 0, &print_unex, 0, 0},
+	{"L40SX", 0, &print_unex, 0, 0}
 
 	EXTRA_FLOPPY_PARAMS
 };
@@ -4181,18 +4183,18 @@ static int __init floppy_setup(char *str
 	int param;
 	int ints[11];
 
-	str = get_options(str,ARRAY_SIZE(ints),ints);
+	str = get_options(str, ARRAY_SIZE(ints), ints);
 	if (str) {
-		for (i=0; i< ARRAY_SIZE(config_params); i++){
-			if (strcmp(str,config_params[i].name) == 0){
+		for (i = 0; i < ARRAY_SIZE(config_params); i++) {
+			if (strcmp(str, config_params[i].name) == 0) {
 				if (ints[0])
 					param = ints[1];
 				else
 					param = config_params[i].def_param;
 				if (config_params[i].fn)
 					config_params[i].
-						fn(ints,param,
-						   config_params[i].param2);
+					    fn(ints, param,
+					       config_params[i].param2);
 				if (config_params[i].var) {
 					DPRINT("%s=%d\n", str, param);
 					*config_params[i].var = param;
@@ -4203,10 +4205,10 @@ static int __init floppy_setup(char *str
 	}
 	if (str) {
 		DPRINT("unknown floppy option [%s]\n", str);
-		
+
 		DPRINT("allowed options are:");
-		for (i=0; i< ARRAY_SIZE(config_params); i++)
-			printk(" %s",config_params[i].name);
+		for (i = 0; i < ARRAY_SIZE(config_params); i++)
+			printk(" %s", config_params[i].name);
 		printk("\n");
 	} else
 		DPRINT("botched floppy option\n");
@@ -4214,7 +4216,7 @@ static int __init floppy_setup(char *str
 	return 0;
 }
 
-static int have_no_fdc= -ENODEV;
+static int have_no_fdc = -ENODEV;
 
 static void floppy_device_release(struct device *dev)
 {
@@ -4226,12 +4228,12 @@ static struct platform_device floppy_dev
 	.id		= 0,
 	.dev		= {
 			.release = floppy_device_release,
-	}
+			}
 };
 
 static struct kobject *floppy_find(dev_t dev, int *part, void *data)
 {
-	int drive = (*part&3) | ((*part&0x80) >> 5);
+	int drive = (*part & 3) | ((*part & 0x80) >> 5);
 	if (drive >= N_DRIVE ||
 	    !(allowed_drive_mask & (1 << drive)) ||
 	    fdc_state[FDC(drive)].version == FDC_NONE)
@@ -4244,12 +4246,12 @@ static struct kobject *floppy_find(dev_t
 
 int __init floppy_init(void)
 {
-	int i,unit,drive;
+	int i, unit, drive;
 	int err;
 
 	raw_cmd = NULL;
 
-	for (i=0; i<N_DRIVE; i++) {
+	for (i = 0; i < N_DRIVE; i++) {
 		disks[i] = alloc_disk(1);
 		if (!disks[i])
 			goto Enomem;
@@ -4264,8 +4266,8 @@ int __init floppy_init(void)
 		motor_off_timer[i].function = motor_off_callback;
 	}
 
-	devfs_mk_dir ("floppy");
-	if ((err = register_blkdev(FLOPPY_MAJOR,"fd")))
+	devfs_mk_dir("floppy");
+	if ((err = register_blkdev(FLOPPY_MAJOR, "fd")))
 		goto out;
 
 	floppy_queue = blk_init_queue(do_fd_request, &floppy_lock);
@@ -4276,9 +4278,9 @@ int __init floppy_init(void)
 	}
 
 	blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
-				floppy_find, NULL, NULL);
+			    floppy_find, NULL, NULL);
 
-	for (i=0; i<256; i++)
+	for (i = 0; i < 256; i++)
 		if (ITYPE(i))
 			floppy_sizes[i] = floppy_type[ITYPE(i)].size;
 		else
@@ -4293,11 +4295,11 @@ int __init floppy_init(void)
 		FDCS->dtr = -1;
 		FDCS->dor = 0x4;
 #if defined(__sparc__) || defined(__mc68000__)
-		/*sparcs/sun3x don't have a DOR reset which we can fall back on to*/
+		/*sparcs/sun3x don't have a DOR reset which we can fall back on to */
 #ifdef __mc68000__
 		if (MACH_IS_SUN3X)
 #endif
-			FDCS->version = FDC_82072A;		
+			FDCS->version = FDC_82072A;
 #endif
 	}
 
@@ -4311,8 +4313,8 @@ int __init floppy_init(void)
 	fdc_state[1].address = FDC2;
 #endif
 
-	fdc = 0; /* reset fdc in case of unexpected interrupt */
-	if (floppy_grab_irq_and_dma()){
+	fdc = 0;		/* reset fdc in case of unexpected interrupt */
+	if (floppy_grab_irq_and_dma()) {
 		err = -EBUSY;
 		goto out1;
 	}
@@ -4332,25 +4334,25 @@ int __init floppy_init(void)
 	for (i = 0; i < N_FDC; i++) {
 		fdc = i;
 		FDCS->driver_version = FD_DRIVER_VERSION;
-		for (unit=0; unit<4; unit++)
+		for (unit = 0; unit < 4; unit++)
 			FDCS->track[unit] = 0;
 		if (FDCS->address == -1)
 			continue;
 		FDCS->rawcmd = 2;
-		if (user_reset_fdc(-1,FD_RESET_ALWAYS,0)){
- 			/* free ioports reserved by floppy_grab_irq_and_dma() */
- 			release_region(FDCS->address+2, 4);
- 			release_region(FDCS->address+7, 1);
+		if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) {
+			/* free ioports reserved by floppy_grab_irq_and_dma() */
+			release_region(FDCS->address + 2, 4);
+			release_region(FDCS->address + 7, 1);
 			FDCS->address = -1;
 			FDCS->version = FDC_NONE;
 			continue;
 		}
 		/* Try to determine the floppy controller type */
 		FDCS->version = get_fdc_version();
-		if (FDCS->version == FDC_NONE){
- 			/* free ioports reserved by floppy_grab_irq_and_dma() */
- 			release_region(FDCS->address+2, 4);
- 			release_region(FDCS->address+7, 1);
+		if (FDCS->version == FDC_NONE) {
+			/* free ioports reserved by floppy_grab_irq_and_dma() */
+			release_region(FDCS->address + 2, 4);
+			release_region(FDCS->address + 7, 1);
 			FDCS->address = -1;
 			continue;
 		}
@@ -4362,13 +4364,13 @@ int __init floppy_init(void)
 		 * properly, so force a reset for the standard FDC clones,
 		 * to avoid interrupt garbage.
 		 */
-		user_reset_fdc(-1,FD_RESET_ALWAYS,0);
+		user_reset_fdc(-1, FD_RESET_ALWAYS, 0);
 	}
-	fdc=0;
+	fdc = 0;
 	del_timer(&fd_timeout);
 	current_drive = 0;
 	floppy_release_irq_and_dma();
-	initialising=0;
+	initialising = 0;
 	if (have_no_fdc) {
 		DPRINT("no floppy controllers found\n");
 		flush_scheduled_work();
@@ -4377,14 +4379,14 @@ int __init floppy_init(void)
 		err = have_no_fdc;
 		goto out2;
 	}
-	
+
 	for (drive = 0; drive < N_DRIVE; drive++) {
 		if (!(allowed_drive_mask & (1 << drive)))
 			continue;
 		if (fdc_state[FDC(drive)].version == FDC_NONE)
 			continue;
 		/* to be cleaned up... */
-		disks[drive]->private_data = (void*)(long)drive;
+		disks[drive]->private_data = (void *)(long)drive;
 		disks[drive]->queue = floppy_queue;
 		disks[drive]->flags |= GENHD_FL_REMOVABLE;
 		add_disk(disks[drive]);
@@ -4399,9 +4401,9 @@ out2:
 	blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
 	blk_cleanup_queue(floppy_queue);
 fail_queue:
-	unregister_blkdev(FLOPPY_MAJOR,"fd");
+	unregister_blkdev(FLOPPY_MAJOR, "fd");
 out:
-	for (i=0; i<N_DRIVE; i++)
+	for (i = 0; i < N_DRIVE; i++)
 		put_disk(disks[i]);
 	devfs_remove("floppy");
 	return err;
@@ -4419,14 +4421,14 @@ static int floppy_grab_irq_and_dma(void)
 	unsigned long flags;
 
 	spin_lock_irqsave(&floppy_usage_lock, flags);
-	if (usage_count++){
+	if (usage_count++) {
 		spin_unlock_irqrestore(&floppy_usage_lock, flags);
 		return 0;
 	}
 	spin_unlock_irqrestore(&floppy_usage_lock, flags);
 	if (fd_request_irq()) {
 		DPRINT("Unable to grab IRQ%d for the floppy driver\n",
-			FLOPPY_IRQ);
+		       FLOPPY_IRQ);
 		spin_lock_irqsave(&floppy_usage_lock, flags);
 		usage_count--;
 		spin_unlock_irqrestore(&floppy_usage_lock, flags);
@@ -4434,7 +4436,7 @@ static int floppy_grab_irq_and_dma(void)
 	}
 	if (fd_request_dma()) {
 		DPRINT("Unable to grab DMA%d for the floppy driver\n",
-			FLOPPY_DMA);
+		       FLOPPY_DMA);
 		fd_free_irq();
 		spin_lock_irqsave(&floppy_usage_lock, flags);
 		usage_count--;
@@ -4442,35 +4444,37 @@ static int floppy_grab_irq_and_dma(void)
 		return -1;
 	}
 
-	for (fdc=0; fdc< N_FDC; fdc++){
-		if (FDCS->address != -1){
-			if (!request_region(FDCS->address+2, 4, "floppy")) {
-				DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + 2);
+	for (fdc = 0; fdc < N_FDC; fdc++) {
+		if (FDCS->address != -1) {
+			if (!request_region(FDCS->address + 2, 4, "floppy")) {
+				DPRINT("Floppy io-port 0x%04lx in use\n",
+				       FDCS->address + 2);
 				goto cleanup1;
 			}
-			if (!request_region(FDCS->address+7, 1, "floppy DIR")) {
-				DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + 7);
+			if (!request_region(FDCS->address + 7, 1, "floppy DIR")) {
+				DPRINT("Floppy io-port 0x%04lx in use\n",
+				       FDCS->address + 7);
 				goto cleanup2;
 			}
 			/* address + 6 is reserved, and may be taken by IDE.
 			 * Unfortunately, Adaptec doesn't know this :-(, */
 		}
 	}
-	for (fdc=0; fdc< N_FDC; fdc++){
-		if (FDCS->address != -1){
+	for (fdc = 0; fdc < N_FDC; fdc++) {
+		if (FDCS->address != -1) {
 			reset_fdc_info(1);
 			fd_outb(FDCS->dor, FD_DOR);
 		}
 	}
 	fdc = 0;
-	set_dor(0, ~0, 8);  /* avoid immediate interrupt */
+	set_dor(0, ~0, 8);	/* avoid immediate interrupt */
 
 	for (fdc = 0; fdc < N_FDC; fdc++)
 		if (FDCS->address != -1)
 			fd_outb(FDCS->dor, FD_DOR);
 	/*
-	 *	The driver will try and free resources and relies on us
-	 *	to know if they were allocated or not.
+	 *      The driver will try and free resources and relies on us
+	 *      to know if they were allocated or not.
 	 */
 	fdc = 0;
 	irqdma_allocated = 1;
@@ -4480,7 +4484,7 @@ cleanup2:
 cleanup1:
 	fd_free_irq();
 	fd_free_dma();
-	while(--fdc >= 0) {
+	while (--fdc >= 0) {
 		release_region(FDCS->address + 2, 4);
 		release_region(FDCS->address + 7, 1);
 	}
@@ -4503,17 +4507,16 @@ static void floppy_release_irq_and_dma(v
 	unsigned long flags;
 
 	spin_lock_irqsave(&floppy_usage_lock, flags);
-	if (--usage_count){
+	if (--usage_count) {
 		spin_unlock_irqrestore(&floppy_usage_lock, flags);
 		return;
 	}
 	spin_unlock_irqrestore(&floppy_usage_lock, flags);
-	if(irqdma_allocated)
-	{
+	if (irqdma_allocated) {
 		fd_disable_dma();
 		fd_free_dma();
 		fd_free_irq();
-		irqdma_allocated=0;
+		irqdma_allocated = 0;
 	}
 	set_dor(0, ~0, 8);
 #if N_FDC > 1
@@ -4522,17 +4525,16 @@ static void floppy_release_irq_and_dma(v
 	floppy_enable_hlt();
 
 	if (floppy_track_buffer && max_buffer_sectors) {
-		tmpsize = max_buffer_sectors*1024;
+		tmpsize = max_buffer_sectors * 1024;
 		tmpaddr = (unsigned long)floppy_track_buffer;
 		floppy_track_buffer = NULL;
 		max_buffer_sectors = 0;
 		buffer_min = buffer_max = -1;
 		fd_dma_mem_free(tmpaddr, tmpsize);
 	}
-
 #ifdef FLOPPY_SANITY_CHECK
 #ifndef __sparc__
-	for (drive=0; drive < N_FDC * 4; drive++)
+	for (drive = 0; drive < N_FDC * 4; drive++)
 		if (timer_pending(motor_off_timer + drive))
 			printk("motor off timer %d still active\n", drive);
 #endif
@@ -4547,35 +4549,35 @@ static void floppy_release_irq_and_dma(v
 	old_fdc = fdc;
 	for (fdc = 0; fdc < N_FDC; fdc++)
 		if (FDCS->address != -1) {
-			release_region(FDCS->address+2, 4);
-			release_region(FDCS->address+7, 1);
+			release_region(FDCS->address + 2, 4);
+			release_region(FDCS->address + 7, 1);
 		}
 	fdc = old_fdc;
 }
 
-
 #ifdef MODULE
 
 char *floppy;
 
-static void unregister_devfs_entries (int drive)
+static void unregister_devfs_entries(int drive)
 {
-    int i;
+	int i;
 
-    if (UDP->cmos < NUMBER(default_drive_params)) {
-	i = 0;
-	do {
-	    devfs_remove("floppy/%d%s", drive, table[table_sup[UDP->cmos][i]]);
-	} while (table_sup[UDP->cmos][i++]);
-    }
+	if (UDP->cmos < NUMBER(default_drive_params)) {
+		i = 0;
+		do {
+			devfs_remove("floppy/%d%s", drive,
+				     table[table_sup[UDP->cmos][i]]);
+		} while (table_sup[UDP->cmos][i++]);
+	}
 }
 
 static void __init parse_floppy_cfg_string(char *cfg)
 {
 	char *ptr;
 
-	while(*cfg) {
-		for(ptr = cfg;*cfg && *cfg != ' ' && *cfg != '\t'; cfg++);
+	while (*cfg) {
+		for (ptr = cfg; *cfg && *cfg != ' ' && *cfg != '\t'; cfg++) ;
 		if (*cfg) {
 			*cfg = '\0';
 			cfg++;
@@ -4588,7 +4590,7 @@ static void __init parse_floppy_cfg_stri
 int init_module(void)
 {
 	printk(KERN_INFO "inserting floppy driver for " UTS_RELEASE "\n");
-		
+
 	if (floppy)
 		parse_floppy_cfg_string(floppy);
 	return floppy_init();
@@ -4628,16 +4630,16 @@ void cleanup_module(void)
 	wait_for_completion(&device_release);
 }
 
-MODULE_PARM(floppy,"s");
-MODULE_PARM(FLOPPY_IRQ,"i");
-MODULE_PARM(FLOPPY_DMA,"i");
+MODULE_PARM(floppy, "s");
+MODULE_PARM(FLOPPY_IRQ, "i");
+MODULE_PARM(FLOPPY_DMA, "i");
 MODULE_AUTHOR("Alain L. Knaff");
 MODULE_SUPPORTED_DEVICE("fd");
 MODULE_LICENSE("GPL");
 
 #else
 
-__setup ("floppy=", floppy_setup);
+__setup("floppy=", floppy_setup);
 module_init(floppy_init)
 #endif
 

_