Commit 408bb25ba50c6abaf516d844fd62556ec89a0af2

Authored by Al Viro
1 parent cab29b99df

switch wd33c93 to ->show_info()

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

Showing 6 changed files with 94 additions and 115 deletions Side-by-side Diff

drivers/scsi/a2091.c
... ... @@ -166,7 +166,8 @@
166 166 static struct scsi_host_template a2091_scsi_template = {
167 167 .module = THIS_MODULE,
168 168 .name = "Commodore A2091/A590 SCSI",
169   - .proc_info = wd33c93_proc_info,
  169 + .show_info = wd33c93_show_info,
  170 + .write_info = wd33c93_write_info,
170 171 .proc_name = "A2901",
171 172 .queuecommand = wd33c93_queuecommand,
172 173 .eh_abort_handler = wd33c93_abort,
drivers/scsi/a3000.c
... ... @@ -181,7 +181,8 @@
181 181 static struct scsi_host_template amiga_a3000_scsi_template = {
182 182 .module = THIS_MODULE,
183 183 .name = "Amiga 3000 built-in SCSI",
184   - .proc_info = wd33c93_proc_info,
  184 + .show_info = wd33c93_show_info,
  185 + .write_info = wd33c93_write_info,
185 186 .proc_name = "A3000",
186 187 .queuecommand = wd33c93_queuecommand,
187 188 .eh_abort_handler = wd33c93_abort,
drivers/scsi/gvp11.c
... ... @@ -191,7 +191,8 @@
191 191 static struct scsi_host_template gvp11_scsi_template = {
192 192 .module = THIS_MODULE,
193 193 .name = "GVP Series II SCSI",
194   - .proc_info = wd33c93_proc_info,
  194 + .show_info = wd33c93_show_info,
  195 + .write_info = wd33c93_write_info,
195 196 .proc_name = "GVP11",
196 197 .queuecommand = wd33c93_queuecommand,
197 198 .eh_abort_handler = wd33c93_abort,
drivers/scsi/mvme147.c
... ... @@ -76,7 +76,8 @@
76 76 called++;
77 77  
78 78 tpnt->proc_name = "MVME147";
79   - tpnt->proc_info = &wd33c93_proc_info;
  79 + tpnt->show_info = wd33c93_show_info,
  80 + tpnt->write_info = wd33c93_write_info,
80 81  
81 82 instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
82 83 if (!instance)
drivers/scsi/wd33c93.c
... ... @@ -2054,22 +2054,16 @@
2054 2054 printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE);
2055 2055 }
2056 2056  
2057   -int
2058   -wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in)
  2057 +int wd33c93_write_info(struct Scsi_Host *instance, char *buf, int len)
