From patchwork Fri Dec 18 20:58:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 58741 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp1268296lbb; Fri, 18 Dec 2015 13:01:38 -0800 (PST) X-Received: by 10.98.73.7 with SMTP id w7mr8292644pfa.158.1450472498438; Fri, 18 Dec 2015 13:01:38 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qd3si26136093pab.208.2015.12.18.13.01.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Dec 2015 13:01:38 -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 1aA28k-0005X6-C3; Fri, 18 Dec 2015 21:00:38 +0000 Received: from mail-ig0-x22f.google.com ([2607:f8b0:4001:c05::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aA28A-00045h-1d for linux-arm-kernel@lists.infradead.org; Fri, 18 Dec 2015 21:00:03 +0000 Received: by mail-ig0-x22f.google.com with SMTP id m11so409781igk.1 for ; Fri, 18 Dec 2015 12:59:41 -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=qvlcjmTL5POLxcPIhhH9GwtayGgsdUDxIqW0AvUfIIY=; b=IMbsr1zVg2S+MfCUA28e9z6HIdSlcmT71R7rhdC5wILKpWlfyscZZLePjL25HLlfE1 UiysBdU/fPJAHmVMtTiwppIQiLPMQrAJ42x3TVyAZYb/OogiEEoK2GLsC4rBVVP9IT1T TuSQuEbdqleh6lUPxcQ3A+vfiz1Gx996h7ya4= 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=qvlcjmTL5POLxcPIhhH9GwtayGgsdUDxIqW0AvUfIIY=; b=On/XmKa1PAxrd2BeKWtlPxqb2P+a0lblONeLq2wuyYMYTlqKwzV83V3/27IGpDOWCy nIs47LKRSB2y747oPw7SdMIpsmIY5yaOIY823aH2jNqnMwBEWijcNRRSC9YUTuMd6Ddu +1WR1UplGfQgv7gmjCZvpd7zRB0vqKvm/PfRAQpoMyC2qo/lANYraE29t/LaqR21Rll4 tVGahwvhdgdanCj6y6mQ7PvFrheXzN4utyHmhMU1vOiPVOpfCsMwHvssbAlV+4OV/wCN SRc9sZY+Llud5ZkXA/aAvYXdbP4Zmn2Mb8lkxsoRIiJM/BZ08MORZP6Xsm9J+MvX/v7H 3kCw== X-Gm-Message-State: ALoCoQkMTCmpG7TLHe3RC6h74bxhihQaAXvKL2bEltYT/na45I9mv2ISDxoYzoHNfzjf2RzyX+jM3/5kdpGLvZGUjb/iaDf7Iw== X-Received: by 10.50.88.69 with SMTP id be5mr1740834igb.94.1450472381261; Fri, 18 Dec 2015 12:59:41 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [184.64.168.246]) by smtp.gmail.com with ESMTPSA id l10sm843701igx.18.2015.12.18.12.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 12:59:40 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org, alexander.shishkin@linux.intel.com Subject: [PATCH V7 03/24] coresight: add API to get sink from path Date: Fri, 18 Dec 2015 13:58:59 -0700 Message-Id: <1450472361-426-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1450472361-426-1-git-send-email-mathieu.poirier@linaro.org> References: <1450472361-426-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151218_130002_234058_DC27F5EF X-CRM114-Status: GOOD ( 10.81 ) 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:4001:c05:0:0:0:22f 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_AU Message has a valid DKIM or DK signature from author's domain -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, 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 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 74beba461aa2..b488af14a143 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.