From nobody Thu Oct 2 20:44:48 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 868C22DE70A for ; Thu, 11 Sep 2025 21:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757627818; cv=none; b=hVeeY/cHl2ZE5ycVzaq6OW4EPmC+Jkf0owDy0OgxUw4DWQ3NuKG5wasd9rKqZUd5NnaVLaln6uvHS56R2572biVtUyoYvZXsENSaJeDe9BPxt8RPBlJFRAYwb2ewYM6PAmZWeharPrWwbTa+RKDrWgNpyNk+0voeO0c51ddUwoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757627818; c=relaxed/simple; bh=cL1unuE3WF08z+2/1hEr0+OZ0Bd6FXIqUHhnJzPyAA4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P1A86Klg6sgDNgrk2/qrGi50szPe4NW+CZO+6/OcxqBWXd1DFCQOZJG4vlAFZ6vdh6vqbYKiycJXGGaWpkDeyWB7N0F7PAGevCB7ZWz1nhrDiAyodun+x1pri7ACkNIcBdyfgugOX4Cl2/YOaVX2l3/54k8mEzUbDZhxKMXwZC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1uwpHe-0004g5-ES; Thu, 11 Sep 2025 23:56:50 +0200 From: Marco Felsch Date: Thu, 11 Sep 2025 23:56:50 +0200 Subject: [PATCH v2 09/10] dmaengine: imx-sdma: make use of devm_add_action_or_reset to unregiser the dma-controller Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250911-v6-16-topic-sdma-v2-9-d315f56343b5@pengutronix.de> References: <20250911-v6-16-topic-sdma-v2-0-d315f56343b5@pengutronix.de> In-Reply-To: <20250911-v6-16-topic-sdma-v2-0-d315f56343b5@pengutronix.de> To: Vinod Koul , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Jiada Wang Cc: dmaengine@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Marco Felsch X-Mailer: b4 0.14.2 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Use the devres capabilities to cleanup the driver remove() callback. Signed-off-by: Marco Felsch Reviewed-by: Peng Fan --- drivers/dma/imx-sdma.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index d6d0d4300f540268a3ab4a6b14af685f7b93275a..a7e6554ca223e2e980caf2e2dea= 832db9ad60ed6 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -2264,6 +2264,13 @@ static struct dma_chan *sdma_xlate(struct of_phandle= _args *dma_spec, ofdma->of_node); } =20 +static void sdma_dma_of_dma_controller_unregister_action(void *data) +{ + struct sdma_engine *sdma =3D data; + + of_dma_controller_free(sdma->dev->of_node); +} + static void sdma_dma_device_unregister_action(void *data) { struct sdma_engine *sdma =3D data; @@ -2408,6 +2415,12 @@ static int sdma_probe(struct platform_device *pdev) return ret; } =20 + ret =3D devm_add_action_or_reset(dev, sdma_dma_of_dma_controller_unregist= er_action, sdma); + if (ret) { + dev_err(dev, "failed to register of-dma-controller unregister hook\n"); + return ret; + } + /* * Because that device tree does not encode ROM script address, * the RAM script in firmware is mandatory for device tree @@ -2431,7 +2444,6 @@ static void sdma_remove(struct platform_device *pdev) struct sdma_engine *sdma =3D platform_get_drvdata(pdev); int i; =20 - of_dma_controller_free(sdma->dev->of_node); /* Kill the tasklet */ for (i =3D 0; i < MAX_DMA_CHANNELS; i++) { struct sdma_channel *sdmac =3D &sdma->channel[i]; --=20 2.47.3