Commit bcc77d9cc12f5fd3e54ea01a6ef8f09e4d7b54a8
Committed by
Bartlomiej Zolnierkiewicz
1 parent
7e8b163b25
Exists in
master
and in
4 other branches
ide-floppy: cleanup and unify debugging macro calls
* some debug_log() calls were not using "ide-floppy: " prefix * a few used printk levels different than KERN_INFO (KERN_NOTICE and KERN_ERR, which is the default one if no level is given) Bart: - fix build issues for IDEFLOPPY_DEBUG_LOG set to 1 while at it - s/__FUNCTION__/__func__/ Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Showing 1 changed file with 31 additions and 37 deletions Side-by-side Diff
drivers/ide/ide-floppy.c
... | ... | @@ -58,7 +58,8 @@ |
58 | 58 | #define IDEFLOPPY_DEBUG( fmt, args... ) |
59 | 59 | |
60 | 60 | #if IDEFLOPPY_DEBUG_LOG |
61 | -#define debug_log printk | |
61 | +#define debug_log(fmt, args...) \ | |
62 | + printk(KERN_INFO "ide-floppy: " fmt, ## args) | |
62 | 63 | #else |
63 | 64 | #define debug_log(fmt, args... ) do {} while(0) |
64 | 65 | #endif |
... | ... | @@ -478,7 +479,7 @@ |
478 | 479 | struct request *rq = HWGROUP(drive)->rq; |
479 | 480 | int error; |
480 | 481 | |
481 | - debug_log(KERN_INFO "Reached idefloppy_end_request\n"); | |
482 | + debug_log("Reached %s\n", __func__); | |
482 | 483 | |
483 | 484 | switch (uptodate) { |
484 | 485 | case 0: error = IDEFLOPPY_ERROR_GENERAL; break; |
485 | 486 | |
486 | 487 | |
... | ... | @@ -624,21 +625,20 @@ |
624 | 625 | floppy->progress_indication = result->sksv[0] & 0x80 ? |
625 | 626 | (u16)get_unaligned((u16 *)(result->sksv+1)):0x10000; |
626 | 627 | if (floppy->failed_pc) |
627 | - debug_log(KERN_INFO "ide-floppy: pc = %x, sense key = %x, " | |
628 | - "asc = %x, ascq = %x\n", floppy->failed_pc->c[0], | |
629 | - result->sense_key, result->asc, result->ascq); | |
628 | + debug_log("pc = %x, sense key = %x, asc = %x, ascq = %x\n", | |
629 | + floppy->failed_pc->c[0], result->sense_key, | |
630 | + result->asc, result->ascq); | |
630 | 631 | else |
631 | - debug_log(KERN_INFO "ide-floppy: sense key = %x, asc = %x, " | |
632 | - "ascq = %x\n", result->sense_key, | |
633 | - result->asc, result->ascq); | |
632 | + debug_log("sense key = %x, asc = %x, ascq = %x\n", | |
633 | + result->sense_key, result->asc, result->ascq); | |
634 | 634 | } |
635 | 635 | |
636 | 636 | static void idefloppy_request_sense_callback (ide_drive_t *drive) |
637 | 637 | { |
638 | 638 | idefloppy_floppy_t *floppy = drive->driver_data; |
639 | 639 | |
640 | - debug_log(KERN_INFO "ide-floppy: Reached %s\n", __FUNCTION__); | |
641 | - | |
640 | + debug_log("Reached %s\n", __func__); | |
641 | + | |
642 | 642 | if (!floppy->pc->error) { |
643 | 643 | idefloppy_analyze_error(drive,(idefloppy_request_sense_result_t *) floppy->pc->buffer); |
644 | 644 | idefloppy_do_end_request(drive, 1, 0); |
645 | 645 | |
... | ... | @@ -654,9 +654,9 @@ |
654 | 654 | static void idefloppy_pc_callback (ide_drive_t *drive) |
655 | 655 | { |
656 | 656 | idefloppy_floppy_t *floppy = drive->driver_data; |
657 | - | |
658 | - debug_log(KERN_INFO "ide-floppy: Reached %s\n", __FUNCTION__); | |
659 | 657 | |
658 | + debug_log("Reached %s\n", __func__); | |
659 | + | |
660 | 660 | idefloppy_do_end_request(drive, floppy->pc->error ? 0 : 1, 0); |
661 | 661 | } |
662 | 662 | |
... | ... | @@ -714,8 +714,7 @@ |
714 | 714 | u16 bcount; |
715 | 715 | u8 stat, ireason; |
716 | 716 | |
717 | - debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", | |
718 | - __FUNCTION__); | |
717 | + debug_log("Reached %s interrupt handler\n", __func__); | |
719 | 718 | |
720 | 719 | if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) { |
721 | 720 | if (HWIF(drive)->ide_dma_end(drive)) { |
722 | 721 | |
723 | 722 | |
... | ... | @@ -724,23 +723,22 @@ |
724 | 723 | pc->actually_transferred = pc->request_transfer; |
725 | 724 | idefloppy_update_buffers(drive, pc); |
726 | 725 | } |
727 | - debug_log(KERN_INFO "ide-floppy: DMA finished\n"); | |
726 | + debug_log("DMA finished\n"); | |
728 | 727 | } |
729 | 728 | |
730 | 729 | /* Clear the interrupt */ |
731 | 730 | stat = drive->hwif->INB(IDE_STATUS_REG); |
732 | 731 | |
733 | 732 | if ((stat & DRQ_STAT) == 0) { /* No more interrupts */ |
734 | - debug_log(KERN_INFO "Packet command completed, %d bytes " | |
735 | - "transferred\n", pc->actually_transferred); | |
733 | + debug_log("Packet command completed, %d bytes transferred\n", | |
734 | + pc->actually_transferred); | |
736 | 735 | clear_bit(PC_DMA_IN_PROGRESS, &pc->flags); |
737 | 736 | |
738 | 737 | local_irq_enable_in_hardirq(); |
739 | 738 | |
740 | 739 | if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) { |
741 | 740 | /* Error detected */ |
742 | - debug_log(KERN_INFO "ide-floppy: %s: I/O error\n", | |
743 | - drive->name); | |
741 | + debug_log("%s: I/O error\n", drive->name); | |
744 | 742 | rq->errors++; |
745 | 743 | if (pc->c[0] == GPCMD_REQUEST_SENSE) { |
746 | 744 | printk(KERN_ERR "ide-floppy: I/O error in " |
... | ... | @@ -801,9 +799,8 @@ |
801 | 799 | NULL); |
802 | 800 | return ide_started; |
803 | 801 | } |
804 | - debug_log(KERN_NOTICE "ide-floppy: The floppy wants to " | |
805 | - "send us more data than expected - " | |
806 | - "allowing transfer\n"); | |
802 | + debug_log("The floppy wants to send us more data than" | |
803 | + " expected - allowing transfer\n"); | |
807 | 804 | } |
808 | 805 | } |
809 | 806 | if (test_bit(PC_WRITING, &pc->flags)) { |
... | ... | @@ -970,7 +967,7 @@ |
970 | 967 | return ide_stopped; |
971 | 968 | } |
972 | 969 | |
973 | - debug_log(KERN_INFO "Retry number - %d\n",pc->retries); | |
970 | + debug_log("Retry number - %d\n", pc->retries); | |
974 | 971 | |
975 | 972 | pc->retries++; |
976 | 973 | /* We haven't transferred any data yet */ |
... | ... | @@ -1019,7 +1016,7 @@ |
1019 | 1016 | |
1020 | 1017 | static void idefloppy_rw_callback (ide_drive_t *drive) |
1021 | 1018 | { |
1022 | - debug_log(KERN_INFO "ide-floppy: Reached idefloppy_rw_callback\n"); | |
1019 | + debug_log("Reached %s\n", __func__); | |
1023 | 1020 | |
1024 | 1021 | idefloppy_do_end_request(drive, 1, 0); |
1025 | 1022 | return; |
... | ... | @@ -1027,8 +1024,7 @@ |
1027 | 1024 | |
1028 | 1025 | static void idefloppy_create_prevent_cmd (idefloppy_pc_t *pc, int prevent) |
1029 | 1026 | { |
1030 | - debug_log(KERN_INFO "ide-floppy: creating prevent removal command, " | |
1031 | - "prevent = %d\n", prevent); | |
1027 | + debug_log("creating prevent removal command, prevent = %d\n", prevent); | |
1032 | 1028 | |
1033 | 1029 | idefloppy_init_pc(pc); |
1034 | 1030 | pc->c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; |
1035 | 1031 | |
... | ... | @@ -1164,10 +1160,10 @@ |
1164 | 1160 | idefloppy_pc_t *pc; |
1165 | 1161 | unsigned long block = (unsigned long)block_s; |
1166 | 1162 | |
1167 | - debug_log(KERN_INFO "dev: %s, flags: %lx, errors: %d\n", | |
1163 | + debug_log("dev: %s, cmd_type: %x, errors: %d\n", | |
1168 | 1164 | rq->rq_disk ? rq->rq_disk->disk_name : "?", |
1169 | - rq->flags, rq->errors); | |
1170 | - debug_log(KERN_INFO "sector: %ld, nr_sectors: %ld, " | |
1165 | + rq->cmd_type, rq->errors); | |
1166 | + debug_log("sector: %ld, nr_sectors: %ld, " | |
1171 | 1167 | "current_nr_sectors: %d\n", (long)rq->sector, |
1172 | 1168 | rq->nr_sectors, rq->current_nr_sectors); |
1173 | 1169 | |
1174 | 1170 | |
... | ... | @@ -1376,12 +1372,10 @@ |
1376 | 1372 | } |
1377 | 1373 | } |
1378 | 1374 | if (!i) { |
1379 | - debug_log( "Descriptor 0 Code: %d\n", | |
1380 | - descriptor->dc); | |
1375 | + debug_log("Descriptor 0 Code: %d\n", descriptor->dc); | |
1381 | 1376 | } |
1382 | - debug_log( "Descriptor %d: %dkB, %d blocks, %d " | |
1383 | - "sector size\n", i, blocks * length / 1024, blocks, | |
1384 | - length); | |
1377 | + debug_log("Descriptor %d: %dkB, %d blocks, %d sector size\n", | |
1378 | + i, blocks * length / 1024, blocks, length); | |
1385 | 1379 | } |
1386 | 1380 | |
1387 | 1381 | /* Clik! disk does not support get_flexible_disk_page */ |
... | ... | @@ -1773,7 +1767,7 @@ |
1773 | 1767 | idefloppy_pc_t pc; |
1774 | 1768 | int ret = 0; |
1775 | 1769 | |
1776 | - debug_log(KERN_INFO "Reached idefloppy_open\n"); | |
1770 | + debug_log("Reached %s\n", __func__); | |
1777 | 1771 | |
1778 | 1772 | if (!(floppy = ide_floppy_get(disk))) |
1779 | 1773 | return -ENXIO; |
... | ... | @@ -1833,8 +1827,8 @@ |
1833 | 1827 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); |
1834 | 1828 | ide_drive_t *drive = floppy->drive; |
1835 | 1829 | idefloppy_pc_t pc; |
1836 | - | |
1837 | - debug_log(KERN_INFO "Reached idefloppy_release\n"); | |
1830 | + | |
1831 | + debug_log("Reached %s\n", __func__); | |
1838 | 1832 | |
1839 | 1833 | if (floppy->openers == 1) { |
1840 | 1834 | /* IOMEGA Clik! drives do not support lock/unlock commands */ |