aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-03-10 18:20:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:30 -0500
commit87f530d8f1733651f3e34b81c801d6e1bb635936 (patch)
treecabfbff252b86b33435b69e150cd9380d1d26d53 /drivers
parent52a0d61f64123ab758d8b8cc8f8ca521733d2f32 (diff)
drivers/block/floppy.c: add debug_dcl(...) macro
Converted #ifdef DCL_DEBUG if (test) DPRINTK(...); #endif to debug_dcl(test, ...); Signed-off-by: Joe 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/floppy.c83
1 files changed, 31 insertions, 52 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 50bd9e9370dd..41f366327193 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -152,6 +152,15 @@
152#define DEBUGT 2 152#define DEBUGT 2
153#define DCL_DEBUG /* debug disk change line */ 153#define DCL_DEBUG /* debug disk change line */
154 154
155#ifdef DCL_DEBUG
156#define debug_dcl(test, fmt, args...) \
157 do { if ((test) & FD_DEBUG) DPRINT(fmt, ##args); } while (0)
158#else
159#define debug_dcl(test, fmt, args...) \
160 do { if (0) DPRINT(fmt, ##args); } while (0)
161#endif
162
163
155/* do print messages for unexpected interrupts */ 164/* do print messages for unexpected interrupts */
156static int print_unex = 1; 165static int print_unex = 1;
157#include <linux/module.h> 166#include <linux/module.h>
@@ -748,14 +757,12 @@ static int disk_change(int drive)
748 } 757 }
749#endif 758#endif
750 759
751#ifdef DCL_DEBUG 760 debug_dcl(UDP->flags,
752 if (UDP->flags & FD_DEBUG) { 761 "checking disk change line for drive %d\n", drive);
753 DPRINT("checking disk change line for drive %d\n", drive); 762 debug_dcl(UDP->flags, "jiffies=%lu\n", jiffies);
754 DPRINT("jiffies=%lu\n", jiffies); 763 debug_dcl(UDP->flags, "disk change line=%x\n", fd_inb(FD_DIR) & 0x80);
755 DPRINT("disk change line=%x\n", fd_inb(FD_DIR) & 0x80); 764 debug_dcl(UDP->flags, "flags=%lx\n", UDRS->flags);
756 DPRINT("flags=%lx\n", UDRS->flags); 765
757 }
758#endif
759 if (UDP->flags & FD_BROKEN_DCL) 766 if (UDP->flags & FD_BROKEN_DCL)
760 return UTESTF(FD_DISK_CHANGED); 767 return UTESTF(FD_DISK_CHANGED);
761 if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80) { 768 if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80) {
@@ -804,10 +811,8 @@ static int set_dor(int fdc, char mask, char data)
804 unit = olddor & 0x3; 811 unit = olddor & 0x3;
805 if (is_selected(olddor, unit) && !is_selected(newdor, unit)) { 812 if (is_selected(olddor, unit) && !is_selected(newdor, unit)) {
806 drive = REVDRIVE(fdc, unit); 813 drive = REVDRIVE(fdc, unit);
807#ifdef DCL_DEBUG 814 debug_dcl(UDP->flags,
808 if (UDP->flags & FD_DEBUG) 815 "calling disk change from set_dor\n");
809 DPRINT("calling disk change from set_dor\n");
810#endif
811 disk_change(drive); 816 disk_change(drive);
812 } 817 }
813 FDCS->dor = newdor; 818 FDCS->dor = newdor;
@@ -1020,10 +1025,7 @@ static void cancel_activity(void)
1020 * transfer */ 1025 * transfer */
1021static void fd_watchdog(void) 1026static void fd_watchdog(void)
1022{ 1027{
1023#ifdef DCL_DEBUG 1028 debug_dcl(DP->flags, "calling disk change from watchdog\n");
1024 if (DP->flags & FD_DEBUG)
1025 DPRINT("calling disk change from watchdog\n");
1026#endif
1027 1029
1028 if (disk_change(current_drive)) { 1030 if (disk_change(current_drive)) {
1029 DPRINT("disk removed during i/o\n"); 1031 DPRINT("disk removed during i/o\n");
@@ -1582,12 +1584,9 @@ static void seek_interrupt(void)
1582 return; 1584 return;
1583 } 1585 }
1584 if (DRS->track >= 0 && DRS->track != ST1 && !blind_seek) { 1586 if (DRS->track >= 0 && DRS->track != ST1 && !blind_seek) {
1585#ifdef DCL_DEBUG 1587 debug_dcl(DP->flags,
1586 if (DP->flags & FD_DEBUG) { 1588 "clearing NEWCHANGE flag because of effective seek\n");
1587 DPRINT("clearing NEWCHANGE flag because of effective seek\n"); 1589 debug_dcl(DP->flags, "jiffies=%lu\n", jiffies);
1588 DPRINT("jiffies=%lu\n", jiffies);
1589 }
1590#endif
1591 CLEARF(FD_DISK_NEWCHANGE); /* effective seek */ 1590 CLEARF(FD_DISK_NEWCHANGE); /* effective seek */
1592 DRS->select_date = jiffies; 1591 DRS->select_date = jiffies;
1593 } 1592 }
@@ -1607,12 +1606,9 @@ static void check_wp(void)
1607 } 1606 }
1608 CLEARF(FD_VERIFY); 1607 CLEARF(FD_VERIFY);
1609 CLEARF(FD_NEED_TWADDLE); 1608 CLEARF(FD_NEED_TWADDLE);
1610#ifdef DCL_DEBUG 1609 debug_dcl(DP->flags,
1611 if (DP->flags & FD_DEBUG) { 1610 "checking whether disk is write protected\n");
1612 DPRINT("checking whether disk is write protected\n"); 1611 debug_dcl(DP->flags, "wp=%x\n", ST3 & 0x40);
1613 DPRINT("wp=%x\n", ST3 & 0x40);
1614 }
1615#endif
1616 if (!(ST3 & 0x40)) 1612 if (!(ST3 & 0x40))
1617 SETF(FD_DISK_WRITABLE); 1613 SETF(FD_DISK_WRITABLE);
1618 else 1614 else
@@ -1626,10 +1622,7 @@ static void seek_floppy(void)
1626 1622
1627 blind_seek = 0; 1623 blind_seek = 0;
1628 1624
1629#ifdef DCL_DEBUG 1625 debug_dcl(DP->flags, "calling disk change from seek\n");
1630 if (DP->flags & FD_DEBUG)
1631 DPRINT("calling disk change from seek\n");
1632#endif
1633 1626
1634 if (!TESTF(FD_DISK_NEWCHANGE) && 1627 if (!TESTF(FD_DISK_NEWCHANGE) &&
1635 disk_change(current_drive) && (raw_cmd->flags & FD_RAW_NEED_DISK)) { 1628 disk_change(current_drive) && (raw_cmd->flags & FD_RAW_NEED_DISK)) {
@@ -1705,10 +1698,8 @@ static void recal_interrupt(void)
1705 * not to move at recalibration is to 1698 * not to move at recalibration is to
1706 * be already at track 0.) Clear the 1699 * be already at track 0.) Clear the
1707 * new change flag */ 1700 * new change flag */
1708#ifdef DCL_DEBUG 1701 debug_dcl(DP->flags,
1709 if (DP->flags & FD_DEBUG) 1702 "clearing NEWCHANGE flag because of second recalibrate\n");
1710 DPRINT("clearing NEWCHANGE flag because of second recalibrate\n");
1711#endif
1712 1703
1713 CLEARF(FD_DISK_NEWCHANGE); 1704 CLEARF(FD_DISK_NEWCHANGE);
1714 DRS->select_date = jiffies; 1705 DRS->select_date = jiffies;
@@ -1968,10 +1959,7 @@ static void floppy_ready(void)
1968 if (fdc_dtr()) 1959 if (fdc_dtr())
1969 return; 1960 return;
1970 1961
1971#ifdef DCL_DEBUG 1962 debug_dcl(DP->flags, "calling disk change from floppy_ready\n");
1972 if (DP->flags & FD_DEBUG)
1973 DPRINT("calling disk change from floppy_ready\n");
1974#endif
1975 if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) && 1963 if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) &&
1976 disk_change(current_drive) && !DP->select_delay) 1964 disk_change(current_drive) && !DP->select_delay)
1977 twaddle(); /* this clears the dcl on certain 1965 twaddle(); /* this clears the dcl on certain
@@ -2002,10 +1990,7 @@ static void floppy_start(void)
2002 reschedule_timeout(current_reqD, "floppy start", 0); 1990 reschedule_timeout(current_reqD, "floppy start", 0);
2003 1991
2004 scandrives(); 1992 scandrives();
2005#ifdef DCL_DEBUG 1993 debug_dcl(DP->flags, "setting NEWCHANGE in floppy_start\n");
2006 if (DP->flags & FD_DEBUG)
2007 DPRINT("setting NEWCHANGE in floppy_start\n");
2008#endif
2009 SETF(FD_DISK_NEWCHANGE); 1994 SETF(FD_DISK_NEWCHANGE);
2010 floppy_ready(); 1995 floppy_ready();
2011} 1996}
@@ -3024,10 +3009,7 @@ static int poll_drive(int interruptible, int flag)
3024 raw_cmd->track = 0; 3009 raw_cmd->track = 0;
3025 raw_cmd->cmd_count = 0; 3010 raw_cmd->cmd_count = 0;
3026 cont = &poll_cont; 3011 cont = &poll_cont;
3027#ifdef DCL_DEBUG 3012 debug_dcl(DP->flags, "setting NEWCHANGE in poll_drive\n");
3028 if (DP->flags & FD_DEBUG)
3029 DPRINT("setting NEWCHANGE in poll_drive\n");
3030#endif
3031 SETF(FD_DISK_NEWCHANGE); 3013 SETF(FD_DISK_NEWCHANGE);
3032 WAIT(floppy_ready); 3014 WAIT(floppy_ready);
3033 return ret; 3015 return ret;
@@ -3290,10 +3272,7 @@ static int raw_cmd_ioctl(int cmd, void __user *param)
3290 raw_cmd = my_raw_cmd; 3272 raw_cmd = my_raw_cmd;
3291 cont = &raw_cmd_cont; 3273 cont = &raw_cmd_cont;
3292 ret = wait_til_done(floppy_start, 1); 3274 ret = wait_til_done(floppy_start, 1);
3293#ifdef DCL_DEBUG 3275 debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n");
3294 if (DP->flags & FD_DEBUG)
3295 DPRINT("calling disk change from raw_cmd ioctl\n");
3296#endif
3297 3276
3298 if (ret != -EINTR && FDCS->reset) 3277 if (ret != -EINTR && FDCS->reset)
3299 ret = -EIO; 3278 ret = -EIO;