diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-31 03:12:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:13:22 -0400 |
commit | 275084cbff47f8a3f4b6f86464d08da6691424db (patch) | |
tree | eb996a70c4a652399f1973d52b334f5612eb349a /drivers/scsi/aha152x.c | |
parent | 31491e1ac425edc6b80a670a71ac8d2dfdd78417 (diff) |
aha152x: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi/aha152x.c')
-rw-r--r-- | drivers/scsi/aha152x.c | 61 |
1 files changed, 12 insertions, 49 deletions
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index a284be17699f..3f7b6fee0a74 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -2977,11 +2977,10 @@ static void show_queues(struct Scsi_Host *shpnt) | |||
2977 | } | 2977 | } |
2978 | 2978 | ||
2979 | #undef SPRINTF | 2979 | #undef SPRINTF |
2980 | #define SPRINTF(args...) pos += sprintf(pos, ## args) | 2980 | #define SPRINTF(args...) seq_printf(m, ##args) |
2981 | 2981 | ||
2982 | static int get_command(char *pos, Scsi_Cmnd * ptr) | 2982 | static void get_command(struct seq_file *m, Scsi_Cmnd * ptr) |
2983 | { | 2983 | { |
2984 | char *start = pos; | ||
2985 | int i; | 2984 | int i; |
2986 | 2985 | ||
2987 | SPRINTF("%p: target=%d; lun=%d; cmnd=( ", | 2986 | SPRINTF("%p: target=%d; lun=%d; cmnd=( ", |
@@ -3011,13 +3010,10 @@ static int get_command(char *pos, Scsi_Cmnd * ptr) | |||
3011 | if (ptr->SCp.phase & syncneg) | 3010 | if (ptr->SCp.phase & syncneg) |
3012 | SPRINTF("syncneg|"); | 3011 | SPRINTF("syncneg|"); |
3013 | SPRINTF("; next=0x%p\n", SCNEXT(ptr)); | 3012 | SPRINTF("; next=0x%p\n", SCNEXT(ptr)); |
3014 | |||
3015 | return (pos - start); | ||
3016 | } | 3013 | } |
3017 | 3014 | ||
3018 | static int get_ports(struct Scsi_Host *shpnt, char *pos) | 3015 | static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt) |
3019 | { | 3016 | { |
3020 | char *start = pos; | ||
3021 | int s; | 3017 | int s; |
3022 | 3018 | ||
3023 | SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name); | 3019 | SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name); |
@@ -3273,11 +3269,9 @@ static int get_ports(struct Scsi_Host *shpnt, char *pos) | |||
3273 | if (s & ENREQINIT) | 3269 | if (s & ENREQINIT) |
3274 | SPRINTF("ENREQINIT "); | 3270 | SPRINTF("ENREQINIT "); |
3275 | SPRINTF(")\n"); | 3271 | SPRINTF(")\n"); |
3276 | |||
3277 | return (pos - start); | ||
3278 | } | 3272 | } |
3279 | 3273 | ||
3280 | static int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) | 3274 | static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length) |
3281 | { | 3275 | { |
3282 | if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) | 3276 | if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) |
3283 | return -EINVAL; | 3277 | return -EINVAL; |
@@ -3320,26 +3314,11 @@ static int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) | |||
3320 | return length; | 3314 | return length; |
3321 | } | 3315 | } |
3322 | 3316 | ||
3323 | #undef SPRINTF | 3317 | static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt) |
3324 | #define SPRINTF(args...) \ | ||
3325 | do { if(pos < buffer + length) pos += sprintf(pos, ## args); } while(0) | ||
3326 | |||
3327 | static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start, | ||
3328 | off_t offset, int length, int inout) | ||
3329 | { | 3318 | { |
3330 | int i; | 3319 | int i; |
3331 | char *pos = buffer; | ||
3332 | Scsi_Cmnd *ptr; | 3320 | Scsi_Cmnd *ptr; |
3333 | unsigned long flags; | 3321 | unsigned long flags; |
3334 | int thislength; | ||
3335 | |||
3336 | DPRINTK(debug_procinfo, | ||
3337 | KERN_DEBUG "aha152x_proc_info: buffer=%p offset=%ld length=%d hostno=%d inout=%d\n", | ||
3338 | buffer, offset, length, shpnt->host_no, inout); | ||
3339 | |||
3340 | |||
3341 | if (inout) | ||
3342 | return aha152x_set_info(buffer, length, shpnt); | ||
3343 | 3322 | ||
3344 | SPRINTF(AHA152X_REVID "\n"); | 3323 | SPRINTF(AHA152X_REVID "\n"); |
3345 | 3324 | ||
@@ -3392,25 +3371,25 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3392 | if (ISSUE_SC) { | 3371 | if (ISSUE_SC) { |
3393 | SPRINTF("not yet issued commands:\n"); | 3372 | SPRINTF("not yet issued commands:\n"); |
3394 | for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr)) | 3373 | for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr)) |
3395 | pos += get_command(pos, ptr); | 3374 | get_command(m, ptr); |
3396 | } else | 3375 | } else |
3397 | SPRINTF("no not yet issued commands\n"); | 3376 | SPRINTF("no not yet issued commands\n"); |
3398 | DO_UNLOCK(flags); | 3377 | DO_UNLOCK(flags); |
3399 | 3378 | ||
3400 | if (CURRENT_SC) { | 3379 | if (CURRENT_SC) { |
3401 | SPRINTF("current command:\n"); | 3380 | SPRINTF("current command:\n"); |
3402 | pos += get_command(pos, CURRENT_SC); | 3381 | get_command(m, CURRENT_SC); |
3403 | } else | 3382 | } else |
3404 | SPRINTF("no current command\n"); | 3383 | SPRINTF("no current command\n"); |
3405 | 3384 | ||
3406 | if (DISCONNECTED_SC) { | 3385 | if (DISCONNECTED_SC) { |
3407 | SPRINTF("disconnected commands:\n"); | 3386 | SPRINTF("disconnected commands:\n"); |
3408 | for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr)) | 3387 | for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr)) |
3409 | pos += get_command(pos, ptr); | 3388 | get_command(m, ptr); |
3410 | } else | 3389 | } else |
3411 | SPRINTF("no disconnected commands\n"); | 3390 | SPRINTF("no disconnected commands\n"); |
3412 | 3391 | ||
3413 | pos += get_ports(shpnt, pos); | 3392 | get_ports(m, shpnt); |
3414 | 3393 | ||
3415 | #if defined(AHA152X_STAT) | 3394 | #if defined(AHA152X_STAT) |
3416 | SPRINTF("statistics:\n" | 3395 | SPRINTF("statistics:\n" |
@@ -3440,24 +3419,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3440 | HOSTDATA(shpnt)->time[i]); | 3419 | HOSTDATA(shpnt)->time[i]); |
3441 | } | 3420 | } |
3442 | #endif | 3421 | #endif |
3443 | 3422 | return 0; | |
3444 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: pos=%p\n", pos); | ||
3445 | |||
3446 | thislength = pos - (buffer + offset); | ||
3447 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: length=%d thislength=%d\n", length, thislength); | ||
3448 | |||
3449 | if(thislength<0) { | ||
3450 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: output too short\n"); | ||
3451 | *start = NULL; | ||
3452 | return 0; | ||
3453 | } | ||
3454 | |||
3455 | thislength = thislength<length ? thislength : length; | ||
3456 | |||
3457 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: return %d\n", thislength); | ||
3458 | |||
3459 | *start = buffer + offset; | ||
3460 | return thislength < length ? thislength : length; | ||
3461 | } | 3423 | } |
3462 | 3424 | ||
3463 | static int aha152x_adjust_queue(struct scsi_device *device) | 3425 | static int aha152x_adjust_queue(struct scsi_device *device) |
@@ -3470,7 +3432,8 @@ static struct scsi_host_template aha152x_driver_template = { | |||
3470 | .module = THIS_MODULE, | 3432 | .module = THIS_MODULE, |
3471 | .name = AHA152X_REVID, | 3433 | .name = AHA152X_REVID, |
3472 | .proc_name = "aha152x", | 3434 | .proc_name = "aha152x", |
3473 | .proc_info = aha152x_proc_info, | 3435 | .show_info = aha152x_show_info, |
3436 | .write_info = aha152x_set_info, | ||
3474 | .queuecommand = aha152x_queue, | 3437 | .queuecommand = aha152x_queue, |
3475 | .eh_abort_handler = aha152x_abort, | 3438 | .eh_abort_handler = aha152x_abort, |
3476 | .eh_device_reset_handler = aha152x_device_reset, | 3439 | .eh_device_reset_handler = aha152x_device_reset, |