From patchwork Thu Feb 18 00:51:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 62143 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp308648lbl; Wed, 17 Feb 2016 16:54:20 -0800 (PST) X-Received: by 10.66.65.109 with SMTP id w13mr6305337pas.142.1455756860300; Wed, 17 Feb 2016 16:54:20 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id zq10si5405077pab.11.2016.02.17.16.54.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Feb 2016 16:54:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for 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: best guess record for 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 1aWCqB-0004o0-5y; Thu, 18 Feb 2016 00:53:07 +0000 Received: from mail-ob0-x22b.google.com ([2607:f8b0:4003:c01::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aWCpb-0004bx-Hx for linux-arm-kernel@lists.infradead.org; Thu, 18 Feb 2016 00:52:32 +0000 Received: by mail-ob0-x22b.google.com with SMTP id xk3so42919928obc.2 for ; Wed, 17 Feb 2016 16:52:12 -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=ZLel/VhjoiQoEf11bPZKkRY3vGTKFNCLeVMW+L4NHuErBtGGs6xMXahqVHThlAsGuP Tn2FQvTXVZ/GqbNl22XC1la2TK+/4YAs7wYljhixAarRD1HAvP6NPrAr5lqIqAMJAPXU TsHinkVKDXYVFEBe3UzIFrN/R4/oJmzEKYRKE= 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=BRJrFRlBMNfAea6eh6YMeoOB7/x7dp1YlHT0KmKZbkIZTqlUk2tkfRBPjpxv2HLH1j rvNvYWZpxjRdvzmohgbtTXOFt0IObTDqsG5n+5fXlStxbZG8cnAO2mE9Gf6Q0YmRWlmC RXn2f6ejoy7rD76PKQeuALw/gR+UvL2vnnZ3QyHMA+KC57F+xBvVAhY8RxfDG+qRjX5z brbjbIuURKBuz2dwgc+L1xVESEKZ9TDOMSi1iXmNw/56V5yYyMBrBewdwTcBxLo0L/au pU93XVKN250pCW4XqkIFJmI9pZ1UrIvXmbi9TSblllsJ7hwywr8DT63vLCcnL0IE6eUk qxDw== X-Gm-Message-State: AG10YOSOS+Y4fNRNCv/f6WhRbYqc+mb9o3YBqspkt7na2kYu/ezfnX/fO66c5wn4OzCrq23Q X-Received: by 10.182.60.198 with SMTP id j6mr2592638obr.12.1455756732272; Wed, 17 Feb 2016 16:52:12 -0800 (PST) Received: from t430.globalsuite.net (h58.159.185.173.static.ip.windstream.net. [173.185.159.58]) by smtp.gmail.com with ESMTPSA id gi5sm2357650obb.6.2016.02.17.16.52.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 16:52:11 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/21] coresight: add API to get sink from path Date: Wed, 17 Feb 2016 17:51:46 -0700 Message-Id: <1455756723-8456-5-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455756723-8456-1-git-send-email-mathieu.poirier@linaro.org> References: <1455756723-8456-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160217_165231_746773_C173E677 X-CRM114-Status: GOOD ( 11.52 ) 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:4003:c01: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_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: linux-kernel@vger.kernel.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 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.