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

NCR5830: switch to ->show_info()

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

Al Viro dd7ab71b b7654914

+76 -83
+32 -39
drivers/scsi/NCR5380.c
··· 695 695 * Return the number of bytes read from or written 696 696 */ 697 697 698 - #undef SPRINTF 699 - #define SPRINTF(args...) do { if(pos < buffer + length-80) pos += sprintf(pos, ## args); } while(0) 700 - static 701 - char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length); 702 - static 703 - char *lprint_command(unsigned char *cmd, char *pos, char *buffer, int len); 704 - static 705 - char *lprint_opcode(int opcode, char *pos, char *buffer, int length); 706 - 707 - static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, 708 - char *buffer, char **start, off_t offset, int length, int inout) 698 + static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, 699 + char *buffer, int length) 709 700 { 710 - char *pos = buffer; 701 + #ifdef DTC_PUBLIC_RELEASE 702 + dtc_wmaxi = dtc_maxi = 0; 703 + #endif 704 + #ifdef PAS16_PUBLIC_RELEASE 705 + pas_wmaxi = pas_maxi = 0; 706 + #endif 707 + return (-ENOSYS); /* Currently this is a no-op */ 708 + } 709 + 710 + #undef SPRINTF 711 + #define SPRINTF(args...) seq_printf(m, ## args) 712 + static 713 + void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m); 714 + static 715 + void lprint_command(unsigned char *cmd, struct seq_file *m); 716 + static 717 + void lprint_opcode(int opcode, struct seq_file *m); 718 + 719 + static int __maybe_unused NCR5380_show_info(struct seq_file *m, 720 + struct Scsi_Host *instance) 721 + { 711 722 struct NCR5380_hostdata *hostdata; 712 723 Scsi_Cmnd *ptr; 713 724 714 725 hostdata = (struct NCR5380_hostdata *) instance->hostdata; 715 726 716 - if (inout) { /* Has data been written to the file ? */ 717 - #ifdef DTC_PUBLIC_RELEASE 718 - dtc_wmaxi = dtc_maxi = 0; 719 - #endif 720 - #ifdef PAS16_PUBLIC_RELEASE 721 - pas_wmaxi = pas_maxi = 0; 722 - #endif 723 - return (-ENOSYS); /* Currently this is a no-op */ 724 - } 725 727 SPRINTF("NCR5380 core release=%d. ", NCR5380_PUBLIC_RELEASE); 726 728 if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) 727 729 SPRINTF("ncr53c400 release=%d. ", NCR53C400_PUBLIC_RELEASE); ··· 757 755 if (!hostdata->connected) 758 756 SPRINTF("scsi%d: no currently connected command\n", instance->host_no); 759 757 else 760 - pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, pos, buffer, length); 758 + lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m); 761 759 SPRINTF("scsi%d: issue_queue\n", instance->host_no); 762 760 for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) 763 - pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); 761 + lprint_Scsi_Cmnd(ptr, m); 764 762 765 763 SPRINTF("scsi%d: disconnected_queue\n", instance->host_no); 766 764 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) 767 - pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); 765 + lprint_Scsi_Cmnd(ptr, m); 768 766 spin_unlock_irq(instance->host_lock); 769 - 770 - *start = buffer; 771 - if (pos - buffer < offset) 772 - return 0; 773 - else if (pos - buffer - offset < length) 774 - return pos - buffer - offset; 775 - return length; 767 + return 0; 776 768 } 777 769 778 - static char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length) 770 + static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m) 779 771 { 780 772 SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); 781 773 SPRINTF(" command = "); 782 - pos = lprint_command(cmd->cmnd, pos, buffer, length); 783 - return (pos); 774 + lprint_command(cmd->cmnd, m); 784 775 } 785 776 786 - static char *lprint_command(unsigned char *command, char *pos, char *buffer, int length) 777 + static void lprint_command(unsigned char *command, struct seq_file *m) 787 778 { 788 779 int i, s; 789 - pos = lprint_opcode(command[0], pos, buffer, length); 780 + lprint_opcode(command[0], m); 790 781 for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 791 782 SPRINTF("%02x ", command[i]); 792 783 SPRINTF("\n"); 793 - return (pos); 794 784 } 795 785 796 - static char *lprint_opcode(int opcode, char *pos, char *buffer, int length) 786 + static void lprint_opcode(int opcode, struct seq_file *m) 797 787 { 798 788 SPRINTF("%2d (0x%02x)", opcode, opcode); 799 - return (pos); 800 789 } 801 790 802 791
+4 -2
drivers/scsi/NCR5380.h
··· 314 314 static int NCR5380_abort(Scsi_Cmnd * cmd); 315 315 static int NCR5380_bus_reset(Scsi_Cmnd * cmd); 316 316 static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); 317 - static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, 318 - char *buffer, char **start, off_t offset, int length, int inout); 317 + static int __maybe_unused NCR5380_show_info(struct seq_file *, 318 + struct Scsi_Host *); 319 + static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, 320 + char *buffer, int length); 319 321 320 322 static void NCR5380_reselect(struct Scsi_Host *instance); 321 323 static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag);
-1
drivers/scsi/arm/cumana_1.c
··· 30 30 #define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value) 31 31 #define NCR5380_intr cumanascsi_intr 32 32 #define NCR5380_queue_command cumanascsi_queue_command 33 - #define NCR5380_proc_info cumanascsi_proc_info 34 33 35 34 #define NCR5380_implementation_fields \ 36 35 unsigned ctrl; \
+4 -2
drivers/scsi/arm/oak.c
··· 31 31 #define NCR5380_write(reg, value) writeb(value, _base + ((reg) << 2)) 32 32 #define NCR5380_intr oakscsi_intr 33 33 #define NCR5380_queue_command oakscsi_queue_command 34 - #define NCR5380_proc_info oakscsi_proc_info 34 + #define NCR5380_show_info oakscsi_show_info 35 + #define NCR5380_write_info oakscsi_write_info 35 36 36 37 #define NCR5380_implementation_fields \ 37 38 void __iomem *base ··· 116 115 117 116 static struct scsi_host_template oakscsi_template = { 118 117 .module = THIS_MODULE, 119 - .proc_info = oakscsi_proc_info, 118 + .show_info = oakscsi_show_info, 119 + .write_info = oakscsi_write_info, 120 120 .name = "Oak 16-bit SCSI", 121 121 .info = oakscsi_info, 122 122 .queuecommand = oakscsi_queue_command,
+2 -1
drivers/scsi/dtc.c
··· 216 216 int sig, count; 217 217 218 218 tpnt->proc_name = "dtc3x80"; 219 - tpnt->proc_info = &dtc_proc_info; 219 + tpnt->show_info = dtc_show_info; 220 + tpnt->write_info = dtc_write_info; 220 221 221 222 for (count = 0; current_override < NO_OVERRIDES; ++current_override) { 222 223 addr = 0;
+2 -1
drivers/scsi/dtc.h
··· 88 88 #define NCR5380_queue_command dtc_queue_command 89 89 #define NCR5380_abort dtc_abort 90 90 #define NCR5380_bus_reset dtc_bus_reset 91 - #define NCR5380_proc_info dtc_proc_info 91 + #define NCR5380_show_info dtc_show_info 92 + #define NCR5380_write_info dtc_write_info 92 93 93 94 /* 15 12 11 10 94 95 1001 1100 0000 0000 */
+20 -31
drivers/scsi/g_NCR5380.c
··· 745 745 746 746 #include "NCR5380.c" 747 747 748 - #define PRINTP(x) len += sprintf(buffer+len, x) 748 + #define PRINTP(x) seq_printf(m, x) 749 749 #define ANDP , 750 750 751 - static int sprint_opcode(char *buffer, int len, int opcode) 751 + static void sprint_opcode(struct seq_file *m, int opcode) 752 752 { 753 - int start = len; 754 753 PRINTP("0x%02x " ANDP opcode); 755 - return len - start; 756 754 } 757 755 758 - static int sprint_command(char *buffer, int len, unsigned char *command) 756 + static void sprint_command(struct seq_file *m, unsigned char *command) 759 757 { 760 - int i, s, start = len; 761 - len += sprint_opcode(buffer, len, command[0]); 758 + int i, s; 759 + sprint_opcode(m, command[0]); 762 760 for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 763 761 PRINTP("%02x " ANDP command[i]); 764 762 PRINTP("\n"); 765 - return len - start; 766 763 } 767 764 768 765 /** 769 766 * sprintf_Scsi_Cmnd - print a scsi command 770 - * @buffer: buffr to print into 771 - * @len: buffer length 767 + * @m: seq_fil to print into 772 768 * @cmd: SCSI command block 773 769 * 774 770 * Print out the target and command data in hex 775 771 */ 776 772 777 - static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd) 773 + static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd) 778 774 { 779 - int start = len; 780 775 PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun); 781 776 PRINTP(" command = "); 782 - len += sprint_command(buffer, len, cmd->cmnd); 783 - return len - start; 777 + sprint_command(m, cmd->cmnd); 784 778 } 785 779 786 780 /** ··· 794 800 * Locks: global cli/lock for queue walk 795 801 */ 796 802 797 - static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, char **start, off_t offset, int length, int inout) 803 + static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_ptr) 798 804 { 799 - int len = 0; 800 805 NCR5380_local_declare(); 801 806 unsigned long flags; 802 807 unsigned char status; ··· 846 853 PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); 847 854 for (i = 0; i < 8; i++) 848 855 if (dev->vendor[i] >= 0x20) 849 - *(buffer + (len++)) = dev->vendor[i]; 850 - *(buffer + (len++)) = ' '; 856 + seq_putc(m, dev->vendor[i]); 857 + seq_putc(m, ' '); 851 858 for (i = 0; i < 16; i++) 852 859 if (dev->model[i] >= 0x20) 853 - *(buffer + (len++)) = dev->model[i]; 854 - *(buffer + (len++)) = ' '; 860 + seq_putc(m, dev->model[i]); 861 + seq_putc(m, ' '); 855 862 for (i = 0; i < 4; i++) 856 863 if (dev->rev[i] >= 0x20) 857 - *(buffer + (len++)) = dev->rev[i]; 858 - *(buffer + (len++)) = ' '; 864 + seq_putc(m, dev->rev[i]); 865 + seq_putc(m, ' '); 859 866 860 867 PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr); 861 868 if (tr) ··· 879 886 if (!hostdata->connected) { 880 887 PRINTP("No currently connected command\n"); 881 888 } else { 882 - len += sprint_Scsi_Cmnd(buffer, len, (Scsi_Cmnd *) hostdata->connected); 889 + sprint_Scsi_Cmnd(m, (Scsi_Cmnd *) hostdata->connected); 883 890 } 884 891 885 892 PRINTP("issue_queue\n"); 886 893 887 894 for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) 888 - len += sprint_Scsi_Cmnd(buffer, len, ptr); 895 + sprint_Scsi_Cmnd(m, ptr); 889 896 890 897 PRINTP("disconnected_queue\n"); 891 898 892 899 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) 893 - len += sprint_Scsi_Cmnd(buffer, len, ptr); 900 + sprint_Scsi_Cmnd(m, ptr); 894 901 895 - *start = buffer + offset; 896 - len -= offset; 897 - if (len > length) 898 - len = length; 899 902 spin_unlock_irqrestore(scsi_ptr->host_lock, flags); 900 - return len; 903 + return 0; 901 904 } 902 905 903 906 #undef PRINTP 904 907 #undef ANDP 905 908 906 909 static struct scsi_host_template driver_template = { 907 - .proc_info = generic_NCR5380_proc_info, 910 + .show_info = generic_NCR5380_show_info, 908 911 .name = "Generic NCR5380/NCR53C400 Scsi Driver", 909 912 .detect = generic_NCR5380_detect, 910 913 .release = generic_NCR5380_release_resources,
+2 -1
drivers/scsi/mac_scsi.c
··· 561 561 562 562 static struct scsi_host_template driver_template = { 563 563 .proc_name = "Mac5380", 564 - .proc_info = macscsi_proc_info, 564 + .show_info = macscsi_show_info, 565 + .write_info = macscsi_write_info, 565 566 .name = "Macintosh NCR5380 SCSI", 566 567 .detect = macscsi_detect, 567 568 .release = macscsi_release,
+2 -1
drivers/scsi/mac_scsi.h
··· 72 72 #define NCR5380_queue_command macscsi_queue_command 73 73 #define NCR5380_abort macscsi_abort 74 74 #define NCR5380_bus_reset macscsi_bus_reset 75 - #define NCR5380_proc_info macscsi_proc_info 75 + #define NCR5380_show_info macscsi_show_info 76 + #define NCR5380_write_info macscsi_write_info 76 77 77 78 #define BOARD_NORMAL 0 78 79 #define BOARD_NCR53C400 1
+2 -1
drivers/scsi/pas16.c
··· 388 388 int count; 389 389 390 390 tpnt->proc_name = "pas16"; 391 - tpnt->proc_info = &pas16_proc_info; 391 + tpnt->show_info = pas16_show_info; 392 + tpnt->write_info = pas16_write_info; 392 393 393 394 if (pas16_addr != 0) { 394 395 overrides[0].io_port = pas16_addr;
+2 -1
drivers/scsi/pas16.h
··· 163 163 #define NCR5380_queue_command pas16_queue_command 164 164 #define NCR5380_abort pas16_abort 165 165 #define NCR5380_bus_reset pas16_bus_reset 166 - #define NCR5380_proc_info pas16_proc_info 166 + #define NCR5380_show_info pas16_show_info 167 + #define NCR5380_write_info pas16_write_info 167 168 168 169 /* 15 14 12 10 7 5 3 169 170 1101 0100 1010 1000 */
+2 -1
drivers/scsi/t128.c
··· 201 201 int sig, count; 202 202 203 203 tpnt->proc_name = "t128"; 204 - tpnt->proc_info = &t128_proc_info; 204 + tpnt->show_info = t128_show_info; 205 + tpnt->write_info = t128_write_info; 205 206 206 207 for (count = 0; current_override < NO_OVERRIDES; ++current_override) { 207 208 base = 0;
+2 -1
drivers/scsi/t128.h
··· 140 140 #define NCR5380_queue_command t128_queue_command 141 141 #define NCR5380_abort t128_abort 142 142 #define NCR5380_bus_reset t128_bus_reset 143 - #define NCR5380_proc_info t128_proc_info 143 + #define NCR5380_show_info t128_show_info 144 + #define NCR5380_write_info t128_write_info 144 145 145 146 /* 15 14 12 10 7 5 3 146 147 1101 0100 1010 1000 */