aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-08-18 09:43:31 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 09:49:48 -0400
commitb592e89ac9af521be164490e45c53c93e89c776f (patch)
treed344abae4fc3a829389df72adcd91f5f3a7603b8 /drivers/s390/scsi/zfcp_dbf.c
parent0fac3f477b6b520ae7d972ceb6e958e6807c8e1a (diff)
[SCSI] zfcp: Remove duplicated code for debug timestamps
The timestamp calculation used for s390dbf output is the same in a private zfcp function and in debug.c. Replace both with a common inline function. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index c066428b2878..215b70749e95 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -38,19 +38,6 @@ static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
38 } 38 }
39} 39}
40 40
41/* FIXME: this duplicate this code in s390 debug feature */
42static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time)
43{
44 unsigned long long sec;
45
46 stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
47 sec = stck >> 12;
48 do_div(sec, 1000000);
49 time->tv_sec = sec;
50 stck -= (sec * 1000000) << 12;
51 time->tv_nsec = ((stck * 1000) >> 12);
52}
53
54static void zfcp_dbf_tag(char **p, const char *label, const char *tag) 41static void zfcp_dbf_tag(char **p, const char *label, const char *tag)
55{ 42{
56 int i; 43 int i;
@@ -107,7 +94,7 @@ static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view,
107 char *p = out_buf; 94 char *p = out_buf;
108 95
109 if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { 96 if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) {
110 zfcp_dbf_timestamp(entry->id.stck, &t); 97 stck_to_timespec(entry->id.stck, &t);
111 zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu", 98 zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu",
112 t.tv_sec, t.tv_nsec); 99 t.tv_sec, t.tv_nsec);
113 zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid); 100 zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid);
@@ -320,7 +307,7 @@ static void zfcp_dbf_hba_view_response(char **p,
320 zfcp_dbf_out(p, "fsf_command", "0x%08x", r->fsf_command); 307 zfcp_dbf_out(p, "fsf_command", "0x%08x", r->fsf_command);
321 zfcp_dbf_out(p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 308 zfcp_dbf_out(p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
322 zfcp_dbf_out(p, "fsf_seqno", "0x%08x", r->fsf_seqno); 309 zfcp_dbf_out(p, "fsf_seqno", "0x%08x", r->fsf_seqno);
323 zfcp_dbf_timestamp(r->fsf_issued, &t); 310 stck_to_timespec(r->fsf_issued, &t);
324 zfcp_dbf_out(p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); 311 zfcp_dbf_out(p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec);
325 zfcp_dbf_out(p, "fsf_prot_status", "0x%08x", r->fsf_prot_status); 312 zfcp_dbf_out(p, "fsf_prot_status", "0x%08x", r->fsf_prot_status);
326 zfcp_dbf_out(p, "fsf_status", "0x%08x", r->fsf_status); 313 zfcp_dbf_out(p, "fsf_status", "0x%08x", r->fsf_status);
@@ -976,7 +963,7 @@ static int zfcp_dbf_scsi_view_format(debug_info_t *id, struct debug_view *view,
976 zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", r->old_fsf_reqid); 963 zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", r->old_fsf_reqid);
977 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 964 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
978 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); 965 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno);
979 zfcp_dbf_timestamp(r->fsf_issued, &t); 966 stck_to_timespec(r->fsf_issued, &t);
980 zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); 967 zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec);
981 968
982 if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { 969 if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) {