Commit 10c9a379 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] floppy.c: better/cleaner use of debugt

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

From: "Luiz Fernando N. Capitulino" <lcapitulino@prefeitura.sp.gov.br>

floppy_debugt.patch: better use of the debugt functions.
parent 794b6dd5
...@@ -604,28 +604,27 @@ static inline int fd_eject(int drive) ...@@ -604,28 +604,27 @@ static inline int fd_eject(int drive)
} }
#endif #endif
#ifdef DEBUGT
static long unsigned debugtimer;
#endif
/* /*
* Debugging * Debugging
* ========= * =========
*/ */
#ifdef DEBUGT
static long unsigned debugtimer;
static inline void set_debugt(void) static inline void set_debugt(void)
{ {
#ifdef DEBUGT
debugtimer = jiffies; debugtimer = jiffies;
#endif
} }
static inline void debugt(const char *message) static inline void debugt(const char *message)
{ {
#ifdef DEBUGT
if (DP->flags & DEBUGT) if (DP->flags & DEBUGT)
printk("%s dtime=%lu\n", message, jiffies - debugtimer); printk("%s dtime=%lu\n", message, jiffies - debugtimer);
#endif
} }
#else
static inline void set_debugt(void) { }
static inline void debugt(const char *message) { }
#endif /* DEBUGT */
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 struct timer_list fd_timeout = TIMER_INITIALIZER(floppy_shutdown, 0, 0);
...@@ -1546,9 +1545,8 @@ static void setup_rw_floppy(void) ...@@ -1546,9 +1545,8 @@ static void setup_rw_floppy(void)
for (i = 0; i < raw_cmd->cmd_count; i++) for (i = 0; i < raw_cmd->cmd_count; i++)
r |= output_byte(raw_cmd->cmd[i]); r |= output_byte(raw_cmd->cmd[i]);
#ifdef DEBUGT
debugt("rw_command: "); debugt("rw_command: ");
#endif
if (r) { if (r) {
cont->error(); cont->error();
reset_fdc(); reset_fdc();
...@@ -1570,9 +1568,7 @@ static int blind_seek; ...@@ -1570,9 +1568,7 @@ static int blind_seek;
*/ */
static void seek_interrupt(void) static void seek_interrupt(void)
{ {
#ifdef DEBUGT
debugt("seek interrupt:"); debugt("seek interrupt:");
#endif
if (inr != 2 || (ST0 & 0xF8) != 0x20) { if (inr != 2 || (ST0 & 0xF8) != 0x20) {
DPRINT("seek failed\n"); DPRINT("seek failed\n");
DRS->track = NEED_2_RECAL; DRS->track = NEED_2_RECAL;
...@@ -1676,24 +1672,18 @@ static void seek_floppy(void) ...@@ -1676,24 +1672,18 @@ static void seek_floppy(void)
output_byte(FD_SEEK); output_byte(FD_SEEK);
output_byte(UNIT(current_drive)); output_byte(UNIT(current_drive));
LAST_OUT(track); LAST_OUT(track);
#ifdef DEBUGT
debugt("seek command:"); debugt("seek command:");
#endif
} }
static void recal_interrupt(void) static void recal_interrupt(void)
{ {
#ifdef DEBUGT
debugt("recal interrupt:"); debugt("recal interrupt:");
#endif
if (inr != 2) if (inr != 2)
FDCS->reset = 1; FDCS->reset = 1;
else if (ST0 & ST0_ECE) { else if (ST0 & ST0_ECE) {
switch (DRS->track) { switch (DRS->track) {
case NEED_1_RECAL: 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 /* after a second recalibrate, we still haven't
* reached track 0. Probably no drive. Raise an * reached track 0. Probably no drive. Raise an
* error, as failing immediately might upset * error, as failing immediately might upset
...@@ -1702,9 +1692,7 @@ static void recal_interrupt(void) ...@@ -1702,9 +1692,7 @@ static void recal_interrupt(void)
cont->redo(); cont->redo();
return; return;
case NEED_2_RECAL: 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, /* If we already did a recalibrate,
* and we are not at track 0, this * and we are not at track 0, this
* means we have moved. (The only way * means we have moved. (The only way
...@@ -1722,9 +1710,7 @@ static void recal_interrupt(void) ...@@ -1722,9 +1710,7 @@ static void recal_interrupt(void)
DRS->select_date = jiffies; DRS->select_date = jiffies;
/* fall through */ /* fall through */
default: default:
#ifdef DEBUGT
debugt("recal interrupt default:"); debugt("recal interrupt default:");
#endif
/* Recalibrate moves the head by at /* Recalibrate moves the head by at
* most 80 steps. If after one * most 80 steps. If after one
* recalibrate we don't have reached * recalibrate we don't have reached
...@@ -1813,9 +1799,7 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1813,9 +1799,7 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static void recalibrate_floppy(void) static void recalibrate_floppy(void)
{ {
#ifdef DEBUGT
debugt("recalibrate floppy:"); debugt("recalibrate floppy:");
#endif
do_floppy = recal_interrupt; do_floppy = recal_interrupt;
output_byte(FD_RECALIBRATE); output_byte(FD_RECALIBRATE);
LAST_OUT(UNIT(current_drive)); LAST_OUT(UNIT(current_drive));
...@@ -1826,9 +1810,7 @@ static void recalibrate_floppy(void) ...@@ -1826,9 +1810,7 @@ static void recalibrate_floppy(void)
*/ */
static void reset_interrupt(void) static void reset_interrupt(void)
{ {
#ifdef DEBUGT
debugt("reset interrupt:"); debugt("reset interrupt:");
#endif
result(); /* get the status ready for set_fdc */ result(); /* get the status ready for set_fdc */
if (FDCS->reset) { if (FDCS->reset) {
printk("reset set in interrupt, calling %p\n", cont->error); printk("reset set in interrupt, calling %p\n", cont->error);
...@@ -2266,9 +2248,7 @@ static void redo_format(void) ...@@ -2266,9 +2248,7 @@ static void redo_format(void)
buffer_track = -1; buffer_track = -1;
setup_format_params(format_req.track << STRETCH(_floppy)); setup_format_params(format_req.track << STRETCH(_floppy));
floppy_start(); floppy_start();
#ifdef DEBUGT
debugt("queue format request"); debugt("queue format request");
#endif
} }
static struct cont_t format_cont = { static struct cont_t format_cont = {
...@@ -2992,9 +2972,7 @@ static void redo_fd_request(void) ...@@ -2992,9 +2972,7 @@ static void redo_fd_request(void)
if (TESTF(FD_NEED_TWADDLE)) if (TESTF(FD_NEED_TWADDLE))
twaddle(); twaddle();
schedule_bh(floppy_start); schedule_bh(floppy_start);
#ifdef DEBUGT
debugt("queue fd request"); debugt("queue fd request");
#endif
return; return;
} }
#undef REPEAT #undef REPEAT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment