diff options
author | Joe Perches <joe@perches.com> | 2010-03-10 18:21:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:31 -0500 |
commit | 1a23d133359eec2297ff4c72c260ccacb156d883 (patch) | |
tree | ca1014d05d926c67dd37f22b940694e204a4cee7 /drivers/block | |
parent | 73507e6cd8dc6cd98a39164a9b775c7092faddb4 (diff) |
drivers/block/floppy.c: remove #define FLOPPY_SANITY_CHECK
The code could not be compiled without the #define, so just remove it and
the #ifdef/#endif lines.
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/block')
-rw-r--r-- | drivers/block/floppy.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 4de027deffb9..c2d9c59f0e64 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -144,7 +144,6 @@ | |||
144 | * Better audit of register_blkdev. | 144 | * Better audit of register_blkdev. |
145 | */ | 145 | */ |
146 | 146 | ||
147 | #define FLOPPY_SANITY_CHECK | ||
148 | #undef FLOPPY_SILENT_DCL_CLEAR | 147 | #undef FLOPPY_SILENT_DCL_CLEAR |
149 | 148 | ||
150 | #define REALLY_SLOW_IO | 149 | #define REALLY_SLOW_IO |
@@ -633,7 +632,6 @@ static DEFINE_TIMER(fd_timeout, floppy_shutdown, 0, 0); | |||
633 | 632 | ||
634 | static const char *timeout_message; | 633 | static const char *timeout_message; |
635 | 634 | ||
636 | #ifdef FLOPPY_SANITY_CHECK | ||
637 | static void is_alive(const char *message) | 635 | static void is_alive(const char *message) |
638 | { | 636 | { |
639 | /* this routine checks whether the floppy driver is "alive" */ | 637 | /* this routine checks whether the floppy driver is "alive" */ |
@@ -642,12 +640,9 @@ static void is_alive(const char *message) | |||
642 | DPRINT("timeout handler died: %s\n", message); | 640 | DPRINT("timeout handler died: %s\n", message); |
643 | } | 641 | } |
644 | } | 642 | } |
645 | #endif | ||
646 | 643 | ||
647 | static void (*do_floppy)(void) = NULL; | 644 | static void (*do_floppy)(void) = NULL; |
648 | 645 | ||
649 | #ifdef FLOPPY_SANITY_CHECK | ||
650 | |||
651 | #define OLOGSIZE 20 | 646 | #define OLOGSIZE 20 |
652 | 647 | ||
653 | static void (*lasthandler)(void); | 648 | static void (*lasthandler)(void); |
@@ -663,7 +658,6 @@ static struct output_log { | |||
663 | } output_log[OLOGSIZE]; | 658 | } output_log[OLOGSIZE]; |
664 | 659 | ||
665 | static int output_log_pos; | 660 | static int output_log_pos; |
666 | #endif | ||
667 | 661 | ||
668 | #define current_reqD -1 | 662 | #define current_reqD -1 |
669 | #define MAXTIMEOUT -2 | 663 | #define MAXTIMEOUT -2 |
@@ -733,7 +727,6 @@ static int disk_change(int drive) | |||
733 | { | 727 | { |
734 | int fdc = FDC(drive); | 728 | int fdc = FDC(drive); |
735 | 729 | ||
736 | #ifdef FLOPPY_SANITY_CHECK | ||
737 | if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) | 730 | if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) |
738 | DPRINT("WARNING disk change called early\n"); | 731 | DPRINT("WARNING disk change called early\n"); |
739 | if (!(FDCS->dor & (0x10 << UNIT(drive))) || | 732 | if (!(FDCS->dor & (0x10 << UNIT(drive))) || |
@@ -742,7 +735,6 @@ static int disk_change(int drive) | |||
742 | DPRINT("drive=%d fdc=%d dor=%x\n", drive, FDC(drive), | 735 | DPRINT("drive=%d fdc=%d dor=%x\n", drive, FDC(drive), |
743 | (unsigned int)FDCS->dor); | 736 | (unsigned int)FDCS->dor); |
744 | } | 737 | } |
745 | #endif | ||
746 | 738 | ||
747 | debug_dcl(UDP->flags, | 739 | debug_dcl(UDP->flags, |
748 | "checking disk change line for drive %d\n", drive); | 740 | "checking disk change line for drive %d\n", drive); |
@@ -1095,7 +1087,6 @@ static void setup_DMA(void) | |||
1095 | { | 1087 | { |
1096 | unsigned long f; | 1088 | unsigned long f; |
1097 | 1089 | ||
1098 | #ifdef FLOPPY_SANITY_CHECK | ||
1099 | if (raw_cmd->length == 0) { | 1090 | if (raw_cmd->length == 0) { |
1100 | int i; | 1091 | int i; |
1101 | 1092 | ||
@@ -1113,7 +1104,6 @@ static void setup_DMA(void) | |||
1113 | FDCS->reset = 1; | 1104 | FDCS->reset = 1; |
1114 | return; | 1105 | return; |
1115 | } | 1106 | } |
1116 | #endif | ||
1117 | f = claim_dma_lock(); | 1107 | f = claim_dma_lock(); |
1118 | fd_disable_dma(); | 1108 | fd_disable_dma(); |
1119 | #ifdef fd_dma_setup | 1109 | #ifdef fd_dma_setup |
@@ -1173,12 +1163,10 @@ static int output_byte(char byte) | |||
1173 | 1163 | ||
1174 | if (is_ready_state(status)) { | 1164 | if (is_ready_state(status)) { |
1175 | fd_outb(byte, FD_DATA); | 1165 | fd_outb(byte, FD_DATA); |
1176 | #ifdef FLOPPY_SANITY_CHECK | ||
1177 | output_log[output_log_pos].data = byte; | 1166 | output_log[output_log_pos].data = byte; |
1178 | output_log[output_log_pos].status = status; | 1167 | output_log[output_log_pos].status = status; |
1179 | output_log[output_log_pos].jiffies = jiffies; | 1168 | output_log[output_log_pos].jiffies = jiffies; |
1180 | output_log_pos = (output_log_pos + 1) % OLOGSIZE; | 1169 | output_log_pos = (output_log_pos + 1) % OLOGSIZE; |
1181 | #endif | ||
1182 | return 0; | 1170 | return 0; |
1183 | } | 1171 | } |
1184 | FDCS->reset = 1; | 1172 | FDCS->reset = 1; |
@@ -1202,10 +1190,8 @@ static int result(void) | |||
1202 | break; | 1190 | break; |
1203 | status &= STATUS_DIR | STATUS_READY | STATUS_BUSY | STATUS_DMA; | 1191 | status &= STATUS_DIR | STATUS_READY | STATUS_BUSY | STATUS_DMA; |
1204 | if ((status & ~STATUS_BUSY) == STATUS_READY) { | 1192 | if ((status & ~STATUS_BUSY) == STATUS_READY) { |
1205 | #ifdef FLOPPY_SANITY_CHECK | ||
1206 | resultjiffies = jiffies; | 1193 | resultjiffies = jiffies; |
1207 | resultsize = i; | 1194 | resultsize = i; |
1208 | #endif | ||
1209 | return i; | 1195 | return i; |
1210 | } | 1196 | } |
1211 | if (status == (STATUS_DIR | STATUS_READY | STATUS_BUSY)) | 1197 | if (status == (STATUS_DIR | STATUS_READY | STATUS_BUSY)) |
@@ -1853,7 +1839,6 @@ static void show_floppy(void) | |||
1853 | jiffies, interruptjiffies, jiffies - interruptjiffies, | 1839 | jiffies, interruptjiffies, jiffies - interruptjiffies, |
1854 | lasthandler); | 1840 | lasthandler); |
1855 | 1841 | ||
1856 | #ifdef FLOPPY_SANITY_CHECK | ||
1857 | pr_info("timeout_message=%s\n", timeout_message); | 1842 | pr_info("timeout_message=%s\n", timeout_message); |
1858 | pr_info("last output bytes:\n"); | 1843 | pr_info("last output bytes:\n"); |
1859 | for (i = 0; i < OLOGSIZE; i++) | 1844 | for (i = 0; i < OLOGSIZE; i++) |
@@ -1865,7 +1850,6 @@ static void show_floppy(void) | |||
1865 | pr_info("last redo_fd_request at %lu\n", lastredo); | 1850 | pr_info("last redo_fd_request at %lu\n", lastredo); |
1866 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, | 1851 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, |
1867 | reply_buffer, resultsize, true); | 1852 | reply_buffer, resultsize, true); |
1868 | #endif | ||
1869 | 1853 | ||
1870 | pr_info("status=%x\n", fd_inb(FD_STATUS)); | 1854 | pr_info("status=%x\n", fd_inb(FD_STATUS)); |
1871 | pr_info("fdc_busy=%lu\n", fdc_busy); | 1855 | pr_info("fdc_busy=%lu\n", fdc_busy); |
@@ -2381,7 +2365,6 @@ static void rw_interrupt(void) | |||
2381 | R_HEAD - HEAD) * SECT_PER_TRACK + | 2365 | R_HEAD - HEAD) * SECT_PER_TRACK + |
2382 | R_SECTOR - SECTOR + eoc) << SIZECODE >> 2; | 2366 | R_SECTOR - SECTOR + eoc) << SIZECODE >> 2; |
2383 | 2367 | ||
2384 | #ifdef FLOPPY_SANITY_CHECK | ||
2385 | if (nr_sectors / ssize > | 2368 | if (nr_sectors / ssize > |
2386 | DIV_ROUND_UP(in_sector_offset + current_count_sectors, ssize)) { | 2369 | DIV_ROUND_UP(in_sector_offset + current_count_sectors, ssize)) { |
2387 | DPRINT("long rw: %x instead of %lx\n", | 2370 | DPRINT("long rw: %x instead of %lx\n", |
@@ -2394,7 +2377,6 @@ static void rw_interrupt(void) | |||
2394 | SECT_PER_TRACK, fsector_t, ssize); | 2377 | SECT_PER_TRACK, fsector_t, ssize); |
2395 | pr_info("in_sector_offset=%d\n", in_sector_offset); | 2378 | pr_info("in_sector_offset=%d\n", in_sector_offset); |
2396 | } | 2379 | } |
2397 | #endif | ||
2398 | 2380 | ||
2399 | nr_sectors -= in_sector_offset; | 2381 | nr_sectors -= in_sector_offset; |
2400 | INFBOUND(nr_sectors, 0); | 2382 | INFBOUND(nr_sectors, 0); |
@@ -2499,7 +2481,6 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2499 | blk_rq_sectors(current_req)); | 2481 | blk_rq_sectors(current_req)); |
2500 | 2482 | ||
2501 | remaining = current_count_sectors << 9; | 2483 | remaining = current_count_sectors << 9; |
2502 | #ifdef FLOPPY_SANITY_CHECK | ||
2503 | if (remaining > blk_rq_bytes(current_req) && CT(COMMAND) == FD_WRITE) { | 2484 | if (remaining > blk_rq_bytes(current_req) && CT(COMMAND) == FD_WRITE) { |
2504 | DPRINT("in copy buffer\n"); | 2485 | DPRINT("in copy buffer\n"); |
2505 | pr_info("current_count_sectors=%ld\n", current_count_sectors); | 2486 | pr_info("current_count_sectors=%ld\n", current_count_sectors); |
@@ -2511,7 +2492,6 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2511 | pr_info("max_sector=%d\n", max_sector); | 2492 | pr_info("max_sector=%d\n", max_sector); |
2512 | pr_info("ssize=%d\n", ssize); | 2493 | pr_info("ssize=%d\n", ssize); |
2513 | } | 2494 | } |
2514 | #endif | ||
2515 | 2495 | ||
2516 | buffer_max = max(max_sector, buffer_max); | 2496 | buffer_max = max(max_sector, buffer_max); |
2517 | 2497 | ||
@@ -2527,7 +2507,6 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2527 | SUPBOUND(size, remaining); | 2507 | SUPBOUND(size, remaining); |
2528 | 2508 | ||
2529 | buffer = page_address(bv->bv_page) + bv->bv_offset; | 2509 | buffer = page_address(bv->bv_page) + bv->bv_offset; |
2530 | #ifdef FLOPPY_SANITY_CHECK | ||
2531 | if (dma_buffer + size > | 2510 | if (dma_buffer + size > |
2532 | floppy_track_buffer + (max_buffer_sectors << 10) || | 2511 | floppy_track_buffer + (max_buffer_sectors << 10) || |
2533 | dma_buffer < floppy_track_buffer) { | 2512 | dma_buffer < floppy_track_buffer) { |
@@ -2545,7 +2524,7 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2545 | } | 2524 | } |
2546 | if (((unsigned long)buffer) % 512) | 2525 | if (((unsigned long)buffer) % 512) |
2547 | DPRINT("%p buffer not aligned\n", buffer); | 2526 | DPRINT("%p buffer not aligned\n", buffer); |
2548 | #endif | 2527 | |
2549 | if (CT(COMMAND) == FD_READ) | 2528 | if (CT(COMMAND) == FD_READ) |
2550 | memcpy(buffer, dma_buffer, size); | 2529 | memcpy(buffer, dma_buffer, size); |
2551 | else | 2530 | else |
@@ -2554,13 +2533,11 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2554 | remaining -= size; | 2533 | remaining -= size; |
2555 | dma_buffer += size; | 2534 | dma_buffer += size; |
2556 | } | 2535 | } |
2557 | #ifdef FLOPPY_SANITY_CHECK | ||
2558 | if (remaining) { | 2536 | if (remaining) { |
2559 | if (remaining > 0) | 2537 | if (remaining > 0) |
2560 | max_sector -= remaining >> 9; | 2538 | max_sector -= remaining >> 9; |
2561 | DPRINT("weirdness: remaining %d\n", remaining >> 9); | 2539 | DPRINT("weirdness: remaining %d\n", remaining >> 9); |
2562 | } | 2540 | } |
2563 | #endif | ||
2564 | } | 2541 | } |
2565 | 2542 | ||
2566 | /* work around a bug in pseudo DMA | 2543 | /* work around a bug in pseudo DMA |
@@ -2580,13 +2557,11 @@ static void virtualdmabug_workaround(void) | |||
2580 | 2557 | ||
2581 | hard_sectors = raw_cmd->length >> (7 + SIZECODE); | 2558 | hard_sectors = raw_cmd->length >> (7 + SIZECODE); |
2582 | end_sector = SECTOR + hard_sectors - 1; | 2559 | end_sector = SECTOR + hard_sectors - 1; |
2583 | #ifdef FLOPPY_SANITY_CHECK | ||
2584 | if (end_sector > SECT_PER_TRACK) { | 2560 | if (end_sector > SECT_PER_TRACK) { |
2585 | pr_info("too many sectors %d > %d\n", | 2561 | pr_info("too many sectors %d > %d\n", |
2586 | end_sector, SECT_PER_TRACK); | 2562 | end_sector, SECT_PER_TRACK); |
2587 | return; | 2563 | return; |
2588 | } | 2564 | } |
2589 | #endif | ||
2590 | SECT_PER_TRACK = end_sector; | 2565 | SECT_PER_TRACK = end_sector; |
2591 | /* make sure SECT_PER_TRACK | 2566 | /* make sure SECT_PER_TRACK |
2592 | * points to end of transfer */ | 2567 | * points to end of transfer */ |
@@ -2805,10 +2780,8 @@ static int make_raw_rw_request(void) | |||
2805 | * if we get here, we know that the write | 2780 | * if we get here, we know that the write |
2806 | * is either aligned or the data already in the buffer | 2781 | * is either aligned or the data already in the buffer |
2807 | * (buffer will be overwritten) */ | 2782 | * (buffer will be overwritten) */ |
2808 | #ifdef FLOPPY_SANITY_CHECK | ||
2809 | if (in_sector_offset && buffer_track == -1) | 2783 | if (in_sector_offset && buffer_track == -1) |
2810 | DPRINT("internal error offset !=0 on write\n"); | 2784 | DPRINT("internal error offset !=0 on write\n"); |
2811 | #endif | ||
2812 | buffer_track = raw_cmd->track; | 2785 | buffer_track = raw_cmd->track; |
2813 | buffer_drive = current_drive; | 2786 | buffer_drive = current_drive; |
2814 | copy_buffer(ssize, max_sector, | 2787 | copy_buffer(ssize, max_sector, |
@@ -2822,7 +2795,6 @@ static int make_raw_rw_request(void) | |||
2822 | raw_cmd->length = in_sector_offset + current_count_sectors; | 2795 | raw_cmd->length = in_sector_offset + current_count_sectors; |
2823 | raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1; | 2796 | raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1; |
2824 | raw_cmd->length <<= 9; | 2797 | raw_cmd->length <<= 9; |
2825 | #ifdef FLOPPY_SANITY_CHECK | ||
2826 | if ((raw_cmd->length < current_count_sectors << 9) || | 2798 | if ((raw_cmd->length < current_count_sectors << 9) || |
2827 | (raw_cmd->kernel_data != current_req->buffer && | 2799 | (raw_cmd->kernel_data != current_req->buffer && |
2828 | CT(COMMAND) == FD_WRITE && | 2800 | CT(COMMAND) == FD_WRITE && |
@@ -2879,7 +2851,6 @@ static int make_raw_rw_request(void) | |||
2879 | DPRINT("zero dma transfer attempted from make_raw_request\n"); | 2851 | DPRINT("zero dma transfer attempted from make_raw_request\n"); |
2880 | return 0; | 2852 | return 0; |
2881 | } | 2853 | } |
2882 | #endif | ||
2883 | 2854 | ||
2884 | virtualdmabug_workaround(); | 2855 | virtualdmabug_workaround(); |
2885 | return 2; | 2856 | return 2; |
@@ -4526,11 +4497,9 @@ cleanup: | |||
4526 | static void floppy_release_irq_and_dma(void) | 4497 | static void floppy_release_irq_and_dma(void) |
4527 | { | 4498 | { |
4528 | int old_fdc; | 4499 | int old_fdc; |
4529 | #ifdef FLOPPY_SANITY_CHECK | ||
4530 | #ifndef __sparc__ | 4500 | #ifndef __sparc__ |
4531 | int drive; | 4501 | int drive; |
4532 | #endif | 4502 | #endif |
4533 | #endif | ||
4534 | long tmpsize; | 4503 | long tmpsize; |
4535 | unsigned long tmpaddr; | 4504 | unsigned long tmpaddr; |
4536 | unsigned long flags; | 4505 | unsigned long flags; |
@@ -4561,7 +4530,6 @@ static void floppy_release_irq_and_dma(void) | |||
4561 | buffer_min = buffer_max = -1; | 4530 | buffer_min = buffer_max = -1; |
4562 | fd_dma_mem_free(tmpaddr, tmpsize); | 4531 | fd_dma_mem_free(tmpaddr, tmpsize); |
4563 | } | 4532 | } |
4564 | #ifdef FLOPPY_SANITY_CHECK | ||
4565 | #ifndef __sparc__ | 4533 | #ifndef __sparc__ |
4566 | for (drive = 0; drive < N_FDC * 4; drive++) | 4534 | for (drive = 0; drive < N_FDC * 4; drive++) |
4567 | if (timer_pending(motor_off_timer + drive)) | 4535 | if (timer_pending(motor_off_timer + drive)) |
@@ -4574,7 +4542,6 @@ static void floppy_release_irq_and_dma(void) | |||
4574 | pr_info("auxiliary floppy timer still active\n"); | 4542 | pr_info("auxiliary floppy timer still active\n"); |
4575 | if (work_pending(&floppy_work)) | 4543 | if (work_pending(&floppy_work)) |
4576 | pr_info("work still pending\n"); | 4544 | pr_info("work still pending\n"); |
4577 | #endif | ||
4578 | old_fdc = fdc; | 4545 | old_fdc = fdc; |
4579 | for (fdc = 0; fdc < N_FDC; fdc++) | 4546 | for (fdc = 0; fdc < N_FDC; fdc++) |
4580 | if (FDCS->address != -1) | 4547 | if (FDCS->address != -1) |