Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

atari_scsi: switch to ->show_info()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro d89537e1 f0002e95

+64 -89
+62 -87
drivers/scsi/atari_NCR5380.c
··· 719 719 * Inputs : instance, pointer to this instance. 720 720 */ 721 721 722 + static void lprint_Scsi_Cmnd(Scsi_Cmnd *cmd) 723 + { 724 + int i, s; 725 + unsigned char *command; 726 + printk("scsi%d: destination target %d, lun %d\n", 727 + H_NO(cmd), cmd->device->id, cmd->device->lun); 728 + printk(KERN_CONT " command = "); 729 + command = cmd->cmnd; 730 + printk(KERN_CONT "%2d (0x%02x)", command[0], command[0]); 731 + for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 732 + printk(KERN_CONT " %02x", command[i]); 733 + printk("\n"); 734 + } 735 + 722 736 static void NCR5380_print_status(struct Scsi_Host *instance) 723 737 { 724 - char *pr_bfr; 725 - char *start; 726 - int len; 738 + struct NCR5380_hostdata *hostdata; 739 + Scsi_Cmnd *ptr; 740 + unsigned long flags; 727 741 728 742 NCR_PRINT(NDEBUG_ANY); 729 743 NCR_PRINT_PHASE(NDEBUG_ANY); 730 744 731 - pr_bfr = (char *)__get_free_page(GFP_ATOMIC); 732 - if (!pr_bfr) { 733 - printk("NCR5380_print_status: no memory for print buffer\n"); 734 - return; 735 - } 736 - len = NCR5380_proc_info(instance, pr_bfr, &start, 0, PAGE_SIZE, 0); 737 - pr_bfr[len] = 0; 738 - printk("\n%s\n", pr_bfr); 739 - free_page((unsigned long)pr_bfr); 740 - } 741 - 742 - 743 - /******************************************/ 744 - /* 745 - * /proc/scsi/[dtc pas16 t128 generic]/[0-ASC_NUM_BOARD_SUPPORTED] 746 - * 747 - * *buffer: I/O buffer 748 - * **start: if inout == FALSE pointer into buffer where user read should start 749 - * offset: current offset 750 - * length: length of buffer 751 - * hostno: Scsi_Host host_no 752 - * inout: TRUE - user is writing; FALSE - user is reading 753 - * 754 - * Return the number of bytes read from or written 755 - */ 756 - 757 - #undef SPRINTF 758 - #define SPRINTF(fmt,args...) \ 759 - do { \ 760 - if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ 761 - pos += sprintf(pos, fmt , ## args); \ 762 - } while(0) 763 - static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length); 764 - 765 - static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer, 766 - char **start, off_t offset, int length, int inout) 767 - { 768 - char *pos = buffer; 769 - struct NCR5380_hostdata *hostdata; 770 - Scsi_Cmnd *ptr; 771 - unsigned long flags; 772 - off_t begin = 0; 773 - #define check_offset() \ 774 - do { \ 775 - if (pos - buffer < offset - begin) { \ 776 - begin += pos - buffer; \ 777 - pos = buffer; \ 778 - } \ 779 - } while (0) 780 - 781 745 hostdata = (struct NCR5380_hostdata *)instance->hostdata; 782 746 783 - if (inout) /* Has data been written to the file ? */ 784 - return -ENOSYS; /* Currently this is a no-op */ 785 - SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); 786 - check_offset(); 747 + printk("\nNCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); 787 748 local_irq_save(flags); 788 - SPRINTF("NCR5380: coroutine is%s running.\n", 749 + printk("NCR5380: coroutine is%s running.\n", 789 750 main_running ? "" : "n't"); 790 - check_offset(); 791 751 if (!hostdata->connected) 792 - SPRINTF("scsi%d: no currently connected command\n", HOSTNO); 752 + printk("scsi%d: no currently connected command\n", HOSTNO); 793 753 else 794 - pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, 795 - pos, buffer, length); 796 - SPRINTF("scsi%d: issue_queue\n", HOSTNO); 797 - check_offset(); 798 - for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) { 799 - pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); 800 - check_offset(); 801 - } 754 + lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected); 755 + printk("scsi%d: issue_queue\n", HOSTNO); 756 + for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) 757 + lprint_Scsi_Cmnd(ptr); 802 758 803 - SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); 804 - check_offset(); 759 + printk("scsi%d: disconnected_queue\n", HOSTNO); 805 760 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; 806 - ptr = NEXT(ptr)) { 807 - pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); 808 - check_offset(); 809 - } 761 + ptr = NEXT(ptr)) 762 + lprint_Scsi_Cmnd(ptr); 810 763 811 764 local_irq_restore(flags); 812 - *start = buffer + (offset - begin); 813 - if (pos - buffer < offset - begin) 814 - return 0; 815 - else if (pos - buffer - (offset - begin) < length) 816 - return pos - buffer - (offset - begin); 817 - return length; 765 + printk("\n"); 818 766 } 819 767 820 - static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length) 768 + static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m) 821 769 { 822 770 int i, s; 823 771 unsigned char *command; 824 - SPRINTF("scsi%d: destination target %d, lun %d\n", 772 + seq_printf(m, "scsi%d: destination target %d, lun %d\n", 825 773 H_NO(cmd), cmd->device->id, cmd->device->lun); 826 - SPRINTF(" command = "); 774 + seq_printf(m, " command = "); 827 775 command = cmd->cmnd; 828 - SPRINTF("%2d (0x%02x)", command[0], command[0]); 776 + seq_printf(m, "%2d (0x%02x)", command[0], command[0]); 829 777 for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 830 - SPRINTF(" %02x", command[i]); 831 - SPRINTF("\n"); 832 - return pos; 778 + seq_printf(m, " %02x", command[i]); 779 + seq_printf(m, "\n"); 833 780 } 834 781 782 + static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance) 783 + { 784 + struct NCR5380_hostdata *hostdata; 785 + Scsi_Cmnd *ptr; 786 + unsigned long flags; 787 + 788 + hostdata = (struct NCR5380_hostdata *)instance->hostdata; 789 + 790 + seq_printf(m, "NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); 791 + local_irq_save(flags); 792 + seq_printf(m, "NCR5380: coroutine is%s running.\n", 793 + main_running ? "" : "n't"); 794 + if (!hostdata->connected) 795 + seq_printf(m, "scsi%d: no currently connected command\n", HOSTNO); 796 + else 797 + show_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m); 798 + seq_printf(m, "scsi%d: issue_queue\n", HOSTNO); 799 + for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) 800 + show_Scsi_Cmnd(ptr, m); 801 + 802 + seq_printf(m, "scsi%d: disconnected_queue\n", HOSTNO); 803 + for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; 804 + ptr = NEXT(ptr)) 805 + show_Scsi_Cmnd(ptr, m); 806 + 807 + local_irq_restore(flags); 808 + return 0; 809 + } 835 810 836 811 /* 837 812 * Function : void NCR5380_init (struct Scsi_Host *instance)
+1 -1
drivers/scsi/atari_scsi.c
··· 1100 1100 #include "atari_NCR5380.c" 1101 1101 1102 1102 static struct scsi_host_template driver_template = { 1103 - .proc_info = atari_scsi_proc_info, 1103 + .show_info = atari_scsi_show_info, 1104 1104 .name = "Atari native SCSI", 1105 1105 .detect = atari_scsi_detect, 1106 1106 .release = atari_scsi_release,
+1 -1
drivers/scsi/atari_scsi.h
··· 47 47 #define NCR5380_intr atari_scsi_intr 48 48 #define NCR5380_queue_command atari_scsi_queue_command 49 49 #define NCR5380_abort atari_scsi_abort 50 - #define NCR5380_proc_info atari_scsi_proc_info 50 + #define NCR5380_show_info atari_scsi_show_info 51 51 #define NCR5380_dma_read_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 0) 52 52 #define NCR5380_dma_write_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 1) 53 53 #define NCR5380_dma_residual(inst) atari_scsi_dma_residual( inst )