From patchwork Wed Feb 3 18:39:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 8208461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 766FFBEEE5 for ; Wed, 3 Feb 2016 19:29:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9D9E2025B for ; Wed, 3 Feb 2016 19:29:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C98F620122 for ; Wed, 3 Feb 2016 19:29:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aR369-0001Or-Et; Wed, 03 Feb 2016 19:28:17 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aR35K-0000mo-Fh for linux-arm-kernel@bombadil.infradead.org; Wed, 03 Feb 2016 19:27:26 +0000 Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1aR2LQ-0005Ds-Bd for linux-arm-kernel@lists.infradead.org; Wed, 03 Feb 2016 18:40:01 +0000 Received: by mail-pf0-x234.google.com with SMTP id 65so18080719pfd.2 for ; Wed, 03 Feb 2016 10:39:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Lh1lJBYmbnWY6VobiR54+G7OxcYmHX43ZupCIuDFyqQ=; b=L/+ctyxbrEKRpp4dOPWrr4WVzwG4wCR/NotIR1oKuiwCxXBdWbSeOOA9RKtmjbRbwd MNHiOXlAao6WQqiGVly/amfBU241B3PNNA5KK7gXxSx397wvKXNpxQo5k89l81FHq3aB eLY6CT4F5UXQMgillng3U+q7p3Z7+33vFT904= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Lh1lJBYmbnWY6VobiR54+G7OxcYmHX43ZupCIuDFyqQ=; b=g5wYbfzS+kGovGYVf6QSW0yFxAqYbJ6gNwsveFQw8fYsN1qYEKRPoAMUoXf4NUrHYF jsoUnW3+WowTBShiQr22beoP8STXp3uNsyIRVLHplo7n6MST4UptjPVIoFmqLT0ahfxi MLHEKkOIPQsstL8f1A+UR1YXG9odahxvwbkm2vqeyBCzbmS/qUGK/Jumo5sZbjzcgK3r fwBiKQn4ZTei71lpmBTZwHzi5zH6YLKF7rEWG+Tp90qGOJ4vEPfYOKFdGKdRcjScpquZ lmqFCdfvf6b/3yWyYRfW/KAWGm8gPR+pHWFAko6nGq4ciZfd/QdQWSCpiZAv2LFZYvPq hZGQ== X-Gm-Message-State: AG10YOQ7B/5z+2T4CfTUsIGVJyneVltGj/rIno3PCOvBCpe0QR8IhpLkW9CMzqXK3uB8bFpz X-Received: by 10.98.19.205 with SMTP id 74mr4592756pft.31.1454524778221; Wed, 03 Feb 2016 10:39:38 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id xa9sm11369704pab.44.2016.02.03.10.39.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Feb 2016 10:39:37 -0800 (PST) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V9 02/18] coresight: add API to get sink from path Date: Wed, 3 Feb 2016 11:39:00 -0700 Message-Id: <1454524756-10628-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454524756-10628-1-git-send-email-mathieu.poirier@linaro.org> References: <1454524756-10628-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160203_134000_540017_4989FFDA X-CRM114-Status: GOOD ( 12.22 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, tor@ti.com, mike.leach@arm.com, zhang.chunyan@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add an API allowing external code to quickly get a handle on the sink within a path. The sink is always last, but adding an API allows to keep the path's node structure private and remove redundant checks. Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-priv.h | 1 + drivers/hwtracing/coresight/coresight.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 7b193a34d709..14f245a2018d 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -54,6 +54,7 @@ static inline void CS_UNLOCK(void __iomem *addr) void coresight_disable_path(struct list_head *path); int coresight_enable_path(struct list_head *path); +struct coresight_device *coresight_get_sink(struct list_head *path); struct list_head *coresight_build_path(struct coresight_device *csdev); void coresight_release_path(struct list_head *path); diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index f26589effb70..2ed48545df26 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -321,6 +321,21 @@ err: goto out; } +struct coresight_device *coresight_get_sink(struct list_head *path) +{ + struct coresight_device *csdev; + + if (!path) + return NULL; + + csdev = list_last_entry(path, struct coresight_node, link)->csdev; + if (csdev->type != CORESIGHT_DEV_TYPE_SINK && + csdev->type != CORESIGHT_DEV_TYPE_LINKSINK) + return NULL; + + return csdev; +} + /** * _coresight_build_path - recursively build a path from a @csdev to a sink. * @csdev: The device to start from.