From patchwork Mon Nov 23 18:33:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 57185 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1603555lbb; Mon, 23 Nov 2015 10:36:49 -0800 (PST) X-Received: by 10.67.22.99 with SMTP id hr3mr37083070pad.10.1448303808113; Mon, 23 Nov 2015 10:36:48 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ji5si21697541pbb.127.2015.11.23.10.36.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Nov 2015 10:36:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com 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 1a0vxY-0001rD-97; Mon, 23 Nov 2015 18:35:28 +0000 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0vwd-0000BJ-8Y for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2015 18:34:36 +0000 Received: by pacdm15 with SMTP id dm15so198922176pac.3 for ; Mon, 23 Nov 2015 10:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BbbETlVP4B0Sg9uZEf7t4oguqh23V9VUk7h2cVXn5nk=; b=b/S2hD8VSmwG9JhYXbAg+K6VH9i9E0osWpD0QWbGBnLsC2v4D8yZ6ovWKszeno+mnA 0Y0rZNQH4j6EQlqrSIoxIldqb1ChOZDrIYpoObIry0XsdtLb5awr1hRTat4DZ4QZee1K cTxf840sqkK8Y+eyjOJNb0QwxFzEN86jiYIRSgt9pCZ9SGvDSDlBmOTqoBjv5ckHTs80 SvI5VfsEOnkP/5daUaQWS/DZqtBYK22QVVt1q1iuUdQTYsiBNE6fTYlNiSOAQYBGloBZ 1DiK9kAdrz7xoXG+v8ZYGhhFJclGgm2ALbbz61MzHK+ZySdhmeZPq1I3nx3LL8szAmye UQtA== 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=BbbETlVP4B0Sg9uZEf7t4oguqh23V9VUk7h2cVXn5nk=; b=bZVgjAPL7TjTrRNSokPJhlWAwSnnZwtlzoBUbpALudvekR8V/wStS2NDjus62mdBmm HzwTRKTlgLj4KRPG1Yoak0BNivjS6NyvSP2j26wymqoObmZJkJk4jQ0UPxeohBJvgcsN cXhv/KVzSNsoAQo3I9+atgh0QgFvQiPAPrYmv3sMpj8WGdOG2+gf6HBRNTQA+D6Wu9Op 5rAuLpRsGtMQmpQdAQQ5uZ2Olcx7edcda771wmylMjx/RlGGU1N9pa0vgmqxYR6MSpgf lmZxYUjcjqR2wfwOH4APPR5ztG18yqE9GbPa+ZYAaW8JYqFMfGWqjIi9D9uhTlyEkERJ Yj8A== X-Gm-Message-State: ALoCoQnJsN7gu7GGLLUGhvCOlpgoS2kVJUq9gzX9pEqvNkxd+WKMoxMU8jZzLl8qpiFtKzsaC/7R X-Received: by 10.68.170.4 with SMTP id ai4mr37259322pbc.78.1448303652196; Mon, 23 Nov 2015 10:34:12 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id r20sm10865186pfa.93.2015.11.23.10.34.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 10:34:11 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, alexander.shishkin@linux.intel.com, acme@kernel.org, mingo@redhat.com, corbet@lwn.net, nicolas.pitre@linaro.org Subject: [RESEND PATCH V4 09/26] coresight: add API to get sink from path Date: Mon, 23 Nov 2015 11:33:01 -0700 Message-Id: <1448303598-11249-10-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448303598-11249-1-git-send-email-mathieu.poirier@linaro.org> References: <1448303598-11249-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151123_103431_613087_66E9BA9C X-CRM114-Status: GOOD ( 10.97 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c03:0:0:0:229 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: al.grant@arm.com, pawel.moll@arm.com, linux-doc@vger.kernel.org, fainelli@broadcom.com, linux-kernel@vger.kernel.org, tor@ti.com, mike.leach@arm.com, zhang.chunyan@linaro.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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(+) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 2dc59a5c5b1e..ed116b303e87 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -60,6 +60,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 7e4064b31c99..47a4e109f700 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -322,6 +322,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.