Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4414110ybi; Mon, 3 Jun 2019 10:26:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKtdOAoL+42LtP2p3Ke1FC5FHkeByNFKQKYGisIsGRkX2kI3YujQSq30VLUJc5HIpisbNs X-Received: by 2002:a62:6585:: with SMTP id z127mr32469195pfb.179.1559582786366; Mon, 03 Jun 2019 10:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559582786; cv=none; d=google.com; s=arc-20160816; b=XUJqRwsVQdN8EGns86RdQ4ui1MZixWD7zHrIchouzTdV/KcugDZ1PxRwV7Pe04mzw1 i5dTZkCO8R60uRtBIWfmvWJv8+gSYCnYQuiYOfTTYRenAocAS6BQOi7De6ybnHN0V1jQ QpRbMCmp4DYFqN+KiIsund5g2kEsYP+iRrj6L5hG9cRVxIStyDOhj0IMmxgeA07iG4v1 sK6RihL7J8YqnPmga1LvB9rziG+FIODyAh5KiVWll8Z3l/+/u/Lv7Lx1c+AiJWsqrEOV PhijwYqVo1QBZdhyw2IhFH8kY+gNsccN5xRfR4NXhMxIQxGYDUIANkfrhqfDGDUmHXqu occw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=20lifKx9/NjRBCOxPqWlC+JnTIwt3odrmH3LlHTbl1E=; b=0+/Emll2TX1glbvx8lvJnSghypMmy4jHQ2IiXQXTrYTuY36OeeKQ+D7m1o8i6kPEfE 7CpPsmScj9bm8NwKYuQWJ/sRsBkZMAaXhy5zCbT4aAldkcxtpqoGjnAkfH+d4w5AL5XR fGuSNqQVS1yGz0D3fatrkvu9SH9n+RVz9gYFaJYp/1YCBYa3z4Ecrr9Q9oA89HHSh97n L+VrfU94CqICqDqvfX6YzuajPDnF5uStN0wdJu8cOhNArVwf48a7awNc5dFVmH6QhYWm GpltrqzF46wRG3x4lreBFPKWUx26et+Ygig/zRMxCHlXs3n9tkEmi0XuQqpfQmgnVryt aULA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=agZsHnu8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si10983523pgh.177.2019.06.03.10.26.08; Mon, 03 Jun 2019 10:26:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=agZsHnu8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728020AbfFCKII (ORCPT + 99 others); Mon, 3 Jun 2019 06:08:08 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:33076 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726369AbfFCKII (ORCPT ); Mon, 3 Jun 2019 06:08:08 -0400 Received: by mail-qt1-f194.google.com with SMTP id 14so8658766qtf.0 for ; Mon, 03 Jun 2019 03:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=20lifKx9/NjRBCOxPqWlC+JnTIwt3odrmH3LlHTbl1E=; b=agZsHnu8Zj/6uLXUE+jJXg1IqtCdweLNoYNsVPvASRgBZeD9x8/9UIan0+otNFOVUx ul0NRWJcKgKQG5EJ9jfOqNkJUlOan38dorkZggntK6I1acGyv/Fv5ffquyuNcMaznEsz aYrpdo3PiopIiRBMa23wh8BL8Vc9Emp44sBlXY9mpj5N0y0MCGIN8nfQxaHPiZbSKJqD BkR3iHFko0dcQxgCkFuVxBEASgjPkrOzeKSx2M/mNDeEHiWd2WRqBpzYIZUrHJE85FEP OGUSb6cSN3oo6jkMP3E2ri6giWntEAD/huMAL7LV5NIfuv/e6X1SeXkprKv6u1z7YaY7 A2zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=20lifKx9/NjRBCOxPqWlC+JnTIwt3odrmH3LlHTbl1E=; b=BQ6gZhlkjui6B1F5YNu39j/RiNipNfE1aqLmGOP7t/f314Nndl+eLT/Fha7nmYHqo0 FUKEE85tPyokKNDhVhWimWPf/oUYh/JbwLBlJjN8hKuESo+328qMv/GW4Btubz5EDPn3 Ww9InMBw+XvdZ9QZ5fsYdqWsSQXXc9EnFjiOMeAYGHSxJcvo2VUWuW/+HuMbZSi2iw1Z VnkG8rFymlyEb0LmYcRMlW9rgQ9xxFf7zKAslw9UtceAKcXl3JBgaZdOuiCYwRNfkEdA /lkRax4xSwFD26LM4TYnBLpb5LdrCWo/PSh8pFkdJie7x5ngLOyBgXXKarBgcCa2Af1I FAaA== X-Gm-Message-State: APjAAAWNxtRt9JCqZ0xrFBn1jnESCHdG38Tl7phkhN5XbBPH7fp/hMVf 1SJUEHypWO0R6NS73shBpgX3Fl0168gYggkzk7C8fhNO X-Received: by 2002:ac8:26dc:: with SMTP id 28mr21560600qtp.88.1559556486585; Mon, 03 Jun 2019 03:08:06 -0700 (PDT) MIME-Version: 1.0 References: <1558521304-27469-1-git-send-email-suzuki.poulose@arm.com> <1558521304-27469-18-git-send-email-suzuki.poulose@arm.com> In-Reply-To: <1558521304-27469-18-git-send-email-suzuki.poulose@arm.com> From: Mike Leach Date: Mon, 3 Jun 2019 11:07:55 +0100 Message-ID: Subject: Re: [PATCH v4 17/30] coresight: Make device to CPU mapping generic To: Suzuki K Poulose Cc: linux-arm-kernel , Coresight ML , linux-kernel@vger.kernel.org, Mathieu Poirier Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Mike > + return 0; > +} > +EXPORT_SYMBOL_GPL(coresight_get_cpu); > + > struct coresight_platform_data * > coresight_get_platform_data(struct device *dev) > { > @@ -318,6 +325,7 @@ coresight_get_platform_data(struct device *dev) > > /* Use device name as sysfs handle */ > pdata->name = dev_name(dev); > + pdata->cpu = coresight_get_cpu(dev); > > if (is_of_node(fwnode)) > ret = of_get_coresight_platform_data(dev, pdata); > diff --git a/include/linux/coresight.h b/include/linux/coresight.h > index e2b95e0..98a4440 100644 > --- a/include/linux/coresight.h > +++ b/include/linux/coresight.h > @@ -292,12 +292,7 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} > > #endif > > -#ifdef CONFIG_OF > -extern int of_coresight_get_cpu(const struct device_node *node); > -#else > -static inline int of_coresight_get_cpu(const struct device_node *node) > -{ return 0; } > -#endif > +extern int coresight_get_cpu(struct device *dev); > > struct coresight_platform_data *coresight_get_platform_data(struct device *dev); > > -- > 2.7.4 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK