diff options
Diffstat (limited to 'drivers/scsi/g_NCR5380.c')
-rw-r--r-- | drivers/scsi/g_NCR5380.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 5041f925c191..5cec6c60ca22 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -745,42 +745,36 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
745 | 745 | ||
746 | #include "NCR5380.c" | 746 | #include "NCR5380.c" |
747 | 747 | ||
748 | #define PRINTP(x) len += sprintf(buffer+len, x) | 748 | #define PRINTP(x) seq_printf(m, x) |
749 | #define ANDP , | 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 | PRINTP("0x%02x " ANDP opcode); | 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; | 758 | int i, s; |
761 | len += sprint_opcode(buffer, len, command[0]); | 759 | sprint_opcode(m, command[0]); |
762 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) | 760 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
763 | PRINTP("%02x " ANDP command[i]); | 761 | PRINTP("%02x " ANDP command[i]); |
764 | PRINTP("\n"); | 762 | PRINTP("\n"); |
765 | return len - start; | ||
766 | } | 763 | } |
767 | 764 | ||
768 | /** | 765 | /** |
769 | * sprintf_Scsi_Cmnd - print a scsi command | 766 | * sprintf_Scsi_Cmnd - print a scsi command |
770 | * @buffer: buffr to print into | 767 | * @m: seq_fil to print into |
771 | * @len: buffer length | ||
772 | * @cmd: SCSI command block | 768 | * @cmd: SCSI command block |
773 | * | 769 | * |
774 | * Print out the target and command data in hex | 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 | PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun); | 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 | PRINTP(" command = "); | 776 | PRINTP(" command = "); |
782 | len += sprint_command(buffer, len, cmd->cmnd); | 777 | sprint_command(m, cmd->cmnd); |
783 | return len - start; | ||
784 | } | 778 | } |
785 | 779 | ||
786 | /** | 780 | /** |
@@ -800,9 +794,8 @@ static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd) | |||
800 | * Locks: global cli/lock for queue walk | 794 | * Locks: global cli/lock for queue walk |
801 | */ | 795 | */ |
802 | 796 | ||
803 | static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, char **start, off_t offset, int length, int inout) | 797 | static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_ptr) |
804 | { | 798 | { |
805 | int len = 0; | ||
806 | NCR5380_local_declare(); | 799 | NCR5380_local_declare(); |
807 | unsigned long flags; | 800 | unsigned long flags; |
808 | unsigned char status; | 801 | unsigned char status; |
@@ -853,16 +846,16 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c | |||
853 | PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); | 846 | PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); |
854 | for (i = 0; i < 8; i++) | 847 | for (i = 0; i < 8; i++) |
855 | if (dev->vendor[i] >= 0x20) | 848 | if (dev->vendor[i] >= 0x20) |
856 | *(buffer + (len++)) = dev->vendor[i]; | 849 | seq_putc(m, dev->vendor[i]); |
857 | *(buffer + (len++)) = ' '; | 850 | seq_putc(m, ' '); |
858 | for (i = 0; i < 16; i++) | 851 | for (i = 0; i < 16; i++) |
859 | if (dev->model[i] >= 0x20) | 852 | if (dev->model[i] >= 0x20) |
860 | *(buffer + (len++)) = dev->model[i]; | 853 | seq_putc(m, dev->model[i]); |
861 | *(buffer + (len++)) = ' '; | 854 | seq_putc(m, ' '); |
862 | for (i = 0; i < 4; i++) | 855 | for (i = 0; i < 4; i++) |
863 | if (dev->rev[i] >= 0x20) | 856 | if (dev->rev[i] >= 0x20) |
864 | *(buffer + (len++)) = dev->rev[i]; | 857 | seq_putc(m, dev->rev[i]); |
865 | *(buffer + (len++)) = ' '; | 858 | seq_putc(m, ' '); |
866 | 859 | ||
867 | PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr); | 860 | PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr); |
868 | if (tr) | 861 | if (tr) |
@@ -886,32 +879,28 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c | |||
886 | if (!hostdata->connected) { | 879 | if (!hostdata->connected) { |
887 | PRINTP("No currently connected command\n"); | 880 | PRINTP("No currently connected command\n"); |
888 | } else { | 881 | } else { |
889 | len += sprint_Scsi_Cmnd(buffer, len, (Scsi_Cmnd *) hostdata->connected); | 882 | sprint_Scsi_Cmnd(m, (Scsi_Cmnd *) hostdata->connected); |
890 | } | 883 | } |
891 | 884 | ||
892 | PRINTP("issue_queue\n"); | 885 | PRINTP("issue_queue\n"); |
893 | 886 | ||
894 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 887 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
895 | len += sprint_Scsi_Cmnd(buffer, len, ptr); | 888 | sprint_Scsi_Cmnd(m, ptr); |
896 | 889 | ||
897 | PRINTP("disconnected_queue\n"); | 890 | PRINTP("disconnected_queue\n"); |
898 | 891 | ||
899 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 892 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
900 | len += sprint_Scsi_Cmnd(buffer, len, ptr); | 893 | sprint_Scsi_Cmnd(m, ptr); |
901 | 894 | ||
902 | *start = buffer + offset; | ||
903 | len -= offset; | ||
904 | if (len > length) | ||
905 | len = length; | ||
906 | spin_unlock_irqrestore(scsi_ptr->host_lock, flags); | 895 | spin_unlock_irqrestore(scsi_ptr->host_lock, flags); |
907 | return len; | 896 | return 0; |
908 | } | 897 | } |
909 | 898 | ||
910 | #undef PRINTP | 899 | #undef PRINTP |
911 | #undef ANDP | 900 | #undef ANDP |
912 | 901 | ||
913 | static struct scsi_host_template driver_template = { | 902 | static struct scsi_host_template driver_template = { |
914 | .proc_info = generic_NCR5380_proc_info, | 903 | .show_info = generic_NCR5380_show_info, |
915 | .name = "Generic NCR5380/NCR53C400 Scsi Driver", | 904 | .name = "Generic NCR5380/NCR53C400 Scsi Driver", |
916 | .detect = generic_NCR5380_detect, | 905 | .detect = generic_NCR5380_detect, |
917 | .release = generic_NCR5380_release_resources, | 906 | .release = generic_NCR5380_release_resources, |