From patchwork Fri Jan 3 10:12:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beleswar Prasad Padhi X-Patchwork-Id: 13925473 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 544D11F942C; Fri, 3 Jan 2025 10:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735899241; cv=none; b=KrToy4u0zHuD0k3fBdUnYSpjo5+dbsYAbHbpthUleWIZ3OkEPPfLfuKetiQERhNp05dYFgCWucdVFiQddRq+6BAJfK5tVA+SEmSZV9ZvfqIFKk8vqhCLoHZ2PzMaeQJiosS3BHRVn4BIscK6pRKvndRUMmPCrAJclfxnQJJqbmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735899241; c=relaxed/simple; bh=1zz23qw+2qCMG3n73hL3eCcT4JyUAIAk9BBZXyR5/8g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=flfkbLQ8wZ1qTLylB8YTrl+7APY7QP1qXVvfWFKjLE3FGyJ8M9Yb7f00YjMvDg5sZmX1MALuOR1bzOQa5Mvg6e/C7O4ansYzvTCcoRXJx0TFHAsUQZGaStnxe0NpAAFVOrpIpJd8Eslh5dokrfGNOKl4R33KQoTxG5j8MyIpLYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=uvvoLs3c; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="uvvoLs3c" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 503ADhBN010879; Fri, 3 Jan 2025 04:13:43 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1735899223; bh=3JzDLHbGkU1DnMefJblE3HJ6YLgh9bHa3MgCOaSNKSs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=uvvoLs3cl9hc4/GJEDZtHVFQuzYP9C/o+NAmgi4bfhy1OyGBceImhBrG7GtCPX4XB 2ROhUFEu7WkAX1AM5sT9KxfV3SD5MCWnlBuCXmfyXhGUEhUcMgKlIQOo+parvyfn8R t8K62Eka56U15w1LGjrU7J3ImVreRsqfO+4VAKN0= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 503ADhKh112917 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Jan 2025 04:13:43 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 3 Jan 2025 04:13:42 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 3 Jan 2025 04:13:43 -0600 Received: from uda0510294.dhcp.ti.com (uda0510294.dhcp.ti.com [172.24.227.151]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 503ACVSa126047; Fri, 3 Jan 2025 04:13:39 -0600 From: Beleswar Padhi To: , CC: , , , , , , , , , , Subject: [PATCH v8 18/20] remoteproc: k3: Refactor mem_release() functions into common driver Date: Fri, 3 Jan 2025 15:42:29 +0530 Message-ID: <20250103101231.1508151-19-b-padhi@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250103101231.1508151-1-b-padhi@ti.com> References: <20250103101231.1508151-1-b-padhi@ti.com> Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea The k3_dsp_mem_release() and k3_m4_rproc_dev_mem_release() functions release the reserved memory of the device, which get auto triggered upon device removal. Refactor these functions into ti_k3_common.c driver as k3_mem_release() and align DSP and M4 drivers to use this common function throughout. Signed-off-by: Beleswar Padhi --- drivers/remoteproc/ti_k3_common.c | 8 ++++++++ drivers/remoteproc/ti_k3_common.h | 1 + drivers/remoteproc/ti_k3_dsp_remoteproc.c | 9 +-------- drivers/remoteproc/ti_k3_m4_remoteproc.c | 9 +-------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c index c1c6eabb867f..c8766a01dc19 100644 --- a/drivers/remoteproc/ti_k3_common.c +++ b/drivers/remoteproc/ti_k3_common.c @@ -496,5 +496,13 @@ int k3_rproc_of_get_memories(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(k3_rproc_of_get_memories); +void k3_mem_release(void *data) +{ + struct device *dev = data; + + of_reserved_mem_device_release(dev); +} +EXPORT_SYMBOL_GPL(k3_mem_release); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("TI K3 common Remoteproc code"); diff --git a/drivers/remoteproc/ti_k3_common.h b/drivers/remoteproc/ti_k3_common.h index 8801914a7c56..31cd202be348 100644 --- a/drivers/remoteproc/ti_k3_common.h +++ b/drivers/remoteproc/ti_k3_common.h @@ -107,4 +107,5 @@ void *k3_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem); int k3_rproc_of_get_memories(struct platform_device *pdev, struct k3_rproc *kproc); +void k3_mem_release(void *data); #endif /* REMOTEPROC_TI_K3_COMMON_H */ diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c index 476f53249793..1176a6f4c977 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -66,13 +66,6 @@ static const struct rproc_ops k3_dsp_rproc_ops = { .get_loaded_rsc_table = k3_get_loaded_rsc_table, }; -static void k3_dsp_mem_release(void *data) -{ - struct device *dev = data; - - of_reserved_mem_device_release(dev); -} - static int k3_dsp_reserved_mem_init(struct k3_rproc *kproc) { struct device *dev = kproc->dev; @@ -102,7 +95,7 @@ static int k3_dsp_reserved_mem_init(struct k3_rproc *kproc) ERR_PTR(ret)); return ret; } - ret = devm_add_action_or_reset(dev, k3_dsp_mem_release, dev); + ret = devm_add_action_or_reset(dev, k3_mem_release, dev); if (ret) return ret; diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/ti_k3_m4_remoteproc.c index a077fe2c06aa..6608b13d125b 100644 --- a/drivers/remoteproc/ti_k3_m4_remoteproc.c +++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c @@ -21,13 +21,6 @@ #include "ti_sci_proc.h" #include "ti_k3_common.h" -static void k3_m4_rproc_dev_mem_release(void *data) -{ - struct device *dev = data; - - of_reserved_mem_device_release(dev); -} - static int k3_m4_reserved_mem_init(struct k3_rproc *kproc) { struct device *dev = kproc->dev; @@ -56,7 +49,7 @@ static int k3_m4_reserved_mem_init(struct k3_rproc *kproc) dev_err(dev, "device cannot initialize DMA pool (%d)\n", ret); return ret; } - ret = devm_add_action_or_reset(dev, k3_m4_rproc_dev_mem_release, dev); + ret = devm_add_action_or_reset(dev, k3_mem_release, dev); if (ret) return ret;