2059 2058 {
2060   -
2061 2059 #ifdef PROC_INTERFACE
2062   -
2063 2060 char *bp;
2064   - char tbuf[128];
2065 2061 struct WD33C93_hostdata *hd;
2066   - struct scsi_cmnd *cmd;
2067 2062 int x;
2068   - static int stop = 0;
2069 2063  
2070 2064 hd = (struct WD33C93_hostdata *) instance->hostdata;
2071 2065  
2072   -/* If 'in' is TRUE we need to _read_ the proc file. We accept the following
  2066 +/* We accept the following
2073 2067 * keywords (same format as command-line, but arguments are not optional):
2074 2068 * debug
2075 2069 * disconnect
2076 2070  
2077 2071  
2078 2072  
2079 2073  
2080 2074  
2081 2075  
2082 2076  
2083 2077  
2084 2078  
2085 2079  
2086 2080  
2087 2081  
2088 2082  
2089 2083  
2090 2084  
2091 2085  
2092 2086  
2093 2087  
2094 2088  
2095 2089  
2096 2090  
2097 2091  
... ... @@ -2083,145 +2077,124 @@
2083 2077 * nosync
2084 2078 */
2085 2079  
2086   - if (in) {
2087   - buf[len] = '\0';
2088   - for (bp = buf; *bp; ) {
2089   - while (',' == *bp || ' ' == *bp)
2090   - ++bp;
2091   - if (!strncmp(bp, "debug:", 6)) {
2092   - hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK;
2093   - } else if (!strncmp(bp, "disconnect:", 11)) {
2094   - x = simple_strtoul(bp+11, &bp, 0);
2095   - if (x < DIS_NEVER || x > DIS_ALWAYS)
2096   - x = DIS_ADAPTIVE;
2097   - hd->disconnect = x;
2098   - } else if (!strncmp(bp, "period:", 7)) {
  2080 + buf[len] = '\0';
  2081 + for (bp = buf; *bp; ) {
  2082 + while (',' == *bp || ' ' == *bp)
  2083 + ++bp;
  2084 + if (!strncmp(bp, "debug:", 6)) {
  2085 + hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK;
  2086 + } else if (!strncmp(bp, "disconnect:", 11)) {
  2087 + x = simple_strtoul(bp+11, &bp, 0);
  2088 + if (x < DIS_NEVER || x > DIS_ALWAYS)
  2089 + x = DIS_ADAPTIVE;
  2090 + hd->disconnect = x;
  2091 + } else if (!strncmp(bp, "period:", 7)) {
  2092 + x = simple_strtoul(bp+7, &bp, 0);
  2093 + hd->default_sx_per =
  2094 + hd->sx_table[round_period((unsigned int) x,
  2095 + hd->sx_table)].period_ns;
  2096 + } else if (!strncmp(bp, "resync:", 7)) {
  2097 + set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0));
  2098 + } else if (!strncmp(bp, "proc:", 5)) {
  2099 + hd->proc = simple_strtoul(bp+5, &bp, 0);
  2100 + } else if (!strncmp(bp, "nodma:", 6)) {
  2101 + hd->no_dma = simple_strtoul(bp+6, &bp, 0);
  2102 + } else if (!strncmp(bp, "level2:", 7)) {
  2103 + hd->level2 = simple_strtoul(bp+7, &bp, 0);
  2104 + } else if (!strncmp(bp, "burst:", 6)) {
  2105 + hd->dma_mode =
  2106 + simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA;
  2107 + } else if (!strncmp(bp, "fast:", 5)) {
  2108 + x = !!simple_strtol(bp+5, &bp, 0);
  2109 + if (x != hd->fast)
  2110 + set_resync(hd, 0xff);
  2111 + hd->fast = x;
  2112 + } else if (!strncmp(bp, "nosync:", 7)) {
2099 2113 x = simple_strtoul(bp+7, &bp, 0);
2100   - hd->default_sx_per =
2101   - hd->sx_table[round_period((unsigned int) x,
2102   - hd->sx_table)].period_ns;
2103   - } else if (!strncmp(bp, "resync:", 7)) {
2104   - set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0));
2105   - } else if (!strncmp(bp, "proc:", 5)) {
2106   - hd->proc = simple_strtoul(bp+5, &bp, 0);
2107   - } else if (!strncmp(bp, "nodma:", 6)) {
2108   - hd->no_dma = simple_strtoul(bp+6, &bp, 0);
2109   - } else if (!strncmp(bp, "level2:", 7)) {
2110   - hd->level2 = simple_strtoul(bp+7, &bp, 0);
2111   - } else if (!strncmp(bp, "burst:", 6)) {
2112   - hd->dma_mode =
2113   - simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA;
2114   - } else if (!strncmp(bp, "fast:", 5)) {
2115   - x = !!simple_strtol(bp+5, &bp, 0);
2116   - if (x != hd->fast)
2117   - set_resync(hd, 0xff);
2118   - hd->fast = x;
2119   - } else if (!strncmp(bp, "nosync:", 7)) {
2120   - x = simple_strtoul(bp+7, &bp, 0);
2121   - set_resync(hd, x ^ hd->no_sync);
2122   - hd->no_sync = x;
2123   - } else {
2124   - break; /* unknown keyword,syntax-error,... */
2125   - }
  2114 + set_resync(hd, x ^ hd->no_sync);
  2115 + hd->no_sync = x;
  2116 + } else {
  2117 + break; /* unknown keyword,syntax-error,... */
2126 2118 }
2127   - return len;
2128 2119 }
  2120 + return len;
  2121 +#else
  2122 + return 0;
  2123 +#endif
  2124 +}
2129 2125  
  2126 +int
  2127 +wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
  2128 +{
  2129 +#ifdef PROC_INTERFACE
  2130 + struct WD33C93_hostdata *hd;
  2131 + struct scsi_cmnd *cmd;
  2132 + int x;
  2133 +
  2134 + hd = (struct WD33C93_hostdata *) instance->hostdata;
  2135 +
2130 2136 spin_lock_irq(&hd->lock);
2131   - bp = buf;
2132   - *bp = '\0';
2133   - if (hd->proc & PR_VERSION) {
2134   - sprintf(tbuf, "\nVersion %s - %s.",
  2137 + if (hd->proc & PR_VERSION)
  2138 + seq_printf(m, "\nVersion %s - %s.",
2135 2139 WD33C93_VERSION, WD33C93_DATE);
2136   - strcat(bp, tbuf);
2137   - }
  2140 +
2138 2141 if (hd->proc & PR_INFO) {
2139   - sprintf(tbuf, "\nclock_freq=%02x no_sync=%02x no_dma=%d"
  2142 + seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d"
2140 2143 " dma_mode=%02x fast=%d",
2141 2144 hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast);
2142   - strcat(bp, tbuf);
2143   - strcat(bp, "\nsync_xfer[] = ");
2144   - for (x = 0; x < 7; x++) {
2145   - sprintf(tbuf, "\t%02x", hd->sync_xfer[x]);
2146   - strcat(bp, tbuf);
2147   - }
2148   - strcat(bp, "\nsync_stat[] = ");
2149   - for (x = 0; x < 7; x++) {
2150   - sprintf(tbuf, "\t%02x", hd->sync_stat[x]);
2151   - strcat(bp, tbuf);
2152   - }
  2145 + seq_printf(m, "\nsync_xfer[] = ");
  2146 + for (x = 0; x < 7; x++)
  2147 + seq_printf(m, "\t%02x", hd->sync_xfer[x]);
  2148 + seq_printf(m, "\nsync_stat[] = ");
  2149 + for (x = 0; x < 7; x++)
  2150 + seq_printf(m, "\t%02x", hd->sync_stat[x]);
2153 2151 }
2154 2152 #ifdef PROC_STATISTICS
2155 2153 if (hd->proc & PR_STATISTICS) {
2156   - strcat(bp, "\ncommands issued: ");
2157   - for (x = 0; x < 7; x++) {
2158   - sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]);
2159   - strcat(bp, tbuf);
2160   - }
2161   - strcat(bp, "\ndisconnects allowed:");
2162   - for (x = 0; x < 7; x++) {
2163   - sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]);
2164   - strcat(bp, tbuf);
2165   - }
2166   - strcat(bp, "\ndisconnects done: ");
2167   - for (x = 0; x < 7; x++) {
2168   - sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]);
2169   - strcat(bp, tbuf);
2170   - }
2171   - sprintf(tbuf,
  2154 + seq_printf(m, "\ncommands issued: ");
  2155 + for (x = 0; x < 7; x++)
  2156 + seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
  2157 + seq_printf(m, "\ndisconnects allowed:");
  2158 + for (x = 0; x < 7; x++)
  2159 + seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
  2160 + seq_printf(m, "\ndisconnects done: ");
  2161 + for (x = 0; x < 7; x++)
  2162 + seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
  2163 + seq_printf(m,
2172 2164 "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO",
2173 2165 hd->int_cnt, hd->dma_cnt, hd->pio_cnt);
2174   - strcat(bp, tbuf);
2175 2166 }
2176 2167 #endif
2177 2168 if (hd->proc & PR_CONNECTED) {
2178   - strcat(bp, "\nconnected: ");
  2169 + seq_printf(m, "\nconnected: ");
2179 2170 if (hd->connected) {
2180 2171 cmd = (struct scsi_cmnd *) hd->connected;
2181   - sprintf(tbuf, " %d:%d(%02x)",
  2172 + seq_printf(m, " %d:%d(%02x)",
2182 2173 cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2183   - strcat(bp, tbuf);
2184 2174 }
2185 2175 }
2186 2176 if (hd->proc & PR_INPUTQ) {
2187   - strcat(bp, "\ninput_Q: ");
  2177 + seq_printf(m, "\ninput_Q: ");
2188 2178 cmd = (struct scsi_cmnd *) hd->input_Q;
2189 2179 while (cmd) {
2190   - sprintf(tbuf, " %d:%d(%02x)",
  2180 + seq_printf(m, " %d:%d(%02x)",
2191 2181 cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2192   - strcat(bp, tbuf);
2193 2182 cmd = (struct scsi_cmnd *) cmd->host_scribble;
2194 2183 }
2195 2184 }
2196 2185 if (hd->proc & PR_DISCQ) {
2197   - strcat(bp, "\ndisconnected_Q:");
  2186 + seq_printf(m, "\ndisconnected_Q:");
2198 2187 cmd = (struct scsi_cmnd *) hd->disconnected_Q;
2199 2188 while (cmd) {
2200   - sprintf(tbuf, " %d:%d(%02x)",
  2189 + seq_printf(m, " %d:%d(%02x)",
2201 2190 cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2202   - strcat(bp, tbuf);
2203 2191 cmd = (struct scsi_cmnd *) cmd->host_scribble;
2204 2192 }
2205 2193 }
2206   - strcat(bp, "\n");
  2194 + seq_printf(m, "\n");
2207 2195 spin_unlock_irq(&hd->lock);
2208   - *start = buf;
2209   - if (stop) {
2210   - stop = 0;
2211   - return 0;
2212   - }
2213   - if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */
2214   - stop = 1;
2215   - if (hd->proc & PR_STOP) /* stop every other time */
2216   - stop = 1;
2217   - return strlen(bp);
2218   -
2219   -#else /* PROC_INTERFACE */
2220   -
2221   - return 0;
2222   -
2223 2196 #endif /* PROC_INTERFACE */
2224   -
  2197 + return 0;
2225 2198 }
2226 2199  
2227 2200 EXPORT_SYMBOL(wd33c93_host_reset);
... ... @@ -2229,5 +2202,6 @@
2229 2202 EXPORT_SYMBOL(wd33c93_abort);
2230 2203 EXPORT_SYMBOL(wd33c93_queuecommand);
2231 2204 EXPORT_SYMBOL(wd33c93_intr);
2232   -EXPORT_SYMBOL(wd33c93_proc_info);
  2205 +EXPORT_SYMBOL(wd33c93_show_info);
  2206 +EXPORT_SYMBOL(wd33c93_write_info);
drivers/scsi/wd33c93.h
... ... @@ -345,7 +345,8 @@
345 345 int wd33c93_abort (struct scsi_cmnd *cmd);
346 346 int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd);
347 347 void wd33c93_intr (struct Scsi_Host *instance);
348   -int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
  348 +int wd33c93_show_info(struct seq_file *, struct Scsi_Host *);
  349 +int wd33c93_write_info(struct Scsi_Host *, char *, int);
349 350 int wd33c93_host_reset (struct scsi_cmnd *);
350 351  
351 352 #endif /* WD33C93_H */