From patchwork Thu Jan 14 21:45:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 59785 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp153881lbb; Thu, 14 Jan 2016 13:49:49 -0800 (PST) X-Received: by 10.98.66.139 with SMTP id h11mr9568809pfd.121.1452808176115; Thu, 14 Jan 2016 13:49:36 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id g25si11630418pfj.135.2016.01.14.13.49.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jan 2016 13:49:36 -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 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 1aJpkz-0005DA-3H; Thu, 14 Jan 2016 21:48:37 +0000 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJpjm-0004FC-9A for linux-arm-kernel@lists.infradead.org; Thu, 14 Jan 2016 21:47:24 +0000 Received: by mail-pa0-x236.google.com with SMTP id yy13so290498769pab.3 for ; Thu, 14 Jan 2016 13:47:01 -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=kDqbGVW9WGUxFjhNhn4olMsq8xz69hTywG+IgmIvM3+LHW0RtKj+zlabMZlJSHw4Ut tkdCTUSLj0BlHE5LpRwWG5WrnKDC875XhuTFz5MvRjnSa2afziJe+FwYSznZTDadkQdQ SyTTo4c0x6UMsfzwcIu7bZDezn2bC6luoQ9qM= 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=hwomClJ9bYli+booO3RqzTAYw80ZXI8f7oy8di+GtfrerPuK9oNLIeZhPvAopPXycu tDsvvQygVPCjCUOHpB+k1XsQcgk0vpajzXytHOk306GqQ+R4vWr+/oDuWGNoWn4u+TeF wqT4e+xrKVBAy6aciSv+LU6aAtFFSQPI0uT74Eqfl0x1Y1smjwzgrpqN2pXBfm53Qcwq nl4ePV7GZjFKbH6R3y5fo+dZ1RIU/NddEBchP6tA5YUv7gSx/b3lvtC9ZZwH1Y5brBLy RxxxZn5PKks5rH/nDk0ZSRT/qaVsLtX6FlaWAtLAMpnbQ2Z5/sDL+/EvsfXaWHrFw44y cDHQ== X-Gm-Message-State: ALoCoQn2CvGm2wYI4Mp9sm1wbvOkQaioXbtcNPHZcjvvOiG9L56dGN8qF7pi1JVDK3/OnslzgrMLVwBHUs0OWe0CpbRb1aj3Ig== X-Received: by 10.66.232.202 with SMTP id tq10mr9286022pac.156.1452808021665; Thu, 14 Jan 2016 13:47:01 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id c87sm11383309pfj.41.2016.01.14.13.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jan 2016 13:47:01 -0800 (PST) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V8 02/23] coresight: add API to get sink from path Date: Thu, 14 Jan 2016 14:45:56 -0700 Message-Id: <1452807977-8069-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452807977-8069-1-git-send-email-mathieu.poirier@linaro.org> References: <1452807977-8069-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160114_134722_496058_E9AB590A X-CRM114-Status: GOOD ( 10.25 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 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:236 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_AU Message has a valid DKIM or DK signature from author's domain 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 , linux-doc@vger.kernel.org, zhang.chunyan@linaro.org, rabin@rab.in, mike.leach@arm.com, tor@ti.com 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 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.