From patchwork Fri Mar 1 00:43:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 15181 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7BA8A23E1A for ; Fri, 1 Mar 2013 00:44:21 +0000 (UTC) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by fiordland.canonical.com (Postfix) with ESMTP id 20846A1935F for ; Fri, 1 Mar 2013 00:44:21 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id fy27so1649969vcb.32 for ; Thu, 28 Feb 2013 16:44:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=4PwfmcE91UOO7PX62bT5y7hafD3s4bUsKHGs/3gu+pY=; b=kcmKfSQTYqLRP63XpZRhcAJhW9X8TbNn8Y2oZwWSAyMElaPxb0DGV3YFAeaQfU7Hos NvdrDuwpm1P7S88EFE6FxkE0lAsfIP6MTT8tIxB+8hVbI/+fGp/l+oduCoYBzJuy+nnT gXhlacgRhfEHfTXZ2BU6l6TWIee8AI9vn6adR259c/h+FB8w1UrUyMB/rTR0Lk0EDyL2 c5SLTwRpPzy/iy/DlqjbEOe3F+UArARJc3voauybVgKzQNf/H/utfXPRLt3tnwxa/mpz no/RnVaWOizV19kpgMZYJwGJc2JPyBJiFfxiBYapFzwl/n1f+LuJ+shnWIJY9eW9rcpP rnPA== X-Received: by 10.220.39.69 with SMTP id f5mr3342395vce.45.1362098660673; Thu, 28 Feb 2013 16:44:20 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp672veb; Thu, 28 Feb 2013 16:44:20 -0800 (PST) X-Received: by 10.68.243.41 with SMTP id wv9mr12239962pbc.35.1362098659756; Thu, 28 Feb 2013 16:44:19 -0800 (PST) Received: from mail-da0-f50.google.com (mail-da0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id t8si10653738pav.25.2013.02.28.16.44.19 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: by mail-da0-f50.google.com with SMTP id h15so1101647dan.9 for ; Thu, 28 Feb 2013 16:44:19 -0800 (PST) X-Received: by 10.66.251.227 with SMTP id zn3mr15818714pac.178.1362098659389; Thu, 28 Feb 2013 16:44:19 -0800 (PST) Received: from localhost.localdomain (c-24-21-54-107.hsd1.or.comcast.net. [24.21.54.107]) by mx.google.com with ESMTPS id dx17sm10914892pac.17.2013.02.28.16.44.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:18 -0800 (PST) From: John Stultz To: lkml Cc: Erik Gilling , Maarten Lankhorst , Daniel Vetter , Rob Clark , Sumit Semwal , Greg KH , dri-devel@lists.freedesktop.org, Android Kernel Team , John Stultz Subject: [PATCH 25/30] staging: sync: Refactor sync debug printing Date: Thu, 28 Feb 2013 16:43:21 -0800 Message-Id: <1362098606-26469-26-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362098606-26469-1-git-send-email-john.stultz@linaro.org> References: <1362098606-26469-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQlLwsxZGrSGVz+Pnd3y07gt/lKVAVA3GYbx0+b6EgE3Nu1XfGln+6cUrbYXi5SpPefuMIMp From: Erik Gilling Move driver callbacks to fill strings instead of using seq_files. This will allow those values to be used in a future tracepoint patch. Cc: Maarten Lankhorst Cc: Erik Gilling Cc: Daniel Vetter Cc: Rob Clark Cc: Sumit Semwal Cc: Greg KH Cc: dri-devel@lists.freedesktop.org Cc: Android Kernel Team Signed-off-by: Erik Gilling Signed-off-by: John Stultz --- drivers/staging/android/sync.c | 18 ++++++++++++++++-- drivers/staging/android/sync.h | 19 +++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 811cf65..988f233 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -847,7 +847,17 @@ static void sync_print_pt(struct seq_file *s, struct sync_pt *pt, bool fence) seq_printf(s, "@%ld.%06ld", tv.tv_sec, tv.tv_usec); } - if (pt->parent->ops->print_pt) { + if (pt->parent->ops->timeline_value_str && + pt->parent->ops->pt_value_str) { + char value[64]; + pt->parent->ops->pt_value_str(pt, value, sizeof(value)); + seq_printf(s, ": %s", value); + if (fence) { + pt->parent->ops->timeline_value_str(pt->parent, value, + sizeof(value)); + seq_printf(s, " / %s", value); + } + } else if (pt->parent->ops->print_pt) { seq_printf(s, ": "); pt->parent->ops->print_pt(s, pt); } @@ -862,7 +872,11 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj) seq_printf(s, "%s %s", obj->name, obj->ops->driver_name); - if (obj->ops->print_obj) { + if (obj->ops->timeline_value_str) { + char value[64]; + obj->ops->timeline_value_str(obj, value, sizeof(value)); + seq_printf(s, ": %s", value); + } else if (obj->ops->print_obj) { seq_printf(s, ": "); obj->ops->print_obj(s, obj); } diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 75ed5f1..38ea986 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -40,14 +40,14 @@ struct sync_fence; * -1 if a will signabl before b * @free_pt: called before sync_pt is freed * @release_obj: called before sync_timeline is freed - * @print_obj: print aditional debug information about sync_timeline. - * should not print a newline - * @print_pt: print aditional debug information about sync_pt. - * should not print a newline + * @print_obj: deprecated + * @print_pt: deprecated * @fill_driver_data: write implmentation specific driver data to data. * should return an error if there is not enough room * as specified by size. This information is returned * to userspace by SYNC_IOC_FENCE_INFO. + * @timeline_value_str: fill str with the value of the sync_timeline's counter + * @pt_value_str: fill str with the value of the sync_pt */ struct sync_timeline_ops { const char *driver_name; @@ -67,15 +67,22 @@ struct sync_timeline_ops { /* optional */ void (*release_obj)(struct sync_timeline *sync_timeline); - /* optional */ + /* deprecated */ void (*print_obj)(struct seq_file *s, struct sync_timeline *sync_timeline); - /* optional */ + /* deprecated */ void (*print_pt)(struct seq_file *s, struct sync_pt *sync_pt); /* optional */ int (*fill_driver_data)(struct sync_pt *syncpt, void *data, int size); + + /* optional */ + void (*timeline_value_str)(struct sync_timeline *timeline, char *str, + int size); + + /* optional */ + void (*pt_value_str)(struct sync_pt *pt, char *str, int size); }; /**