From patchwork Wed Jun 19 17:29:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004903 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 B18546C5 for ; Wed, 19 Jun 2019 17:38:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B5332847E for ; Wed, 19 Jun 2019 17:38:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FC95284BD; Wed, 19 Jun 2019 17:38:38 +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 2ACB92847E for ; Wed, 19 Jun 2019 17:38:38 +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=Uurfn1PgCYSbN99TvDIJL15D4/ i0OLiq1WhMuNZwTx8+hyOWTPPqZHNWvZbmQEtE+9NlOGlZ1A+cIWu1FsKF7YkBmlFYgzc28LBTdNx qa+HZ/f7K+9YhlTgs2NC8o2RgSpjv7P0yJq/X9LrxPGCJbXndZT+iPDPyEeQyVDZKUtnJHApcHbTD fGGnKq7g6eLQ+G8hgPUSagOueDrx9V6NR6Vp3D7JRHbrdYIPJGqZ+hPUHlWwH7IkTzgYiEOOiKX3X fkX4TzoK6nRHEiGMdERyrFZF6ACQxUhcb6xK1uyPHPRk1BbpRCRNzKTuI+ecEBUc9pD9rltZ42B8C f/lcp52w==; 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 1hdeXV-0007lx-Vj; Wed, 19 Jun 2019 17:38:30 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdePa-0008W7-KP for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:24 +0000 Received: by mail-pg1-x541.google.com with SMTP id s21so30152pga.12 for ; Wed, 19 Jun 2019 10:30:18 -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=UjHafWEoDz3DZuhMTjFRQGMVsWF4ASFIIsUiNhOCH0FiJIs84orobVrzd8u6cQ5PUZ NOtRf5jIBZBbO1kgmlTYCcLSRIHbS7A/PF1oAqOD2T6GR1fHtgJVBds0zah/5gnk+g7P RoN2t/4nakViDcy0jwaZepoMvitP/2xNZteGzHA9Mpacw+Muk+b8q5RCinmYdq1jsUSR 8RrQYkkt6JKX6vpuPIk2AJX51Fx6d1Y41b60lu2BEVfHudFzkfUKEjGWprsDDmedcfk3 8TTo316WqUH3B185uwZLVGFTKrtV03PueHzNwDfXTcxAEIkJu3UK1MI+EM4u2s0HPioO CpzQ== 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=ibw1UILrOdi2OjiBZ7s9q9vLmgPZLxDnwLHtUnnj61MkliGYs0QIWmsmzTOXbnMG2O hwMIqO/gWmyugaMNeZsCcOGPTlGWUNuHl48SKlb2tEofVw5PzjrAQpeW1Jf3kD0IV6A/ 89yXxOaqyJWepmsPPzV1p+1nZIMoYzFGOEZtoF3dRyAr+rrc0lNSw/XVKg8DkUhTCZ/5 Xz1H9d1jJDg38Ogg3CPRVdOFMEDTWk5dJdmsDfE/gjuqP/VTVsrMz9J7pPZ8/tsMD5Uh nBgfO8IixNOEzb4idjYktq5Ji1J7r9ZM66tcnc6JCc2JQb/EzsLVw5mfXG9d4ZpJcsYl HeQg== X-Gm-Message-State: APjAAAWMh2wDQHnuFdKT9JObsdQVwD7MmNGM//XAQdI+Ie+C7axnb3oi i4rP9akfkj+BNBvQoyLYwnqUi/G9Q/2Qwg== X-Google-Smtp-Source: APXvYqwrWE9534EWG72q0SdzBYBO1JOdODGm3LNjNiTDTSi8b/SIehox14914DN8m0c0M06HTw7snw== X-Received: by 2002:a17:90a:9b8a:: with SMTP id g10mr12067319pjp.66.1560965417481; Wed, 19 Jun 2019 10:30:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:16 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 28/45] coresight: Add support for releasing platform specific data Date: Wed, 19 Jun 2019 11:29:32 -0600 Message-Id: <20190619172949.4522-29-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_103018_791796_43429B4D 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);