aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/in2000.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 03:32:45 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:25 -0400
commit887fc88e63139810cbde5bf41aa11a749b2b776b (patch)
tree076ce0198b6ed68cd934be74e62bcecca38f1883 /drivers/scsi/in2000.c
parentd773e42213bcec26400732e494e2d8e37dc08c92 (diff)
in2000: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi/in2000.c')
-rw-r--r--drivers/scsi/in2000.c178
1 files changed, 72 insertions, 106 deletions
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index deb5b6d8398e..bf028218ac36 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -2166,152 +2166,117 @@ static int in2000_biosparam(struct scsi_device *sdev, struct block_device *bdev,
2166} 2166}
2167 2167
2168 2168
2169static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) 2169static int in2000_write_info(struct Scsi_Host *instance, char *buf, int len)
2170{ 2170{
2171 2171
2172#ifdef PROC_INTERFACE 2172#ifdef PROC_INTERFACE
2173 2173
2174 char *bp; 2174 char *bp;
2175 char tbuf[128];
2176 unsigned long flags;
2177 struct IN2000_hostdata *hd; 2175 struct IN2000_hostdata *hd;
2178 Scsi_Cmnd *cmd;
2179 int x, i; 2176 int x, i;
2180 static int stop = 0;
2181 2177
2182 hd = (struct IN2000_hostdata *) instance->hostdata; 2178 hd = (struct IN2000_hostdata *) instance->hostdata;
2183 2179
2184/* If 'in' is TRUE we need to _read_ the proc file. We accept the following 2180 buf[len] = '\0';
2185 * keywords (same format as command-line, but only ONE per read): 2181 bp = buf;
2186 * debug 2182 if (!strncmp(bp, "debug:", 6)) {
2187 * disconnect 2183 bp += 6;
2188 * period 2184 hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK;
2189 * resync 2185 } else if (!strncmp(bp, "disconnect:", 11)) {
2190 * proc 2186 bp += 11;
2191 */ 2187 x = simple_strtoul(bp, NULL, 0);
2192 2188 if (x < DIS_NEVER || x > DIS_ALWAYS)
2193 if (in) { 2189 x = DIS_ADAPTIVE;
2194 buf[len] = '\0'; 2190 hd->disconnect = x;
2195 bp = buf; 2191 } else if (!strncmp(bp, "period:", 7)) {
2196 if (!strncmp(bp, "debug:", 6)) { 2192 bp += 7;
2197 bp += 6; 2193 x = simple_strtoul(bp, NULL, 0);
2198 hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK; 2194 hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns;
2199 } else if (!strncmp(bp, "disconnect:", 11)) { 2195 } else if (!strncmp(bp, "resync:", 7)) {
2200 bp += 11; 2196 bp += 7;
2201 x = simple_strtoul(bp, NULL, 0); 2197 x = simple_strtoul(bp, NULL, 0);
2202 if (x < DIS_NEVER || x > DIS_ALWAYS) 2198 for (i = 0; i < 7; i++)
2203 x = DIS_ADAPTIVE; 2199 if (x & (1 << i))
2204 hd->disconnect = x; 2200 hd->sync_stat[i] = SS_UNSET;
2205 } else if (!strncmp(bp, "period:", 7)) { 2201 } else if (!strncmp(bp, "proc:", 5)) {
2206 bp += 7; 2202 bp += 5;
2207 x = simple_strtoul(bp, NULL, 0); 2203 hd->proc = simple_strtoul(bp, NULL, 0);
2208 hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns; 2204 } else if (!strncmp(bp, "level2:", 7)) {
2209 } else if (!strncmp(bp, "resync:", 7)) { 2205 bp += 7;
2210 bp += 7; 2206 hd->level2 = simple_strtoul(bp, NULL, 0);
2211 x = simple_strtoul(bp, NULL, 0);
2212 for (i = 0; i < 7; i++)
2213 if (x & (1 << i))
2214 hd->sync_stat[i] = SS_UNSET;
2215 } else if (!strncmp(bp, "proc:", 5)) {
2216 bp += 5;
2217 hd->proc = simple_strtoul(bp, NULL, 0);
2218 } else if (!strncmp(bp, "level2:", 7)) {
2219 bp += 7;
2220 hd->level2 = simple_strtoul(bp, NULL, 0);
2221 }
2222 return len;
2223 } 2207 }
2208#endif
2209 return len;
2210}
2211
2212static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
2213{
2214
2215#ifdef PROC_INTERFACE
2216 unsigned long flags;
2217 struct IN2000_hostdata *hd;
2218 Scsi_Cmnd *cmd;
2219 int x;
2220
2221 hd = (struct IN2000_hostdata *) instance->hostdata;
2224 2222
2225 spin_lock_irqsave(instance->host_lock, flags); 2223 spin_lock_irqsave(instance->host_lock, flags);
2226 bp = buf; 2224 if (hd->proc & PR_VERSION)
2227 *bp = '\0'; 2225 seq_printf(m, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE);
2228 if (hd->proc & PR_VERSION) { 2226
2229 sprintf(tbuf, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE);
2230 strcat(bp, tbuf);
2231 }
2232 if (hd->proc & PR_INFO) { 2227 if (hd->proc & PR_INFO) {
2233 sprintf(tbuf, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No"); 2228 seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No");
2234 strcat(bp, tbuf); 2229 seq_printf(m, "\nsync_xfer[] = ");
2235 strcat(bp, "\nsync_xfer[] = "); 2230 for (x = 0; x < 7; x++)
2236 for (x = 0; x < 7; x++) { 2231 seq_printf(m, "\t%02x", hd->sync_xfer[x]);
2237 sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); 2232 seq_printf(m, "\nsync_stat[] = ");
2238 strcat(bp, tbuf); 2233 for (x = 0; x < 7; x++)
2239 } 2234 seq_printf(m, "\t%02x", hd->sync_stat[x]);
2240 strcat(bp, "\nsync_stat[] = ");
2241 for (x = 0; x < 7; x++) {
2242 sprintf(tbuf, "\t%02x", hd->sync_stat[x]);
2243 strcat(bp, tbuf);
2244 }
2245 } 2235 }
2246#ifdef PROC_STATISTICS 2236#ifdef PROC_STATISTICS
2247 if (hd->proc & PR_STATISTICS) { 2237 if (hd->proc & PR_STATISTICS) {
2248 strcat(bp, "\ncommands issued: "); 2238 seq_printf(m, "\ncommands issued: ");
2249 for (x = 0; x < 7; x++) { 2239 for (x = 0; x < 7; x++)
2250 sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); 2240 seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
2251 strcat(bp, tbuf); 2241 seq_printf(m, "\ndisconnects allowed:");
2252 } 2242 for (x = 0; x < 7; x++)
2253 strcat(bp, "\ndisconnects allowed:"); 2243 seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
2254 for (x = 0; x < 7; x++) { 2244 seq_printf(m, "\ndisconnects done: ");
2255 sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); 2245 for (x = 0; x < 7; x++)
2256 strcat(bp, tbuf); 2246 seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
2257 } 2247 seq_printf(m, "\ninterrupts: \t%ld", hd->int_cnt);
2258 strcat(bp, "\ndisconnects done: ");
2259 for (x = 0; x < 7; x++) {
2260 sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]);
2261 strcat(bp, tbuf);
2262 }
2263 sprintf(tbuf, "\ninterrupts: \t%ld", hd->int_cnt);
2264 strcat(bp, tbuf);
2265 } 2248 }
2266#endif 2249#endif
2267 if (hd->proc & PR_CONNECTED) { 2250 if (hd->proc & PR_CONNECTED) {
2268 strcat(bp, "\nconnected: "); 2251 seq_printf(m, "\nconnected: ");
2269 if (hd->connected) { 2252 if (hd->connected) {
2270 cmd = (Scsi_Cmnd *) hd->connected; 2253 cmd = (Scsi_Cmnd *) hd->connected;
2271 sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2254 seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2272 strcat(bp, tbuf);
2273 } 2255 }
2274 } 2256 }
2275 if (hd->proc & PR_INPUTQ) { 2257 if (hd->proc & PR_INPUTQ) {
2276 strcat(bp, "\ninput_Q: "); 2258 seq_printf(m, "\ninput_Q: ");
2277 cmd = (Scsi_Cmnd *) hd->input_Q; 2259 cmd = (Scsi_Cmnd *) hd->input_Q;
2278 while (cmd) { 2260 while (cmd) {
2279 sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2261 seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2280 strcat(bp, tbuf);
2281 cmd = (Scsi_Cmnd *) cmd->host_scribble; 2262 cmd = (Scsi_Cmnd *) cmd->host_scribble;
2282 } 2263 }
2283 } 2264 }
2284 if (hd->proc & PR_DISCQ) { 2265 if (hd->proc & PR_DISCQ) {
2285 strcat(bp, "\ndisconnected_Q:"); 2266 seq_printf(m, "\ndisconnected_Q:");
2286 cmd = (Scsi_Cmnd *) hd->disconnected_Q; 2267 cmd = (Scsi_Cmnd *) hd->disconnected_Q;
2287 while (cmd) { 2268 while (cmd) {
2288 sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2269 seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2289 strcat(bp, tbuf);
2290 cmd = (Scsi_Cmnd *) cmd->host_scribble; 2270 cmd = (Scsi_Cmnd *) cmd->host_scribble;
2291 } 2271 }
2292 } 2272 }
2293 if (hd->proc & PR_TEST) { 2273 if (hd->proc & PR_TEST) {
2294 ; /* insert your own custom function here */ 2274 ; /* insert your own custom function here */
2295 } 2275 }
2296 strcat(bp, "\n"); 2276 seq_printf(m, "\n");
2297 spin_unlock_irqrestore(instance->host_lock, flags); 2277 spin_unlock_irqrestore(instance->host_lock, flags);
2298 *start = buf;
2299 if (stop) {
2300 stop = 0;
2301 return 0; /* return 0 to signal end-of-file */
2302 }
2303 if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */
2304 stop = 1;
2305 if (hd->proc & PR_STOP) /* stop every other time */
2306 stop = 1;
2307 return strlen(bp);
2308
2309#else /* PROC_INTERFACE */
2310
2311 return 0;
2312
2313#endif /* PROC_INTERFACE */ 2278#endif /* PROC_INTERFACE */
2314 2279 return 0;
2315} 2280}
2316 2281
2317MODULE_LICENSE("GPL"); 2282MODULE_LICENSE("GPL");
@@ -2319,7 +2284,8 @@ MODULE_LICENSE("GPL");
2319 2284
2320static struct scsi_host_template driver_template = { 2285static struct scsi_host_template driver_template = {
2321 .proc_name = "in2000", 2286 .proc_name = "in2000",
2322 .proc_info = in2000_proc_info, 2287 .write_info = in2000_write_info,
2288 .show_info = in2000_show_info,
2323 .name = "Always IN2000", 2289 .name = "Always IN2000",
2324 .detect = in2000_detect, 2290 .detect = in2000_detect,
2325 .release = in2000_release, 2291 .release = in2000_release,