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=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT 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 E6B5AC10F0E for ; Thu, 18 Apr 2019 18:15:11 +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 9FE92206B6 for ; Thu, 18 Apr 2019 18:15:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JiGDg/qt"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="g63Jrcfp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FE92206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gr/JVO0gdI4jNd9FmMLv28lVMUyf4DBHm6dRRZBEhyc=; b=JiGDg/qt3oGd8I irBuBmPhilSWrBAjxMrE6ai40e7bfJCAXi0kYXV3FxdZfd1KipvVBgpZusT/eJCoDv6zl8aT9NpPH LmgpR6HjAUa5W9WnSt3cqX3ZlWrXWUtzv+2GB03+A+L0sWINpSivFyaJzzAqIvQM46FT0Rfqt7RNM vIxNxEPp2+yVHeCDZV4wrePkWJHUPemA+b5ddYtTJgTa5IKZHaAHybSZ3Q3mT9d/dBUtKQanskx47 yrDEUteTmeKa/NbDOFmwfJYmdKzBecLVYJL8wMcFGYyDnP67wNozyVX/OocNGHwpdPOR50pSD1a0G EaxWLEbB2ZSZgzDDKcIg==; 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 1hHBYn-0008SM-AK; Thu, 18 Apr 2019 18:14:57 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hHBYj-0008Rm-5E for linux-arm-kernel@lists.infradead.org; Thu, 18 Apr 2019 18:14:54 +0000 Received: by mail-pf1-x442.google.com with SMTP id w25so1461323pfi.9 for ; Thu, 18 Apr 2019 11:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=o16/LdvJgUhzxLOzJLz4tqzs41ZSZqXnYt0SCNmPbYM=; b=g63Jrcfpp0CpXF2CFaPR5HqCA2ZwtddghF2cRaGIrjv8hGHzvfH1BA9XAD8CC6jt0W zqM465FEm5g4bFAFr+9UJmI9GET9/8YToiMNWmX21CQoyUx9Eym/mjRDPV/oNUeud1oD UBQ6dnxgefhAj3NTMRVArkwDHH2jt2F2YE7n9eERT/zSkftQlxVxwXaKyhhmru24ZkyT kxQhYXAIUGzRWcf9WKe46Yi6ckQTJJJNXZ22BgUxuSIWawMbPlyCrVxkn2C2mzZUifNp YbERyV33RwG/f4mhGDMtnAzyWZe/aNpk2hsD03496o5eEYVySItfVMYJ8mX9OmY+EsaN sY1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=o16/LdvJgUhzxLOzJLz4tqzs41ZSZqXnYt0SCNmPbYM=; b=g7Mvt2WaDsfF8jy2aMHrbwfhhYaINh8faf8lZFznOo98h1zfFr9RWZTXQvqv7bOWBM aLG6Zmgp0OEt7lnBlUaHRI45BO7HRAPVlNAskIjqRYAy+Qanw7SQ/GvT9VhWBoW6/nLE eB0vo38vhfxO+o8qtkYstVXQiWe/dcxHgWq9SbxIP1HevJkPwicRmQCBEx3onMLS8kwS tP+NpQ/+WTkev5H4b/eHxk+B2njzT/Ee5BcrzQTBD/K3Q2r3f8SvEK+MxrcCvHw4+JI1 bfWVzD7eKcHVzW62bWgA28QeMvBpViRB13xaDabaez3GLQAKZYPZn6EpAO2mZvYxJG6u +drg== X-Gm-Message-State: APjAAAVuB2zu224HpTkJANu81CmpIziwwIB0DxGBKA+Qk9u+jBrY6EQ7 zjicmiAc+yo7Wgw03w2821V3afCrIh8= X-Google-Smtp-Source: APXvYqySah2SU+varGc+UC5VL+EUx98oNt8QxAn/OemSNcn2Ar603CT9p5I3Yqp1jfE51gY+bDdkDw== X-Received: by 2002:a63:df12:: with SMTP id u18mr90482891pgg.135.1555611291965; Thu, 18 Apr 2019 11:14:51 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 8sm4339349pfs.50.2019.04.18.11.14.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Apr 2019 11:14:51 -0700 (PDT) Date: Thu, 18 Apr 2019 12:14:48 -0600 From: Mathieu Poirier To: Suzuki K Poulose Subject: Re: [PATCH v2 20/36] coresight: Make device to CPU mapping generic Message-ID: <20190418181448.GC10675@xps15> References: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> <1555344260-12375-21-git-send-email-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1555344260-12375-21-git-send-email-suzuki.poulose@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190418_111453_229998_E55DF1B1 X-CRM114-Status: GOOD ( 20.36 ) 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: coresight@lists.linaro.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, robert.walker@arm.com, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Apr 15, 2019 at 05:04:03PM +0100, 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. > > Cc: 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 25a1838..8a86ba3 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 > @@ -241,8 +242,6 @@ 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); > > @@ -294,6 +293,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); > + return 0; > +} > +EXPORT_SYMBOL_GPL(coresight_get_cpu); > + > struct coresight_platform_data * > coresight_get_platform_data(struct device *dev) > { > @@ -309,6 +316,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)) > return of_get_coresight_platform_data(dev, pdata); > diff --git a/include/linux/coresight.h b/include/linux/coresight.h > index 5b29255..a48cd9b 100644 > --- a/include/linux/coresight.h > +++ b/include/linux/coresight.h > @@ -291,12 +291,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); For patches 12, 13 and 15-20: Reviewed-by: Mathieu Poirier > > -- > 2.7.4 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel