Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp308941ybm; Wed, 22 May 2019 03:37:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzEQ9GfafM1iSdlABhfX6FkxqvvY0cNQc75HoPRsXUMaQlneUgUtIks8MhqBeZRcd/mjB/ X-Received: by 2002:a17:902:bc4b:: with SMTP id t11mr82805615plz.255.1558521438455; Wed, 22 May 2019 03:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558521438; cv=none; d=google.com; s=arc-20160816; b=V3XQf/edq0h36/itHoGu+5iped+WR/QP3DfmQo8yYJ/VlFGPUKjbK1i7yI5W3svgdc tNEMpdy2jCK2JBhOgQpvMaeIfRxy8RNV9wRW2r3ulBaTWZ8jtWBtYAWMZs1/pLZwOWLL MDY1M+Ipr9fFLGbrQ9c/2F4rKSGJLSS6DLUxoz6qWMaQloHz8JuDsHh7LwutP1qqohnm mucpW5QkWNciUDHeptHE9Vz92LR3vR/s09qitV2kV6ATwnfL0YfDHENCofCOOzPGqPph NQm1fPxp9jf725Q3d4HLHYmxx5UeLBSwCjdNILQZjLM/RKJkvLhilW556bEUhfK3BnC7 mgMQ== 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=slTNoya2jiDLZUQ/IQvAEAOlXXgAH+/6jduSj/bDVyo=; b=PCoqK14QGiDIv18POhCulmwxg/QfNCXOwUxI2OThB3lodFxho6Fglp03Qkq0S2m+sN OTKfKPDI8jIAifl602Aj8guIjp2G5ZmM2vFGRyx/R7xnbSmaZZOJfZp+KEA6O1FNhXEE WGmVEn0m9U//QeVpqQrVJZPl0efvbkoTMlngcU6RIKgBlsZOysLdFucvZ8leTbGtIsju ANho6ivPg272AVyhvJQ0AAXZeKmyb8fqdzTOGtjtnN9OX5aHB2dgIkRsd0YR04qiKztR gAqfDwEf50m5cp8s7PsmeAQKXHT6grpGLEJqPE5rYCD2vhbN63qF+3u8VVvbXMO4BzIH XrkA== 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 o28si24867765pgm.183.2019.05.22.03.37.03; Wed, 22 May 2019 03:37:18 -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 S1729370AbfEVKfj (ORCPT + 99 others); Wed, 22 May 2019 06:35:39 -0400 Received: from foss.arm.com ([217.140.101.70]:47068 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729347AbfEVKfg (ORCPT ); Wed, 22 May 2019 06:35:36 -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 66D9F341; Wed, 22 May 2019 03:35:36 -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 576593F575; Wed, 22 May 2019 03:35:35 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, coresight@lists.linaro.org, Suzuki K Poulose Subject: [PATCH v4 14/30] coresight: platform: Make memory allocation helper generic Date: Wed, 22 May 2019 11:34:47 +0100 Message-Id: <1558521304-27469-15-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558521304-27469-1-git-send-email-suzuki.poulose@arm.com> References: <1558521304-27469-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. Reviewed-by: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-platform.c | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) 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); -- 2.7.4