aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/NCR5380.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 01:15:54 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:17 -0400
commitdd7ab71bb3b4dad7fa1c4fd89706d6870991cfe6 (patch)
tree7d222384c4c958d89ac755a70261c0a4f6071419 /drivers/scsi/NCR5380.c
parentb7654914bb8059a9817f32f4c4d0e7f75a08b78a (diff)
NCR5830: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi/NCR5380.c')
-rw-r--r--drivers/scsi/NCR5380.c61
1 files changed, 27 insertions, 34 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 450353e04dde..1e9d6ad9302b 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -695,33 +695,35 @@ static void NCR5380_print_status(struct Scsi_Host *instance)
695 * Return the number of bytes read from or written 695 * Return the number of bytes read from or written
696 */ 696 */
697 697
698static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance,
699 char *buffer, int length)
700{
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
698#undef SPRINTF 710#undef SPRINTF
699#define SPRINTF(args...) do { if(pos < buffer + length-80) pos += sprintf(pos, ## args); } while(0) 711#define SPRINTF(args...) seq_printf(m, ## args)
700static 712static
701char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length); 713void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m);
702static 714static
703char *lprint_command(unsigned char *cmd, char *pos, char *buffer, int len); 715void lprint_command(unsigned char *cmd, struct seq_file *m);
704static 716static
705char *lprint_opcode(int opcode, char *pos, char *buffer, int length); 717void lprint_opcode(int opcode, struct seq_file *m);
706 718
707static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, 719static int __maybe_unused NCR5380_show_info(struct seq_file *m,
708 char *buffer, char **start, off_t offset, int length, int inout) 720 struct Scsi_Host *instance)
709{ 721{
710 char *pos = buffer;
711 struct NCR5380_hostdata *hostdata; 722 struct NCR5380_hostdata *hostdata;
712 Scsi_Cmnd *ptr; 723 Scsi_Cmnd *ptr;
713 724
714 hostdata = (struct NCR5380_hostdata *) instance->hostdata; 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 SPRINTF("NCR5380 core release=%d. ", NCR5380_PUBLIC_RELEASE); 727 SPRINTF("NCR5380 core release=%d. ", NCR5380_PUBLIC_RELEASE);
726 if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) 728 if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400)
727 SPRINTF("ncr53c400 release=%d. ", NCR53C400_PUBLIC_RELEASE); 729 SPRINTF("ncr53c400 release=%d. ", NCR53C400_PUBLIC_RELEASE);
@@ -755,46 +757,37 @@ static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance,
755 if (!hostdata->connected) 757 if (!hostdata->connected)
756 SPRINTF("scsi%d: no currently connected command\n", instance->host_no); 758 SPRINTF("scsi%d: no currently connected command\n", instance->host_no);
757 else 759 else
758 pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, pos, buffer, length); 760 lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m);
759 SPRINTF("scsi%d: issue_queue\n", instance->host_no); 761 SPRINTF("scsi%d: issue_queue\n", instance->host_no);
760 for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) 762 for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
761 pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); 763 lprint_Scsi_Cmnd(ptr, m);
762 764
763 SPRINTF("scsi%d: disconnected_queue\n", instance->host_no); 765 SPRINTF("scsi%d: disconnected_queue\n", instance->host_no);
764 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) 766 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
765 pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); 767 lprint_Scsi_Cmnd(ptr, m);
766 spin_unlock_irq(instance->host_lock); 768 spin_unlock_irq(instance->host_lock);
767 769 return 0;
768 *start = buffer;
769 if (pos - buffer < offset)
770 return 0;
771 else if (pos - buffer - offset < length)
772 return pos - buffer - offset;
773 return length;
774} 770}
775 771
776static char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length) 772static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m)
777{ 773{
778 SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); 774 SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
779 SPRINTF(" command = "); 775 SPRINTF(" command = ");
780 pos = lprint_command(cmd->cmnd, pos, buffer, length); 776 lprint_command(cmd->cmnd, m);
781 return (pos);
782} 777}
783 778
784static char *lprint_command(unsigned char *command, char *pos, char *buffer, int length) 779static void lprint_command(unsigned char *command, struct seq_file *m)
785{ 780{
786 int i, s; 781 int i, s;
787 pos = lprint_opcode(command[0], pos, buffer, length); 782 lprint_opcode(command[0], m);
788 for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 783 for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
789 SPRINTF("%02x ", command[i]); 784 SPRINTF("%02x ", command[i]);
790 SPRINTF("\n"); 785 SPRINTF("\n");
791 return (pos);
792} 786}
793 787
794static char *lprint_opcode(int opcode, char *pos, char *buffer, int length) 788static void lprint_opcode(int opcode, struct seq_file *m)
795{ 789{
796 SPRINTF("%2d (0x%02x)", opcode, opcode); 790 SPRINTF("%2d (0x%02x)", opcode, opcode);
797 return (pos);
798} 791}
799 792
800 793