From patchwork Thu Dec 3 21:04:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 57683 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp167546lbb; Thu, 3 Dec 2015 13:08:25 -0800 (PST) X-Received: by 10.98.67.68 with SMTP id q65mr16235174pfa.63.1449176905849; Thu, 03 Dec 2015 13:08:25 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c66si14179682pfd.69.2015.12.03.13.08.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Dec 2015 13:08:25 -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 1a4b5d-00056o-AN; Thu, 03 Dec 2015 21:06:57 +0000 Received: from mail-ig0-x230.google.com ([2607:f8b0:4001:c05::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a4b4f-0004Te-45 for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2015 21:06:05 +0000 Received: by igl9 with SMTP id 9so19872259igl.0 for ; Thu, 03 Dec 2015 13:05:36 -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=hH/NXzqFazmen+rn0Vm0hR/964DH01oVx4XgQN5C9eo=; b=UheHKC0XTIUSnMcddvVKpEb+LJetuqPI/MiTMpMU1rMd5Gs/qRX290xXa5FUMI/h7p piO/sDHfuVlSr8wwWH9v3M+X9rxOA+F3y5HK3tRNd0RVnHmx8epVTF0VivJr4NU6FZZF zq+pwvT90ankq6bGuX/TzxMZ1pc1cBA0ENRTZED8m1rGpyf5KrK+QWlgYR2eX9VVMV7Q enHV4kghaPxg1AVWBbLax/jrTo2Ytv8Xne33LS4JZ3SiWVG3aDx+lE5jGZNCje4fkzVQ fkMZ63nf4T0edVGysQ/SFvnujZciGnps770BCoxKRcSkfNJ8kZXQaPRVtsG4v7rT3yNs j8kg== 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=hH/NXzqFazmen+rn0Vm0hR/964DH01oVx4XgQN5C9eo=; b=Bv6CGqJD/rhJAHjGDy/ws2HoklEOZfIxh/r2vd4IMwuNuzuT/OOTVtPepZ+JwS7Xq1 c5M/PVghUYV+R2rr5iQaxcapsNwhGStLWZn9yLB4teI+0xzbCgi+pAygdklr/6meF7Q1 z/iuYQBK/GvqwEHzl0pTx/0dD77QlSF0q88ItOn8kpFDbYFa+03qX9WGpUIFzaLI5Swj gRmFF8Q1079+f5ibiiQuSOcmAoEC3khP4oEJ//l+FGbEwZAK/iilOmpcgXOEYK9pZV3s MxHsTfloiTdE2XdAaJrfAjrA1GOUXTgSmsefDnJhAOGYMy+4jmR2VzVCCBYof6lmqnU/ nofw== X-Gm-Message-State: ALoCoQlzluBowj6q2j0vq8Qmg13yXyGDf9C20cqqjqFwWHw35/eNx3e4VmJHMlJIzepgU/sc17SK X-Received: by 10.50.109.201 with SMTP id hu9mr781082igb.5.1449176736410; Thu, 03 Dec 2015 13:05:36 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [184.64.168.246]) by smtp.gmail.com with ESMTPSA id d81sm3615433ioj.12.2015.12.03.13.05.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Dec 2015 13:05:35 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org, alexander.shishkin@linux.intel.com Subject: [PATCH V6 09/26] coresight: add API to get sink from path Date: Thu, 3 Dec 2015 14:04:45 -0700 Message-Id: <1449176702-13213-10-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449176702-13213-1-git-send-email-mathieu.poirier@linaro.org> References: <1449176702-13213-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151203_130557_454124_6177BCFF X-CRM114-Status: GOOD ( 11.05 ) 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:4001:c05:0:0:0:230 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_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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, Mathieu Poirier , 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(+) -- 2.1.4 _______________________________________________ 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 4e326d792100..c02da2edfd80 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.