From patchwork Mon Apr 15 16:04:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 162228 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3107802jan; Mon, 15 Apr 2019 09:08:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpCo8IIyJTE2TGT0SzAROL7a/k6VMwEWVoThnjtrQ3H3nf0U5YKgV8MsxTAvUL4V7Tfymg X-Received: by 2002:a65:4343:: with SMTP id k3mr70547173pgq.384.1555344487813; Mon, 15 Apr 2019 09:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555344487; cv=none; d=google.com; s=arc-20160816; b=DKevKwYvwj/WZf1/3ttAAu5U4hlY+02+9rtSWBmPIpTUymH2B5lUfXd8c8ZC43j4Ek Q+Qt3Udud4Ag4uzKY1FjPq+LRr5ns3hpnVXALICm6sm1joT3x1YSLpLFOKI8wjh0gjbo E/0nJ7qPWCYv/sNoRIRzMqvK6Qeoo7EIaoTrVxXMGAtP9ods+w7i+3Ga/aqnkFt3JIW4 r9533uCubANlcOZN7f/lI143FePmNpRZVjro69RgVkHkG0GTe81CUYpOGHKQaMFC4t7k AwWWCv7ynksTZGb8U+Rl+GVZgiskK//fHJvAPNKaJLXryQA6JalHDRH8TLdy3dDT5fkr EAaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=XDRTMppfRnaUp3dHCTapRsTJIzJcZi1kV+zItlZEXlU=; b=w7EvfRF0HGmxSkMRIE0dxr9e+16/Gu9fX/o9NJ6UuyG5U7Z4PGKZmz80uMC/Dq/BhJ 3g1+esGG2PhsQ/IBRVDp8LnIcacOtFjXRaUc7x5dyGYDjkF+Lb3IgoRJmb+CC75Sa7RY FuuQ+jJ2BgdOSfqEKPu7WAfDm3GwDShd9OT2WjJMehluR2n582PAqZacE2PyAa0d85pi 8XKJrViLKXD97UtcPJUKOIYuqDUxNL66qzSU3xlwNeEd6/vuhnLpNBtBP00SSJBEkONe sLym0KWRl8t1dTsJ5+g0fpWU/R9N4AWApiyFSGhtyhVEKYjbkmr1foEVQk7hY2fI2FSW 9h4w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si45214973plr.307.2019.04.15.09.08.07; Mon, 15 Apr 2019 09:08:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728011AbfDOQGW (ORCPT + 30 others); Mon, 15 Apr 2019 12:06:22 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37880 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727991AbfDOQGQ (ORCPT ); Mon, 15 Apr 2019 12:06:16 -0400 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 6EFF31688; Mon, 15 Apr 2019 09:06:16 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E957C3F68F; Mon, 15 Apr 2019 09:06:14 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, rjw@rjwysocki.net, robert.walker@arm.com, Suzuki K Poulose Subject: [PATCH v2 18/36] coresight: platform: Make memory allocation helper generic Date: Mon, 15 Apr 2019 17:04:01 +0100 Message-Id: <1555344260-12375-19-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> References: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rename the of_coresight_alloc_memory() => coresight_alloc_conns() as it is independent of the underlying firmware type. This is in preparation for the ACPI support. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-platform.c | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 514cc2b..4c31299 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -17,6 +17,24 @@ #include #include +/* + * coresight_alloc_conns: Allocate connections record for each output + * port from the device. + */ +static int coresight_alloc_conns(struct device *dev, + struct coresight_platform_data *pdata) +{ + if (pdata->nr_outport) { + pdata->conns = devm_kzalloc(dev, pdata->nr_outport * + sizeof(*pdata->conns), + GFP_KERNEL); + if (!pdata->conns) + return -ENOMEM; + } + + return 0; +} + #ifdef CONFIG_OF static int of_dev_node_match(struct device *dev, void *data) { @@ -133,20 +151,6 @@ static void of_coresight_get_ports(const struct device_node *node, } } -static int of_coresight_alloc_memory(struct device *dev, - struct coresight_platform_data *pdata) -{ - if (pdata->nr_outport) { - pdata->conns = devm_kzalloc(dev, pdata->nr_outport * - sizeof(*pdata->conns), - GFP_KERNEL); - if (!pdata->conns) - return -ENOMEM; - } - - return 0; -} - int of_coresight_get_cpu(const struct device_node *node) { int cpu; @@ -252,7 +256,7 @@ of_get_coresight_platform_data(struct device *dev, if (!pdata->nr_outport) return pdata; - ret = of_coresight_alloc_memory(dev, pdata); + ret = coresight_alloc_conns(dev, pdata); if (ret) return ERR_PTR(ret);