All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 26/27] zfcp: Remove duplicated code for debug timestamps
Date: Tue, 18 Aug 2009 15:43:31 +0200	[thread overview]
Message-ID: <20090818135032.224181000@de.ibm.com> (raw)
In-Reply-To: 20090818134305.841868000@de.ibm.com

[-- Attachment #1: 705-zfcp-debug-timestamps.diff --]
[-- Type: text/plain, Size: 4310 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

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>
---

 arch/s390/include/asm/timex.h |    8 ++++++++
 arch/s390/kernel/debug.c      |    8 +-------
 arch/s390/kernel/time.c       |    1 +
 drivers/s390/scsi/zfcp_dbf.c  |   19 +++----------------
 4 files changed, 13 insertions(+), 23 deletions(-)

--- a/arch/s390/include/asm/timex.h	2009-08-17 11:08:55.000000000 +0200
+++ b/arch/s390/include/asm/timex.h	2009-08-17 11:12:35.000000000 +0200
@@ -88,6 +88,14 @@ int get_sync_clock(unsigned long long *c
 void init_cpu_timer(void);
 unsigned long long monotonic_clock(void);
 
+void tod_to_timeval(__u64, struct timespec *);
+
+static inline
+void stck_to_timespec(unsigned long long stck, struct timespec *ts)
+{
+	tod_to_timeval(stck - TOD_UNIX_EPOCH, ts);
+}
+
 extern u64 sched_clock_base_cc;
 
 #endif
--- a/arch/s390/kernel/debug.c	2009-08-17 11:08:54.000000000 +0200
+++ b/arch/s390/kernel/debug.c	2009-08-17 11:11:22.000000000 +0200
@@ -63,8 +63,6 @@ typedef struct
 } debug_sprintf_entry_t;
 
 
-extern void tod_to_timeval(uint64_t todval, struct timespec *xtime);
-
 /* internal function prototyes */
 
 static int debug_init(void);
@@ -1450,17 +1448,13 @@ debug_dflt_header_fn(debug_info_t * id, 
 			 int area, debug_entry_t * entry, char *out_buf)
 {
 	struct timespec time_spec;
-	unsigned long long time;
 	char *except_str;
 	unsigned long caller;
 	int rc = 0;
 	unsigned int level;
 
 	level = entry->id.fields.level;
-	time = entry->id.stck;
-	/* adjust todclock to 1970 */
-	time -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
-	tod_to_timeval(time, &time_spec);
+	stck_to_timespec(entry->id.stck, &time_spec);
 
 	if (entry->id.fields.exception)
 		except_str = "*";
--- a/arch/s390/kernel/time.c	2009-08-17 11:08:55.000000000 +0200
+++ b/arch/s390/kernel/time.c	2009-08-17 11:11:22.000000000 +0200
@@ -90,6 +90,7 @@ void tod_to_timeval(__u64 todval, struct
 	todval -= (sec * 1000000) << 12;
 	xtime->tv_nsec = ((todval * 1000) >> 12);
 }
+EXPORT_SYMBOL(tod_to_timeval);
 
 void clock_comparator_work(void)
 {
--- a/drivers/s390/scsi/zfcp_dbf.c	2009-08-17 11:09:56.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_dbf.c	2009-08-17 11:11:22.000000000 +0200
@@ -38,19 +38,6 @@ static void zfcp_dbf_hexdump(debug_info_
 	}
 }
 
-/* FIXME: this duplicate this code in s390 debug feature */
-static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time)
-{
-	unsigned long long sec;
-
-	stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
-	sec = stck >> 12;
-	do_div(sec, 1000000);
-	time->tv_sec = sec;
-	stck -= (sec * 1000000) << 12;
-	time->tv_nsec = ((stck * 1000) >> 12);
-}
-
 static void zfcp_dbf_tag(char **p, const char *label, const char *tag)
 {
 	int i;
@@ -107,7 +94,7 @@ static int zfcp_dbf_view_header(debug_in
 	char *p = out_buf;
 
 	if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) {
-		zfcp_dbf_timestamp(entry->id.stck, &t);
+		stck_to_timespec(entry->id.stck, &t);
 		zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu",
 			     t.tv_sec, t.tv_nsec);
 		zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid);
@@ -320,7 +307,7 @@ static void zfcp_dbf_hba_view_response(c
 	zfcp_dbf_out(p, "fsf_command", "0x%08x", r->fsf_command);
 	zfcp_dbf_out(p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
 	zfcp_dbf_out(p, "fsf_seqno", "0x%08x", r->fsf_seqno);
-	zfcp_dbf_timestamp(r->fsf_issued, &t);
+	stck_to_timespec(r->fsf_issued, &t);
 	zfcp_dbf_out(p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec);
 	zfcp_dbf_out(p, "fsf_prot_status", "0x%08x", r->fsf_prot_status);
 	zfcp_dbf_out(p, "fsf_status", "0x%08x", r->fsf_status);
@@ -976,7 +963,7 @@ static int zfcp_dbf_scsi_view_format(deb
 		zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", r->old_fsf_reqid);
 	zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
 	zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno);
-	zfcp_dbf_timestamp(r->fsf_issued, &t);
+	stck_to_timespec(r->fsf_issued, &t);
 	zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec);
 
 	if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) {

  parent reply	other threads:[~2009-08-18 13:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18 13:43 [patch 00/27] zfcp updates for 2.6.32 Christof Schmitt
2009-08-18 13:43 ` [patch 01/27] zfcp: invalid usage after free of port resources Christof Schmitt
2009-08-18 13:43 ` [patch 02/27] zfcp: Move debug data from zfcp_data to own data structure Christof Schmitt
2009-08-18 13:43 ` [patch 03/27] zfcp: Only collect SCSI debug data for matching trace levels Christof Schmitt
2009-08-18 13:43 ` [patch 04/27] zfcp: Only collect FSF/HBA " Christof Schmitt
2009-08-18 13:43 ` [patch 05/27] zfcp: Remove useless assignment Christof Schmitt
2009-08-18 13:43 ` [patch 06/27] zfcp: Only issue one test link command per port Christof Schmitt
2009-08-18 13:43 ` [patch 07/27] zfcp: Implicitly close all wka ports Christof Schmitt
2009-08-18 13:43 ` [patch 08/27] zfcp: fix layering oddities between zfcp_fsf and zfcp_qdio Christof Schmitt
2009-08-18 13:43 ` [patch 09/27] zfcp: Replace fsf_req wait_queue with completion Christof Schmitt
2009-08-18 13:43 ` [patch 10/27] zfcp: Improve request allocation through mempools Christof Schmitt
2009-08-18 13:43 ` [patch 11/27] zfcp: Remove the useless ZFCP_REQ_AUTO_CLEANUP flag Christof Schmitt
2009-08-18 13:43 ` [patch 12/27] zfcp: Move workqueue to adapter struct Christof Schmitt
2009-08-18 13:43 ` [patch 13/27] zfcp: Separate qdio attributes from zfcp_fsf_req Christof Schmitt
2009-08-18 13:43 ` [patch 14/27] zfcp: Move qdio related data out of zfcp_adapter Christof Schmitt
2009-08-18 13:43 ` [patch 15/27] zfcp: Decouple gid_pn requests from erp Christof Schmitt
2009-08-18 13:43 ` [patch 16/27] zfcp: Update dbf calls Christof Schmitt
2009-08-18 13:43 ` [patch 17/27] zfcp: introduce _setup, _destroy for qdio and FC Christof Schmitt
2009-08-18 13:43 ` [patch 18/27] zfcp: Apply common naming conventions to zfcp_fc Christof Schmitt
2009-08-18 13:43 ` [patch 19/27] zfcp: resolve false usage of dd_data in fc_rport Christof Schmitt
2009-08-18 13:43 ` [patch 20/27] zfcp: Use kthread API for zfcp erp thread Christof Schmitt
2009-08-18 13:43 ` [patch 21/27] zfcp: Simplify and update ct/gs and els timeout handling Christof Schmitt
2009-08-18 13:43 ` [patch 22/27] zfcp: Defer resource allocation to first ccw_set_online call Christof Schmitt
2009-08-18 13:43 ` [patch 23/27] zfcp: Replace config semaphore with mutex Christof Schmitt
2009-08-18 13:43 ` [patch 24/27] zfcp: proper use of device register Christof Schmitt
2009-08-18 13:43 ` [patch 25/27] zfcp: Handle failures during device allocation correctly Christof Schmitt
2009-08-18 13:43 ` Christof Schmitt [this message]
2009-08-18 13:43 ` [patch 27/27] zfcp: optimize zfcp_qdio_account Christof Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090818135032.224181000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.