Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87f530d8 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

drivers/block/floppy.c: add debug_dcl(...) macro



Converted #ifdef DCL_DEBUG if (test) DPRINTK(...); #endif
to debug_dcl(test, ...);

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 52a0d61f
Loading
Loading
Loading
Loading
+31 −52
Original line number Original line Diff line number Diff line
@@ -152,6 +152,15 @@
#define DEBUGT 2
#define DEBUGT 2
#define DCL_DEBUG		/* debug disk change line */
#define DCL_DEBUG		/* debug disk change line */


#ifdef DCL_DEBUG
#define debug_dcl(test, fmt, args...) \
	do { if ((test) & FD_DEBUG) DPRINT(fmt, ##args); } while (0)
#else
#define debug_dcl(test, fmt, args...) \
	do { if (0) DPRINT(fmt, ##args); } while (0)
#endif


/* do print messages for unexpected interrupts */
/* do print messages for unexpected interrupts */
static int print_unex = 1;
static int print_unex = 1;
#include <linux/module.h>
#include <linux/module.h>
@@ -748,14 +757,12 @@ static int disk_change(int drive)
	}
	}
#endif
#endif


#ifdef DCL_DEBUG
	debug_dcl(UDP->flags,
	if (UDP->flags & FD_DEBUG) {
		  "checking disk change line for drive %d\n", drive);
		DPRINT("checking disk change line for drive %d\n", drive);
	debug_dcl(UDP->flags, "jiffies=%lu\n", jiffies);
		DPRINT("jiffies=%lu\n", jiffies);
	debug_dcl(UDP->flags, "disk change line=%x\n", fd_inb(FD_DIR) & 0x80);
		DPRINT("disk change line=%x\n", fd_inb(FD_DIR) & 0x80);
	debug_dcl(UDP->flags, "flags=%lx\n", UDRS->flags);
		DPRINT("flags=%lx\n", UDRS->flags);

	}
#endif
	if (UDP->flags & FD_BROKEN_DCL)
	if (UDP->flags & FD_BROKEN_DCL)
		return UTESTF(FD_DISK_CHANGED);
		return UTESTF(FD_DISK_CHANGED);
	if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80) {
	if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80) {
@@ -804,10 +811,8 @@ static int set_dor(int fdc, char mask, char data)
		unit = olddor & 0x3;
		unit = olddor & 0x3;
		if (is_selected(olddor, unit) && !is_selected(newdor, unit)) {
		if (is_selected(olddor, unit) && !is_selected(newdor, unit)) {
			drive = REVDRIVE(fdc, unit);
			drive = REVDRIVE(fdc, unit);
#ifdef DCL_DEBUG
			debug_dcl(UDP->flags,
			if (UDP->flags & FD_DEBUG)
				  "calling disk change from set_dor\n");
				DPRINT("calling disk change from set_dor\n");
#endif
			disk_change(drive);
			disk_change(drive);
		}
		}
		FDCS->dor = newdor;
		FDCS->dor = newdor;
@@ -1020,10 +1025,7 @@ static void cancel_activity(void)
 * transfer */
 * transfer */
static void fd_watchdog(void)
static void fd_watchdog(void)
{
{
#ifdef DCL_DEBUG
	debug_dcl(DP->flags, "calling disk change from watchdog\n");
	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");
		DPRINT("disk removed during i/o\n");
@@ -1582,12 +1584,9 @@ static void seek_interrupt(void)
		return;
		return;
	}
	}
	if (DRS->track >= 0 && DRS->track != ST1 && !blind_seek) {
	if (DRS->track >= 0 && DRS->track != ST1 && !blind_seek) {
#ifdef DCL_DEBUG
		debug_dcl(DP->flags,
		if (DP->flags & FD_DEBUG) {
			  "clearing NEWCHANGE flag because of effective seek\n");
			DPRINT("clearing NEWCHANGE flag because of effective seek\n");
		debug_dcl(DP->flags, "jiffies=%lu\n", jiffies);
			DPRINT("jiffies=%lu\n", jiffies);
		}
#endif
		CLEARF(FD_DISK_NEWCHANGE);	/* effective seek */
		CLEARF(FD_DISK_NEWCHANGE);	/* effective seek */
		DRS->select_date = jiffies;
		DRS->select_date = jiffies;
	}
	}
@@ -1607,12 +1606,9 @@ static void check_wp(void)
		}
		}
		CLEARF(FD_VERIFY);
		CLEARF(FD_VERIFY);
		CLEARF(FD_NEED_TWADDLE);
		CLEARF(FD_NEED_TWADDLE);
