switch wd33c93 to ->show_info()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 31 Mar 2013 04:30:35 +0000 (00:30 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Apr 2013 18:13:15 +0000 (14:13 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/scsi/a2091.c
drivers/scsi/a3000.c
drivers/scsi/gvp11.c
drivers/scsi/mvme147.c
drivers/scsi/wd33c93.c
drivers/scsi/wd33c93.h

index 3e09aa21c1ca787141aa7f02d08a4aa50dfce7a3..30fa38a0ad39a33102f1cd4656b4d800c498ae07 100644 (file)
@@ -166,7 +166,8 @@ static int a2091_bus_reset(struct scsi_cmnd *cmd)
 static struct scsi_host_template a2091_scsi_template = {
        .module                 = THIS_MODULE,
        .name                   = "Commodore A2091/A590 SCSI",
-       .proc_info              = wd33c93_proc_info,
+       .show_info              = wd33c93_show_info,
+       .write_info             = wd33c93_write_info,
        .proc_name              = "A2901",
        .queuecommand           = wd33c93_queuecommand,
        .eh_abort_handler       = wd33c93_abort,
index e29fe0e708f8f4e63fbcc0f9f20142ce06d6517f..c487916a9d45ecd404c1abdaa12d5d2742aeffe9 100644 (file)
@@ -181,7 +181,8 @@ static int a3000_bus_reset(struct scsi_cmnd *cmd)
 static struct scsi_host_template amiga_a3000_scsi_template = {
        .module                 = THIS_MODULE,
        .name                   = "Amiga 3000 built-in SCSI",
-       .proc_info              = wd33c93_proc_info,
+       .show_info              = wd33c93_show_info,
+       .write_info             = wd33c93_write_info,
        .proc_name              = "A3000",
        .queuecommand           = wd33c93_queuecommand,
        .eh_abort_handler       = wd33c93_abort,
index dbe4cc6b9f8b75be0823653fb05dd8e15e279cc9..2203ac281103b964917f47c1095d6c6a233ec7bf 100644 (file)
@@ -191,7 +191,8 @@ static int gvp11_bus_reset(struct scsi_cmnd *cmd)
 static struct scsi_host_template gvp11_scsi_template = {
        .module                 = THIS_MODULE,
        .name                   = "GVP Series II SCSI",
-       .proc_info              = wd33c93_proc_info,
+       .show_info              = wd33c93_show_info,
+       .write_info             = wd33c93_write_info,
        .proc_name              = "GVP11",
        .queuecommand           = wd33c93_queuecommand,
        .eh_abort_handler       = wd33c93_abort,
index c29d0dbb9660b97e34515317927208a475215f95..e7f6661a8862112a7a126e2ee4ec07c369c7dd5a 100644 (file)
@@ -76,7 +76,8 @@ int mvme147_detect(struct scsi_host_template *tpnt)
        called++;
 
        tpnt->proc_name = "MVME147";
-       tpnt->proc_info = &wd33c93_proc_info;
+       tpnt->show_info = wd33c93_show_info,
+       tpnt->write_info = wd33c93_write_info,
 
        instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
        if (!instance)
index c0ee4ea28a19707896c3a74021c4e231bd5d4880..41883a87931d1d68d4336478b4cc5c5c6ab8f967 100644 (file)
@@ -2054,22 +2054,16 @@ wd33c93_init(struct Scsi_Host *instance, const wd33c93_regs regs,
        printk("           Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE);
 }
 
-int
-wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in)
+int wd33c93_write_info(struct Scsi_Host *instance, char *buf, int len)
 {
-
 #ifdef PROC_INTERFACE
-
        char *bp;
-       char tbuf[128];
        struct WD33C93_hostdata *hd;
-       struct scsi_cmnd *cmd;
        int x;
-       static int stop = 0;
 
        hd = (struct WD33C93_hostdata *) instance->hostdata;
 
-/* If 'in' is TRUE we need to _read_ the proc file. We accept the following
+/* We accept the following
  * keywords (same format as command-line, but arguments are not optional):
  *    debug
  *    disconnect
@@ -2083,145 +2077,124 @@ wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off
  *    nosync
  */
 
-       if (in) {
-               buf[len] = '\0';
-               for (bp = buf; *bp; ) {
-                       while (',' == *bp || ' ' == *bp)
-                               ++bp;
-               if (!strncmp(bp, "debug:", 6)) {
-                               hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK;
-               } else if (!strncmp(bp, "disconnect:", 11)) {
-                               x = simple_strtoul(bp+11, &bp, 0);
-                       if (x < DIS_NEVER || x > DIS_ALWAYS)
-                               x = DIS_ADAPTIVE;
-                       hd->disconnect = x;
-               } else if (!strncmp(bp, "period:", 7)) {
+       buf[len] = '\0';
+       for (bp = buf; *bp; ) {
+               while (',' == *bp || ' ' == *bp)
+                       ++bp;
+       if (!strncmp(bp, "debug:", 6)) {
+                       hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK;
+       } else if (!strncmp(bp, "disconnect:", 11)) {
+                       x = simple_strtoul(bp+11, &bp, 0);
+               if (x < DIS_NEVER || x > DIS_ALWAYS)
+                       x = DIS_ADAPTIVE;
+               hd->disconnect = x;
+       } else if (!strncmp(bp, "period:", 7)) {
+               x = simple_strtoul(bp+7, &bp, 0);
+               hd->default_sx_per =
+                       hd->sx_table[round_period((unsigned int) x,
+                                                 hd->sx_table)].period_ns;
+       } else if (!strncmp(bp, "resync:", 7)) {
+                       set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0));
+       } else if (!strncmp(bp, "proc:", 5)) {
+                       hd->proc = simple_strtoul(bp+5, &bp, 0);
+       } else if (!strncmp(bp, "nodma:", 6)) {
+                       hd->no_dma = simple_strtoul(bp+6, &bp, 0);
+       } else if (!strncmp(bp, "level2:", 7)) {
+                       hd->level2 = simple_strtoul(bp+7, &bp, 0);
+               } else if (!strncmp(bp, "burst:", 6)) {
+                       hd->dma_mode =
+                               simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA;
+               } else if (!strncmp(bp, "fast:", 5)) {
+                       x = !!simple_strtol(bp+5, &bp, 0);
+                       if (x != hd->fast)
+                               set_resync(hd, 0xff);
+                       hd->fast = x;
+               } else if (!strncmp(bp, "nosync:", 7)) {
                        x = simple_strtoul(bp+7, &bp, 0);
-                       hd->default_sx_per =
-                               hd->sx_table[round_period((unsigned int) x,
-                                                         hd->sx_table)].period_ns;
-               } else if (!strncmp(bp, "resync:", 7)) {
-                               set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0));
-               } else if (!strncmp(bp, "proc:", 5)) {
-                               hd->proc = simple_strtoul(bp+5, &bp, 0);
-               } else if (!strncmp(bp, "nodma:", 6)) {
-                               hd->no_dma = simple_strtoul(bp+6, &bp, 0);
-               } else if (!strncmp(bp, "level2:", 7)) {
-                               hd->level2 = simple_strtoul(bp+7, &bp, 0);
-                       } else if (!strncmp(bp, "burst:", 6)) {
-                               hd->dma_mode =
-                                       simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA;
-                       } else if (!strncmp(bp, "fast:", 5)) {
-                               x = !!simple_strtol(bp+5, &bp, 0);
-                               if (x != hd->fast)
-                                       set_resync(hd, 0xff);
-                               hd->fast = x;
-                       } else if (!strncmp(bp, "nosync:", 7)) {
-                               x = simple_strtoul(bp+7, &bp, 0);
-                               set_resync(hd, x ^ hd->no_sync);
-                               hd->no_sync = x;
-                       } else {
-                               break; /* unknown keyword,syntax-error,... */
-                       }
+                       set_resync(hd, x ^ hd->no_sync);
+                       hd->no_sync = x;
+               } else {
+                       break; /* unknown keyword,syntax-error,... */
                }
-               return len;
        }
+       return len;
+#else
+       return 0;
+#endif
+}
+
+int
+wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
+{
+#ifdef PROC_INTERFACE
+       struct WD33C93_hostdata *hd;
+       struct scsi_cmnd *cmd;
+       int x;
+
+       hd = (struct WD33C93_hostdata *) instance->hostdata;
 
        spin_lock_irq(&hd->lock);
-       bp = buf;
-       *bp = '\0';
-       if (hd->proc & PR_VERSION) {
-               sprintf(tbuf, "\nVersion %s - %s.",
+       if (hd->proc & PR_VERSION)
+               seq_printf(m, "\nVersion %s - %s.",
                        WD33C93_VERSION, WD33C93_DATE);
-               strcat(bp, tbuf);
-       }
+
        if (hd->proc & PR_INFO) {
-               sprintf(tbuf, "\nclock_freq=%02x no_sync=%02x no_dma=%d"
+               seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d"
                        " dma_mode=%02x fast=%d",
                        hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast);
-               strcat(bp, tbuf);
-               strcat(bp, "\nsync_xfer[] =       ");
-               for (x = 0; x < 7; x++) {
-                       sprintf(tbuf, "\t%02x", hd->sync_xfer[x]);
-                       strcat(bp, tbuf);
-               }
-               strcat(bp, "\nsync_stat[] =       ");
-               for (x = 0; x < 7; x++) {
-                       sprintf(tbuf, "\t%02x", hd->sync_stat[x]);
-                       strcat(bp, tbuf);
-               }
+               seq_printf(m, "\nsync_xfer[] =       ");
+               for (x = 0; x < 7; x++)
+                       seq_printf(m, "\t%02x", hd->sync_xfer[x]);
+               seq_printf(m, "\nsync_stat[] =       ");
+               for (x = 0; x < 7; x++)
+                       seq_printf(m, "\t%02x", hd->sync_stat[x]);
        }
 #ifdef PROC_STATISTICS
        if (hd->proc & PR_STATISTICS) {
-               strcat(bp, "\ncommands issued:    ");
-               for (x = 0; x < 7; x++) {
-                       sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]);
-                       strcat(bp, tbuf);
-               }
-               strcat(bp, "\ndisconnects allowed:");
-               for (x = 0; x < 7; x++) {
-                       sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]);
-                       strcat(bp, tbuf);
-               }
-               strcat(bp, "\ndisconnects done:   ");
-               for (x = 0; x < 7; x++) {
-                       sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]);
-                       strcat(bp, tbuf);
-               }
-               sprintf(tbuf,
+               seq_printf(m, "\ncommands issued:    ");
+               for (x = 0; x < 7; x++)
+                       seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
+               seq_printf(m, "\ndisconnects allowed:");
+               for (x = 0; x < 7; x++)
+                       seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
+               seq_printf(m, "\ndisconnects done:   ");
+               for (x = 0; x < 7; x++)
+                       seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
+               seq_printf(m,
                        "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO",
                        hd->int_cnt, hd->dma_cnt, hd->pio_cnt);
-               strcat(bp, tbuf);
        }
 #endif
        if (hd->proc & PR_CONNECTED) {
-               strcat(bp, "\nconnected:     ");
+               seq_printf(m, "\nconnected:     ");
                if (hd->connected) {
                        cmd = (struct scsi_cmnd *) hd->connected;
-                       sprintf(tbuf, " %d:%d(%02x)",
+                       seq_printf(m, " %d:%d(%02x)",
                                cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
-                       strcat(bp, tbuf);
                }
        }
        if (hd->proc & PR_INPUTQ) {
-               strcat(bp, "\ninput_Q:       ");
+               seq_printf(m, "\ninput_Q:       ");
                cmd = (struct scsi_cmnd *) hd->input_Q;
                while (cmd) {
-                       sprintf(tbuf, " %d:%d(%02x)",
+                       seq_printf(m, " %d:%d(%02x)",
                                cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
-                       strcat(bp, tbuf);
                        cmd = (struct scsi_cmnd *) cmd->host_scribble;
                }
        }
        if (hd->proc & PR_DISCQ) {
-               strcat(bp, "\ndisconnected_Q:");
+               seq_printf(m, "\ndisconnected_Q:");
                cmd = (struct scsi_cmnd *) hd->disconnected_Q;
                while (cmd) {
-                       sprintf(tbuf, " %d:%d(%02x)",
+                       seq_printf(m, " %d:%d(%02x)",
                                cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
-                       strcat(bp, tbuf);
                        cmd = (struct scsi_cmnd *) cmd->host_scribble;
                }
        }
-       strcat(bp, "\n");
+       seq_printf(m, "\n");
        spin_unlock_irq(&hd->lock);
-       *start = buf;
-       if (stop) {
-               stop = 0;
-               return 0;
-       }
-       if (off > 0x40000)      /* ALWAYS stop after 256k bytes have been read */
-               stop = 1;
-       if (hd->proc & PR_STOP) /* stop every other time */
-               stop = 1;
-       return strlen(bp);
-
-#else                          /* PROC_INTERFACE */
-
-       return 0;
-
 #endif                         /* PROC_INTERFACE */
-
+       return 0;
 }
 
 EXPORT_SYMBOL(wd33c93_host_reset);
@@ -2229,4 +2202,5 @@ EXPORT_SYMBOL(wd33c93_init);
 EXPORT_SYMBOL(wd33c93_abort);
 EXPORT_SYMBOL(wd33c93_queuecommand);
 EXPORT_SYMBOL(wd33c93_intr);
-EXPORT_SYMBOL(wd33c93_proc_info);
+EXPORT_SYMBOL(wd33c93_show_info);
+EXPORT_SYMBOL(wd33c93_write_info);
index 3b463d7304dca635cf3f4360c7aa6d9430127f63..08abe508e9ada325aef82e6f29b4f4547da7c889 100644 (file)
@@ -345,7 +345,8 @@ void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs,
 int wd33c93_abort (struct scsi_cmnd *cmd);
 int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd);
 void wd33c93_intr (struct Scsi_Host *instance);
-int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
+int wd33c93_show_info(struct seq_file *, struct Scsi_Host *);
+int wd33c93_write_info(struct Scsi_Host *, char *, int);
 int wd33c93_host_reset (struct scsi_cmnd *);
 
 #endif /* WD33C93_H */