summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihed Chaibi <jihed.chaibi.dev@gmail.com>2026-03-25 01:39:07 +0300
committerMark Brown <broonie@kernel.org>2026-03-30 21:37:21 +0300
commitb81f63108250818ed17fc7df9fdf9a7fb84f3f69 (patch)
tree951b28e005b099258dfb616aad409f001b8a63fc
parent2a740dc5892a0e90e32ddae4d0ece501ace2adfc (diff)
downloadlinux-b81f63108250818ed17fc7df9fdf9a7fb84f3f69.tar.xz
ASoC: samsung: spdif: Convert to devm_ioremap_resource()
Replace the open-coded request_mem_region() + ioremap() sequence with devm_ioremap_resource(), which handles both the region claim and mapping under devres lifetime management. This eliminates the manual iounmap() and release_mem_region() calls in the error path (err3/err4 labels) and in spdif_remove(), simplifying the probe error handling. Signed-off-by: Jihed Chaibi <jihed.chaibi.dev@gmail.com> Link: https://patch.msgid.link/20260324223907.98897-1-jihed.chaibi.dev@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/samsung/spdif.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index 235d0063d1b3..fb30f6b637a0 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -407,21 +407,12 @@ static int spdif_probe(struct platform_device *pdev)
if (ret)
goto err1;
- /* Request S/PDIF Register's memory region */
- if (!request_mem_region(mem_res->start,
- resource_size(mem_res), "samsung-spdif")) {
- dev_err(&pdev->dev, "Unable to request register region\n");
- ret = -EBUSY;
+ spdif->regs = devm_ioremap_resource(&pdev->dev, mem_res);
+ if (IS_ERR(spdif->regs)) {
+ ret = PTR_ERR(spdif->regs);
goto err2;
}
- spdif->regs = ioremap(mem_res->start, 0x100);
- if (spdif->regs == NULL) {
- dev_err(&pdev->dev, "Cannot ioremap registers\n");
- ret = -ENXIO;
- goto err3;
- }
-
spdif_stereo_out.addr_width = 2;
spdif_stereo_out.addr = mem_res->start + DATA_OUTBUF;
filter = NULL;
@@ -435,7 +426,7 @@ static int spdif_probe(struct platform_device *pdev)
NULL, NULL, NULL);
if (ret) {
dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
- goto err4;
+ goto err2;
}
dev_set_drvdata(&pdev->dev, spdif);
@@ -444,14 +435,10 @@ static int spdif_probe(struct platform_device *pdev)
&samsung_spdif_component, &samsung_spdif_dai, 1);
if (ret != 0) {
dev_err(&pdev->dev, "fail to register dai\n");
- goto err4;
+ goto err2;
}
return 0;
-err4:
- iounmap(spdif->regs);
-err3:
- release_mem_region(mem_res->start, resource_size(mem_res));
err2:
clk_disable_unprepare(spdif->sclk);
err1:
@@ -463,12 +450,6 @@ err0:
static void spdif_remove(struct platform_device *pdev)
{
struct samsung_spdif_info *spdif = &spdif_info;
- struct resource *mem_res;
-
- iounmap(spdif->regs);
-
- mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(mem_res->start, resource_size(mem_res));
clk_disable_unprepare(spdif->sclk);
clk_disable_unprepare(spdif->pclk);