From patchwork Wed May 22 10:34:47 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: 164785 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp693861ili; Wed, 22 May 2019 03:35:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNd8/8gCpO+8azt6+Nc8TEmTQx70skFVYGA/IPZolStPdi+Kl7t5w+4CZVs6TRkqr4KazA X-Received: by 2002:aa7:930e:: with SMTP id 14mr37660507pfj.262.1558521341366; Wed, 22 May 2019 03:35:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558521341; cv=none; d=google.com; s=arc-20160816; b=VbjYfgQuccYezgQaxTLDpeBq/GCBm3WybG3D/XOWCOgZHWzx1voQewRED8IdsLXBEb Lza8LKUdbPNd8c8TycPTHP7B4pe48BSjAYiaqQvctWFM77vjvGyq3ooWVjgEcTjkBRLg wEsRyphyyl7OwJoXhpVeQxeTcSPeapriFy+ZGZI4xGimSBcEQaCbZkwkUVBjv2nkYcTh mM8Kyhq9Y2bgCMPfz9v02TK2k+KmyfrC/4qbK5Zn7wDm+i6tZppTLw7UDAfg0qxpJQeI pUJuU1P7+B2SBXPQZ7JYeXOPQZswNqpwZ39DN8cL1X0MRoUwI4C4jBA34uPis1Qy883o mVDA== 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 h68si25312309pgc.270.2019.05.22.03.35.40; Wed, 22 May 2019 03:35:41 -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 S1729374AbfEVKfj (ORCPT + 30 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(-) -- 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);