From patchwork Wed Jun 19 19:53:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005137 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 D0C8076 for ; Wed, 19 Jun 2019 19:57:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF29428644 for ; Wed, 19 Jun 2019 19:57:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3064286BF; Wed, 19 Jun 2019 19:57:53 +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 3C0F628644 for ; Wed, 19 Jun 2019 19:57:53 +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=fDharwS7tki/TQ0tKAXnHg96qh/+gDn45wp/zx/C2as=; b=jWivodnf1opeyBSl33BfVDhGzw 8mTZQZQ5N8W26L9u4o10BlnfB4eV+kH924pNbmzpKJhpA9b6r3CPuPw+/w47OferTxsw8OrLUBmIa O4nSFKSC5hdU5f4yLOHemYYfgMmqWVVfupq0GuHnhJKtEqZ74Cc9WUwL728zfs2CVzAu/upf5j2gv 4g2EucyKDQ5TyxlSajD1OZ0UtN/wEwLA6cd2CPgzEpc2m1Xt+n8dRq5EzE5FKaf+uhvQV8HyYm/OB b5EyLx+cKFIqtsOaGTIB/EnJNUeLwltwzw26J/5LefhmXwjfCMFQ1eG1+pQj8hLVcDX0bRz1Xs5Mj 6+Swb7Tw==; 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 1hdgiI-0002eg-SR; Wed, 19 Jun 2019 19:57:47 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeC-0006Um-5d for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:34 +0000 Received: by mail-pf1-x444.google.com with SMTP id d126so220210pfd.2 for ; Wed, 19 Jun 2019 12:53:31 -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=ErY5wp85e3XhtR5Z0E4YUaVt5Ce9QaUAmTEfjZRCKV8=; b=BNfMdxifym8r3u6Fi8UK5/lZqA5200mtttYJhChCUB52n+vLiVmM9PEC7BJTxIpYYS y3heflhVW3vvzYyvNMDIR7qoDCSJvyj8XO4ALkzYl+kWFQL6MqaiXVLF6C9LIl5WB8xq x1Dm6/iaqlGnnqC0V3R5YBwkk2syqOnKBLqqMkfNris9nG1v/DU1aFNUo4RNmbGKfYep 4vpSXoVp9FHIKIPi8g0yeSct7ubQqyO0J0+fR5fVMDg63/usfJGSCAudBoizTSvELuY8 QXRh2XzyeSeCTQ8tHp/6CqVz1ZnkYyzeXqSc+SlUZP/lhM4f90lA9C6/OcdJFyjZZv1c gzug== 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=ErY5wp85e3XhtR5Z0E4YUaVt5Ce9QaUAmTEfjZRCKV8=; b=gW1NSFGVLe+ZfZRoluIse5Iy+HzDu9Sa6ZYX8yhctSY5w/biA95wqK0kZu6el8vte3 WnVPobl/gYkvfY1cil9/kOaPWneLtP62g3ap9G2GyVsCtgR/qb1TIIF/AGhSvnbvBSU2 DPrI/Ql+1qG3AGAyGtO1WZROj1+9/SYAhR8mYfC4IicHDu3zOKkJU/6NZiVeASPuvyxM SjLylSU1OrdP2WwvKPV11YTWHqQEugAdXDIxnnlvgiRhUn+oea+quEg9MH20vS2Sbcvr eixAbwNzP4G7TOMEb/oJyWnS8eoZsaCil43yG541D36i3njbUP6E4cBJ3ZEIcTYCL5YF RZCA== X-Gm-Message-State: APjAAAXVYY8KuLt5DGBrycuFNlFNUIwhpai2NBJG8D/b6pwhF9wquikF bXJNzsgc+OOp4WESZNv7WnyR/w== X-Google-Smtp-Source: APXvYqx2j1DW8lsgf/BBoFN4LD24Be8kwDwoRGvmqmH0ev+GM8yS5duvfC499gbsOVE2fmzb1fY2ow== X-Received: by 2002:a65:4383:: with SMTP id m3mr9047185pgp.435.1560974011051; Wed, 19 Jun 2019 12:53:31 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:30 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/28] coresight: Add support for releasing platform specific data Date: Wed, 19 Jun 2019 13:53:01 -0600 Message-Id: <20190619195318.19254-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125332_477217_2A62B336 X-CRM114-Status: GOOD ( 14.84 ) 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 Add a helper to clean up the platform specific data provided by the firmware. This will be later used for dropping the necessary references when we switch to the fwnode handles for tracking connections. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-platform.c | 6 +++++- drivers/hwtracing/coresight/coresight-priv.h | 4 ++++ drivers/hwtracing/coresight/coresight.c | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index f500de61e7f9..53d6eed44a20 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -17,6 +17,7 @@ #include #include +#include "coresight-priv.h" /* * coresight_alloc_conns: Allocate connections record for each output * port from the device. @@ -311,7 +312,7 @@ struct coresight_platform_data * coresight_get_platform_data(struct device *dev) { int ret = -ENOENT; - struct coresight_platform_data *pdata; + struct coresight_platform_data *pdata = NULL; struct fwnode_handle *fwnode = dev_fwnode(dev); if (IS_ERR_OR_NULL(fwnode)) @@ -329,6 +330,9 @@ coresight_get_platform_data(struct device *dev) if (!ret) return pdata; error: + if (!IS_ERR_OR_NULL(pdata)) + /* Cleanup the connection information */ + coresight_release_platform_data(pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_get_platform_data); diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index e0684d06e9ee..c21642114fc3 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -200,4 +200,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id) return 0; } +static inline void +coresight_release_platform_data(struct coresight_platform_data *pdata) +{} + #endif diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 96e15154a566..526141c2f876 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1250,6 +1250,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) err_free_csdev: kfree(csdev); err_out: + /* Cleanup the connection information */ + coresight_release_platform_data(desc->pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_register); @@ -1259,6 +1261,7 @@ void coresight_unregister(struct coresight_device *csdev) etm_perf_del_symlink_sink(csdev); /* Remove references of that device in the topology */ coresight_remove_conns(csdev); + coresight_release_platform_data(csdev->pdata); device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister);