Skip to contentSkip to conversation

ASoC: bcm: bcm63xx-i2s-whistler: Convert to devm_platform_ioremap_resource()

PATCH In review Yangtao Li 3 participants 7 messages Jul 11, 2023 – Jul 17, 2023

Subsystems (7)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/5 ASoC: bcm: bcm63xx-i2s-whistler: Convert to devm_platform_ioremap_resource()

Use devm_platform_ioremap_resource() to simplify code.

---
 sound/soc/bcm/bcm63xx-i2s-whistler.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
sound/soc/bcm/bcm63xx-i2s-whistler.c +1 -15
index 18c51dbbc8dc..c64609718738 100644
@@ -225,7 +225,6 @@ static int bcm63xx_i2s_dev_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	void __iomem *regs;
-	struct resource *r_mem, *region;
 	struct bcm_i2s_priv *i2s_priv;
 	struct regmap *regmap_i2s;
 	struct clk *i2s_clk;
@@ -241,20 +240,7 @@ static int bcm63xx_i2s_dev_probe(struct platform_device *pdev)
 		return PTR_ERR(i2s_clk);
 	}
 
-	r_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!r_mem) {
-		dev_err(&pdev->dev, "Unable to get register resource.\n");
-		return -ENODEV;
-	}
-
-	region = devm_request_mem_region(&pdev->dev, r_mem->start,
-					resource_size(r_mem), DRV_NAME);
-	if (!region) {
-		dev_err(&pdev->dev, "Memory region already claimed\n");
-		return -EBUSY;
-	}
-
-	regs = devm_ioremap_resource(&pdev->dev, r_mem);
+	regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(regs)) {
 		ret = PTR_ERR(regs);
 		return ret;
Signature · 1 line
2.39.0
author
#1 lore raw

PATCH 2/5 ASoC: ti: Convert to devm_platform_ioremap_resource_byname()

Use devm_platform_ioremap_resource_byname() to simplify code.

---
 sound/soc/ti/omap-dmic.c  | 4 +---
 sound/soc/ti/omap-mcpdm.c | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)
sound/soc/ti/omap-dmic.c +1 -3
index 825c70a443da..cb60af36dbc3 100644
@@ -488,12 +488,10 @@ static int asoc_dmic_probe(struct platform_device *pdev)
 
 	dmic->dma_data.filter_data = "up_link";
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
-	dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
+	dmic->io_base = devm_platform_ioremap_resource_byname(pdev, "mpu");
 	if (IS_ERR(dmic->io_base))
 		return PTR_ERR(dmic->io_base);
 
-
 	ret = devm_snd_soc_register_component(&pdev->dev,
 					      &omap_dmic_component,
 					      &omap_dmic_dai, 1);
sound/soc/ti/omap-mcpdm.c +1 -2
index 0b18a7bfd3fd..35deceb73427 100644
@@ -563,8 +563,7 @@ static int asoc_mcpdm_probe(struct platform_device *pdev)
 	mcpdm->dma_data[0].filter_data = "dn_link";
 	mcpdm->dma_data[1].filter_data = "up_link";
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
-	mcpdm->io_base = devm_ioremap_resource(&pdev->dev, res);
+	mcpdm->io_base = devm_platform_ioremap_resource_byname(pdev, "mpu");
 	if (IS_ERR(mcpdm->io_base))
 		return PTR_ERR(mcpdm->io_base);
 
Signature · 1 line
2.39.0
author
#2 lore raw

PATCH 3/5 ASoC: mediatek: mt8186: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c +1 -3
index a868a04ed4e7..b86159f70a33 100644
@@ -2815,7 +2815,6 @@ static int mt8186_afe_pcm_dev_probe(struct platform_device *pdev)
 {
 	struct mtk_base_afe *afe;
 	struct mt8186_afe_private *afe_priv;
-	struct resource *res;
 	struct reset_control *rstc;
 	struct device *dev = &pdev->dev;
 	int i, ret, irq_id;
@@ -2836,8 +2835,7 @@ static int mt8186_afe_pcm_dev_probe(struct platform_device *pdev)
 	afe_priv = afe->platform_priv;
 	afe->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	afe->base_addr = devm_ioremap_resource(dev, res);
+	afe->base_addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(afe->base_addr))
 		return PTR_ERR(afe->base_addr);
 
Signature · 1 line
2.39.0
author
#3 lore raw

PATCH 4/5 ASoC: pxa: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 sound/soc/pxa/pxa2xx-i2s.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
sound/soc/pxa/pxa2xx-i2s.c +3 -10
index 3e4c70403672..10636506b622 100644
@@ -370,18 +370,11 @@ static const struct snd_soc_component_driver pxa_i2s_component = {
 
 static int pxa2xx_i2s_drv_probe(struct platform_device *pdev)
 {
-	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	struct resource *res;
 
-	if (!res) {
-		dev_err(&pdev->dev, "missing MMIO resource\n");
-		return -ENXIO;
-	}
-
-	i2s_reg_base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(i2s_reg_base)) {
-		dev_err(&pdev->dev, "ioremap failed\n");
+	i2s_reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(i2s_reg_base))
 		return PTR_ERR(i2s_reg_base);
-	}
 
 	pxa2xx_i2s_pcm_stereo_out.addr = res->start + SADR;
 	pxa2xx_i2s_pcm_stereo_in.addr = res->start + SADR;
Signature · 1 line
2.39.0
author
#4 lore raw

PATCH 5/5 ASoC: tegra: tegra20_ac97: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 sound/soc/tegra/tegra20_ac97.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/tegra/tegra20_ac97.c +1 -2
index a4073a746ae3..60e7df41c64c 100644
@@ -328,8 +328,7 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	regs = devm_ioremap_resource(&pdev->dev, mem);
+	regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
 	if (IS_ERR(regs)) {
 		ret = PTR_ERR(regs);
 		goto err_clk_put;
Signature · 1 line
2.39.0
Acked-by on v1 5/5
#5 lore raw

Re: [PATCH 5/5] ASoC: tegra: tegra20_ac97: Use devm_platform_get_and_ioremap_resource()

Quoted 8 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 sound/soc/tegra/tegra20_ac97.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
maintainer
#6 lore raw
In reply to Yangtao Li
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/5] ASoC: bcm: bcm63xx-i2s-whistler: Convert to devm_platform_ioremap_resource()

      commit: 7562539e15f1376577d7b62e904b509d17c4bc3f
[2/5] ASoC: ti: Convert to devm_platform_ioremap_resource_byname()
      commit: c8b04f008fc33ab2b902a1780c205810d157c849
[3/5] ASoC: mediatek: mt8186: Convert to devm_platform_ioremap_resource()
      commit: e1537b59633cc0e30305e498ba9eead45e762910
[4/5] ASoC: pxa: Use devm_platform_get_and_ioremap_resource()
      commit: 97b19db1cfb34303101a3f30c26ef0e2ede07d89
[5/5] ASoC: tegra: tegra20_ac97: Use devm_platform_get_and_ioremap_resource()
      commit: 976201dd5f597b7c25b9fc5ebeee382b5e6bf8fb

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark