aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorMartin Peschke <mp3@de.ibm.com>2008-03-31 05:15:23 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:08 -0400
commit8fc5af168753239d7bf77ccca831196bcdffbfbe (patch)
treeb744a31c3172fce9a37c627cb462cb6a1e80913a /drivers/s390
parent81e56ded878aeb8730f18c1d0a70d5face788be3 (diff)
[SCSI] zfcp: simplify zfcp_dbf_timestamp()
Change zfcp_dbf_timestamp() so that it just calculates timespec from timestamp. First step to be able to rip this code out of zfcp. Besides, this change makes it easier to rip out old-style debug view functions. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index aecdc7f2dbc6..edd93533db40 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -49,23 +49,17 @@ static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
49 } 49 }
50} 50}
51 51
52static int 52/* FIXME: this duplicate this code in s390 debug feature */
53zfcp_dbf_stck(char *out_buf, const char *label, unsigned long long stck) 53static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time)
54{ 54{
55 unsigned long long sec; 55 unsigned long long sec;
56 struct timespec dbftime;
57 int len = 0;
58 56
59 stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096); 57 stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
60 sec = stck >> 12; 58 sec = stck >> 12;
61 do_div(sec, 1000000); 59 do_div(sec, 1000000);
62 dbftime.tv_sec = sec; 60 time->tv_sec = sec;
63 stck -= (sec * 1000000) << 12; 61 stck -= (sec * 1000000) << 12;
64 dbftime.tv_nsec = ((stck * 1000) >> 12); 62 time->tv_nsec = ((stck * 1000) >> 12);
65 len += sprintf(out_buf + len, "%-24s%011lu:%06lu\n",
66 label, dbftime.tv_sec, dbftime.tv_nsec);
67
68 return len;
69} 63}
70 64
71static int zfcp_dbf_tag(char *out_buf, const char *label, const char *tag) 65static int zfcp_dbf_tag(char *out_buf, const char *label, const char *tag)
@@ -146,10 +140,12 @@ zfcp_dbf_view_header(debug_info_t * id, struct debug_view *view, int area,
146{ 140{
147 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); 141 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry);
148 int len = 0; 142 int len = 0;
143 struct timespec t;
149 144
150 if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { 145 if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) {
151 len += zfcp_dbf_stck(out_buf + len, "timestamp", 146 zfcp_dbf_timestamp(entry->id.stck, &t);
152 entry->id.stck); 147 len += zfcp_dbf_view(out_buf + len, "timestamp", "%011lu:%06lu",
148 t.tv_sec, t.tv_nsec);
153 len += zfcp_dbf_view(out_buf + len, "cpu", "%02i", 149 len += zfcp_dbf_view(out_buf + len, "cpu", "%02i",
154 entry->id.fields.cpuid); 150 entry->id.fields.cpuid);
155 } else { 151 } else {
@@ -363,6 +359,7 @@ zfcp_hba_dbf_view_response(char *out_buf,
363 struct zfcp_hba_dbf_record_response *rec) 359 struct zfcp_hba_dbf_record_response *rec)
364{ 360{
365 int len = 0; 361 int len = 0;
362 struct timespec t;
366 363
367 len += zfcp_dbf_view(out_buf + len, "fsf_command", "0x%08x", 364 len += zfcp_dbf_view(out_buf + len, "fsf_command", "0x%08x",
368 rec->fsf_command); 365 rec->fsf_command);
@@ -370,7 +367,9 @@ zfcp_hba_dbf_view_response(char *out_buf,
370 rec->fsf_reqid); 367 rec->fsf_reqid);
371 len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", 368 len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x",
372 rec->fsf_seqno); 369 rec->fsf_seqno);
373 len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued); 370 zfcp_dbf_timestamp(rec->fsf_issued, &t);
371 len += zfcp_dbf_view(out_buf + len, "fsf_issued", "%011lu:%06lu",
372 t.tv_sec, t.tv_nsec);
374 len += zfcp_dbf_view(out_buf + len, "fsf_prot_status", "0x%08x", 373 len += zfcp_dbf_view(out_buf + len, "fsf_prot_status", "0x%08x",
375 rec->fsf_prot_status); 374 rec->fsf_prot_status);
376 len += zfcp_dbf_view(out_buf + len, "fsf_status", "0x%08x", 375 len += zfcp_dbf_view(out_buf + len, "fsf_status", "0x%08x",
@@ -1222,6 +1221,7 @@ zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view,
1222 struct zfcp_scsi_dbf_record *rec = 1221 struct zfcp_scsi_dbf_record *rec =
1223 (struct zfcp_scsi_dbf_record *)in_buf; 1222 (struct zfcp_scsi_dbf_record *)in_buf;
1224 int len = 0; 1223 int len = 0;
1224 struct timespec t;
1225 1225
1226 if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) 1226 if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
1227 return 0; 1227 return 0;
@@ -1253,7 +1253,9 @@ zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view,
1253 rec->fsf_reqid); 1253 rec->fsf_reqid);
1254 len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", 1254 len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x",
1255 rec->fsf_seqno); 1255 rec->fsf_seqno);
1256 len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued); 1256 zfcp_dbf_timestamp(rec->fsf_issued, &t);
1257 len += zfcp_dbf_view(out_buf + len, "fsf_issued", "%011lu:%06lu",
1258 t.tv_sec, t.tv_nsec);
1257 if (strncmp(rec->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { 1259 if (strncmp(rec->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) {
1258 len += 1260 len +=
1259 zfcp_dbf_view(out_buf + len, "fcp_rsp_validity", "0x%02x", 1261 zfcp_dbf_view(out_buf + len, "fcp_rsp_validity", "0x%02x",