From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F635C04AB5 for ; Thu, 6 Jun 2019 12:56:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4062C20868 for ; Thu, 6 Jun 2019 12:56:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NdmwDw/1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4062C20868 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gow2F4mBbG6iv14Z2YHVgtahe+to9yC4VzzswcL8uKA=; b=NdmwDw/1LNVK9XPQgf3NdprwQ g6OS88PJTBnArap0CWmJzQrLm3Zrdu2VHyQhVRrLXOeCZBjq6DNCIufdO/0t+yFSeFDixR6RuhMYy XoKWrsrSu1+N+R/W617mQx4rN9RLHv6ZEoYOfjzvfFTmb8Yf30KuSI8cX4DTVFACYxSOaiTgNtifo 9dNFMWXWGBY7P3S6o/U5HYNFBCy+WbeTfAW/Zz6arYPHgZtWWHQomgqxSLKAUCSnXj/IVObOCi7P7 /bfEfa43oiiMjJdIW1HE7lXMXKQX4Zn+oG4g+Ap/VGLR0Y0R8Sx3E9wl/VE6N83NYQxnnrm+v/7Sb f6S4nfwxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYrwV-0004rO-Qs; Thu, 06 Jun 2019 12:56:31 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYrwS-0004qh-HW for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2019 12:56:29 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EE25B374; Thu, 6 Jun 2019 05:56:27 -0700 (PDT) Received: from [10.1.196.93] (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0DA6C3F5AF; Thu, 6 Jun 2019 05:56:26 -0700 (PDT) Subject: Re: [PATCH v4 17/30] coresight: Make device to CPU mapping generic To: mike.leach@linaro.org References: <1558521304-27469-1-git-send-email-suzuki.poulose@arm.com> <1558521304-27469-18-git-send-email-suzuki.poulose@arm.com> From: Suzuki K Poulose Message-ID: Date: Thu, 6 Jun 2019 13:56:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190606_055628_588587_8C4D7C55 X-CRM114-Status: GOOD ( 20.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mathieu.poirier@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 03/06/2019 11:07, Mike Leach wrote: > Hi, > > On Wed, 22 May 2019 at 11:37, Suzuki K Poulose wrote: >> >> The CoreSight components ETM and CPU-Debug are always associated >> with CPUs. Replace the of_coresight_get_cpu() with a platform >> agnostic helper, in preparation to add ACPI support. >> >> Reviewed-by: Mathieu Poirier >> Signed-off-by: Suzuki K Poulose >> --- >> drivers/hwtracing/coresight/coresight-cpu-debug.c | 3 +-- >> drivers/hwtracing/coresight/coresight-platform.c | 18 +++++++++++++----- >> include/linux/coresight.h | 7 +------ >> 3 files changed, 15 insertions(+), 13 deletions(-) >> >> diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c >> index e8819d7..07a1367 100644 >> --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c >> +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c >> @@ -572,14 +572,13 @@ static int debug_probe(struct amba_device *adev, const struct amba_id *id) >> struct device *dev = &adev->dev; >> struct debug_drvdata *drvdata; >> struct resource *res = &adev->res; >> - struct device_node *np = adev->dev.of_node; >> int ret; >> >> drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); >> if (!drvdata) >> return -ENOMEM; >> >> - drvdata->cpu = np ? of_coresight_get_cpu(np) : 0; >> + drvdata->cpu = coresight_get_cpu(dev); >> if (per_cpu(debug_drvdata, drvdata->cpu)) { >> dev_err(dev, "CPU%d drvdata has already been initialized\n", >> drvdata->cpu); >> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c >> index 5d78f4f..ba8c146 100644 >> --- a/drivers/hwtracing/coresight/coresight-platform.c >> +++ b/drivers/hwtracing/coresight/coresight-platform.c >> @@ -151,12 +151,14 @@ static void of_coresight_get_ports(const struct device_node *node, >> } >> } >> >> -int of_coresight_get_cpu(const struct device_node *node) >> +static int of_coresight_get_cpu(struct device *dev) >> { >> int cpu; >> struct device_node *dn; >> >> - dn = of_parse_phandle(node, "cpu", 0); >> + if (!dev->of_node) >> + return 0; >> + dn = of_parse_phandle(dev->of_node, "cpu", 0); >> /* Affinity defaults to CPU0 */ >> if (!dn) >> return 0; >> @@ -166,7 +168,6 @@ int of_coresight_get_cpu(const struct device_node *node) >> /* Affinity to CPU0 if no cpu nodes are found */ >> return (cpu < 0) ? 0 : cpu; >> } >> -EXPORT_SYMBOL_GPL(of_coresight_get_cpu); >> >> /* >> * of_coresight_parse_endpoint : Parse the given output endpoint @ep >> @@ -240,8 +241,6 @@ static int of_get_coresight_platform_data(struct device *dev, >> bool legacy_binding = false; >> struct device_node *node = dev->of_node; >> >> - pdata->cpu = of_coresight_get_cpu(node); >> - >> /* Get the number of input and output port for this component */ >> of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport); >> >> @@ -300,6 +299,14 @@ of_get_coresight_platform_data(struct device *dev, >> } >> #endif >> >> +int coresight_get_cpu(struct device *dev) >> +{ >> + if (is_of_node(dev->fwnode)) >> + return of_coresight_get_cpu(dev); > > No of_coresight_get_cpu() will be defined if CONFIG_OF _not_ defined. > This will hit an implicit declaration compile error in this case. Thanks for catching it and you're right. I will fix this. Cheers Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel