From patchwork Mon Nov 30 02:14:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 57418 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1180729lbb; Sun, 29 Nov 2015 18:20:45 -0800 (PST) X-Received: by 10.66.90.234 with SMTP id bz10mr52415522pab.115.1448850045013; Sun, 29 Nov 2015 18:20:45 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [198.137.202.9]) by mx.google.com with ESMTPS id 77si5567483pfm.39.2015.11.29.18.20.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Nov 2015 18:20:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 198.137.202.9 as permitted sender) client-ip=198.137.202.9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 198.137.202.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 1a3E3b-0006xD-Gd; Mon, 30 Nov 2015 02:19:11 +0000 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a3E1Y-0005Wg-Kn for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2015 02:17:06 +0000 Received: by padhx2 with SMTP id hx2so168019696pad.1 for ; Sun, 29 Nov 2015 18:16:43 -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=sB//EUQBk+acWc/+8WubKw1sglbTKPuPaZQZiKruILEHRexg20vqcEZUd4yJfvaZ7Y HOTpkfK+LwAQnxoFT21Kt2CGOwfSr8l5aOcPeDzuQyO44QQ2huHCWuvz/OIeWnr9w+FT IPXX/IjfSeiL9Pw4s27F/UmgYLQOd4DvMD5c278QyvQ9nrPayA+c4LPOgR3HeFJ0Cw8E Vod+uCM9rBn+joAVjyqaxWNKv5JCYxlaE2vklwUGWF2wyVVQGTwgOub8cdr3bUuNkJiH oiLfLTW2voEloDARbv++GVkgNweKOIEU0MhKtKKbD84fi4HVLtexNk+kzpHpmv3vYKKX Lt+Q== 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=JUV/jtvk6UFAwcuYK7CWrXig8CgIJQ4e3vkJ2iHTmYcHurU1chTag76hSHvUBk8maW 3RulVdAun0AQ0VGJ4NcsSb5Pyg1+SiUGrKKWsZLf9+eSSv6W3UNmRsLyBP1KTOO7HEtg Jb1+t+MXqdStpPmk0aXnwYqmavO/7QEJZ6Qt5YtvZdIWUv5bDLsIxJR1YNJMXuMPDb83 EE7ZyITmYgDeyWnnGbQmY2hD3asw/1IEP2ciXP8/B0V+H6dYGQ4dGx8SdREACiQisAji cBZjjb3B++n3e5mEpHO3xQOpkUOam55AzOlry603dZRVXsoG8/aJ363GjpIrKnxab/Qs qsyQ== X-Gm-Message-State: ALoCoQmwGAZjM7CPTCGdvGlX/1lJOz9iwQvOSE4Gk0gwDFA9D4gqJwkuWOENvRIDYEgJHKxeBhGU X-Received: by 10.98.65.76 with SMTP id o73mr67591076pfa.119.1448849803735; Sun, 29 Nov 2015 18:16:43 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id n16sm47168818pfa.53.2015.11.29.18.16.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Nov 2015 18:16:43 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org, alexander.shishkin@linux.intel.com Subject: [PATCH V5 09/26] coresight: add API to get sink from path Date: Sun, 29 Nov 2015 19:14:30 -0700 Message-Id: <1448849687-5724-10-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448849687-5724-1-git-send-email-mathieu.poirier@linaro.org> References: <1448849687-5724-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151129_181704_867272_4493ACF6 X-CRM114-Status: GOOD ( 10.84 ) 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:22b 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, Mathieu Poirier , 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(+) -- 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.