From patchwork Wed Jun 19 17:29:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9FF686C5 for ; Wed, 19 Jun 2019 17:37:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AB6C1FFD9 for ; Wed, 19 Jun 2019 17:37:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F422283AD; Wed, 19 Jun 2019 17:37:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0FF961FFD9 for ; Wed, 19 Jun 2019 17:37:40 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=noXKls5VRq76zZMKstRTDzGS8SA+7SleCAI/20+HEjc=; b=XFikOiV4EIyZHDsXx4qPkXYwU6 PJsCNp/Kuro/eLPGI6v/TrWd9vFNyzOWMj8GnM0jyT+hGWSWNjRm+l8/HlcscGY4aVxW0G/Elfv8g S/LCHJUgZl1bDbgeyvVF2gxKTw00zOCRUYvs1pi3AQBZpph6nRsmUcUFsj2/CARtpKhhYeJOEt/Yn yWmVEkEMYfj1DarubYoN/VKY2JvOEbvqFJwNkcPbLcvWoDbxat/RKysUlFFkMMFcV/PYLW4MIU2lo GdgXXoHFC4yrKhRMolizwqM4E3hOdrBpGJotvx5YSwjh0tKAxsZMq2jadTg/1e442SwSSquodf0az 1gtRhJ9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdeWf-00071P-CR; Wed, 19 Jun 2019 17:37:37 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdePX-00086w-8h for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:19 +0000 Received: by mail-pf1-x442.google.com with SMTP id r7so11943pfl.3 for ; Wed, 19 Jun 2019 10:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P8HOcu/iy58r97z1ZeEK9hZTcUyQU9lbtvmBDEqsK0c=; b=j+vwQNKrlxU0pB2aMYfXLTrSXtIol5Z5NrZcceuavtkupVjU8t8XpwO2kpWWYmCrog 8Np0B/qhoAYgf8mu1huXxDEwcaCc3BWfxTPfk1h62NUqiEV9eSKA23BKAwUtmJsfklv0 Ln/Lkxcb5nurTLFXR89FtYprIxEFGzFJQzkMDnzTRwE3It41Iaq55zLL4hXXBIJwLYHA fwFmSdxK9zyHjp4d7BIt89Bpke6JuDM9eoY3qDbxiA4M6iuoxQ43cqHj/Im1Qn/3Up56 zRLadea8O1Rue4uXiknyw0W8t1V0n7u1/NZaw1kQ222T0StxPD8J8u3HAoj4l4fBmkp0 9uMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P8HOcu/iy58r97z1ZeEK9hZTcUyQU9lbtvmBDEqsK0c=; b=ND6YNn3tTiPGsP9jlSZL1RDio3py2b9UAepv7TAuzQFcJdYDZ/hyNRbg+LzDI5HMOh oVojId7Gr7gSTE13Slb2lcx2KxCsMAsNxr7axCbhW7yk2iMYWou6uCdaWzmqZ9hBf59a Hm9SQT7BS8njZAt6h8manbT7qNFRDw/25nuXrzXfvzUMA9t2GQVDGJWuTYPUKRDYtKUO e4ZUkyghW3agvT/mKQG4Ro7pNalD7wdJR5dHSUdQzdY9spUt7uHK3m4xaBTofrwoGr4J lgL3DA1eq95KTRetTyTspnSNpJQ98zU3g496o8m2efJbezTbBXSRu6iuqgQqkFsf7BsM AK0Q== X-Gm-Message-State: APjAAAUu6QDdQmveYm0muZD33+dRe/Vx/wQGz5h8zzp/3PNXXdufdr3D TbWavNE8jXaNEkvesK4exzJDJA== X-Google-Smtp-Source: APXvYqw0WmRFdcNA37h3eEdFVwC7qHM3Cwg7PD/8zJDmC77AHVz9oLFcJzbPAND/Cu7FmI40yJ6nzg== X-Received: by 2002:aa7:9a8a:: with SMTP id w10mr10792808pfi.66.1560965409280; Wed, 19 Jun 2019 10:30:09 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:08 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 19/45] coresight: platform: Make memory allocation helper generic Date: Wed, 19 Jun 2019 11:29:23 -0600 Message-Id: <20190619172949.4522-20-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103015_554966_8D65B9C4 X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose 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. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../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 514cc2b67c36..4c31299607cf 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);