#ifdef DCL_DEBUG
		debug_dcl(DP->flags,
		if (DP->flags & FD_DEBUG) {
			  "checking whether disk is write protected\n");
			DPRINT("checking whether disk is write protected\n");
		debug_dcl(DP->flags, "wp=%x\n", ST3 & 0x40);
			DPRINT("wp=%x\n", ST3 & 0x40);
		}
#endif
		if (!(ST3 & 0x40))
		if (!(ST3 & 0x40))
			SETF(FD_DISK_WRITABLE);
			SETF(FD_DISK_WRITABLE);
		else
		else
@@ -1626,10 +1622,7 @@ static void seek_floppy(void)


	blind_seek = 0;
	blind_seek = 0;


#ifdef DCL_DEBUG
	debug_dcl(DP->flags, "calling disk change from seek\n");
	if (DP->flags & FD_DEBUG)
		DPRINT("calling disk change from seek\n");
#endif


	if (!TESTF(FD_DISK_NEWCHANGE) &&
	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)) {
@@ -1705,10 +1698,8 @@ static void recal_interrupt(void)
			 * not to move at recalibration is to
			 * not to move at recalibration is to
			 * be already at track 0.) Clear the
			 * be already at track 0.) Clear the
			 * new change flag */
			 * new change flag */
#ifdef DCL_DEBUG
			debug_dcl(DP->flags,
			if (DP->flags & FD_DEBUG)
				  "clearing NEWCHANGE flag because of second recalibrate\n");
				DPRINT("clearing NEWCHANGE flag because of second recalibrate\n");
#endif


			CLEARF(FD_DISK_NEWCHANGE);
			CLEARF(FD_DISK_NEWCHANGE);
			DRS->select_date = jiffies;
			DRS->select_date = jiffies;
@@ -1968,10 +1959,7 @@ static void floppy_ready(void)
	if (fdc_dtr())
	if (fdc_dtr())
		return;
		return;


#ifdef DCL_DEBUG
	debug_dcl(DP->flags, "calling disk change from floppy_ready\n");
	if (DP->flags & FD_DEBUG)
		DPRINT("calling disk change from floppy_ready\n");
#endif
	if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) &&
	if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) &&
	    disk_change(current_drive) && !DP->select_delay)
	    disk_change(current_drive) && !DP->select_delay)
		twaddle();	/* this clears the dcl on certain
		twaddle();	/* this clears the dcl on certain
@@ -2002,10 +1990,7 @@ static void floppy_start(void)
	reschedule_timeout(current_reqD, "floppy start", 0);
	reschedule_timeout(current_reqD, "floppy start", 0);


	scandrives();
	scandrives();
#ifdef DCL_DEBUG
	debug_dcl(DP->flags, "setting NEWCHANGE in floppy_start\n");
	if (DP->flags & FD_DEBUG)
		DPRINT("setting NEWCHANGE in floppy_start\n");
#endif
	SETF(FD_DISK_NEWCHANGE);
	SETF(FD_DISK_NEWCHANGE);
	floppy_ready();
	floppy_ready();
}
}
@@ -3024,10 +3009,7 @@ static int poll_drive(int interruptible, int flag)
	raw_cmd->track = 0;
	raw_cmd->track = 0;
	raw_cmd->cmd_count = 0;
	raw_cmd->cmd_count = 0;
	cont = &poll_cont;
	cont = &poll_cont;
#ifdef DCL_DEBUG
	debug_dcl(DP->flags, "setting NEWCHANGE in poll_drive\n");
	if (DP->flags & FD_DEBUG)
		DPRINT("setting NEWCHANGE in poll_drive\n");
#endif
	SETF(FD_DISK_NEWCHANGE);
	SETF(FD_DISK_NEWCHANGE);
	WAIT(floppy_ready);
	WAIT(floppy_ready);
	return ret;
	return ret;
@@ -3290,10 +3272,7 @@ static int raw_cmd_ioctl(int cmd, void __user *param)
	raw_cmd = my_raw_cmd;
	raw_cmd = my_raw_cmd;
	cont = &raw_cmd_cont;
	cont = &raw_cmd_cont;
	ret = wait_til_done(floppy_start, 1);
	ret = wait_til_done(floppy_start, 1);
#ifdef DCL_DEBUG
	debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n");
	if (DP->flags & FD_DEBUG)
		DPRINT("calling disk change from raw_cmd ioctl\n");
#endif


	if (ret != -EINTR && FDCS->reset)
	if (ret != -EINTR && FDCS->reset)
		ret = -EIO;
		ret = -EIO;