From nobody Sat Jul 25 00:10:52 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20EA53375D5 for ; Tue, 21 Jul 2026 22:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674486; cv=none; b=j6cO+hbjmVPu2bDFLcol8bH19JwDsrkJRScBDXSkWti4P8Ma1qX/8W5HLGwcuR8Zyjm643DSi9UyY7kySkwDIaP0pj1CQyc73ejBmKq8xelNtFJeoFoUWCRwjXQtspjnlVwtXh8vfFItGm8oUmZq5+KskE4gCSRPe0UF1LaaNk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674486; c=relaxed/simple; bh=l3T1ZwxPhm4j4ZjqPoXWyL63holaH//cXTmXIHO2F4o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=riAt3d/bYwTnGzOmNbgm5ny3lObCbwNIpiVlUb1V/vqgj0ao8H9Dz0MkcQQ5MhE7sf3j4NjW5j6qJ6vyHrhWjXtDv8Jez8s0pN4Q7XzOM7IHZVIi1QkVKv4XoYPPMYnWdkM64VVcQBXN+8vhPaR660IqGNjzjHvCWk1XQjh8dJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=guuXt6Bz; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="guuXt6Bz" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-38e07ebd263so5437704a91.1 for ; Tue, 21 Jul 2026 15:54:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784674484; x=1785279284; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=QbIg1IxIIpMZeFpgIXtG09JmNMcRp9S88gerpDxWPSU=; b=guuXt6BzzNugTK7uleB5xqNJijdLpScNGE6y38pBPMcE31gDrPb1lIi4sO22lmjWe0 0DWAec6W0RxkG0gNzWarl8mQHJ6g8Psv3DHsQh4BCHmV91tRyrsDUCQwWxZq4oY47yVX Fo05FOgD9Hk3ibKfItKcU8H5bAQeuhhdiUr+cq+6EOclXDJ+pe/wDWanDBbYgR3mA5w1 FS4qrWdY/3/90ALEonaYZxa1ryMXVJxHooRbjg2kUcwPeC9+NL5p3FlJ1EInbVM0EItG 76E2p3d9xTyPvDpjZqAhYrMtB0x0AZ/5qXPYsHVd9KFc+Ef8eDgXfUhWq0F6O/0KUu+D CBLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784674484; x=1785279284; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=QbIg1IxIIpMZeFpgIXtG09JmNMcRp9S88gerpDxWPSU=; b=m01uOCU54ZozUhtFaRjI8HFs+39SgaDmFJ0hb4IGbJwUquzNHftn9fP9YYqJb1FDMH MuG55It6ITO3BCYnXMZu2C2DhCTYBk4uHDzEvy1Uloo2AipDXcv22etROaOeOUp9Mgpt M1eTqC+z2VzPyaeit0Jrec13S9BuzlgnV0F+xppWGbF4dqtYtSb5mzMW3NqrUGjzrYqA TQxPB4G/zhPG5KErjy6IaEfxI3ul0FZdBRiGBujMIKsZNVxfhS0fru3CZEERTvAIraCA +WU9sFVcdvuFwltxfoZg0aK7JcTG4KulVddKUhrLub3FyUIr37yeTfeAR3YLU7oCW5T5 69Dw== X-Forwarded-Encrypted: i=1; AHgh+Rp8hO+q1NOSfCl3+y8G1JH+ETNVXO/jd8kQPzw2WpZlu+/NfAksM561J+jLBGd7I56KkPoRvjV9/WiJ3+k=@vger.kernel.org X-Gm-Message-State: AOJu0YyuEyLOnD6OmxsuI26g8cNID0E4ye1s/YirCOqclna7uayJe2fI c4eGFgDrCNZ39kRaNE5IZoeBRsNhFbWyueyoLjqqmi1Vsrn66AmUKf+r X-Gm-Gg: AR+sD11Zkxg9oOitO8iR6vX1OUIOUrOS+rJs6EM/Jog3t3hMNYm0AVJGTslYIFKzgbr 4fbPMMKpvNKFMEwO3QPuCn68NeyIQwCglh2NAmyvXwuA2vl8gpese+BbEBoR/idKchw0aHJJ5I4 iOQ1R9z7U/35SNU56ZYGTdpsGCX/3ARN7f2uJPmd3doB11VmJgE8A5s4R+VPwmDLp7TEutvLZky G6QvOuaULd4HMJOvRPCx4D30Tn0LiO9WzMVex3ryBLxLtut3PlGYUPsUdc8zTH9IUNyPdXM4K/c eZpUF10oGteXc6AulBNdo6qg2vpH8QTYG/RTuQF81p/qnK7hhQCBeYhuGcdxYfP4CuIUn+CP+ZE nQS6Ieu9psnBzNGlR9cqT4EaC0JgzhdhGgOKK/mDS6tq34Z1u9iznzMtHtXhCA1WzU41W+VfMwB AB6X7spn5+djGNWQDPy6Ez2FAdYj15i74eSUp9pA6ZSpQFiVwzT6sBWoYPBBMgmTtts6vE9flll bFRX2l8CXTdrtgK0efmG5FLMDx3lXFJW1BDb+Q5IMpCDvN+DR8xm7fsQpVuky0w/A== X-Received: by 2002:a17:90b:2ec6:b0:38e:6a44:671b with SMTP id 98e67ed59e1d1-38e6a446b78mr8745830a91.0.1784674484427; Tue, 21 Jul 2026 15:54:44 -0700 (PDT) Received: from ryzen.lan ([2601:644:8000:7a86::e35]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38ea7aff836sm39369a91.15.2026.07.21.15.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 15:54:43 -0700 (PDT) From: Rosen Penev To: linux-sound@vger.kernel.org Cc: Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , linuxppc-dev@lists.ozlabs.org (open list:FREESCALE SOC SOUND DRIVERS), linux-kernel@vger.kernel.org (open list), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT:Keyword:\b(?i:clang|llvm)\b) Subject: [PATCH] ASoC: fsl: dma: use platform helpers and devm cleanup Date: Tue, 21 Jul 2026 15:54:42 -0700 Message-ID: <20260721225442.817787-1-rosenp@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Convert fsl_soc_dma_probe() to managed APIs. Replace the open-coded of_address_to_resource()/of_iomap() of the DMA channel registers with devm_platform_ioremap_resource(), and irq_of_parse_and_map() with platform_get_irq() (which returns a negative errno instead of 0). Switch the allocation to devm_kzalloc() and register the component via the devm variant, dropping the now-unneeded error-path cleanup and the manual fsl_soc_dma_remove(). The SSI node's register resource is still read via of_address_to_resource() to compute the SSI FIFO physical addresses (dma->ssi_stx_phys / ssi_srx_phys); only the DMA controller window is mapped. The DMA controller register window is owned solely by this driver, so the new region request from devm_platform_ioremap_resource() cannot conflict with another claimant, and it is mapped exactly once (no double mapping). The local channel pointer is declared as void __iomem * so the devm_platform_ioremap_resource() result can be stored before assignment to dma->channel. No functional change; built for powerpc (allmodconfig + CONFIG_SND_SOC_FSL_= DMA) with LLVM=3D1 and sound/soc/fsl/fsl_dma.o compiles cleanly. Assisted-by: opencode:hy3-free Signed-off-by: Rosen Penev --- sound/soc/fsl/fsl_dma.c | 68 ++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index b12474880185..b1b341132dd6 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include =20 @@ -824,9 +822,34 @@ static int fsl_soc_dma_probe(struct platform_device *p= dev) struct device_node *np =3D pdev->dev.of_node; struct device_node *ssi_np; struct resource res; + void __iomem *channel; const uint32_t *iprop; + int irq; int ret; =20 + channel =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(channel)) + return PTR_ERR(channel); + + irq =3D platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + dma =3D devm_kzalloc(&pdev->dev, sizeof(*dma), GFP_KERNEL); + if (!dma) + return -ENOMEM; + + dma->dai.name =3D DRV_NAME; + dma->dai.open =3D fsl_dma_open; + dma->dai.close =3D fsl_dma_close; + dma->dai.hw_params =3D fsl_dma_hw_params; + dma->dai.hw_free =3D fsl_dma_hw_free; + dma->dai.pointer =3D fsl_dma_pointer; + dma->dai.pcm_new =3D fsl_dma_new; + + dma->channel =3D channel; + dma->irq =3D irq; + /* Find the SSI node that points to us. */ ssi_np =3D find_ssi_node(np); if (!ssi_np) { @@ -842,55 +865,19 @@ static int fsl_soc_dma_probe(struct platform_device *= pdev) return ret; } =20 - dma =3D kzalloc_obj(*dma); - if (!dma) { - of_node_put(ssi_np); - return -ENOMEM; - } - - dma->dai.name =3D DRV_NAME; - dma->dai.open =3D fsl_dma_open; - dma->dai.close =3D fsl_dma_close; - dma->dai.hw_params =3D fsl_dma_hw_params; - dma->dai.hw_free =3D fsl_dma_hw_free; - dma->dai.pointer =3D fsl_dma_pointer; - dma->dai.pcm_new =3D fsl_dma_new; - /* Store the SSI-specific information that we need */ dma->ssi_stx_phys =3D res.start + REG_SSI_STX0; dma->ssi_srx_phys =3D res.start + REG_SSI_SRX0; =20 iprop =3D of_get_property(ssi_np, "fsl,fifo-depth", NULL); + of_node_put(ssi_np); if (iprop) dma->ssi_fifo_depth =3D be32_to_cpup(iprop); else /* Older 8610 DTs didn't have the fifo-depth property */ dma->ssi_fifo_depth =3D 8; =20 - of_node_put(ssi_np); - - ret =3D devm_snd_soc_register_component(&pdev->dev, &dma->dai, NULL, 0); - if (ret) { - dev_err(&pdev->dev, "could not register platform\n"); - kfree(dma); - return ret; - } - - dma->channel =3D of_iomap(np, 0); - dma->irq =3D irq_of_parse_and_map(np, 0); - - dev_set_drvdata(&pdev->dev, dma); - - return 0; -} - -static void fsl_soc_dma_remove(struct platform_device *pdev) -{ - struct dma_object *dma =3D dev_get_drvdata(&pdev->dev); - - iounmap(dma->channel); - irq_dispose_mapping(dma->irq); - kfree(dma); + return devm_snd_soc_register_component(&pdev->dev, &dma->dai, NULL, 0); } =20 static const struct of_device_id fsl_soc_dma_ids[] =3D { @@ -905,7 +892,6 @@ static struct platform_driver fsl_soc_dma_driver =3D { .of_match_table =3D fsl_soc_dma_ids, }, .probe =3D fsl_soc_dma_probe, - .remove =3D fsl_soc_dma_remove, }; =20 module_platform_driver(fsl_soc_dma_driver); --=20 2.55.0